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(); } }
private void detach_AccountPurchase1s(AccountPurchase1 entity) { this.SendPropertyChanging(); entity.Customer1 = null; }
partial void DeleteAccountPurchase1(AccountPurchase1 instance);
partial void UpdateAccountPurchase1(AccountPurchase1 instance);
partial void InsertAccountPurchase1(AccountPurchase1 instance);
private void attach_AccountPurchase1s(AccountPurchase1 entity) { this.SendPropertyChanging(); entity.Store = this; }