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; } }
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; }