Exemple #1
0
        public virtual bool IsLegalOption()

        {
            bool isLegalOption = SystemOption.CheckSyntax(this.option_, GetOption(), false, true);

            return(isLegalOption);
        }
Exemple #2
0
        public IActionResult Get(Guid id)
        {
            try
            {
                using (var db = new AllInOneContext.AllInOneContext())
                {
                    SystemOption data = db.SystemOption
                                        .Include(t => t.ApplicationSystemOptions)
                                        .FirstOrDefault(p => p.SystemOptionId.Equals(id));
                    if (data == null)
                    {
                        return(NoContent());
                    }

                    return(new ObjectResult(data));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("Get:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
                return(BadRequest(new ApplicationException {
                    ErrorCode = "Unknown", ErrorMessage = ex.Message
                }));
            }
        }
Exemple #3
0
        private void btnRemoveOption_Click(object sender, RoutedEventArgs e)
        {
            if (currentSelectedOption == null)
            {
                EventBus.EventBus.Instance.PostEvent(new CustomEvent("Notify", "Please select an option first", CustomEvent.EventType.warning));
            }
            else
            {
                SystemOption systemOption = new SystemOption(currentSystem.GUID, currentSelectedOption.GUID);
                systemOption.removeFromClientOptions();

                updateOptions();
                EventBus.EventBus.Instance.PostEvent(new CustomEvent("Notify", "Option successfully removed", CustomEvent.EventType.accept));
            }
        }
Exemple #4
0
        public ActionResult OpenForm(long id)
        {
            //Check User Permission For this Page
            if (!UserAccountMannager.HasPermission(_uow, _security, AppSession.CurrentUser.Id, EN_Screens.SystemOptions, EN_Permissions.Edit))
            {
                return(Redirect("/Home/Index"));
            }

            SystemOption entity = _uow.SystemOptionsRepository.GetById(id);

            if (entity == null || entity.IsDeleted || entity.IsHidden)
            {
                return(NotFound());
            }

            return(View(entity));
        }
Exemple #5
0
        private void btnAddOptionfromList_Click(object sender, RoutedEventArgs e)
        {
            if (currentOption == null)
            {
                EventBus.EventBus.Instance.PostEvent(new CustomEvent("Notify", "Please select an option first", CustomEvent.EventType.warning));
            }
            else
            {
                // SQL to add option to client
                SystemOption optionProduct = new SystemOption(currentSystem.GUID, currentOption.GUID);
                optionProduct.insertIntoSystemOption();

                updateOptions();

                EventBus.EventBus.Instance.PostEvent(new CustomEvent("Notify", "Option successfully added", CustomEvent.EventType.accept));
                ViewModel.AddOptionEnabled = false;
            }
        }
Exemple #6
0
        public IActionResult Add([FromBody] Schedule model)
        {
            try
            {
                if (model == null)
                {
                    return(BadRequest());
                }
                using (var db = new AllInOneContext.AllInOneContext())
                {
                    if (model.ScheduleCycle != null)
                    {
                        //补全数据
                        SystemOption cycletype = db.Set <SystemOption>()
                                                 .FirstOrDefault(p => p.SystemOptionId.Equals(model.ScheduleCycle.CycleTypeId));
                        Schedule Schedule = model;
                        if (cycletype != null)
                        {
                            Schedule.ScheduleCycle.CycleType = cycletype;
                        }
                        DateTime?executeTime = ScheduleUtility.GetExecuteTime(Schedule, DateTime.Now);
                        model.ScheduleCycle.NextExecute = executeTime;
                    }
                    db.Schedule.Add(model);
                    db.SaveChanges();
                    return(Created("", "OK"));
                }
            }
            catch (DbUpdateException dbEx)
            {
                _logger.LogError("Add:Message:{0}\r\n,StackTrace:{1}", dbEx.Message, dbEx.StackTrace);

                return(BadRequest(new ApplicationException {
                    ErrorCode = "DBUpdate", ErrorMessage = "数据保存异常:" + dbEx.Message
                }));
            }
            catch (System.Exception ex)
            {
                _logger.LogError("Add:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
                return(BadRequest(new ApplicationException {
                    ErrorCode = "Unknown", ErrorMessage = ex.Message
                }));
            }
        }
Exemple #7
0
    protected void lnkSave_Click(object sender, EventArgs e)
    {
        List <SystemOption> lstSystemOption = new List <SystemOption>();
        SystemOption        objSystemOption = new SystemOption();

        objSystemOption.OptionId    = 165;
        objSystemOption.OptionValue = txtCacheTimeout.Text;
        lstSystemOption.Add(objSystemOption);

        AMSResult <bool> Result = SystemSettings.UpdateGeneralSystemOptions(lstSystemOption);

        if (Result.ResultType != AMSResultType.Success)
        {
            DisplayError(Result.GetLocalizedMessage(LanguageID));
        }
        else
        {
            DisplaySuccess(PhraseLib.Lookup("cache.caheintervalsaved", LanguageID));
        }
    }
Exemple #8
0
        public IActionResult Save(SystemOption entity, IFormCollection form)
        {
            string strReturnMsg = "error";

            try
            {
                var systemOption = _uow.SystemOptionsRepository.GetById(entity.Id);
                if (systemOption.IsReadOnly != true)
                {
                    if (!string.IsNullOrEmpty(form["TextValue"]))
                    {
                        systemOption.Value = form["TextValue"];
                    }

                    if (!string.IsNullOrEmpty(form["Time"]))
                    {
                        var date = form["Time"].ToString();
                        systemOption.Time = TimeSpan.Parse(date);
                    }

                    systemOption.ModificationDate = DateTime.Now;
                    systemOption.ModifiedBy       = AppSession.CurrentUser.Id;


                    //Re-ValidateModel
                    ModelState.Clear();
                    TryValidateModel(systemOption);
                    if (ModelState.IsValid)
                    {
                        _uow.SystemOptionsRepository.Update(systemOption);
                    }
                    _uow.Save();
                    strReturnMsg = "success";
                }
            }
            catch (Exception ex) { }
            return(Json(new { id = entity.Id, status = strReturnMsg }));
        }
Exemple #9
0
 public IActionResult Update([FromBody] SystemOption model)
 {
     try
     {
         if (model == null)
         {
             return(BadRequest());
         }
         using (var db = new AllInOneContext.AllInOneContext())
         {
             db.SystemOption.Update(model);
             db.SaveChanges();
             return(new NoContentResult());
         }
     }
     catch (System.Exception ex)
     {
         _logger.LogError("Update:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
         return(BadRequest(new ApplicationException {
             ErrorCode = "Unknown", ErrorMessage = ex.Message
         }));
     }
 }
Exemple #10
0
 public IActionResult Delete(Guid id)
 {
     try
     {
         using (var db = new AllInOneContext.AllInOneContext())
         {
             SystemOption data = db.SystemOption.FirstOrDefault(p => p.SystemOptionId == id);
             if (data == null)
             {
                 return(NoContent());
             }
             db.SystemOption.Remove(data);
             db.SaveChanges();
             return(new NoContentResult());
         }
     }
     catch (System.Exception ex)
     {
         _logger.LogError("Delete:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
         return(BadRequest(new ApplicationException {
             ErrorCode = "Unknown", ErrorMessage = ex.Message
         }));
     }
 }
Exemple #11
0
        public static void Update20161219()
        {
            //防区名称调整
            using (var db = new AllInOneContext())
            {
                var baseOption = db.SystemOption.FirstOrDefault(t => t.SystemOptionCode.Equals("103"));
                if (baseOption == null)
                {
                    var bs = new SystemOption()
                    {
                        SystemOptionCode = "103",
                        SystemOptionId   = DataCache.CreateGuid3("103"),
                        SystemOptionName = "日志分类",
                        Description      = "日志分类"
                    };
                    db.SystemOption.Add(bs);
                    db.SaveChanges();
                }

                var baguid = db.SystemOption.FirstOrDefault(t => t.SystemOptionCode.Equals("103")).SystemOptionId;
                var b1     = db.SystemOption.FirstOrDefault(t => t.SystemOptionCode.Equals("10300001"));
                if (b1 != null)
                {
                    b1.ParentSystemOptionId = baguid;
                    db.SystemOption.Update(b1);
                }

                var b2 = db.SystemOption.FirstOrDefault(t => t.SystemOptionCode.Equals("10300002"));
                if (b2 != null)
                {
                    b2.ParentSystemOptionId = baguid;
                    db.SystemOption.Update(b2);
                }
                db.SaveChanges();
            }
        }
Exemple #12
0
        public IActionResult Update([FromBody] Schedule model)
        {
            try
            {
                if (model == null)
                {
                    return(BadRequest());
                }
                using (var db = new AllInOneContext.AllInOneContext())
                {
                    using (var tran = db.Database.BeginTransaction())
                    {
                        if (model.ScheduleCycle != null)
                        {
                            //补全数据
                            SystemOption cycletype = db.Set <SystemOption>()
                                                     .FirstOrDefault(p => p.SystemOptionId.Equals(model.ScheduleCycle.CycleTypeId));
                            Schedule Schedule = model;
                            if (cycletype != null)
                            {
                                Schedule.ScheduleCycle.CycleType = cycletype;
                            }
                            DateTime?executeTime = ScheduleUtility.GetExecuteTime(Schedule, DateTime.Now);
                            model.ScheduleCycle.NextExecute = executeTime;
                        }
                        //转换一般数据
                        Schedule shedule = db.Schedule
                                           .Include(t => t.ScheduleType)
                                           .Include(t => t.ScheduleCycle).ThenInclude(t => t.DayPeriods)
                                           .Include(t => t.ScheduleCycle).ThenInclude(t => t.CycleType)
                                           .FirstOrDefault(p => p.ScheduleId.Equals(model.ScheduleId));

                        if (shedule == null)
                        {
                            return(BadRequest());
                        }

                        shedule.EffectiveTime  = model.EffectiveTime;
                        shedule.ExpirationTime = model.ExpirationTime;
                        shedule.ScheduleTypeId = model.ScheduleTypeId;
                        shedule.ScheduleName   = model.ScheduleName;
                        //
                        ScheduleCycle scheduleCycle = db.Set <ScheduleCycle>()
                                                      .Include(t => t.DayPeriods)
                                                      .FirstOrDefault(p => p.ScheduleCycleId.Equals(shedule.ScheduleCycle.ScheduleCycleId));
                        //转换ScheduleCycle
                        scheduleCycle.CycleTypeId = model.ScheduleCycle.CycleTypeId;
                        scheduleCycle.Days        = model.ScheduleCycle.Days;
                        scheduleCycle.DaysJson    = model.ScheduleCycle.DaysJson;
                        scheduleCycle.LastExecute = model.ScheduleCycle.LastExecute;
                        scheduleCycle.Months      = model.ScheduleCycle.Months;
                        scheduleCycle.MonthsJson  = model.ScheduleCycle.MonthsJson;
                        scheduleCycle.NextExecute = model.ScheduleCycle.NextExecute;
                        scheduleCycle.WeekDayJson = model.ScheduleCycle.WeekDayJson;
                        scheduleCycle.WeekDays    = model.ScheduleCycle.WeekDays;
                        //
                        RemoveList(db, shedule);
                        //
                        scheduleCycle.DayPeriods = model.ScheduleCycle.DayPeriods;
                        shedule.ScheduleCycle    = scheduleCycle;
                        db.Schedule.Update(shedule);
                        db.SaveChanges();
                        //
                        tran.Commit();
                        return(new NoContentResult());
                    }
                }
            }
            catch (DbUpdateException dbEx)
            {
                _logger.LogError("Update:Message:{0}\r\n,StackTrace:{1}", dbEx.Message, dbEx.StackTrace);

                return(BadRequest(new ApplicationException {
                    ErrorCode = "DBUpdate", ErrorMessage = "数据保存异常:" + dbEx.Message
                }));
            }
            catch (System.Exception ex)
            {
                _logger.LogError("Update:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
                return(BadRequest(new ApplicationException {
                    ErrorCode = "Unknown", ErrorMessage = ex.Message
                }));
            }
        }
Exemple #13
0
        public IActionResult GetNextDutyCheckLog(Guid organizationId)
        {
            try
            {
                if (organizationId == null || organizationId == new Guid())
                {
                    return(NoContent());
                }
                //调整方法,原来记录生成的只是组织机构,需匹配生成查勤点
                using (var db = new AllInOneContext.AllInOneContext())
                {
                    DutyCheckPackage package = db.DutyCheckPackage
                                               .Include(t => t.DutyCheckPackLogs).ThenInclude(t => t.DutyCheckLog).ThenInclude(t => t.Status)
                                               .FirstOrDefault(p => p.StartTime <= DateTime.Now && p.EndTime >= DateTime.Now && p.PackageStatusId != new Guid("124A8562-EAC8-4C09-8758-A6E312974552"));
                    if (package == null)
                    {
                        return(NoContent());
                    }

                    //处理已获取,未完成的记录
                    var getLogs = package.DutyCheckPackLogs.Where(p => p.DutyCheckLog.Status.SystemOptionCode.Equals("16000002"));

                    if (getLogs.Count() > 0)
                    {
                        DutyCheckLog log = db.DutyCheckLog
                                           .Include(t => t.Apprises).ThenInclude(t => t.DutyCheckAppraise).ThenInclude(t => t.AppraiseICO)
                                           .Include(t => t.Apprises).ThenInclude(t => t.DutyCheckAppraise).ThenInclude(t => t.AppraiseType)
                                           .Include(t => t.DutyCheckOperation).ThenInclude(t => t.Attachments).ThenInclude(t => t.Attachment)
                                           .Include(t => t.DutyCheckOperation).ThenInclude(t => t.Attachments).ThenInclude(t => t.AttachmentType)
                                           .Include(t => t.DutyCheckSiteSchedule).ThenInclude(t => t.SiteOrganization)
                                           .Include(t => t.DutyCheckSiteSchedule).ThenInclude(t => t.CheckMan)
                                           .Include(t => t.DutyCheckStaff)
                                           .Include(t => t.Organization)
                                           .Include(t => t.RecordType)
                                           .Include(t => t.Status)
                                           .Include(t => t.CircularTypes).ThenInclude(t => t.Dispose)
                                           .Include(t => t.MainApprise)
                                           .FirstOrDefault(p => p.DutyCheckLogId.Equals(getLogs.ToList()[0].DutyCheckLogId));
                        //
                        CameraView cameraView = GetCameraView(log.DutyCheckSiteSchedule.SiteOrganizationId, db, log);

                        DutyCheckPointView View = new DutyCheckPointView
                        {
                            DutyCheckLog = log,
                            CameraView   = cameraView
                        };

                        return(new ObjectResult(View));
                    }
                    //从未获取的记录中,返回一个
                    var noLogs = package.DutyCheckPackLogs.Where(p => p.DutyCheckLog.Status.SystemOptionCode.Equals("16000001"));
                    if (noLogs.Count() > 0)
                    {
                        DutyCheckLog log = db.DutyCheckLog
                                           .Include(t => t.Apprises).ThenInclude(t => t.DutyCheckAppraise).ThenInclude(t => t.AppraiseICO)
                                           .Include(t => t.Apprises).ThenInclude(t => t.DutyCheckAppraise).ThenInclude(t => t.AppraiseType)
                                           .Include(t => t.DutyCheckOperation).ThenInclude(t => t.Attachments).ThenInclude(t => t.Attachment)
                                           .Include(t => t.DutyCheckOperation).ThenInclude(t => t.Attachments).ThenInclude(t => t.AttachmentType)
                                           .Include(t => t.DutyCheckSiteSchedule).ThenInclude(t => t.SiteOrganization)
                                           .Include(t => t.DutyCheckSiteSchedule).ThenInclude(t => t.CheckMan)
                                           .Include(t => t.DutyCheckStaff)
                                           .Include(t => t.Organization)
                                           .Include(t => t.RecordType)
                                           .Include(t => t.Status)
                                           .Include(t => t.CircularTypes).ThenInclude(t => t.Dispose)
                                           .Include(t => t.MainApprise)
                                           .FirstOrDefault(p => p.DutyCheckLogId.Equals(noLogs.ToList()[0].DutyCheckLogId));
                        //
                        CameraView cameraView = GetCameraView(log.DutyCheckSiteSchedule.SiteOrganizationId, db, log);
                        //绑定查勤视频点与查勤记录的关系
                        if (cameraView != null)
                        {
                            log.DutycheckSiteId   = cameraView.CameraId;
                            log.DutycheckSiteName = log.DutyCheckSiteSchedule.SiteOrganization.OrganizationShortName + "-" + cameraView.CameraName;
                            SystemOption so = db.SystemOption.FirstOrDefault(p => p.SystemOptionCode.Equals("16000002"));
                            log.StatusId = so.SystemOptionId;
                            log.Status   = null;
                            db.DutyCheckLog.Update(log);
                            db.SaveChanges();
                        }
                        //
                        DutyCheckPointView View = new DutyCheckPointView
                        {
                            DutyCheckLog = log,
                            CameraView   = cameraView
                        };

                        return(new ObjectResult(View));
                    }
                    //当前时段已完成,更新查勤包的状态
                    else
                    {
                        package.PackageStatusId = new Guid("24AC9875-C463-47B6-8147-5845874C3CAF");
                        db.DutyCheckPackage.Update(package);
                        //
                        return(NoContent());
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("根据组织机构ID获取下一个查勤数据:Message:{0}\r\n,StackTrace:{1}", ex.Message, ex.StackTrace);
                return(BadRequest(new ApplicationException {
                    ErrorCode = "Unknown", ErrorMessage = ex.Message
                }));
            }
        }
        public GroupSelectionMenu(SystemOption userChoice)
        {
            InitializeComponent();

            fileModifierOption = userChoice;
        }
Exemple #15
0
        public static void Main(string[] args)

        {
            Out    @out      = new Out();
            string optionStr = "";
            Option inOption  = new Option(optionStr);


            if (args.Length > 0)

            {
                optionStr = "";
                for (int i = 0; i < args.Length; i++)

                {
                    if (i == 0)

                    {
                        optionStr = args[i];
                    }
                    else

                    {
                        optionStr = optionStr + " " + args[i];
                    }
                }

                inOption = new Option(optionStr);
            }

            LexCheck          lexCheck    = new LexCheck();
            List <OptionItem> optionItems = inOption.GetOptionItems();

            if (SystemOption.CheckSyntax(inOption, lexCheck.GetOption(), false, true) == true)

            {
                lexCheck.ExecuteCommands(inOption, lexCheck.GetOption(), @out);

                if ((runFlag_ == true) && (inReader_ == null))

                {
                    try

                    {
                        helpMenu(@out);
                    }
                    catch (Exception)
                    {
                    }
                }
                else if (runFlag_ == true)

                {
                    bool useClassPath = false;
                    if (string.ReferenceEquals(configFile_, null))

                    {
                        useClassPath = true;
                        configFile_  = "data.config.lexCheck";
                    }

                    if (conf_ == null)

                    {
                        conf_ = new Configuration(configFile_, useClassPath);
                    }

                    RunProgram(@out);
                }
            }
            else

            {
                helpMenu(@out);
            }

            try

            {
                Close();
            }
            catch (Exception)
            {
            }
        }