private bool CheckCustomerID() { if (ID_TextBox.Text.ToString() == "" || ID_TextBox.Text.ToString() == "Customer ID") { string message1 = "Please fill ID"; string title1 = "Error"; MessageBox.Show(message1, title1); return(false); } int ID1 = int.Parse(ID_TextBox.Text.ToString()); foreach (Customer c in Program.Customers) { if (ID1 == c.getCustomerID()) { V1_Picture.Show(); CheckID_button.Hide(); IsCustomer = true; return(true); } } string message2 = "Customer not found, please create new customer"; string title2 = "Error"; MessageBox.Show(message2, title2); V1_Picture.Hide(); IsCustomer = false; return(false); }
private void submit_button_Click(object sender, EventArgs e) { if (price_textbox.Text == "") { string message5 = "Please enter sale details"; string title5 = "Error"; MessageBox.Show(message5, title5); } else { PaymentMethod pm = (PaymentMethod)Enum.Parse(typeof(PaymentMethod), comboBox1.SelectedItem.ToString()); Sale s = new Sale(Program.Sales.Count() + 1, DateTime.Now, pm, customer, true); recordsINsale = new List <Record_in_sale>(); foreach (var item in map) { Record rec = item.Key; int q = item.Value; foreach (Record r in records) { if (rec.ToString() == r.ToString()) { ris = new Record_in_sale(r, s, q, true); recordsINsale.Add(ris); r.addRecordInSale(ris); s.addRecord(ris); ID_TextBox.ReadOnly = false; break; } } } s.updateTotalCost(); customer.add_sale(s); sale_label.Hide(); ID_TextBox.Hide(); barcode_textbox.Hide(); V1_Picture.Hide(); V2_Picture.Hide(); CheckID_button.Hide(); quantity_label.Hide(); numericUpDown1.Hide(); richTextBox1.Hide(); comboBox1.Hide(); price_textbox.Hide(); total_cost_label.Hide(); ADD_button.Hide(); clear_button.Hide(); symbol_label.Hide(); newCustumer_label.Hide(); submit_button.Hide(); Thanks_label.Show(); } }
private bool CheckCustomerID() { if (customer_ID_textbox.Text.ToString() == "" || customer_ID_textbox.Text.ToString() == "Customer ID") { string message1 = "Please fill ID"; string title1 = "Error"; MessageBox.Show(message1, title1); return(false); } int ID1 = int.Parse(customer_ID_textbox.Text.ToString()); foreach (Customer c in Program.Customers) { if (ID1 == c.getCustomerID()) { if (c.getHasLendingTab() == true && DateTime.Compare(c.getLendingEndDate(), DateTime.Now) > 0) { V1_Picture.Show(); IsCustomer = true; customer = c; CheckID_button.Hide(); return(true); } string message1 = "The Customer doesn't have valid lending tab"; string title1 = "Error"; IsCustomer = false; MessageBox.Show(message1, title1); return(false); } } string message2 = "Customer not found"; string title2 = "Error"; MessageBox.Show(message2, title2); IsCustomer = false; return(false); }