Exemplo n.º 1
0
 public static void Boot()
 {
     ConfigureDependencies();
     AutoMapperInitialize();
     InitSystemSwitch.Init();
     ScheduleTaskServices.RegisterTask(new TimeSendMessage(), new IntervalSchedule(TimeSpan.Parse("02:00:00"), DateTime.Now));
     ScheduleTaskServices.RegisterTask(new UserBehavior(), new IntervalSchedule(TimeSpan.Parse("00:00:10"), DateTime.Now));
     ScheduleTaskServices.RegisterTask(new OrderTimeSendMessage(), new IntervalSchedule(TimeSpan.Parse("00:00:20"), DateTime.Now));
     ScheduleTaskServices.Start();
     System.Threading.Thread t = new System.Threading.Thread(ReviceMessage);
     t.Start();
 }
Exemplo n.º 2
0
        public static void Boot()
        {
            ConfigureDependencies();
            AutoMapperInitialize();
            InitSystemSwitch.Init();
            ScheduleTaskServices.RegisterTask(new TimeSendMessage(), new IntervalSchedule(TimeSpan.Parse("02:00:00"), DateTime.Now));
            ScheduleTaskServices.RegisterTask(new UserBehavior(), new IntervalSchedule(TimeSpan.Parse("00:00:10"), DateTime.Now));
            ScheduleTaskServices.RegisterTask(new OrderTimeSendMessage(), new IntervalSchedule(TimeSpan.Parse("00:10:00"), DateTime.Now));
            SystemConsoSwitch.QTSettingList.ForEach(x =>
            {
                ScheduleTaskServices.RegisterTask(new GetQTInfo(x), new IntervalSchedule(TimeSpan.Parse(x.Timeout), DateTime.Now));
            });

            ScheduleTaskServices.RegisterTask(new OpenTicketTask(), new DailySchedule(1, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 3, 0, 0)));
            ScheduleTaskServices.Start();
            System.Threading.Thread t = new System.Threading.Thread(ReviceMessage);
            t.Start();
            QueueLogsManager.Init();
        }
Exemplo n.º 3
0
        public void SetAirChangTimeOutInfo(string QTStartTime, string QTEndTime, string TimeOut, bool?IsOpen)
        {
            bool _status;

            if (!IsOpen.HasValue)
            {
                _status = false;
            }
            else
            {
                _status = IsOpen.Value;
            }
            string           _code = AuthManager.GetCurrentUser().Code;
            string           _path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config", "AirChange.xml");
            List <QTSetting> list  = BPiaoBao.Common.XmlHelper.XmlDeserializeFromFile <List <QTSetting> >(_path, Encoding.Default);

            if (int.Parse(TimeOut) > 60)
            {
                if (int.Parse(TimeOut) >= 600)
                {
                    TimeOut = "" + int.Parse(TimeOut) / 60 + ":00:00";
                }
                else
                {
                    TimeOut = "0" + int.Parse(TimeOut) / 60 + ":" + int.Parse(TimeOut) % 60 + ":00";
                }
            }
            else
            {
                TimeOut = "00:" + TimeOut + ":00";
            }
            if (list.Where(x => x.Code == _code).FirstOrDefault() == null)
            {
                QTSetting model = new QTSetting()
                {
                    QTEndTime   = QTEndTime,
                    QTStartTime = QTStartTime,
                    Timeout     = TimeOut,
                    Code        = _code,
                    IsOpen      = _status
                };
                list.Add(model);
                ScheduleTaskServices.RegisterTask(new GetQTInfo(model), new IntervalSchedule(TimeSpan.Parse(TimeOut), DateTime.Now));
            }
            else
            {
                list.ForEach(x =>
                {
                    if (x.Code == _code)
                    {
                        x.QTStartTime = QTStartTime;
                        x.QTEndTime   = QTEndTime;
                        x.Timeout     = TimeOut;
                        x.Code        = AuthManager.GetCurrentUser().Code;
                        x.IsOpen      = _status;
                    }
                });
            }
            BPiaoBao.Common.XmlHelper.XmlSerializeToFile(list, _path, Encoding.Default);
            var info = SystemConsoSwitch.QTSettingList.Where(x => x.Code == _code).FirstOrDefault();

            if (info == null)
            {
                info = new QTSetting()
                {
                    Code = _code, Timeout = TimeOut, QTEndTime = QTEndTime, QTStartTime = QTStartTime, IsOpen = _status
                };
                SystemConsoSwitch.QTSettingList.Add(info);
            }
            else
            {
                info.QTEndTime   = QTEndTime;
                info.QTStartTime = QTStartTime;
                info.Timeout     = TimeOut;
                info.IsOpen      = _status;
            }
        }