//thêm liên lạc private void Btnthemlienlac_Click(object sender, EventArgs e) { dtgvnhom.CurrentRow.Selected = true; string tennhom = dtgvnhom.SelectedCells[0].Value.ToString(); string manhom = Nhom.getMaTuTenNhom(tennhom, path); var addlienlac = new Addlienlac(this, manhom); addlienlac.Show(); }
// Refresh dtgvLienLac public void refreshDtgvLienLac() { dtgvnhom.CurrentRow.Selected = true; string tenNhom = dtgvnhom.SelectedCells[0].Value.ToString(); string maNhom = Nhom.getMaTuTenNhom(tenNhom, path); dtgvlienlac.AutoGenerateColumns = false; dtgvlienlac.DataSource = LienLac.getLienLacTuMaNhom(maNhom, path1); dtgvlienlac.Refresh(); }
//kích chuột vào tên nhóm và hiển thị thông tin ra dtgv liên lạc private void Dtgvnhom_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index >= 0) { DataGridViewRow selectRow = dtgvnhom.Rows[index]; string tenNhom = selectRow.Cells["TenNhom"].Value.ToString(); string maNhom = Nhom.getMaTuTenNhom(tenNhom, path); dtgvlienlac.AutoGenerateColumns = false; dtgvlienlac.DataSource = LienLac.getLienLacTuMaNhom(maNhom, path1); } }
//xóa nhóm private void Btnxoanhom_Click(object sender, EventArgs e) { if (MessageBox.Show( "Ban co that su muon xoa khong?", "Thong bao", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { bool flag = dtgvnhom.CurrentRow.Selected; if (flag) { string tenNhom = dtgvnhom.SelectedCells[0].Value.ToString(); string maNhom = Nhom.getMaTuTenNhom(tenNhom, path); Nhom.xoaNhom(path, maNhom); } MessageBox.Show("Da xoa thanh cong!", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information); } //refresh refreshdtgvnhom(); }