private void DataGridPhanNhom_CellClick(object sender, DataGridViewCellEventArgs e) { Object.PhanNhom pN = new Object.PhanNhom(); pN.MaNV = dataGridPhanNhom.Rows[e.RowIndex].Cells[0].Value.ToString(); pN.MaNhomNguoiDung = dataGridPhanNhom.Rows[e.RowIndex].Cells[3].Value.ToString(); pN.XuatNhapLieu(ref txtMaNV, ref txtTenNV, ref cbbNhomNguoiDung); }
private void BtnXoa_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Bạn thực sự muốn xóa?", "Cảnh báo!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { Object.PhanNhom pN = new Object.PhanNhom(); pN.MaNV = txtMaNV.Text; pN.MaNhomNguoiDung = cbbNhomNguoiDung.SelectedValue.ToString(); pN.XoaData(); LamMoi(); } else if (dialogResult == DialogResult.No) { } }
private void BtnLuu_Click(object sender, EventArgs e) { if (btnSua.Visible == false) { Object.PhanNhom pN = new Object.PhanNhom(); pN.MaNV = txtMaNV.Text; pN.MaNhomNguoiDung = cbbNhomNguoiDung.SelectedValue.ToString(); pN.ThemData(); } if (btnThem.Visible == false) { Object.PhanNhom pN = new Object.PhanNhom(); pN.MaNV = txtMaNV.Text; pN.MaNhomNguoiDung = cbbNhomNguoiDung.SelectedValue.ToString(); pN.SuaData(); } LamMoi(); }
private void LamMoi() { DataTable dataPN = Data.Query.LayDuLieu("PHAN_NHOM"); dataPN.Columns.Add("TenNV", typeof(String)); dataPN.Columns.Add("MaPhongGiaoDich", typeof(String)); Object.PhanNhom pN = new Object.PhanNhom(); for (int i = 0; i < dataPN.Rows.Count; i++) { pN.MaNV = dataPN.Rows[i].ItemArray[0].ToString(); pN.MaNhomNguoiDung = dataPN.Rows[i].ItemArray[1].ToString(); dataPN.Rows[i][3] = pN.MaNhomNguoiDung; dataPN.Rows[i][2] = pN.getHoTen(); dataPN.Rows[i][1] = pN.getNhomNguoiDung(); } dataGridPhanNhom.DataSource = dataPN; }