public void Sua(DataRow row, GiamDoc nv) { if (nv.ID == "" || nv.Name == "" || nv.Phone == "" || nv.Address == "" || nv.Position == "") { MessageBox.Show("Không có dữ liệu", "Cảnh Báo"); } else { row["MaNV"] = nv.ID; row["HoTenNV"] = nv.Name; row["DiaChi"] = nv.Address; row["SDT"] = nv.Phone; row["ChucVu"] = nv.Position; } }
private void btnChange_Click(object sender, EventArgs e) { for (int i = 0; i < dgvDanhSachQL.Rows.Count; i++) { if (dgvDanhSachQL.Rows[i].Selected) { string id, name, address, phone, position; id = txtID.Text; name = txtName.Text; address = txtAddress.Text; phone = txtPhone.Text; position = cmbPosition.Text; GiamDoc gd = new GiamDoc(id, name, address, phone, position); DataRow row = cng.memberTable.Rows[i]; cng.Sua(row, gd); } } }
public double TinhLuong(int soNgay, int chon) { double kq = 0; if (soNgay >= 0 && soNgay <= 31) { switch (chon) { case 1: { GiamDoc gd = new GiamDoc(); kq = gd.TinhTienLuong(soNgay); break; } case 2: { PhoGiamDoc pgd = new PhoGiamDoc(); kq = pgd.TinhTienLuong(soNgay); break; } case 3: { TruongPhong tp = new TruongPhong(); kq = tp.TinhTienLuong(soNgay); break; } case 4: { NhanVien nv = new NhanVien(); kq = nv.TinhTienLuong(soNgay); break; } } } else { MessageBox.Show("Nhập sai dữ liệu ", "Cảnh Báo"); } return(kq); }