예제 #1
0
        private void btn_go_Click(object sender, EventArgs e)
        {
            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                AccountPurchase1 accnt = new AccountPurchase1();

                string    items    = Convert.ToString(comb_items.SelectedItem);
                DateTime  date     = date_picker.Value;
                int       quant    = Convert.ToInt16(num_txt.Text);
                int       custid   = Convert.ToInt16(txt_cust.ToString());
                Customer1 customer = db.Customer1s.Single(u => u.customerID == custid);

                accnt.customerID      = custid;
                accnt.purchaseDate    = date;
                accnt.quantity        = quant;
                accnt.prodDescription = items;

                var price = from p in db.Stores
                            where p.prodDescription == items
                            select p.productPrice;
                decimal totalPrice = Convert.ToDecimal(price) * quant;

                customer.customerBalance = customer.customerBalance + totalPrice;

                db.AccountPurchase1s.InsertOnSubmit(accnt);
                db.SubmitChanges();



                MessageBox.Show("Action Completed");
                this.Hide();
                customerPage pg = new customerPage();
                pg.ShowDialog();
            }
        }
예제 #2
0
 private void detach_AccountPurchase1s(AccountPurchase1 entity)
 {
     this.SendPropertyChanging();
     entity.Customer1 = null;
 }
예제 #3
0
 partial void DeleteAccountPurchase1(AccountPurchase1 instance);
예제 #4
0
 partial void UpdateAccountPurchase1(AccountPurchase1 instance);
예제 #5
0
 partial void InsertAccountPurchase1(AccountPurchase1 instance);
예제 #6
0
 private void attach_AccountPurchase1s(AccountPurchase1 entity)
 {
     this.SendPropertyChanging();
     entity.Store = this;
 }