Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if( cart.Count == 0 )
                MessageBox.Show("Shopping cart is empty.");
            else
            {
                String ivc = "";
                for (int i = 0; i < cart.Count; i++)
                {
                    String[] temp = cart.ElementAt(i).Split('-');

                    int id = int.Parse(temp[0].Trim());
                    String name = temp[1].Trim();
                    int amount = int.Parse(temp[2].Trim());
                    String unit = temp[3].Trim();
                    decimal price = decimal.Parse(temp[4].Trim());
                    decimal sub = decimal.Parse(temp[5].Trim());

                    String[] temp2 = label6.Text.Split(':');
                    ivc = temp2[1].Trim();

                    TransactionSell obj = new TransactionSell();
                    obj.Amount = amount;
                    obj.InventoryId = id;
                    obj.InvoiceCode = ivc;
                    obj.Price = price;
                    obj.SellDate = dateTimePicker1.Value;

                    db.TransactionSells.InsertOnSubmit(obj);
                    db.SubmitChanges();

                }

                MessageBox.Show("Transaction is complete.");
                PrintInvoiceForm pif = new PrintInvoiceForm(ivc, dateTimePicker1.Value);
                pif.MdiParent = this.MdiParent;
                pif.Show();
                this.Dispose();
            }
        }
 partial void UpdateTransactionSell(TransactionSell instance);
 partial void DeleteTransactionSell(TransactionSell instance);
 partial void InsertTransactionSell(TransactionSell instance);