/// <summary> /// 登录操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { try { BaseVariable.NetworkStatus = NetStatus; BaseVariable.ServerStatus = ServerStatus; string UserID = this.txtUser.Text.Trim().ToString(); string UserPwd = this.txtPwd.Text.Trim().ToString(); UserInfoMDL UserInfo = null; if (!NetStatus || !ServerStatus) { UserInfo = lUserDAL.GetModel(UserID); } else { UserInfo = UserDAL.GetModel(UserID); } if (UserInfo != null) { string UserPwdMD5 = MD5.Encode(UserPwd, 32).ToUpper(); if (UserInfo.UserPwd.ToUpper() == UserPwdMD5) { BaseVariable.UserEntity = UserInfo; XmlHelper xml = new XmlHelper(); xml.UpdateInnerText("/Root/User/UserID", UserID); xml.UpdateInnerText("/Root/User/UserPwd", UserPwd); FrmMain form = new FrmMain(); form.Owner = this; form.Show(); this.Hide(); } else { MessageBox.Show("密码错误"); } } else { MessageBox.Show("用户不存在"); } } catch (Exception ex) { this.lblMsg.Text = "服务器连接失败"; CLog.WriteErrLog(ex.Message); } }
//1.用户表 #region 载用户表 private void DownloadUser() { try { DataTable table = userDAL.GetAll(); if (table != null && table.Rows.Count > 0) { int count = table.Rows.Count; this.progressBar.Maximum = count; this.progressBar.Value = 0; for (int i = 0; i < count; i++) { DataRow row = table.Rows[i]; UserInfoMDL model = userDAL.DataRowToModel(row); bool rst = lUserDAL.Add(model); this.progressBar.Value = i; } } } catch (Exception ex) { CLog.WriteErrLog(ex.Message); } }