예제 #1
0
        public static List <SystemSetting> GetSystemSettings()
        {
            List <SystemSetting> SystemSettings = new List <SystemSetting>();

            using (SQLiteHelper SQLite = new SQLiteHelper())
            {
                DataTable tblSystemSettings = SQLite.Select("SELECT * FROM SystemSetting");
                if (tblSystemSettings.Rows.Count > 0)
                {
                    foreach (DataRow row in tblSystemSettings.Rows)
                    {
                        SystemSetting SystemSetting = new SystemSetting();
                        int           Id            = 0;
                        int.TryParse(row["Id"].ToString(), out Id);
                        SystemSetting.Id             = Id;
                        SystemSetting.AttributeKey   = row["AttributeKey"].ToString();
                        SystemSetting.AttributeLabel = row["AttributeLabel"].ToString();
                        SystemSetting.AttributeType  = row["AttributeType"].ToString();
                        SystemSetting.AttributeValue = row["AttributeValue"].ToString();

                        SystemSettings.Add(SystemSetting);
                    }
                }
            }

            return(SystemSettings);
        }
 public static void CreateSystemSettingXml()
 {
     systemSetting = new SystemSetting();
     systemSetting.VersionSetting = new VersionSetting();
     systemSetting.VersionSetting.VersionNumber = SystemSettingHelper.instance.versionNum;
     SaveSystemSetting();
 }
    // Update is called once per frame
    //void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.P))
    //    {
    //        Screen.fullScreen = !Screen.fullScreen;
    //    }
    //}

    /// <summary>
    /// 获取系统设置
    /// </summary>
    public static void GetSystemSetting()
    {
        string path = Application.dataPath + ConfigPath;

        if (!File.Exists(path))
        {
            CreateSystemSettingXml();
        }
        else
        {
            systemSetting = SerializeHelper.DeserializeFromFile <SystemSetting>(path);
        }
        Log.Error("SystemSettingHelper.GetSystemSetting" + systemSetting.IsShowLeftTopo);
        resolutionSetting    = systemSetting.ResolutionSetting;
        cinemachineSetting   = systemSetting.CinemachineSetting;
        communicationSetting = systemSetting.CommunicationSetting;
        versionSetting       = systemSetting.VersionSetting;
        refreshSetting       = systemSetting.RefreshSetting;
        assetLoadSetting     = systemSetting.AssetLoadSetting;
        honeyWellSetting     = systemSetting.HoneyWellSetting;
        deviceSetting        = systemSetting.DeviceSetting;
        historyPathSetting   = systemSetting.HistoryPathSetting;
        alarmSetting         = systemSetting.AlarmSetting;
        ///如果版本号不一致,自动更新
        if (versionSetting.VersionNumber != SystemSettingHelper.instance.versionNum)
        {
            versionSetting.VersionNumber = SystemSettingHelper.instance.versionNum;
            SaveSystemSetting();
        }

        locationSetting = systemSetting.LocationSetting;

        debugSetting = systemSetting.DebugSetting;
    }
예제 #4
0
 public UserController(IWebHostEnvironment env, IOptions <SystemSetting> attachsetting, IOptions <SystemSetting> setting)
 {
     attach         = Core.Config.GetSystemConfig().AttachConfigEntity;
     _env           = env;
     _attachsetting = attachsetting.Value;
     _appSettings   = setting.Value;
 }
예제 #5
0
        public void SaveSettings <T>(List <T> models)
            where T : SettingsBase, new()
        {
            var key = new T().Name;

            if (models.Count == 0)
            {
                models = new List <T>();
            }
            SystemSetting settings = this.Single <SystemSetting>(t => t.Name == key);

            if (settings == null)
            {
                settings = new SystemSetting {
                    Id = Guid.NewGuid().ToString("N"), Name = key, Value = models.GetJson(), CreateTime = DateTime.Now
                };
                this.Add(settings);
            }
            else
            {
                settings.Value      = models.GetJson();
                settings.UpdateTime = DateTime.Now;
                this.Update(settings);
            }
            base.Save();
        }
예제 #6
0
        protected override void OnLoaded()
        {
            base.OnLoaded();
            SystemSetting setting = Session.FindObject <SystemSetting>(null);

            DueDateMessage = string.Format("Due date can not be exceed {0} days from today!", setting.DocumentLeaseMaxDays);
        }
예제 #7
0
        /// <summary>
        /// Shows the error message.
        /// </summary>
        /// <param name="ex">The ex.</param>
        void ShowErrorMessage(ref Exception ex)
        {
            this.isError = true;
            if (this.Debug)
            {
                lblError.Text = ex.Message + ex.StackTrace + ex.Source;
            }
            else
            {
                SystemSetting.LogError(ex);
                //lblError.Text = "An error has occured within IQCARE during processing. Please contact the support team.  " + ex.Message;
                //this.isError = this.divError.Visible = true;
                //Exception lastError = ex;
                //lastError.Data.Add("Domain", "Service Management");
                //try
                //{
                //    Application.Logger.EventLogger logger = new Application.Logger.EventLogger();
                //    logger.LogError(ex);
                //}
                //catch
                //{

                //}
            }
        }
        public async Task <ActionResult> Create(
            [Bind(Include = "ChargeScheduleId")] SystemSettingsViewModel systemSettingModel)
        {
            ChargeSchedule chargeSchedule = await db.ChargeSchedules.FindAsync(systemSettingModel.ChargeScheduleId);

            if (chargeSchedule != null)
            {
                try
                {
                    var systemSetting = new SystemSetting
                    {
                        SystemSettingId  = IdentityGenerator.NewSequentialGuid(),
                        DateCreated      = DateTime.Now,
                        CreatedBy        = User.Identity.Name,
                        SetBy            = User.Identity.Name,
                        ChargeScheduleId = chargeSchedule.ChargeScheduleId
                    };
                    db.SystemSettings.Add(systemSetting);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index", "SystemSettings"));
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("*", ex);
                    return(View(systemSettingModel));
                }
            }
            ModelState.AddModelError("*", "Error");
            return(View(systemSettingModel));
        }
예제 #9
0
        /// <summary>
        /// 发送考勤异常提醒邮件
        /// </summary>
        /// <param name="date"></param>
        /// <param name="shiftCodes"></param>
        public void SendWarnEmail(DateTime date, List <string> shiftCodes = null)
        {
            DataContext dc = new DataContext(this.DbString);

            AttendanceRecordCalExceptionView record = dc.Context.GetTable <AttendanceRecordCalExceptionView>().
                                                      FirstOrDefault(s => s.attendanceDate.Equals(date) && s.isExceptionHandled == false);

            if (record != null && record.isExceptionHandledCount > 0)
            {
                SystemSetting setting = dc.Context.GetTable <SystemSetting>().FirstOrDefault();

                if (setting == null)
                {
                    throw new SystemSettingNotSetException();
                }
                Dictionary <string, string> values = new Dictionary <string, string>();
                values.Add("date", date.ToString("yyyy-MM-dd"));
                values.Add("count", record.isExceptionHandledCount.Value.ToString());
                values.Add("host", setting.systemHost);
                values.Add("shiftDesc", (shiftCodes == null || shiftCodes.Count == 0) ? "" : string.Join(",", shiftCodes.ToArray()) + " 班");
                string body = EmailHelper.Build("AttendanceWarn.html", values);

                EmailHelper.SendEmail(setting.emaiSMTPHost,
                                      setting.emailUser,
                                      setting.emailAddress,
                                      setting.emailPwd,
                                      setting.attendanceExceptionAlertMails,
                                      "考勤异常提醒",
                                      body, true);
            }
        }
예제 #10
0
        public Result SaveSystemSetting(SystemSetting setting)
        {
            Result Res = new Result();

            Res = bll.SaveSystemSetting(setting);
            return(Res);
        }
예제 #11
0
        public ActionResult Index()
        {
            ISystemSettingService ss      = new SystemSettingService(Settings.Default.db);
            SystemSetting         setting = ss.Find();

            return(View(setting));
        }
예제 #12
0
        public static string GetValue(string Name, string Default = "")
        {
            string result = MemoryCache.Default.Get(key + Name) as string;

            if (result.IsNotNullOrEmpty())
            {
                return(result);
            }

            BuildingEntities db = new BuildingEntities();
            SystemSetting    ss = db.SystemSettings.FirstOrDefault(val => val.Name == Name);

            if (ss == null)
            {
                ss       = new SystemSetting();
                ss.Name  = Name;
                ss.Value = Default;
                ss.Date  = DateTime.Now;
                ss.Title = Name;
                db.SystemSettings.AddObject(ss);
                db.SaveChanges();
            }

            db.Dispose();
            Default = ss.Value;

            MemoryCache.Default.Add(key + Name, Default, new CacheItemPolicy()
            {
                AbsoluteExpiration = DateTime.Now.AddMinutes(duration)
            });

            return(Default);
        }
예제 #13
0
        public IActionResult Sys()
        {
            Dictionary <int, ExamOpenSetting> examOpenSettings = _config.LoadModuleExamOpenSetting();
            List <Module> modules = _context.Modules.ToList();

            foreach (var item in modules)
            {
                if (!examOpenSettings.TryGetValue(item.ModuleId, out var moduleExamOpenSetting))
                {
                    examOpenSettings.Add(item.ModuleId, new ExamOpenSetting
                    {
                        IsOpen     = false,
                        ModuleId   = item.ModuleId,
                        ModuleName = item.Name
                    });
                }
            }

            _config.ReWriteModuleExamOpenSetting(examOpenSettings);

            SystemSetting setting = _config.LoadSystemSetting();

            setting.Staffs = setting.Staffs.OrderBy(s => s.Name).ToList(); //按照名称排序

            ViewData["ModuleSetting"] = examOpenSettings;
            return(View(setting));
        }
예제 #14
0
        //加载窗体
        private void Login_Load(object sender, EventArgs e)
        {
            try
            {
                if (File.Exists(mPath))
                {
                    mXmlDoc.Load(mPath);
                    Thread rThr = new Thread(new ThreadStart(LoadRecordTrace));
                    rThr.Start();
                }
                else
                {
                    tb_serveradd.Text = "demo.anychat.cn";
                    tb_port.Text      = "8906";
                }

                //初始化log日志文件
                if (File.Exists(Log.logPath))
                {
                    File.Delete(Log.logPath);
                }

                //初始化AnyChat
                SystemSetting.Init(this.Handle);
            }
            catch (Exception ex)
            {
                Log.SetLog("VideoChat.Login.Login_Load       Login_Load:" + ex.Message.ToString());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                return;
            }
            SystemSetting systemSetting = systemSettingServiceInstance.GetCurrentSystemSetting();

            this.MenuStyle            = 0;
            this.lblLoginMessage.Text = "<b>" + systemSetting.SystemName + "</b><font size='2' color='#999999' face='Verdana, Arial, Helvetica, sans-serif'>版本" + systemSetting.SystemVersion + "<br /></font>";
            if (this.CurrentLoginUser != null)
            {
                this.lblLoginMessage.Text += "当前登录用户:" + this.CurrentLoginUser.UserName;
                if (this.CurrentLoginUser.DepartmentID != null)
                {
                    this.lblLoginMessage.Text += ",所属部门:" + this.CurrentLoginUser.DepartmentID.DepartmentNameCn + "。";
                }
                List <SystemRole> roles =
                    systemUserServiceInstance.GetUserAssignedRoleByUserLoginID(this.CurrentLoginUser.UserLoginID);
                if (roles.Count > 0)
                {
                    this.lblLoginMessage.ToolTip = "当前用户分配角色:";
                    foreach (SystemRole role in roles)
                    {
                        this.lblLoginMessage.ToolTip += role.RoleName + ",";
                    }
                }
            }

            this.lblLisence.Text = systemSetting.SystemLisence;
        }
예제 #16
0
    public static void SetScriptableData(Type _type)
    {
        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;
        string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset";

        assets = Resources.LoadAll(assetName);

        MasterLoadSprite tmp     = new MasterLoadSprite();
        ScriptableObject sObject = null;

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is MasterLoadSprite)
            {
                tmp     = (MasterLoadSprite)asset;
                sObject = (ScriptableObject)asset;
            }
        }
        List <MasterLoadSprite.Data> listData = MasterLoadSpriteCSVLoader.GetListDataFromCSV(_type);

        tmp.DataList = listData;

        //最後に保存して変更を確定
        EditorUtility.SetDirty(sObject);
    }
예제 #17
0
    public static void SetScriptableData(Type _type)
    {
        //	string filePath = SystemSetting.GetAssetBundleListPath ()+"CSV.csv";

        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;
        string assetName = SystemSetting.GetAssetBundleDataFolder() + "AssetBundleDataAsset";

        assets = Resources.LoadAll(assetName);

        AssetBundleData  tmp     = new AssetBundleData();
        ScriptableObject sObject = null;

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is AssetBundleData)
            {
                tmp     = (AssetBundleData)asset;
                sObject = (ScriptableObject)asset;
            }
        }
        List <AssetBundleData.Param> listData = GetListDataFromCSV(_type);

        tmp.list = listData;

        //最後に保存して変更を確定
        EditorUtility.SetDirty(sObject);
    }
예제 #18
0
        private ExicoShopifyDbContext _InitDbContext()
        {
            var options = new DbContextOptionsBuilder <ExicoShopifyDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            ExicoShopifyDbContext testContext = new ExicoShopifyDbContext(options);

            //emptying
            testContext.Database.EnsureDeleted();
            ////recreating
            testContext.Database.EnsureCreated();
            //seeding


            var s = new SystemSetting()
            {
                DefaultValue = "APP_DASHBOARD_CONTOLLER",
                Description  = "APP_DASHBOARD_CONTOLLER",
                DisplayName  = "APP_DASHBOARD_CONTOLLER",
                GroupName    = DbSettingsReaderExtensions.CORE_SETTINGS_GROUP_NAME,
                SettingName  = CORE_SYSTEM_SETTING_NAMES.DASHBOARD_CONTOLLER.ToString(),
                Value        = "DashBoard"
            };

            testContext.SystemSettings.Add(s);

            testContext.SaveChanges();
            return(testContext);
        }
        public async Task <ActionResult> Edit(
            [Bind(Include = "SystemSettingId,ChargeScheduleId")] SystemSettingsViewModel systemSettingViewModel)
        {
            ChargeSchedule chargeSchedule = await db.ChargeSchedules.FindAsync(systemSettingViewModel.ChargeScheduleId);

            if (chargeSchedule != null)
            {
                SystemSetting systemSetting = await db.SystemSettings.FindAsync(systemSettingViewModel.SystemSettingId);

                if (systemSetting != null)
                {
                    try
                    {
                        db.Entry(systemSetting).State = EntityState.Modified;
                        await db.SaveChangesAsync();

                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        ModelState.AddModelError("*", ex);
                        return(View(systemSettingViewModel));
                    }
                }
                return(HttpNotFound("Could Not Find Entity with that ID"));
            }
            return(HttpNotFound("Could Not Find Entity with that ID"));
        }
예제 #20
0
        public IHttpActionResult SystemSettingSubmit(SystemSetting model)
        {
            try
            {
                //if (model != null)
                //{
                //    var exisData = _systemSettingervice.GetSystemSettings(x => x.ICustomer == model.ICustomer).FirstOrDefault();

                //    if (exisData != null)
                //    {
                //        exisData.LocalCode = model.LocalCode;
                //        exisData.AnswerTime = model.AnswerTime;
                //        exisData.MaxCallDuration = model.MaxCallDuration;
                //        _systemSettingervice.UpdateSystemSetting(exisData);
                //    }
                //    else
                //    {
                //        _systemSettingervice.InsertSystemSetting(model);
                //    }

                //}


                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)));
            }
        }
예제 #21
0
        /// <summary>
        /// 根据员工号和日期获取员工的详细打卡记录视图
        /// 重点是,根据日期来判断排班,然后通过排班来查找所有的记录
        /// 如果排班时间开始都是在当前日期的排班,但是计算时要用下面废弃的!
        /// **如果排班的结束时间的HH:mm小于日期的HH:mm,并且结束时间的天等于(或加1等于)日期的天
        /// schedule视图里的fullEnd时间已经是根据排班类型计算过的了 -废弃,Charlot 2016.09.02**
        /// </summary>
        /// <param name="nr"></param>
        /// <param name="datetime"></param>
        /// <returns></returns>
        public List <AttendanceRecordDetailView> GetDetailsViewByStaffAndDate(string nr, DateTime datetime)
        {
            DataContext dc = new DataContext(this.DbString);
            List <AttendanceRecordDetailView> records = new List <AttendanceRecordDetailView>();

            /// 获取所有排班
            List <ShiftScheduleView> shifts = dc.Context.GetTable <ShiftScheduleView>().Where(s => s.staffNr.Equals(nr) && s.fullStartAt.Value.Date.Equals(datetime.Date) && s.fullEndAt.Value < datetime).ToList();
            /// 系统配置
            SystemSetting setting = dc.Context.GetTable <SystemSetting>().FirstOrDefault();

            if (setting == null)
            {
                throw new SystemSettingNotSetException();
            }

            foreach (ShiftScheduleView s in shifts)
            {
                DateTime sq = s.fullStartAt.Value.AddMinutes(0 - setting.validAttendanceRecordTime.Value);
                DateTime eq = s.fullEndAt.Value.AddMinutes(setting.validAttendanceRecordTime.Value);

                List <AttendanceRecordDetailView> shiftAttendRecords = dc.Context.GetTable <AttendanceRecordDetailView>().Where(ss => ss.recordAt >= sq && ss.recordAt <= eq && ss.staffNr.Equals(nr)).OrderBy(ss => ss.recordAt).ToList();//new List<AttendanceRecordDetailView>();

                records.AddRange(shiftAttendRecords);
            }

            records = records.Distinct().ToList();

            return(records);
        }
 public JsonActionResult <bool> Update(SystemSetting setting)
 {
     return(SafeExecute(() =>
     {
         return SysSettingService.UpdateSetting(setting.ID, setting.SettingValue);
     }));
 }
예제 #23
0
파일: Form2.cs 프로젝트: toannd18/PBXForm
        private async void Form2_Load(object sender, EventArgs e)
        {
            systemSetting = new SystemSetting();
            await systemSetting.Load_Account();

            await systemSetting.Load_Devices();

            Account acc       = systemSetting._account;
            int     idMicro   = systemSetting._microInfos.FindIndex(m => m.DeviceID == acc.DeviceMicro);
            int     idSpeaker = systemSetting._speakerInfos.FindIndex(m => m.DeviceID == acc.DeviceSpeaker);

            cbMicroPhone.DataSource    = systemSetting._microInfos;
            cbMicroPhone.DisplayMember = "ProductName";

            cbMicroPhone.SelectedIndex = idMicro > 0 ? idMicro : 0;

            cbSpeaker.DataSource    = systemSetting._speakerInfos;
            cbSpeaker.DisplayMember = "ProductName";

            cbSpeaker.SelectedIndex = idSpeaker > 0 ? idSpeaker : 0;
            txtDName.Text           = acc.DisplayName;
            txtDomain.Text          = acc.DomainServerHost;
            txtDPort.Text           = acc.DomainServerPort;
            txtPwork.Text           = acc.RegisterPassword;
            txtUName.Text           = acc.UserName;
        }
예제 #24
0
 /// <summary>
 /// Shows the error message.
 /// </summary>
 /// <param name="ex">The ex.</param>
 private void showErrorMessage(ref Exception ex)
 {
     this.isError = true;
     if (this.Debug)
     {
         lblError.Text = ex.Message + ex.StackTrace + ex.Source;
     }
     else
     {
         //lblError.Text = "An error has occured within IQCARE during processing. Please contact the support team.  ";
         //this.isError = this.divError.Visible = true;
         //Exception lastError = ex;
         //lastError.Data.Add("Domain", "Wards Admission Home");
         //try
         //{
         //    Application.Logger.EventLogger logger = new Application.Logger.EventLogger();
         //    logger.LogError(ex);
         //}
         //catch
         //{
         SystemSetting.LogError(ex);
         //}
     }
     notifyPopupExtender.Hide();
     this.ctrlAdmit.EnableModelDialog(false);
 }
예제 #25
0
        /// Shows the error message.
        /// </summary>
        /// <param name="ex">The ex.</param>
        private void showErrorMessage(ref Exception ex)
        {
            this.isError = true;
            if (this.Debug)
            {
                lblError.Text = ex.Message + ex.StackTrace + ex.Source;
            }
            else
            {
                lblError.Text = "An error has occured within IQCARE during processing. Please contact the support team.  ";
                this.isError  = this.divError.Visible = true;
                Exception lastError = ex;
                lastError.Data.Add("Domain", "Item Master");
                SystemSetting.LogError(lastError);
                //try
                //{
                //    Application.Logger.EventLogger logger = new Application.Logger.EventLogger();
                //    logger.LogError(ex);
                //}
                //catch
                //{

                //}
            }
            mpeBillableDetails.Hide();
            mpeItemPopup.Hide();
            mpeSubTypePopup.Hide();
        }
예제 #26
0
        public override async Task <StartSetupReply> StartSetup(Empty request, ServerCallContext context)
        {
            bool isInstalled = await IsAlreadyInstalled();

            string?existingAuthKey = await GetSetupAuthKey();

            if (isInstalled || existingAuthKey != null)
            {
                return(new StartSetupReply
                {
                    Success = false,
                });
            }

            string        newAuthKey     = _secureRandom.GetRandomString(16);
            SystemSetting authKeySetting = new SystemSetting
            {
                Name  = AUTH_KEY,
                Value = newAuthKey,
            };

            _authDbContext.Add(authKeySetting);
            await _authDbContext.SaveChangesAsync();

            return(new StartSetupReply
            {
                Success = true,
                AuthToken = newAuthKey,
            });
        }
예제 #27
0
        public int UpdateSystemSetting(SystemSetting data)
        {
            var needRestartHistory = false;

            if (data.ChangedProperties.Any(m => m.Key == "HistoryPath"))
            {
                //历史保存路径修改了
                needRestartHistory = true;

                //这里确保能创建数据库
                if (!string.IsNullOrEmpty(data.HistoryPath))
                {
                    var HistoryDataPath = $"data source=\"{data.HistoryPath.Replace("\\", "/")}/history_data.db\"";
                    using (var hisDB = new DB.SunRiz(HistoryDataPath, Way.EntityDB.DatabaseType.Sqlite))
                    {
                    }
                }
            }

            if (data.ChangedProperties.Any(m => m.Key == "LogPath"))
            {
                SystemLog.Init();
            }
            SystemHelper.AddSysLog(this.User.id.Value, "更新系统设置:" + Newtonsoft.Json.JsonConvert.SerializeObject(data.ChangedProperties));

            this.db.Update(data);
            if (needRestartHistory)
            {
                HistoryRecord.HistoryAutoRec.ReStart();
            }
            return(data.id.Value);
        }
예제 #28
0
        //加载窗体
        private void Login_Load(object sender, EventArgs e)
        {
            try
            {
                cmbBox_Router.SelectedIndex = 1;
                if (File.Exists(mPath))
                {
                    mXmlDoc.Load(mPath);
                    Thread rThr = new Thread(new ThreadStart(LoadRecordTrace));
                    rThr.Start();
                }
                else
                {
                    cbox_serverIP.Text = "demo.anychat.cn";
                    cbox_port.Text     = "8906";

                    cbox_userIdentity.SelectedIndex     = 0;
                    cbox_identityPriority.SelectedIndex = 5;
                }

                //初始化log日志文件
                if (File.Exists(Log.logPath))
                {
                    File.Delete(Log.logPath);
                }

                //初始化AnyChat
                SystemSetting.Init(this.Handle);
            }
            catch (Exception ex)
            {
                Log.SetLog("QueueClient.Login.Login_Load       Login_Load:" + ex.Message.ToString());
            }
        }
예제 #29
0
 private void LoadModbusSetting()
 {
     _systemSetting                         = OrderSortService.GetSystemSettingCache();
     txtPortName.Text                       = _systemSetting.ModbusSetting.PortName;
     txtBaudRate.Text                       = _systemSetting.ModbusSetting.BaudRate.ToString();
     cbParity.SelectedValue                 = _systemSetting.ModbusSetting.Parity;
     txtDataBits.Text                       = _systemSetting.ModbusSetting.DataBits.ToString();
     cbStopBits.SelectedValue               = _systemSetting.ModbusSetting.StopBits;
     txtLEDStartAddress.Text                = _systemSetting.ModbusSetting.LEDStartAddress.ToString();
     txtGratingStartAddress.Text            = _systemSetting.ModbusSetting.GratingStartAddress.ToString();
     txtButtonStartAddress.Text             = _systemSetting.ModbusSetting.ButtonStartAddress.ToString();
     txtResetGratingStartAddress.Text       = _systemSetting.ModbusSetting.ResetGratingStartAddress.ToString();
     txtWarningRedLightStartAddress.Text    = _systemSetting.ModbusSetting.WarningRedLightStartAddress.ToString();
     txtWarningGreenLightStartAddress.Text  = _systemSetting.ModbusSetting.WarningGreenLightStartAddress.ToString();
     txtWarningYellowLightStartAddress.Text = _systemSetting.ModbusSetting.WarningYellowLightStartAddress.ToString();
     txtWarningBuzzerStartAddress.Text      = _systemSetting.ModbusSetting.WarningBuzzerStartAddress.ToString();
     txtNumberOfPoints.Text                 = _systemSetting.ModbusSetting.NumberOfPoints.ToString();
     cbSortingPatten.SelectedValue          = _systemSetting.SortingPatten;
     cbSortingSolution.SelectedValue        = _systemSetting.SortingSolution;
     cbCabinetNumber.Text                   = _systemSetting.CabinetNumber.ToString();
     cbWarningCabinetId.Text                = _systemSetting.WarningCabinetId.ToString();
     txtCriticalWeight.Text                 = _systemSetting.CriticalWeight.ToString("0.000");
     txtBoxWeight.Text                      = _systemSetting.BoxWeight.ToString("0.000");
     cbLogStorageDays.SelectedValue         = _systemSetting.LogStorageDays;
     cbIsInterfaceType.SelectedValue        = (int)_systemSetting.InterfaceType;
     txtCabinetId1_SlaveAddress.Text        = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 1).SlaveAddress.ToString();
     txtCabinetId2_SlaveAddress.Text        = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 2).SlaveAddress.ToString();
     txtCabinetId3_SlaveAddress.Text        = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 3).SlaveAddress.ToString();
     txtCabinetId4_SlaveAddress.Text        = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 4).SlaveAddress.ToString();
     cmbPrintFormat.SelectedValue           = _systemSetting.PrintFormat;
 }
예제 #30
0
    private static List <MasterLoadAudio.Data> ReadExcel(Type _type)
    {
        string loadPath = SystemSetting.GetExcelSeetPath() + _type.Name + "Sheet.xls";
        List <MasterLoadAudio.Data> dataList = new List <MasterLoadAudio.Data> ();

        using (FileStream stream = File.Open(loadPath, FileMode.Open, FileAccess.Read)) {
            IWorkbook book  = new HSSFWorkbook(stream);
            ISheet    sheet = book.GetSheet("MainSeet");

            for (int i = 1; i < sheet.LastRowNum; i++)
            {
                IRow row     = sheet.GetRow(i);
                int  iColumn = 0;

                MasterLoadAudio.Data tmpData = new MasterLoadAudio.Data();

                //DataSwitch :
                tmpData.filename   = row.GetCell(iColumn++).StringCellValue;
                tmpData.version    = (int)row.GetCell(iColumn++).NumericCellValue;
                tmpData.path       = row.GetCell(iColumn++).StringCellValue;
                tmpData.audio_type = (int)row.GetCell(iColumn++).NumericCellValue;
                tmpData.del_flg    = (int)row.GetCell(iColumn++).NumericCellValue;

                iColumn++;

                dataList.Add(tmpData);
            }
        }

        MasterLoadAudioCSVLoader.UpdateCSVFile(dataList);

        return(dataList);
    }
 public virtual SystemSetting GetCurrentSystemSetting()
 {
     List<SystemSetting> listSystemSetting = this.SelfDao.FindAll();
     if (listSystemSetting.Count <= 0)
     {
         SystemSetting systemSetting = new SystemSetting();
         systemSetting.SystemName = "基础管理平台";
         systemSetting.SystemUrl = "#";
         systemSetting.SystemDescription = "";
         systemSetting.SystemVersion = "1.0.0";
         systemSetting.SystemLisence =
             "Powered By <a href='#' target='_blank'><font color='#ffffff'>Supesoft.com</font></a> Information Technology Logistics Inc.";
         this.Create(systemSetting);
         return systemSetting;
     }
     else if (listSystemSetting.Count == 1)
     {
         return listSystemSetting[0];
     }
     else if (listSystemSetting.Count > 1)
     {
         for (int i = 0; i < listSystemSetting.Count - 1; i++)
         {
             this.Delete(listSystemSetting[i + 1]);
         }
         return listSystemSetting[0];
     }
     else
     {
         SystemSetting systemSetting = new SystemSetting();
         systemSetting.SystemName = "基础管理平台";
         systemSetting.SystemUrl = "#";
         systemSetting.SystemDescription = "";
         systemSetting.SystemVersion = "1.0.0";
         systemSetting.SystemLisence =
             "Powered By <a href='#' target='_blank'><font color='#ffffff'>Supesoft.com</font></a> Information Technology Logistics Inc.";
         this.Create(systemSetting);
         return systemSetting;
     }
 }
 public void AddToSystemSettings(SystemSetting systemSetting)
 {
     base.AddObject("SystemSettings", systemSetting);
 }
 public static SystemSetting CreateSystemSetting(string name)
 {
     SystemSetting systemSetting = new SystemSetting();
     systemSetting.name = name;
     return systemSetting;
 }
 /// <summary>
 /// Instead of specifying individual longhand properties, a
 /// keyword can be used to represent a specific system font.
 /// </summary>
 /// <param name="setting">The setting to apply.</param>
 void SetTo(SystemSetting setting)
 {
     //TODO set properties to the setting given by the enumeration value
 }