private void btUpdate_Click(object sender, EventArgs e) { if (Them) { try { NVNhaCC nvcc = new NVNhaCC(); nvcc.ThemNCC(BienToanCuc.MANCC, BienToanCuc.TenCongTy, BienToanCuc.DiaChiNCC, BienToanCuc.SDTNCC, BienToanCuc.Fax, BienToanCuc.GmailNCC, BienToanCuc.Website, ref err); Loaddata(); MessageBox.Show("Đã Thêm Xong"); } catch { MessageBox.Show("Không Thêm Được"); } } else { try { int r = dgvNCC.CurrentCell.RowIndex; string strNCC = dgvNCC.Rows[r].Cells[0].Value.ToString(); NVNhaCC nvkh = new NVNhaCC(); nvkh.Update(strNCC, BienToanCuc.TenCongTy, BienToanCuc.DiaChiNCC, BienToanCuc.SDTNCC, BienToanCuc.Fax, BienToanCuc.GmailNCC, BienToanCuc.Website, ref err); Loaddata(); } catch { MessageBox.Show("Không Sửa Được"); } } }
private void btOK_Click(object sender, EventArgs e) { NVNhaCC ncc = new NVNhaCC(); ncc.ThemNCC(txbMaNCC.Text, txbTenCT.Text, txbDiaChi.Text, txbSDT.Text, txbFax.Text, txbGmail.Text, txbGmail.Text, ref err); this.Hide(); }