private void PMDDataFixForm_Load(object sender, EventArgs e)
        {
            DateTime maxDate = DateTime.Now.AddDays(-1);

            //bg_time.MaxDate = maxDate;
            //ed_time.MaxDate = DateTime.MaxValue;
            if (iniFile.ExistINIFile())
            {
                string uri = iniFile.IniReadValue(ICL.SERV_LAB, ICL.SERV_URI);
                tb_uri.Text = uri + "";
                CURR_URI    = uri;
                string sid = iniFile.IniReadValue(ICL.SERV_LAB, ICL.SERV_SID);
                tb_conf_id.Text = sid;
                string conf = iniFile.IniReadValue(ICL.SERV_LAB, ICL.SERV_SCONF);
                if (!string.IsNullOrEmpty(conf))
                {
                    try
                    {
                        conf    = Tools.DecodeBase64("UTF-8", conf);
                        configM = JsonConvert.DeserializeObject <DBConfigM>(conf);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex, "加载ini文件读取conf错误!!");
                        MessageBox.Show("非法串改配置文件数据");
                    }
                }

                string dblink = iniFile.IniReadValue(ICL.DB_LAB, ICL.DB_DBLINK);
                if (!string.IsNullOrEmpty(dblink))
                {
                    DBTools.DBLink = dblink;
                    CURR_DBConf    = dblink;
                }
                string opr = iniFile.IniReadValue(ICL.LOCL_LAB, ICL.LOCL_OPR);
                if (!string.IsNullOrEmpty(opr))
                {
                    tb_opr.Text = opr;
                    CURR_OPR    = opr;
                }
                string scm = iniFile.IniReadValue(ICL.LOCL_LAB, ICL.LOCL_SCM);
                if (!string.IsNullOrEmpty(scm))
                {
                    tb_scm.Text = scm;
                    CURR_SCM    = scm;
                }
                string dbid = iniFile.IniReadValue(ICL.LOCL_LAB, ICL.LOCL_DBID);
                if (!string.IsNullOrEmpty(dbid))
                {
                    tb_dbid.Text = dbid;
                    CURR_DBID    = dbid;
                }
            }
            if (configM != null)
            {
                makeUIEnable(false);
            }
        }
        private void GetServerConfigInfo(object sender, EventArgs e)
        {
            string url = tb_uri.Text;

            if (string.IsNullOrEmpty(url) && string.IsNullOrWhiteSpace(url))
            {
                MessageBox.Show("请输入【服务器地址】");
                return;
            }
            string configId = tb_conf_id.Text;

            if (string.IsNullOrEmpty(configId) && string.IsNullOrWhiteSpace(configId))
            {
                MessageBox.Show("请输入【配置Id】");
                return;
            }
            string queryparam = "type=400&sid=" + configId;

            try
            {
                string res = Tools.HttpPostInfo(url + ICL.API_KEY, queryparam);
                if (!string.IsNullOrWhiteSpace(res))
                {
                    ResultInfo rInfo = JsonConvert.DeserializeObject <ResultInfo>(res);
                    if (rInfo.Data != null)
                    {
                        string conf = rInfo.Data["conf"];
                        configM = JsonConvert.DeserializeObject <DBConfigM>(conf);
                        string dbconf = configM.Dbconf;
                        if (string.IsNullOrWhiteSpace(dbconf))
                        {
                            MessageBox.Show("服务端没有数据库配置信息!");
                            return;
                        }
                        iniFile.IniWriteValue(ICL.DB_LAB, ICL.DB_DBLINK, configM.Dbconf);
                        iniFile.IniWriteValue(ICL.SERV_LAB, ICL.SERV_SCONF, Tools.EncodeBase64("UTF-8", JsonConvert.SerializeObject(configM)));
                        iniFile.IniWriteValue(ICL.SERV_LAB, ICL.SERV_URI, url);
                        iniFile.IniWriteValue(ICL.SERV_LAB, ICL.SERV_SID, configId);
                        CURR_URI       = url;
                        CURR_DBConf    = configM.Dbconf;
                        DBTools.DBLink = CURR_DBConf;
                        bool bok = checkConfDB();
                        if (bok)
                        {
                            checkLogDB();
                            tb_conf_id.Enabled = false;
                            tb_uri.Enabled     = false;
                        }
                    }
                    else
                    {
                        MessageBox.Show("没有获取到配置信息");
                    }
                }
                else
                {
                    MessageBox.Show("没有获取到配置信息");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "访问服务器失败");
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
 public ProdJob(string url, DBConfigM configM)
 {
     this.url     = url;
     this.configM = configM;
     makeSql();
 }
示例#4
0
 public ProdJob(string url, DBConfigM configM, string cURR_DBID, string cURR_SCM, string cURR_OPR) : this(url, configM)
 {
     this.cURR_DBID = cURR_DBID;
     this.cURR_SCM  = cURR_SCM;
     this.cURR_OPR  = cURR_OPR;
 }
示例#5
0
 public void setConfigM(DBConfigM value)
 {
     configM = value;
     makeSql();
 }