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
            };
        }
示例#2
0
        private int GetDefaultDepartment()
        {
            var dataSyncDefaultDepartmentConfig = _sysConfigRepo.Query(new Hashtable {
                { ConstStrings.Name, ConstStrings.DataSyncDefaultDepartment }
            }).FirstOrDefault();

            if (dataSyncDefaultDepartmentConfig != null && !string.IsNullOrWhiteSpace(dataSyncDefaultDepartmentConfig.Value))
            {
                return(dataSyncDefaultDepartmentConfig.Value.ToInt32());
            }

            return(0);
        }
示例#3
0
        private List <SysConfigViewModel> InitDataSyncJobTimeConfigs()
        {
            var configViewModels = new List <SysConfigViewModel>();

            for (int index = 0; index < 10; index++)
            {
                configViewModels.Add(new SysConfigViewModel()
                {
                    Value = "00:00:00"
                });
            }

            var config = _sysConfigRepository.Query(new Hashtable()).FirstOrDefault(x => x.Name == ConstStrings.DataSyncConfig);

            if (config != null)
            {
                var configs = config.Value.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                for (int index = 0; index < configs.Count(); index++)
                {
                    configViewModels[index].Value      = configs[index];
                    configViewModels[index].IsSelected = true;
                }
            }

            return(configViewModels);
        }