private void btnAddAgency_Click(object sender, EventArgs e) { try { Vendor_DTO vendor = new Vendor_DTO(); vendor.VendorID = txtIDAgency.Text; vendor.VendorName = txtNameAgency.Text; vendor.VendorAddress = txtAddressOfAgency.Text; vendor.VendorPhone = txtNumberPhone.Text; if (txtIDAgency.Text == "" || txtNameAgency.Text == "" || txtAddressOfAgency.Text == "" || txtNumberPhone.Text == "") { XtraMessageBox.Show("You have to fullfill vendor information!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } if (Vendor_BUS.InsertVendor(vendor)) { XtraMessageBox.Show("Vendor Info has been inserted sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadVendorList(); ClearDisplay(); return; } } catch { XtraMessageBox.Show("Insert Info Failed!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public void btnDeleteAgency_Click(object sender, EventArgs e) { try { Vendor_DTO vendor = new Vendor_DTO(); vendor.VendorID = dtgvAgencyInfoList.CurrentRow.Cells["VendorID"].Value.ToString(); vendor.VendorName = txtNameAgency.Text; if (txtIDAgency.Text == "" || txtNameAgency.Text == "" || txtAddressOfAgency.Text == "" || txtNumberPhone.Text == "") { XtraMessageBox.Show("You have to choose at least one vendor to delete!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } if (Vendor_BUS.DeleteVendor(vendor)) { LoadVendorList(); XtraMessageBox.Show("Vendor Info has been deleted sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearDisplay(); return; } }catch { XtraMessageBox.Show("Delete Info Failed!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void LoadVendor() { List <Vendor_DTO> loadVendor = Vendor_BUS.LoadVendor(); cmbVendor.DataSource = loadVendor; cmbVendor.ValueMember = "VendorID"; cmbVendor.DisplayMember = "VendorName"; }
private void LoadVendor() { List <Vendor_DTO> loadVendor = Vendor_BUS.LoadVendor(); cmbIDAgency.DataSource = loadVendor; cmbIDAgency.ValueMember = "VendorID"; cmbIDAgency.DisplayMember = "VendorName"; txtVendorId.Text = cmbIDAgency.SelectedValue.ToString(); }
public void LoadVendorList() { List <Vendor_DTO> vendor = Vendor_BUS.LoadVendor(); dtgvAgencyInfoList.DataSource = vendor; }