private void btnLuu_Click(object sender, EventArgs e) { provider p = new provider(); p.id = txtMa.Text; p.name = txtTen.Text; p.phone = txtSdt.Text; p.email = txtEmail.Text; p.address = txtDiaChi.Text; if (busNhaCungCap.Insert(p)) { DialogResult = DialogResult.OK; this.Close(); } else { DialogResult = DialogResult.Cancel; XtraMessageBox.Show("Có lỗi trong quá trình thêm, vui lòng kiểm tra lại", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); this.Close(); } }
partial void Deleteprovider(provider instance);
partial void Updateprovider(provider instance);
partial void Insertprovider(provider instance);
void gvNhaCungCap_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (gvNhaCungCap.SelectedRowsCount != 1) return; ncc = (provider)gvNhaCungCap.GetFocusedRow(); lblTenNhaCungCap.Text = ncc.name; lblDiaChi.Text = ncc.address; lblSoDienThoai.Text = ncc.phone; lblEmail.Text = ncc.email; dgvSanPhamCungCap.DataSource = busNhaCungCap.GetProduct(ncc); }