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 CheckBarCode() { if (barcode_textbox.Text.ToString() == "" || barcode_textbox.Text.ToString() == "BarCode") { string message1 = "Please fill BarCode"; string title1 = "Error"; MessageBox.Show(message1, title1); IsBarCode = false; return(false); } int ID2 = int.Parse(barcode_textbox.Text.ToString()); foreach (Record r in Program.Records) { if (ID2 == r.getQrCode()) { if (r.getQuantityInStock() > 0) { V2_Picture.Show(); IsBarCode = true; return(true); } string message4 = "The record doesn't exist in stock"; string title4 = "Error"; MessageBox.Show(message4, title4); V2_Picture.Hide(); IsBarCode = false; return(false); } } string message3 = "Record not found"; string title3 = "Error"; MessageBox.Show(message3, title3); V2_Picture.Hide(); IsBarCode = 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(); }