public Returning(int ID, DateTime date, Record record, Customer Customer, bool is_new) { this.returnDate = date; this.returnID = ID; this.record = record; this.Customer = Customer; this.totalCost = record.getPrice(); }
private void ADD_button_Click(object sender, EventArgs e) { if (IsCustomer) { CheckBarCode(); } if (!IsCustomer) { string message7 = "Please fill ID number"; string title7 = "Error"; MessageBox.Show(message7, title7); } if (IsBarCode && IsCustomer) { ID_TextBox.ReadOnly = true; Rquantity = numericUpDown1.Value; quantity = (int)Rquantity; customer = Program.GetCustomerByID(int.Parse(ID_TextBox.Text)); Record record = Program.GetRecordByQR(int.Parse(barcode_textbox.Text)); if (quantity <= record.getQuantityInStock()) { string s = ""; s.Replace("\n", Environment.NewLine); richTextBox1.Text = richTextBox1.Text + "\n" + "Name: " + record.getRecordName().ToString() + " x " + quantity + " By: " + record.getArtist().ToString() + ", " + "Price: " + (quantity * record.getPrice()); totalPrice = totalPrice + quantity * record.getPrice(); price_textbox.Text = totalPrice.ToString(); record.setQuantityInStock(record.getQuantityInStock() - quantity); if (!records.Contains(record)) { map.Add(record, quantity); } else { foreach (var item in map) { int q = item.Value; if (map.ContainsKey(record)) { q = q + 1; } else { map.Add(record, quantity); } } } records.Add(record); IsBarCode = false; } if (quantity > record.getQuantityInStock() && record.getQuantityInStock() != 0) { string message4 = "There are only " + record.getQuantityInStock() + " records in stock"; string title4 = "Error"; MessageBox.Show(message4, title4); } } }