public async Task <IActionResult> Index([Bind("SysConfigId,AppName,AppFolder,DeveloperName,DeveloperEmail,BusinessOwnerName,BusinessOwnerEmail,AppFromName,AppFromEmail,SmtpServer,SmtpPort,UserAdministratorName,UserAdministratorEmail,Rebuild,IsDebug")] SysConfig sysConfig)
        {
            if (sysConfig.SysConfigId != 1)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _sysConfigService.UpdateSysConfig(sysConfig);
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
                return(RedirectToAction(nameof(Index), "Admin"));
            }

            var pageView = new SysConfigViewModel();

            pageView.SysConfig = sysConfig;
            pageView.Title     = "Edit System Configuration";
            return(View(pageView));
        }
        private void InitConfigs()
        {
            var autoCleanConfig = _sysConfigRepository.Query(new Hashtable()).FirstOrDefault(x => x.Name == ConstStrings.AutoCleanConfig);

            var configs            = autoCleanConfig.Value.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            var sysLogExpireMonths = configs.First(x => x.StartsWith(ConstStrings.SysLogExpireMonths))
                                     .Substring(ConstStrings.SysLogExpireMonths.Length + 1).ToInt32();

            var deviceTrafficLogExpiredMonths = configs.First(x => x.StartsWith(ConstStrings.DeviceTrafficLogExpiredMonths))
                                                .Substring(ConstStrings.DeviceTrafficLogExpiredMonths.Length + 1).ToInt32();

            var deviceMngtLogExpiredMonths = configs.First(x => x.StartsWith(ConstStrings.DeviceMngtLogExpiredMonths))
                                             .Substring(ConstStrings.DeviceMngtLogExpiredMonths.Length + 1).ToInt32();

            var doorHistoryExpiredMonths = configs.First(x => x.StartsWith(ConstStrings.DoorHistoryExpiredMonths))
                                           .Substring(ConstStrings.DoorHistoryExpiredMonths.Length + 1).ToInt32();

            SysLogExpiredMonthsConfigViewModel = new SysConfigViewModel {
                Value = sysLogExpireMonths.ToString(), IsSelected = sysLogExpireMonths != 0
            };
            DeviceTrafficLogExpiredMonthsConfigViewModel = new SysConfigViewModel {
                Value = deviceTrafficLogExpiredMonths.ToString(), IsSelected = deviceTrafficLogExpiredMonths != 0
            };
            DeviceMngtLogExpiredMonthsConfigViewModel = new SysConfigViewModel {
                Value = deviceMngtLogExpiredMonths.ToString(), IsSelected = deviceMngtLogExpiredMonths != 0
            };
            DoorHistoryExpiredMonthsConfigViewModel = new SysConfigViewModel {
                Value = doorHistoryExpiredMonths.ToString(), IsSelected = doorHistoryExpiredMonths != 0
            };
        }
示例#3
0
        public async Task <SysConfigViewModel> GetIndexViewAsync()
        {
            var sysConfig = await _unitOfWork.SysConfigRepository.GetSysConfigAsync();

            var pageView = new SysConfigViewModel();

            pageView.SysConfig = sysConfig;
            pageView.Title     = "Edit System Configuration";
            return(pageView);
        }
        // GET: SysConfigs

        // GET: SysConfigs/Edit/5
        public async Task <IActionResult> Index()
        {
            var sysConfig = await _unitOfWork.SysConfigs.GetSysConfig();

            if (sysConfig == null)
            {
                return(NotFound());
            }

            var pageView = new SysConfigViewModel();

            pageView.SysConfig = sysConfig;
            pageView.Title     = "Edit System Configuration";
            return(View(pageView));
        }
示例#5
0
        public ActionResult SysConfigUpdate(LeXPro.Models.SysConfig CurrentSysConfig)
        {
            SysConfigViewModel model = new SysConfigViewModel();

            Result res = TerminalContext.SysConfigUpdate(CurrentSysConfig);

            if (res.Succeed)
            {
                model = (SysConfigViewModel)res.Data;
                model.SetCurrent(CurrentSysConfig.config_key);
                model.DisplayMode = "EditOnly";
                ViewBag.Result    = "Successfully updated";
            }
            else
            {
                ViewBag.Result = res.Desc;
            }
            return(View("SysConfigIndex", model));
        }
示例#6
0
        public ActionResult SysConfigEdit(string id)
        {
            if (Session["Message"] != null)
            {
                ViewBag.Result     = Session["Message"];
                Session["Message"] = null;
            }
            SysConfigViewModel model = new SysConfigViewModel();
            Result             res   = TerminalContext.SysConfigList();

            if (!res.Succeed)
            {
                ViewBag.Result = res.Desc;
            }
            else
            {
                model = (SysConfigViewModel)res.Data;
                model.SetCurrent(id);
                model.DisplayMode = "EditOnly";
            }
            return(View("SysConfigIndex", model));
        }