Пример #1
0
        /// <summary>
        /// 開始運行。此方法會阻塞綫程
        /// </summary>
        public void Run()
        {
            if (isExit)
            {
                return;
            }

            // 啓動時投遞訊息
            PostEvent(EventFilter.User, EventType.BotStart);

            // 進入事件循環
            isExit = false;
            while (!isExit)
            {
                Event coreEvent;
                if (!GetEvent(out coreEvent) || coreEvent.type == EventType.Idle)
                {
                    Thread.Sleep(1);
                    continue;
                }

                // 處理事件
                EventWorkers.QueueUserWorkItem(ProcessEvent, coreEvent);
            }
        }
Пример #2
0
        public IActionResult AddEventWorkers(int event_id, int id_user, int hours)
        {
            EventWorkers worker = new EventWorkers()
            {
                Event_Id = event_id, Worker_Id = id_user, Hours = hours
            };

            db.Events_Workers.Add(worker);
            db.SaveChanges();
            SendSalary(id_user);
            ViewBag.event_workers = db.Events_Workers;


            return(Redirect($"/Home/AddEventWorkers/{event_id}"));
        }