Page tree
Skip to end of metadata
Go to start of metadata

How to prepare Netigma Component listening to the event

 

Summary

Netigma publishes events at certain points, allowing developers to intervene. This document will explain how to listen to events.


Document Content

 

 

Operations To Be Considered

During the execution, the document "Rules to be observed in classes that use TypeManager (Factory) " must be observed.


IEventServiceProvider 

You can listen to IMeta, GUI, and INetigmaDomain-dependent events by implementing the interfaces that are derived from the IEventServiceProvider interface.

IEventServiceProvider
/// <summary>
/// Represents generic events for queries, forms and reports  
/// </summary>
public interface IEventServiceProvider : INamedItemReadOnly, ICloneable
{
}

IDefaultGUIEventServiceProvider  

IMeta, INetigmaDomain, IDefaultGUIEventServiceProvider interface must be implemented for GUI-dependent events.

IDefaultGUIEventServiceProvider
public interface IDefaultGUIEventServiceProvider : IEventServiceProvider
{
    void OnGUIStep(GUIStep step, INetigmaDomain domain, CancelEventArgs cancelArgs);
}

OnGUIStep Method

The current parameter as the parameter sends the object for the NetigmaDomain object and the operation abort.

Calling the Method

Netigma runs the OnGUIStep method at each step on the page.

Implementation and Executing

The class library that contains the IDefaultGUIEventServiceProvider implementation is compiled and the dll file is copied into the bin folder of the Netigma web application.

 

Operations To Be Considered

During the implementation of IGlobalEventServiceProvider, the "Rules to be observed in classes using TypeManager (Factory)" document should be prepared by taking into account the document.

 

 

As a basis for project references

  • AuthorizationManager
  • ParameterManager
  • Logmanager
  • Netcad.Netigma

 

  • Netcad.SimpleThreading

 

libraries should be included.

 

(tick) After this step, Netigma will run the method of the corresponding implementation when creating each database connection of the page.

 

IGlobalEventServiceProvider 

 

Interfaces that are derived from the IGlobalEventServiceProvider interface can be implemented and system independent events can be listened.

The following topics will be covered.

IGlobalEventServiceProvider
/// <summary>
/// IMeta bağımlı olmayan Genel eventleri dinleyecek sınıflar gerçeklemelidir.
/// </summary>
public interface IGlobalEventServiceProvider : INamedItemReadOnly, ICloneable
{
}

IGlobalEventServiceProvider Olay Listesi

IGlobalEventServiceProvider, by realizing its interface, can listen to global events broadcast on Netigma. The class that performs the interface can capture the event it is interested in by using the GenericGlobalServiceArgs.EventType value.

The EventType information for transactions currently posted in Netigma are:

EventTypeDescription
"SYS.REPORT.PERMISSION.REGISTER"The report is fired when the authority is registered.
"SYS.CONNECTION.CHANGECONNECTIONSTRING"The database fires when the connection information changes.
"SYS.QUERY.POSTQUERY"After any query runs, it fires .
"SYS.FILE.ADDING"When a file is being uploaded to Netigma, it is fired before the file is saved.
"SYS.FILE.ADDED"When a file is being uploaded to Netigma, it is fired after the file is saved.

Using IGlobalEventServiceProvider for File Tracking Event Tracking

 

Sample File Upload Tracker
using Netcad.Netigma;
using Netigma.FileArchiveSystem;
namespace SampleEventServiceProvider
{
    public class FileTracker : Netcad.Netigma.IGenericGlobalEventServiceProvider
    {
        public string DisplayName
        {
            get
            {
                return "Sample File Tracker";    }
        }
        public string Name
        {
            get
            {
                return "SampleFileTracker";
            }
        }
        public object Clone()
        {
            return new FileTracker();
        }
      
        public void OnEventFire(GenericGlobalServiceArgs args)
        {
            if (!string.IsNullOrEmpty(args.EventType) && args.EventType.Equals("SYS.FILE.ADDING"))
            {
                INetigmaFile file = args.Input["FileInfo"] as INetigmaFile;
                NetigmaFileArchive archieve = args.Input["Sender"] as NetigmaFileArchive;
            }
            if (!string.IsNullOrEmpty(args.EventType) && args.EventType.Equals("SYS.FILE.ADDED"))
            {
                INetigmaFile file = args.Input["FileInfo"] as INetigmaFile;
                NetigmaFileArchive archieve = args.Input["Sender"] as NetigmaFileArchive;
            }
        }
    }
    
}

 

Using IGlobalEventServiceProvider for Query Event Tracking

Sample File Upload Tracker
using Netcad.Netigma;
using Netcad.Data.Filtering;
namespace SampleEventServiceProvider
{
    class QueryTracker : Netcad.Netigma.IGenericGlobalEventServiceProvider
    {
        public string DisplayName
        {
            get
            {
                return "Sample Query Tracker";
            }
        }
        public string Name
        {
            get
            {
                return "SampleQueryTracker";
            }
        }
        public object Clone()
        {
            return new QueryTracker();
        }
        //Event oluştuğu zaman çağrılan fonksiyon
        public void OnEventFire(GenericGlobalServiceArgs args)
        {
           //Event türü kontrolü
            if (!string.IsNullOrEmpty(args.EventType) && args.EventType.Equals("SYS.QUERY.POSTQUERY"))
            {
                // Sorgunun çalıştğı kriter, domain gibi bilgiler, sorgu nesnesi yakalanabilir.
                OgcCriteriaOperator criteria = args.Input["CRITERIA"] as OgcCriteriaOperator;
                INetigmaDomain domain = args.Input["DOMAIN"] as INetigmaDomain;
                IQuery archieve = args.Input["QUERY"] as IQuery;
            }
        }
    }
}

Using IGlobalEventServiceProvider for a Custom Event Tracking

Sample File Upload Tracker
using Netcad.Netigma;
namespace SampleEventServiceProvider
{
    class CustomEvent : Netcad.Netigma.IGenericGlobalEventServiceProvider
    {
        public string DisplayName
        {
            get
            {
                return "Custom Sample Event";
            }
        }
        public string Name
        {
            get
            {
                return "CustomSampleEvent";
            }
        }
        public object Clone()
        {
            return new CustomEvent(); ;
        }
        public void OnEventFire(GenericGlobalServiceArgs args)
        {   
            // özel tanımlı bir event süzülür ve event'e ait özellikler yakalanabilir. Bunlar ile işlemler yapılabilir. 
            if (!string.IsNullOrEmpty(args.EventType) && args.EventType.Equals("CUSTOM.SAMPLE.EVENT"))
            {
                args.Input["ARGS0"] = "ARGS0_NAME";
                args.Input["ARGS1"] = "ARGS1_NAME";
            }
        }
    }
}

Interfaces that are derived from the IGlobalEventServiceProvider interface can be implemented and system independent events can be listened.

  The following topics will be covered.



IConnectionStringControlGlobalEventServiceProvider 

For database connection operations, the IConnectionStringControlGlobalEventServiceProvider interface must be implemented.

IConnectionStringControlGlobalEventServiceProvider
public interface IConnectionStringControlGlobalEventServiceProvider : IGlobalEventServiceProvider
{
    IConnectionString CheckConnectionString(IConnectionString connection, object Host);
}
CheckConnectionString Method   ( IConnectionStringControlGlobalEventServiceProvider )

As a parameter to the method, the current database connects and sends HttpContext on the web. Gets a database connection as the output of the method.

If there is more than one IConnectionStringControlGlobalEventServiceProvider implementation, it will enter into realizations in order. Each time, if it is not empty, it starts using the value returned from the implementation.

Calling The Method( IConnectionStringControlGlobalEventServiceProvider ) 

Netigma runs the CheckConnectionString method when creating a database connection on the page.

Implementation and Executing( IConnectionStringControlGlobalEventServiceProvider ) 

The class library with the IConnectionStringControlGlobalEventServiceProvider implementation is compiled and the dll file is copied into the bin folder of the Netigma web application.

Dikkat Edilmesi Gereken işlemler

IConnectionStringControlGlobalEventServiceProvider  gerçekleştirimi sırasında , "Rules to be observed in classes that using TypeManager (Factory)" dokümanı dikkate alınarak hazırlanmalıdır.

 

 

During the execution of IConnectionStringControlGlobalEventServiceProvider, the "Rules to be observed in classes that using TypeManager (Factory) " document must be prepared, taking into account the document.

 

 

As a basis for project references

  • AuthorizationManager
  • ParameterManager
  • Logmanager
  • Netcad.Core
  • Netcad.ComponentModel
  • Netcad.Data
  • Netcad.Data.Filtering
  • Netcad.Interop
  • Netcad.Netigma
  • Netcad.Runtime
  • Netcad.SimpleThreading
  • Netcad.Xml


libraries should be included.

(tick) After this step, Netigma will run the method of the corresponding implementation when creating a database connection.

 

See Also

 Rules to be observed in classes that using TypeManager (Factory)# UUYTFH