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); }
public NewLending_Form(string r) { InitializeComponent(); V1_Picture.Hide(); V2_Picture.Hide(); textBoxes = new List <TextBox>(); records = new List <Record>(); textBoxes.Add(textBox1); textBoxes.Add(textBox2); textBoxes.Add(textBox3); textBoxes.Add(textBox4); textBoxes.Add(textBox5); textBoxes.Add(textBox6); textBoxes.Add(textBox7); textBoxes.Add(textBox8); textBoxes.Add(textBox9); textBoxes.Add(textBox10); textBoxes.Add(textBox11); textBoxes.Add(textBox12); textBoxes.Add(textBox13); textBoxes.Add(textBox14); textBoxes.Add(textBox15); textBoxes.Add(textBox16); textBoxes.Add(textBox17); textBoxes.Add(textBox18); textBoxes.Add(textBox19); textBoxes.Add(textBox20); this.role = r; foreach (TextBox tb in textBoxes) { tb.ReadOnly = true; } }
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(); } }
public Sale_Form(string r) { InitializeComponent(); richTextBox1.ReadOnly = true; CheckID_button.Show(); Thanks_label.Hide(); V1_Picture.Hide(); V2_Picture.Hide(); comboBox1.DataSource = Enum.GetValues(typeof(PaymentMethod)); records = new List <Record>(); ID_TextBox.ReadOnly = false; this.role = r; }
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); }
private void clear_button_Click(object sender, EventArgs e) { foreach (Record r in records) { r.setQuantityInStock(r.getQuantityInStock() + quantity); } customer = null; IsCustomer = false; IsBarCode = false; V1_Picture.Hide(); V2_Picture.Hide(); CheckID_button.Show(); ID_TextBox.Text = "Customer ID"; barcode_textbox.Text = "BarCode"; richTextBox1.Text = ""; price_textbox.Text = ""; numericUpDown1.Value = 1; totalPrice = 0; ID_TextBox.ReadOnly = false; map.Clear(); records.Clear(); }
private void clear_button_Click(object sender, EventArgs e) { if (isSubmit == false) { Record r; for (int i = 0; i < textBoxes.Count(); i = i + 4) { if (textBoxes[i].Text != "") { r = Program.GetRecordByQR(int.Parse(textBoxes[i].Text)); r.setQuantityInStock(r.getQuantityInStock() + int.Parse(textBoxes[i + 3].Text)); } } } foreach (TextBox tb in textBoxes) { tb.Clear(); } V1_Picture.Hide(); V2_Picture.Hide(); CheckID_button.Show(); records.Clear(); customer = null; record = null; IsCustomer = false; IsBarCode = false; isSubmit = false; customer_ID_textbox.Text = "Customer ID"; Barcode_textbox.Text = "BarCode"; submit_button.Show(); // this.Hide(); // Lending_Form lf=new Lending_Form(); }