DataEvent

Namespace: Automatonymous
We found 10 examples in language CSharp for this search. You will see 40 fragments of code.

        public void AddEvent(DataEvent dataEvent)
        {
            DataEvents.Add(dataEvent);

            if (Items.Count == 0)
            {
                Items.Add(dataEvent);
                return;
            }

            int index = FindInsersionPlace(dataEvent.Message.timestamp.Ticks, 0, Items.Count - 1);

            Items.Insert(index, dataEvent);
        }

        private void DataEventList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SelectedEvent != null)
                SelectedEvent.Selected = false;
            SelectedEvent = (DataEvent)SelectedItem;
            if (SelectedEvent != null)
                SelectedEvent.Selected = true;
        }

        internal void RemoveEvent(DataEvent dataEvent)
        {
            DataEvents.Remove(dataEvent);
            Items.Remove(dataEvent);
        }


        public void AddEvent(DataEvent dataEvent)
        {
            DataEvents.Add(dataEvent);

            if (Items.Count == 0)
            {
                Items.Add(dataEvent);
                return;
            }

            int index = FindInsersionPlace(dataEvent.Message.timestamp.Ticks, 0, Items.Count - 1);

            Items.Insert(index, dataEvent);
        }

        private void DataEventList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SelectedEvent != null)
                SelectedEvent.Selected = false;
            SelectedEvent = (DataEvent)SelectedItem;
            if (SelectedEvent != null)
                SelectedEvent.Selected = true;
        }

        internal void RemoveEvent(DataEvent dataEvent)
        {
            DataEvents.Remove(dataEvent);
            Items.Remove(dataEvent);
        }


        public void Dispose(bool disposing)
        {
            if (disposing)
            {
                dataEvent.ZoneChanged -= new DataEvent.ZoneChangedDelegate(OnZoneChange);
                dataEvent.PartyListChanged -= new DataEvent.PartyListChangedDelegate(OnPartyListChanged);
            }
        }

using System.Collections.Generic;

namespace DotNetify.Postgres
{
   public class Transaction
   {
      public List<DataEvent> DataEvents { get; } = new List<DataEvent>();
   }

   public class Relation
   {
      public uint Id { get; set; }
      public string Name { get; set; }
      public string[] ColumnNames { get; set; }
   }

   public class DataEvent
   {
      public Relation Relation { get; set; }
   }

   public class InsertEvent : DataEvent
   {
      public object[] ColumnValues { get; set; }
   }

   public class UpdateEvent : DataEvent
   {
      public object[] ColumnValues { get; set; }
      public object[] OldColumnValues { get; set; }
   }

   public class DeleteEvent : DataEvent
   {
      public object[] Keys { get; set; }
      public object[] OldColumnValues { get; set; }
   }
}

		public static Image CreateImage(byte[] data) {
			if((data == null) || (data.Length <= 0))
				return null;
			MemoryStream ms = new MemoryStream(data);
			return Image.FromStream(ms);
		}

		public void Delete() {
			this.Table.Delete(this);
		}

		public virtual void Save() {
			this.Table.Save(this);
		}

		public DataEventCollection LinkedDataEvents(DataTableBase linkedTable) {
			return this.LinkedDataEvents(this.table.LinkedTables.IndexOf(linkedTable));
		}
		public virtual DataEventCollection LinkedDataEvents(int index) {
			return this.linkedEventCollections[index];
		}

		public int Add( DataEvent value )  {
			return( List.Add( value ) );
		}

        public ActionResult Index(int? status, string searchCode, string searchRequestBy, DateTime? searchRequestDate, string searchCreatedby,DateTime? searchCreatedDate, int? page)
        {
            //ViewBag.ListData
            List<transaksi_event> ListEvent = EventRepo.GetAllData();
            ViewBag.CurrentFilter1 = searchCode;
            ViewBag.CurrentFilter2 = searchRequestBy;
            ViewBag.CurrentFilter3 = searchRequestDate;
            ViewBag.CurrentFilter4 = status;
            ViewBag.CurrentFilter5 = searchCreatedby;
            ViewBag.CurrentFilter6 = searchCreatedDate;
            ViewBag.DataKosong = DataKosong;
            if (!string.IsNullOrEmpty(searchCode))
            {
                ListEvent = ListEvent.Where(x => x.code == searchCode).ToList();
            }
            if (!string.IsNullOrEmpty(searchRequestBy))
            {
                ListEvent = ListEvent.Where(x => x.request_by == searchRequestBy).ToList();
            }
            if (searchRequestDate != null)
            {
                ListEvent = ListEvent.Where(x => x.request_date.ToString("dd MMMM yyyy") == searchRequestDate.Value.ToString("dd MMMM yyyy")).ToList();
            }
            if (status != null)
              {
                  ListEvent = ListEvent.Where(x => x.status == status).ToList();
              }
            if (searchCreatedDate != null)
            {
                ListEvent = ListEvent.Where(x => x.created_date.Value.ToString("dd MMMM yyyy") == searchCreatedDate.Value.ToString("dd MMMM yyyy")).ToList();
            }
            if (!string.IsNullOrEmpty(searchCreatedby))
            {
                ListEvent = ListEvent.Where(x => x.created_by == searchCreatedby).ToList();
            }
            if (ListEvent.Count == 0)
            {
                DataKosong = "Data tidak ditemukan";
            }
            else
            {
                DataKosong = "";
            }

            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(ListEvent.ToPagedList(pageNumber, pageSize));
           
        }
        [HttpGet]
        public ActionResult Create()
        {
            return View();
        }
        [HttpPost]
        public ActionResult CreateData(VMEvent dataevent)
        {
            string result = EventRepo.CreateData(dataevent);
            string[] spearator = { "Berhasil" };
            return Json(new { respon = result.Split(spearator, StringSplitOptions.RemoveEmptyEntries) }, JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public ActionResult Edit(int id)
        {
            VMEvent dataevent = EventRepo.GetDataById(id);
            return View(dataevent);
        }
        [HttpPost]
        public ActionResult UpdateData(VMEvent dataevent)
        {
            string result = EventRepo.UpdateData(dataevent);
            string[] spearator = { "Berhasil" };
            return Json(new { respon = result.Split(spearator, StringSplitOptions.RemoveEmptyEntries) }, JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public ActionResult Approval(int id)
        {
            VMEvent dataevent = EventRepo.GetDataById(id);
            return View(dataevent);
        }

        public ActionResult Index(int? status, string searchCode, string searchRequestBy, DateTime? searchRequestDate, string searchCreatedby,DateTime? searchCreatedDate, int? page)
        {
            //ViewBag.ListData
            List<transaksi_event> ListEvent = EventRepo.GetAllData();
            ViewBag.CurrentFilter1 = searchCode;
            ViewBag.CurrentFilter2 = searchRequestBy;
            ViewBag.CurrentFilter3 = searchRequestDate;
            ViewBag.CurrentFilter4 = status;
            ViewBag.CurrentFilter5 = searchCreatedby;
            ViewBag.CurrentFilter6 = searchCreatedDate;
            ViewBag.DataKosong = DataKosong;
            if (!string.IsNullOrEmpty(searchCode))
            {
                ListEvent = ListEvent.Where(x => x.code == searchCode).ToList();
            }
            if (!string.IsNullOrEmpty(searchRequestBy))
            {
                ListEvent = ListEvent.Where(x => x.request_by == searchRequestBy).ToList();
            }
            if (searchRequestDate != null)
            {
                ListEvent = ListEvent.Where(x => x.request_date.ToString("dd MMMM yyyy") == searchRequestDate.Value.ToString("dd MMMM yyyy")).ToList();
            }
            if (status != null)
              {
                  ListEvent = ListEvent.Where(x => x.status == status).ToList();
              }
            if (searchCreatedDate != null)
            {
                ListEvent = ListEvent.Where(x => x.created_date.Value.ToString("dd MMMM yyyy") == searchCreatedDate.Value.ToString("dd MMMM yyyy")).ToList();
            }
            if (!string.IsNullOrEmpty(searchCreatedby))
            {
                ListEvent = ListEvent.Where(x => x.created_by == searchCreatedby).ToList();
            }
            if (ListEvent.Count == 0)
            {
                DataKosong = "Data tidak ditemukan";
            }
            else
            {
                DataKosong = "";
            }

            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(ListEvent.ToPagedList(pageNumber, pageSize));
           
        }
        [HttpGet]
        public ActionResult Create()
        {
            return View();
        }
        [HttpPost]
        public ActionResult CreateData(VMEvent dataevent)
        {
            string result = EventRepo.CreateData(dataevent);
            string[] spearator = { "Berhasil" };
            return Json(new { respon = result.Split(spearator, StringSplitOptions.RemoveEmptyEntries) }, JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public ActionResult Edit(int id)
        {
            VMEvent dataevent = EventRepo.GetDataById(id);
            return View(dataevent);
        }
        [HttpPost]
        public ActionResult UpdateData(VMEvent dataevent)
        {
            string result = EventRepo.UpdateData(dataevent);
            string[] spearator = { "Berhasil" };
            return Json(new { respon = result.Split(spearator, StringSplitOptions.RemoveEmptyEntries) }, JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public ActionResult Approval(int id)
        {
            VMEvent dataevent = EventRepo.GetDataById(id);
            return View(dataevent);
        }


        public void Lock()
        {
            lock (taskListSyncRoot)
            {
                lockCount++;
            }
        }

        public void Unlock()
        {
            lock (taskListSyncRoot)
            {
                lockCount--;
                if (lockCount == 0 && delayedTaskList.Count > 0)
                {
                    while (delayedTaskList.Count > 0)
                        taskList.Enqueue(delayedTaskList.Dequeue());

                    if (TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenAdded ||
                    TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenExecuted)
                        ReorderTasks();

                    TasksAdded();
                }
            }
        }

		/// <summary>
		/// Creates a new Task based upon the given action.
		/// </summary>
		/// <typeparam name="T">The return value of the task.</typeparam>
		/// <param name="function">The function to process at the dispatchers thread.</param>
		/// <returns>The new task.</returns>
		public Task<T> Dispatch<T>(Func<T> function)
        {
			CheckAccessLimitation();

            var task = new Task<T>(function);
            AddTask(task);
            return task;
        }

		/// <summary>
		/// Creates a new Task based upon the given action.
		/// </summary>
		/// <param name="action">The action to process at the dispatchers thread.</param>
		/// <returns>The new task.</returns>
        public Task Dispatch(Action action)
        {
			CheckAccessLimitation();

            var task = Task.Create(action);
            AddTask(task);
            return task;
        }

        /// <summary>
        /// Dispatches a given Task.
        /// </summary>
        /// <param name="action">The action to process at the dispatchers thread.</param>
        /// <returns>The new task.</returns>
        public Task Dispatch(Task task)
        {
            CheckAccessLimitation();

            AddTask(task);
            return task;
        }

		internal virtual void AddTask(Task task)
        {
            lock (taskListSyncRoot)
            {
                if (lockCount > 0)
                {
                    delayedTaskList.Enqueue(task);
                    return;
                }

                taskList.Enqueue(task);
                
                if (TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenAdded ||
                    TaskSortingSystem == UnityThreading.TaskSortingSystem.ReorderWhenExecuted)
					 ReorderTasks();
            }
			TasksAdded();
        }

    void Awake()
    {
        _instance = this;
    }

    public void AddDataWatch(DataType dataType, EventMgr eventMgr)
    {
        if (EventMgrDict == null)
        {
            EventMgrDict = new Dictionary<DataType, DataEvent>();
        }

        if (EventMgrDict.ContainsKey(dataType))
        {
            //已存在该信息的刷新方法 先移除监听 绑定方法后重新监听
            EventManager._instance.UnRegister((int)dataType);
            EventMgrDict[dataType].BindEvnt(eventMgr);
            EventManager._instance.Register((int)dataType, EventMgrDict[dataType].InstanceEvent);
        }
        else
        {
            //不存在该信息的刷新方法,需注册
            var dataEvent = new DataEvent();
            dataEvent.BindEvnt(eventMgr);
            EventMgrDict.Add(dataType, dataEvent);
            EventManager._instance.Register((int)dataType, dataEvent.InstanceEvent);
        }
    }


    public DataBase Get(DataType dataType)
    {
        if (EventListerDict.ContainsKey(dataType))
        {
            return EventListerDict[dataType];
        }
        Debug.LogError("Key:" + dataType + "不存在,获取失败!");
        return null;



    }

    public void Register(DataType dataType, DataBase dataBase)
    {
        if (EventListerDict == null)
        {
            EventListerDict = new Dictionary<DataType, DataBase>();
        }

        if (EventListerDict.ContainsKey(dataType))
        {
            Debug.LogError("Key:" + dataType + "已经被注册!");
            return;
        }
        EventListerDict.Add(dataType, dataBase);

    }


        public DataEvent AddMetaData(string key, object value)
        {
            MetaData[key] = value;
            return this;
        }

        public static DataEvent Created(string subject, object payload = null)
        {
            return new DataEvent(DataEventAction.Created, subject, payload);
        }

        public static DataEvent Updated(string subject, object payload = null)
        {
            return new DataEvent(DataEventAction.Updated, subject, payload);
        }

        public static DataEvent Deleted(string subject, object payload = null)
        {
            return new DataEvent(DataEventAction.Deleted, subject, payload);
        }

Automatonymous.Events.DataEvent<TData> : Event, Visitable, IProbeSite, IComparable

Constructors :

public DataEvent(String name = )

Methods :

public Void Accept(StateMachineVisitor visitor = )
public Void Probe(ProbeContext context = )
public Boolean Equals(DataEvent other = )
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()
public String get_Name()
public Int32 CompareTo(Event other = )
public Boolean Equals(TriggerEvent other = )
public Type GetType()

Other methods