示例#1
0
        public static Guid Attach()
        {
            EventListener eventlistener = new EventListener ();
            eventlistener.Save ();

            return eventlistener.Id;
        }
示例#2
0
文件: Event.cs 项目: sundowndk/sXUL
        public static List<Event> List(EventListener EventListener)
        {
            List<Event> result = new List<Event> ();

            foreach (Datastore.Item item in Datastore.List (DatastoreAisle, Datastore.Filter.Where ("ownerid", Datastore.Filter.ComparisonOperator.NotEqual, EventListener.Id), Datastore.Sort.AccendingBy ("sort")))
            {
                try
                {
                    Event e = FromData (item.Data);
                    if (e._updatetimestamp >= EventListener.UpdateTimestamp)
                    {
                        result.Add (e);
                    }
                }
                catch (Exception exception)
                {
                    // LOG: LogDebug.ExceptionUnknown
                    Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, typeof (Event), exception.Message));

                    // LOG: LogDebug.EventList
                    Logging.LogDebug (string.Format (Strings.LogDebug.EventList, item.Id));
                }
            }

            //			result.Sort (delegate (Event e1, Event e2) { return e1.Sort.CompareTo (e2.Sort); });

            return result;
        }
示例#3
0
 public static void Delete(EventListener EventListener)
 {
     Delete (EventListener._id);
 }
示例#4
0
        public static EventListener FromData(Data data)
        {
            EventListener result = new EventListener ();

            if (data.ContainsKey ("id"))
                result._id = data.Get<Guid>("id");
            else
                throw new Exception (string.Format (SorentoLib.Strings.Exception.JSONFrom, typeof (Event), "ID"));

            if (data.ContainsKey ("createtimestamp"))
                result._createtimestamp = data.Get<int>("createtimestamp");

            if (data.ContainsKey ("updatetimestamp"))
                result._updatetimestamp = data.Get<int>("updatetimestamp");

            return result;
        }