private void btn_laydulieu_ncc_Click(object sender, EventArgs e) { NHACCBUS nccbus = new NHACCBUS(); List <NHACC> list_ncc = nccbus.GetList(); nhacungcapdgv.DataSource = list_ncc; }
private void btn_capnhat_Click(object sender, EventArgs e) { int index = nhacungcapdgv.CurrentCell.RowIndex; if (txt_ten.Text != "" && index != -1) { error_ncc.Clear(); NHACCBUS nccbus = new NHACCBUS(); NHACC ncc = new NHACC(); ncc.ID = int.Parse(txt_mancc.Text); ncc.TENNCC = txt_tenncc_ds.Text; ncc.SDT = txt_dienthoai_ds.Text; ncc.DIACHI = txt_diachi_ds.Text; ncc.EMAIL = txt_email_ds.Text; if (nccbus.Update(ncc)) { MessageBox.Show("Thành công!"); } else { MessageBox.Show("Lỗi:" + GenericDataRepository <NHACC> .error_message); } } else { error_ncc.SetError(txt_tenncc_ds, "Tên NCC k dc rỗng"); } }
private void btn_them_Click(object sender, EventArgs e) { if (txt_ten.Text != "") { error_ncc.Clear(); NHACC ncc = new NHACC(); ncc.TENNCC = txt_ten.Text; ncc.SDT = txt_dienthoai.Text; ncc.DIACHI = txt_dchi.Text; ncc.EMAIL = txt_email.Text; NHACCBUS nccbus = new NHACCBUS(); if (nccbus.Add(ncc)) { MessageBox.Show("Thành công!"); } else { MessageBox.Show("Lỗi:" + GenericDataRepository <NHACC> .error_message); } } else { error_ncc.SetError(txt_ten, "Tên NCC không được rỗng"); } }