//nut cap nhap nhan vien private void button37_Click(object sender, EventArgs e) { NHANVIEN entity = new NHANVIEN(); entity.MANV = suatxtidnhanvien.Text; entity.TENNV = suatxtten.Text; entity.MATKHAU = suatxtmatkhau.Text; entity.NGAYSINH = dateTimePicker6.Value.Date; entity.DIACHI = suatxtdiachi.Text; entity.DIENTHOAI = suatxtsdt.Text; // entity.PHANQUYEN = suatxtphanquyen.Text; if (comboBox2.SelectedItem.Equals("Admin")) { entity.PHANQUYEN = true; } else if (comboBox2.SelectedItem.Equals("User")) { entity.PHANQUYEN = false; } nhanvienbus bus = new nhanvienbus(); bool success = bus.update(entity); common.successorerror(success); if (success) { common.ClearTextBoxes(tabPage17); thanhviendgv.DataSource = bus.findall(textBox19.Text); thanhviendgv.Columns["NHANVIENs"].Visible = false; } else { ViewErrors(bus.validatedictionary); } }
private void textBox19_TextChanged(object sender, EventArgs e) { nhanvienbus bus = new nhanvienbus(); thanhviendgv.DataSource = bus.findall(textBox19.Text); thanhviendgv.Columns["MANV"].HeaderText = "Mã nhân viên"; thanhviendgv.Columns["TENNV"].HeaderText = "Tên nhân viên"; thanhviendgv.Columns["DIACHI"].HeaderText = "Địa chỉ"; thanhviendgv.Columns["DIENTHOAI"].HeaderText = "Điện thoại"; thanhviendgv.Columns["NGAYSINH"].HeaderText = "Ngày sinh"; thanhviendgv.Columns["NHANVIENs"].Visible = false; thanhviendgv.Columns["MATKHAU"].Visible = false; thanhviendgv.Columns["PHANQUYEN"].Visible = false; thanhviendgv.Columns["XUATKHOes"].Visible = false; }
//xoa user private void button36_Click(object sender, EventArgs e) { NHANVIEN entity = new NHANVIEN(); entity.MANV = suatxtidnhanvien.Text; entity.TENNV = suatxtten.Text; entity.MATKHAU = suatxtmatkhau.Text; entity.DIACHI = suatxtdiachi.Text; entity.DIENTHOAI = suatxtsdt.Text; nhanvienbus bus = new nhanvienbus(); bool success = bus.delete(entity); common.successorerror(success); if (success) { common.ClearTextBoxes(tabPage17); thanhviendgv.DataSource = bus.findall(textBox19.Text); thanhviendgv.Columns["NHANVIENs"].Visible = false; } }