Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            tblProduct product = new tblProduct();

            product.Description = txtDescription.Text;
            product.Price       = decimal.Parse(txtPrice.Text);
            product.Image       = byteBLOBData;
            product.ProductType = (int)cboCategory.SelectedValue;

            cse.tblProducts.Add(product);
            cse.SaveChanges();

            MessageBox.Show("Product Added!");
        }
Exemple #2
0
        private void paymentSuccess(object sender, PaymentMadeEventArgs e)
        {
            tblTransaction transaction = new tblTransaction();

            transaction.TransactionDate = DateTime.Now;

            if (e.PaymentSuccess == true)
            {
                foreach (tblProduct product in products)
                {
                    transaction.tblTransactionItems.Add(new tblTransactionItem()
                    {
                        ProductID = product.ProductID
                    });
                }

                cse.tblTransactions.Add(transaction);
                cse.SaveChanges();
            }
        }