public static Guid Attach() { EventListener eventlistener = new EventListener (); eventlistener.Save (); return eventlistener.Id; }
public static EventListener Load(Guid Id) { EventListener result; try { Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, Id.ToString ()).SelectSingleNode ("(//didius.eventlistener)[1]"))); result = new EventListener (); result._id = new Guid ((string)item["id"]); if (item.ContainsKey ("createtimestamp")) { result._createtimestamp = int.Parse ((string)item["createtimestamp"]); } if (item.ContainsKey ("updatetimestamp")) { result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]); } } catch (Exception exception) { // LOG: LogDebug.ExceptionUnknown SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.EVENTLISTENER", exception.Message)); // EXCEPTION: Excpetion.EventListenerLoadGuid throw new Exception (string.Format (Strings.Exception.EventListenerLoadGuid, Id)); } return result; }
public static List<Event> List(EventListener EventListener) { List<Event> result = new List<Event> (); // foreach (string id in SorentoLib.Services.Datastore.ListOfShelfs (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("ownerid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.NotEqual, EventListener.Id))) foreach (string id in SorentoLib.Services.Datastore.ListOfShelfs (DatastoreAisle)) { try { Event e = Event.Load (new Guid (id)); if (e._updatetimestamp > EventListener.UpdateTimestamp) { result.Add (e); } } catch (Exception exception) { // LOG: LogDebug.ExceptionUnknown SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.CUSTOMER", exception.Message)); // LOG: LogDebug.CustomerList SorentoLib.Services.Logging.LogDebug (string.Format (Strings.LogDebug.CustomerList, id)); } } result.Sort (delegate (Event e1, Event e2) { return e1.UpdateTimestamp.CompareTo (e2.UpdateTimestamp); }); return result; }