private void btn_editCus_Click(object sender, EventArgs e) { if (validateFields()) { try { foreach (Customer cus in customer) { if (cusId.ToString() == cus.Customer_ID.ToString()) { CustServices_Rules.EditCustomer(cusId, tb_Fname.Text, tb_Lname.Text, tb_companyName.Text, tb_Phone.Text, new string[] { tb_add1.Text, tb_add2.Text, tb_add3.Text }); MessageBox.Show("The details for customer " + tb_companyName.Text + " have been successfully updated!"); this.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void deleteCustomProduct() { foreach (Product custom in customPart) { CustServices_Rules.DeleteCustomProduct(custom.ProductName); } }
private void btn_AddCustom_Click(object sender, EventArgs e) { bool qtyResult = int.TryParse(txt_CustomQty.Text, out customQty); if (qtyResult) { if (txt_customPartName.Text != null && txt_CustomSpecs.Text != null) { customPartName = txt_customPartName.Text; specs = txt_CustomSpecs.Text; CustServices_Rules.AddCustomProduct(customPartId, customPartName, specs, customQty, rfqId); customPart.Add(new Product(customPartId, customPartName, specs, customQty, rfqId)); customPartId++; clearCustomFields(); } else { MessageBox.Show("You need to fill all the fields!"); } } else { MessageBox.Show("You need to enter a number on the Id field!"); } }
private void btn_saveAddCus_Click(object sender, EventArgs e) { if (validateFields()) { // ICustomer duplicateCustomer = model.CustomerList.FirstOrDefault(cust => cust.CustFirstName == tb_FirstName.Text.Trim()); //if (duplicateCustomer ==) //{ try { CustServices_Rules.AddCustomer(Convert.ToInt32(tbCustomer_ID.Text), tb_FirstName.Text, tb_LastName.Text, tb_CompanyName.Text, tb_Phone.Text, new string[] { tb_add1.Text, tb_Add2.Text, tb_add3.Text }); MessageBox.Show("The customer " + tb_CompanyName.Text + " was successfully created!"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("The customer " + tb_CompanyName.Text + " already exists please try another company name!"); } }
private void btn_deleteCus_Click(object sender, EventArgs e) { if (cusId != 0) { if (MessageBox.Show("Are you sure you want to delete the customer " + tb_companyName.Text + " ?", "Confirm Delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { CustServices_Rules.DeleteCustomer(cusId); MessageBox.Show("The customer " + tb_companyName.Text + " was successfully deleted!"); this.Close(); } } }
public ViewCustomerDetails(IModel _Model) { InitializeComponent(); this.ControlBox = false; this.Bounds = Screen.PrimaryScreen.Bounds; this.TopMost = true; model = _Model; customers = model.CustomerList; List <String[]> custList = CustServices_Rules.GetCustomer(); //PopulateListView(lv_customers, custList); }
private void btn_Create_Click(object sender, EventArgs e) { string lotTravellerID = CustServices_Rules.GetProductionStage(int.Parse(WorkOrderID)); string productionProcess = ""; foreach (LotTraveller lt in lotTravellers) { if (lotTravellerID == lt.LotTavellerID.ToString()) { productionProcess = lt.ProductionProcess; } } CreateAFieldRequestResponse fsrr = new CreateAFieldRequestResponse(); fsrr.metroTextBox5.Text = productionProcess; fsrr.MdiParent = this.MdiParent; fsrr.Dock = DockStyle.Fill; fsrr.Show(); this.Close(); }