Example #1
0
        private void Frm_Load(object sender, EventArgs e)
        {
            try
            {
                TH.Smart.BaseClass.ClsBaseDataInfo.sWebPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName) + @"\WebURL.txt";
                if (!File.Exists(TH.Smart.BaseClass.ClsBaseDataInfo.sWebPath))
                {
                    MessageBox.Show("请先设置连接");
                    FrmWebURL f = new FrmWebURL();
                    f.ShowDialog();
                }

                StreamReader sr   = new StreamReader(TH.Smart.BaseClass.ClsBaseDataInfo.sWebPath);
                string       sUrl = sr.ReadToEnd().Trim();
                if (sUrl.Trim() != "")
                {
                    TH.Smart.BaseClass.ClsBaseDataInfo.sConnString = @"http://" + sUrl.Trim() + @"/webDMC/DBScanForCheck.asmx";
                }
                sr.Close();

                if (TH.Smart.BaseClass.ClsBaseDataInfo.sConnString == "")
                {
                    MessageBox.Show("请先设置连接");
                    FrmWebURL f = new FrmWebURL();
                    f.ShowDialog();
                }

                TH.Smart.WebService.ClsUseWebService clsWeb = new TH.Smart.WebService.ClsUseWebService();
                if (clsWeb.HelloWork() != "Hello World")
                {
                    throw new Exception("网络地址配置不正确,或网络不通");
                }

                DateTime d = Convert.ToDateTime(clsWeb.sServerTime());
                if (d > Convert.ToDateTime("1900-01-01"))
                {
                    dtmLogin.Value = d;
                }

                txtUid.Focus();
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Example #2
0
        private void btnSetWebURL_Click(object sender, EventArgs e)
        {
            try
            {
                FrmWebURL f = new FrmWebURL();
                f.WindowState = FormWindowState.Maximized;
                f.ShowDialog();

                TH.Smart.WebService.ClsUseWebService clsWeb = new TH.Smart.WebService.ClsUseWebService();
                DateTime d = Convert.ToDateTime(clsWeb.sServerTime());
                if (d > Convert.ToDateTime("1900-01-01"))
                {
                    dtmLogin.Value = d;
                }
                txtUid.Focus();
            }
            catch (Exception ee)
            {
                MsgBox m = new MsgBox();
                m.textBox1.Text = "加载Web服务设置窗口失败:" + ee.Message;
                m.Text          = "提示";
                m.ShowDialog();
            }
        }