private void btSearchManager_Click(object sender, EventArgs e) { string information = ""; switch (combManager.Text.Trim()) { case "工号": information = "manID"; break; case "姓名": information = "manName"; break; case "性别": information = "manSex"; break; case "年龄": information = "manAge"; break; default: break; } Maticsoft.BLL.Manager man = new BLL.Manager(); string string1 = string.Format("{0} = '{1}'", information, tbManager.Text.Trim()); if (information == "manID") { Model.Manager manmodel = new Model.Manager(); manmodel = man.GetModel1(string1); if (manmodel.manID == "" || manmodel.manID == null) { MessageBox.Show("查无此人"); } else { SeekManager see = new Hotel.SeekManager(manmodel); see.ShowDialog(this); } } else { DataSet ds = new DataSet(); ds = man.GetList(string1); dgvManager.DataSource = ds.Tables[0]; ds.Tables[0].Columns["manID"].ColumnName = "前台工号"; ds.Tables[0].Columns["manName"].ColumnName = "姓名"; ds.Tables[0].Columns["manSex"].ColumnName = "性别"; ds.Tables[0].Columns["manAge"].ColumnName = "年龄"; ds.Tables[0].Columns["passwd"].ColumnName = "密码"; dgvManager.AllowUserToAddRows = false; dgvManager.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } }
protected bool LoginAuto(string un, string pwd) { bool userpassword = false; Model.Manager LAM = new Model.Manager(); LAM.Name = un; LAM.Password = pwd; BLL.Manager LA = new BLL.Manager(); userpassword = LA.ValidatePassword(LAM); return(userpassword); }
private void tbID_TextChanged_1(object sender, EventArgs e) { Maticsoft.BLL.Manager man = new BLL.Manager(); string string1 = string.Format("manID = '{0}'", tbID.Text.Trim()); if (man.GetRecordCount(string1) == 1) { Model.Manager manmodel = new Model.Manager(); nudAge.Value = man.GetModel1(string1).manAge; } else { nudAge.Value = 18; } }
public void ManagerLoad() { Maticsoft.BLL.Manager man = new BLL.Manager(); DataSet ds = new DataSet(); string str1 = string.Format("manID != '离职'"); ds = man.GetList(str1); dgvManager.DataSource = ds.Tables[0]; ds.Tables[0].Columns["manID"].ColumnName = "前台工号"; ds.Tables[0].Columns["manName"].ColumnName = "姓名"; ds.Tables[0].Columns["manSex"].ColumnName = "性别"; ds.Tables[0].Columns["manAge"].ColumnName = "年龄"; ds.Tables[0].Columns["passwd"].ColumnName = "密码"; dgvManager.AllowUserToAddRows = false; dgvManager.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
private void btConfirm_Click(object sender, EventArgs e) { if (tbID.Text.Trim() == "") { MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { if (tbID.Text.Trim() != "离职") { Maticsoft.BLL.Manager man = new BLL.Manager(); string str1 = string.Format("manID = '{0}'", tbID.Text.Trim()); string string1 = string.Format("{0}", tbID.Text.Trim()); if (man.GetRecordCount(str1) > 0) { if (man.Delete(string1) == true) { MessageBox.Show("删除成功!"); this.DialogResult = DialogResult.OK; ((Main_Admin)this.Owner).ManagerLoad(); this.Close(); } else { MessageBox.Show("删除失败!"); } } else { MessageBox.Show("不存在此前台!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("离职备份不可删除!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void btConfirm_Click(object sender, EventArgs e) { if (tbID.Text.Trim() == "" || tbName.Text.Trim() == "" || cbSex.Text == "" || nupAge.Value.ToString() == "" || pbPhoto.Image == null) { MessageBox.Show("输入信息不完整!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { Maticsoft.BLL.Manager man = new BLL.Manager(); Model.Manager manmodel = new Model.Manager(); string str1 = string.Format("manID = '{0}'", tbID.Text.Trim()); if (man.GetRecordCount(str1) > 0) { MessageBox.Show("当前工号已存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { manmodel.manID = tbID.Text.Trim(); manmodel.manName = tbName.Text.Trim(); manmodel.manSex = cbSex.Text.Trim(); manmodel.manAge = Convert.ToInt32(nupAge.Value); manmodel.passwd = null; manmodel.manPhoto = mybyte; if (man.Add(manmodel) == true) { MessageBox.Show("添加成功!"); ((Main_Admin)this.Owner).ManagerLoad(); this.Close(); } else { MessageBox.Show("添加失败!"); } } } }
private void btConfirm_Click(object sender, EventArgs e) { if (tbID.Text.Trim() == "") { MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { Maticsoft.BLL.Manager man = new BLL.Manager(); string string1 = string.Format("manID = '{0}'", tbID.Text.Trim()); if (man.GetRecordCount(string1) == 1) { Model.Manager manmodel = new Model.Manager(); manmodel.manID = tbID.Text.Trim(); manmodel.manName = tbName.Text.Trim(); manmodel.manSex = cbSex.Text.Trim(); manmodel.manAge = Convert.ToInt32(nudAge.Value); manmodel.passwd = null; manmodel.manPhoto = mybyte; if (man.Update(manmodel) == true) { MessageBox.Show("修改成功!"); ((Main_Admin)this.Owner).ManagerLoad(); this.Close(); } else { MessageBox.Show("修改失败!"); } } else { MessageBox.Show("不存在此员工!", "修改出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void but_ok_Click(object sender, EventArgs e) { userName = text_userName.Text.Trim(); passwd = text_passwd.Text.Trim(); ensureCode = text_ensureCode.Text.Trim(); if (ensureCode == string.Empty || passwd == string.Empty || userName == string.Empty) { MessageBox.Show("请完善信息", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error); form_Shake(); checkCode_Random(); if (ensureCode == string.Empty) { text_ensureCode.Focus(); } if (passwd == string.Empty) { text_ensureCode.Text = string.Empty; text_passwd.Focus(); } if (userName == string.Empty) { text_ensureCode.Text = string.Empty; text_passwd.Text = string.Empty; text_userName.Focus(); } } else { if (text_ensureCode.Text == checkCode.Text) { string strWhere = string.Empty, name = ""; int count = 0; if (combox_power.Text == "管理员") { BLL.Admin bllAdmin = new BLL.Admin(); strWhere = string.Format("userID = '{0}' and passwd = '{1}'", userName, passwd); count = bllAdmin.GetRecordCount(strWhere); name = new BLL.Admin().GetModel(userName).userName; } else { BLL.Manager bllManager = new BLL.Manager(); strWhere = string.Format("manID = '{0}' and passwd = '{1}'", userName, passwd); count = bllManager.GetRecordCount(strWhere); name = new BLL.Manager().GetModel(userName).manName; } if (count == 1) { MessageBox.Show("登录成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information); Common.StaticClass.userType = combox_power.Text.ToString(); Common.StaticClass.userName = name; Common.StaticClass.userID = userName; this.Hide(); new Main_Admin().ShowDialog(this); text_passwd.Text = text_ensureCode.Text = string.Empty; checkCode_Random(); } else { errorTime -= 1; if (errorTime > 0) { MessageBox.Show("用户名或密码错误,还有" + errorTime.ToString() + "次机会", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error); checkCode_Random(); form_Shake(); text_userName.Text = text_passwd.Text = text_ensureCode.Text = string.Empty; text_userName.Focus(); } else { MessageBox.Show("用户名或密码错误三次,请稍后登录", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } } } else { MessageBox.Show("验证码不正确", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error); checkCode_Random(); form_Shake(); } } }