private void btnUpdateCustomer_Click(object sender, EventArgs e) { if (txtIDCustomer.Text == "" || txtNameCustomer.Text == "") { XtraMessageBox.Show("You have to choose at least 1 customer info to update!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } Customer_DTO customer = new Customer_DTO(); customer.CustomerID = (string)dtgvCustomersListOfStore.CurrentRow.Cells["MaKH"].Value; customer.CustomerName = txtNameCustomer.Text; customer.CustomerAddress = txtAddressCustomer.Text; customer.CustomerPhone = txtNumberPhone.Text; if (Customer_BUS.UpdateCustomer(customer)) { LoadCustomer(); ClearDisplay(); XtraMessageBox.Show("Update Customer Sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } XtraMessageBox.Show("Update Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void btnAddCustomer_Click(object sender, EventArgs e) { if (txtNameCustomer.Text == "" || txtNumberPhone.Text == "" || txtAddressCustomer.Text == "") { XtraMessageBox.Show("You have to fullfill the customer information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } Customer_DTO customer = new Customer_DTO(); customer.CustomerID = txtIDCustomer.Text; customer.CustomerName = txtNameCustomer.Text; customer.CustomerAddress = txtAddressCustomer.Text; customer.CustomerPhone = txtNumberPhone.Text; if (Customer_BUS.InsertCustomer(customer)) { XtraMessageBox.Show("Insert Customer Sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadCustomer(); ClearDisplay(); return; } XtraMessageBox.Show("Insert Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void LoadCustomer() { List <Customer_DTO> loadCustomer = Customer_BUS.LoadCustomerList(); cmbCustomerName.DataSource = loadCustomer; cmbCustomerName.ValueMember = "CustomerID"; cmbCustomerName.DisplayMember = "CustomerName"; txtCustomerID.Text = cmbCustomerName.SelectedValue.ToString(); }
public void LoadCustomer() { List <Customer_DTO> customerList = Customer_BUS.LoadCustomerList(); dtgvCustomersListOfStore.DataSource = customerList; }