private void panelLogin_Click(object sender, EventArgs e) { if (this.enableFlag) { this.errorProvider.Clear(); if (string.IsNullOrEmpty(this.tbUser.Caption.Trim()) || this.tbUser.Caption.Trim() == "用户名") { Utility.Common.Validator.SetError(this.errorProvider, this.tbUser, "用户名不能为空!"); return; } if (string.IsNullOrEmpty(this.tbPwd.Caption.Trim()) || this.tbPwd.Caption.Trim() == "密码") { Utility.Common.Validator.SetError(this.errorProvider, this.tbPwd, "密码不能为空!"); return; } FormLoading.StartLoading(this); this.enableFlag = false; this.userName = this.tbUser.Caption.Trim(); this.pwd = this.tbPwd.Caption.Trim(); this.uiHandler += new UiHandler(this.LoginResult); //登录验证 ThreadPool.QueueUserWorkItem(new WaitCallback(this._Login)); } else { FormMessgeBox.ShowMsg(this, "数据库连接异常!", this.panelTop.BackColor); } }
private void panelLogin_Click(object sender, EventArgs e) { if (this.enableFlag) { if (this.dtDb.Rows.Count == 0) { MessageBoxEx.Show("帐套信息加载中…"); this.RefreshAccData(); return; } this.errorProvider.Clear(); if (string.IsNullOrEmpty(this.tbUser.Caption.Trim()) || this.tbUser.Caption.Trim() == "用户名") { Utility.Common.Validator.SetError(this.errorProvider, this.tbUser, "用户名不能为空!"); return; } if (string.IsNullOrEmpty(this.tbPwd.Caption.Trim()) || this.tbPwd.Caption.Trim() == "密码") { Utility.Common.Validator.SetError(this.errorProvider, this.tbPwd, "密码不能为空!"); return; } FormLoading.StartLoading(this, new Size(110, 120)); this.enableFlag = false; this.userName = this.tbUser.Caption.Trim(); this.pwd = this.tbPwd.Caption.Trim(); this.uiHandler += new UiHandler(this.LoginResult); //保存帐套信息 string dbId = this.tbDb.Tag.ToString(); DataRow dr = this.dtDb.Select("Value='" + dbId + "'")[0]; GlobalStaticObj.CurrAccID = dbId; GlobalStaticObj.CurrAccCode = dr["Code"].ToString(); GlobalStaticObj.CurrAccName = dr["Name"].ToString(); GlobalStaticObj.IsDefaultAcc = dr["Status"].ToString() == DataSources.EnumYesNo.Yes.ToString("d"); this.timer.Enabled = true; //登录验证 ThreadPool.QueueUserWorkItem(new WaitCallback(this._Login)); } else { MessageBoxEx.Show("服务连接异常!"); } }
private void panelYes_Click(object sender, EventArgs e) { if (!myLock) { return; } this.myLock = false; this.errorProvider.Clear(); if (string.IsNullOrEmpty(this.tbDBIp.Caption.Trim())) { Utility.Common.Validator.SetError(this.errorProvider, this.tbDBIp, "服务器Ip不能为空!"); return; } if (!InetetTest(this.tbDBIp.Caption.Trim(), 100)) { FormMessgeBox.ShowMsg(this, "IP无法连接!", this.panelTop.BackColor); this.myLock = true; return; } if (string.IsNullOrEmpty(this.tbDBUser.Caption.Trim())) { Utility.Common.Validator.SetError(this.errorProvider, this.tbDBUser, "用户名不能为空!"); return; } if (string.IsNullOrEmpty(this.tbDBPwd.Caption.Trim())) { Utility.Common.Validator.SetError(this.errorProvider, this.tbDBPwd, "密码不能为空!"); return; } this.arrays[1] = this.tbDBIp.Caption.Trim(); this.arrays[5] = this.tbDBUser.Caption.Trim(); this.arrays[7] = this.tbDBPwd.Caption.Trim(); connString = ConfigHelper.PackageConnString(this.arrays); FormLoading.StartLoading(this); ThreadPool.QueueUserWorkItem(new WaitCallback(this._DbTest), connString); }
void UCOldPartsPalautusAddOrEdit_SyncEvent(object sender, EventArgs e) { #region 必要的判断 if (dtpSTime.Value > dtpETime.Value) { MessageBoxEx.Show("创建日期范围,开始时间不能大于结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strCurrentSMon = dtpSTime.Value.Month.ToString(); //创建日期范围开始日期的月份 string strCurrentEMon = dtpETime.Value.Month.ToString(); //创建日期范围结束日期的月份 if (strCurrentEMon != strCurrentSMon) { MessageBoxEx.Show("创建日期范围必须在同一个月!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } string strCurrentSDay = dtpSTime.Value.Day.ToString();//创建日期范围开始日期的天 if (strCurrentSDay != "1") { MessageBoxEx.Show("创建日期范围,开始日期必须为每月第1天!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (dtpSTime.Value.AddMonths(1).AddDays(-1).ToShortDateString() != dtpETime.Value.ToShortDateString()) { MessageBoxEx.Show("创建日期范围必须为整月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion strWhere = @" create_time_start='" + Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtpSTime.Value.ToString("yyyy-MM-dd"))).ToString() + "'and create_time_end='" + Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtpETime.Value.ToString("yyyy-MM-dd"))).ToString() + "' "; this.uiHandler -= new UiHandler(this.ShowData); this.uiHandler += new UiHandler(this.ShowData); //加载帐套信息 ThreadPool.QueueUserWorkItem(new WaitCallback(this.GetWebServHandler), dtpSTime.Value.ToString("yyyy-MM-dd") + "," + dtpETime.Value.ToString("yyyy-MM-dd")); FormLoading.StartLoading(dgvMaterials); }