private void btnLogin_Click(object sender, EventArgs e) { try { if (!chkBaseInfo()) { MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string sErrInfo; if (!Login(out sErrInfo)) { MessageBox.Show("登陆失败!\n\n原因:\n " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUID.Focus(); return; } if (chkPWD.Checked) { string sPWD = ""; FrmChangePWD frmChgPWD = new FrmChangePWD(); frmChgPWD.ShowDialog(); if (frmChgPWD.DialogResult == DialogResult.OK) { sPWD = frmChgPWD.sNewPWD; //string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; //clsSQLCommond.ExecSql(sSQL); string s = clsWeb.saveUserInfoPwd(txtUID.Text.Trim(), clsDES.Encrypt(sPWD)); if (s != "") { throw new Exception(s); } MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } WriteConfig(); try { 系统服务.ClsBaseDataInfo.sUid = txtUID.Text.Trim(); 系统服务.ClsBaseDataInfo.sLogDate = dtmLogin.Text.Trim(); //string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' "; //系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim(); 系统服务.ClsBaseDataInfo.sUserName = clsWeb.svchrName(txtUID.Text.Trim()); } catch { } DialogResult = DialogResult.OK; } catch (Exception ee) { MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click(object sender, EventArgs e) { try { if (bU8Improt && lookUpAcc.Text.Trim() == string.Empty) { MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); lookUpAcc.Focus(); return; } if (!chkBaseInfo()) { MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string sErrInfo; if (!Login(out sErrInfo)) { MessageBox.Show("登陆失败!\n\n原因:\n " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUID.Focus(); return; } if (chkPWD.Checked) { string sPWD = ""; FrmChangePWD frmChgPWD = new FrmChangePWD(); frmChgPWD.ShowDialog(); if (frmChgPWD.DialogResult == DialogResult.OK) { sPWD = frmChgPWD.sNewPWD; string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; clsSQLCommond.ExecSql(sSQL); MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } //string sPWD = ""; //FrmChangePWD frmChgPWD = new FrmChangePWD(); //frmChgPWD.ShowDialog(); //if (frmChgPWD.DialogResult == DialogResult.OK) //{ // sPWD = frmChgPWD.sNewPWD; // string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; // clsSQLCommond.ExecSql(sSQL); // //string s = clsWeb.saveUserInfoPwd(txtUID.Text.Trim(), clsDES.Encrypt(sPWD)); // if (s != "") // { // throw new Exception(s); // } // MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); //} } WriteConfig(); try { 系统服务.ClsBaseDataInfo.sUid = txtUID.Text.Trim(); 系统服务.ClsBaseDataInfo.sLogDate = dtmLogin.Text.Trim(); 系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text; if (bU8Improt) { 系统服务.ClsBaseDataInfo.sUFDataBaseName = "UFDATA_" + lookUpAcc.EditValue.ToString().Trim() + "_" + dtmLogin.DateTime.ToString("yyyy").Trim(); 系统服务.ClsBaseDataInfo.sUFDataBaseText = lookUpAcc.Text.Trim(); 系统服务.ClsBaseDataInfo.sConnString2 = 系统服务.ClsBaseDataInfo.sConnString.Replace(系统服务.ClsBaseDataInfo.sDataBaseName, 系统服务.ClsBaseDataInfo.sUFDataBaseName); } string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' "; 系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim(); //系统服务.ClsBaseDataInfo.sUserName = clsWeb.svchrName(txtUID.Text.Trim()); if (bU8Improt) { sSQL = "select count(*) from Master.dbo.sysdatabases where name='" + 系统服务.ClsBaseDataInfo.sUFDataBaseName + "'"; int iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL)); //int iCou = 系统服务.规格化.ReturnInt(clsWeb.sbU8Improt(系统服务.ClsBaseDataInfo.sUFDataBaseName)); if (iCou == 0) { MessageBox.Show("年度帐不存在,日期请选择" + dtmLogin.DateTime.AddYears(-1).ToString("yyyy").Trim() + "-12-31"); return; } } } catch { } DialogResult = DialogResult.OK; } catch (Exception ee) { MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click(object sender, EventArgs e) { try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); //if (lookUpAcc.Text.Trim() == string.Empty) //{ // MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // lookUpAcc.Focus(); // return; //} if (!chkBaseInfo()) { MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string sErrInfo; if (!Login(out sErrInfo)) { MessageBox.Show("登陆失败!\n\n原因:\n " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUID.Focus(); return; } if (chkPWD.Checked) { string sPWD = ""; FrmChangePWD frmChgPWD = new FrmChangePWD(); frmChgPWD.ShowDialog(); if (frmChgPWD.DialogResult == DialogResult.OK) { sPWD = frmChgPWD.sNewPWD; string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; clsSQLCommond.ExecSql(sSQL); MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } WriteConfig(); try { 系统服务.ClsBaseDataInfo.sUid = txtUID.Text.Trim(); 系统服务.ClsBaseDataInfo.sLogDate = dtmLogin.Text.Trim(); 系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text; string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' "; 系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim(); } catch { } DialogResult = DialogResult.OK; } catch (Exception ee) { MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }