private void BindData()
        {
            try
            {
                List <SystemConfigEntity> systemConfigList = systemConfigBll.GetSystemConfigList();
                if (systemConfigList.Count == 0)
                {
                    base.ShowErrorMessage("从系统数据库中未读取到配置数据");
                    return;
                }

                foreach (SystemConfigEntity item in systemConfigList)
                {
                    switch (item.SysConfigID)
                    {
                    case (int)SystemConfigs.DataExportService:
                        setServiceStatus(SystemConfigs.DataExportService, item.Status);
                        break;

                    case (int)SystemConfigs.FtpUpoladService:
                        if (item.Status == 1 && !checkFtpUseable())
                        {
                            return;
                        }
                        setServiceStatus(SystemConfigs.FtpUpoladService, item.Status);
                        break;

                    case (int)SystemConfigs.HeartbeatService:
                        break;

                    case (int)SystemConfigs.ConfigSynStatus:
                        break;

                    case (int)SystemConfigs.SystemVersion:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                base.ShowErrorMessage($"数据加载异常[{ex.Message}][{ex.StackTrace}]");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 检测系统配置
        /// </summary>
        protected void CheckSystemConfiguration()
        {
            if (!Common.IsExistSQLiteDB())
            {
                ShowErrorMessage("系统未检测到数据库,请联系开卷客服人员");
                return;
            }

            List <SystemConfigEntity> systemConfigList = systemConfigService.GetSystemConfigList();

            if (systemConfigList.Count == 0)
            {
                ShowErrorMessage("系统配置表不存在,请联系开卷客服人员");
                return;
            }

            //1检测客户密钥
            SystemConfigEntity systemConfig = systemConfigList.Find(item => item.SysConfigID == (int)SystemConfigs.EncryptKey);

            if (systemConfig == null)
            {
                ShowErrorMessage("系统配置表不存在客户密钥数据记录,请联系开卷客服人员");
                return;
            }
            if (string.IsNullOrEmpty(systemConfig.ExSetting01))
            {
                ShowErrorMessage("未配置客户密钥,请先配置客户密钥");
                EncryptKeyConfigFrm frm = new EncryptKeyConfigFrm();
                frm.StartPosition = FormStartPosition.CenterParent;
                frm.ShowDialog();;
            }

            //2检测FTP配置
            FtpConfigEntity ftpConfig = ftpService.GetFirstFtpInfo();

            if (ftpConfig == null)
            {
                ShowErrorMessage("未配置FTP信息,请先配置FTP数据");
                FtpConfigFrm frm = new FtpConfigFrm();
                frm.StartPosition = FormStartPosition.CenterParent;
                frm.ShowDialog();
            }
            systemConfig = systemConfigList.Find(item => item.SysConfigID == (int)SystemConfigs.FtpUpoladService);
            if (systemConfig == null)
            {
                ShowErrorMessage("系统配置表不存在FTP上传服务数据记录,请联系开卷客服人员");
                return;
            }
            if (systemConfig.Status == 1)
            {
                try
                {
                    FtpHelper.ConnectFtpServer(ftpConfig);
                }
                catch (Exception ex)
                {
                    ShowErrorMessage($"请检查FTP配置信息。错误信息[{ex.Message}]");
                    FtpConfigFrm frm = new FtpConfigFrm();
                    frm.StartPosition = FormStartPosition.CenterParent;
                    frm.ShowDialog();
                }
            }
        }