private void Button1_Click(object sender, EventArgs e) { banking_dbEntities context = new banking_dbEntities(); newAccount acc = new newAccount(); Deposit dp = new Deposit(); dp.Date = date1b1.Text; dp.AccountNo = Convert.ToDecimal(acctxt.Text); dp.Name = nametxt.Text; dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text); dp.Mode = ComboBox.SelectedItem.ToString(); dp.DipAmount = Convert.ToDecimal(amounttxt.Text); context.Deposit.Add(dp); decimal b = Convert.ToDecimal(acctxt.Text); var item = (from u in context.userAccount where u.Account_No == b select u).FirstOrDefault(); item.balance = item.balance + Convert.ToDecimal(amounttxt.Text); try { context.SaveChanges(); MessageBox.Show("Deposit Money Sucessfully"); } catch { // throw new NotImplementedException(); MessageBox.Show("Deposit Money Sucessfully"); } // MessageBox.Show("Deposit Money Sucessfully"); }
private void Button2_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); newAccount nacc = new newAccount(); debit dp = new debit();//debit dp dp.Date = date1b1.Text; dp.Account = Convert.ToDecimal(acctxt.Text); dp.Name = nametxt.Text; dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text); dp.Mode = comboBox1.SelectedItem.ToString(); dp.DebAmount = Convert.ToDecimal(DebAmount1.Text); dbe.debit.Add(dp); decimal b = Convert.ToDecimal(acctxt.Text); var item = (from u in dbe.userAccount where u.Account_No == b select u).FirstOrDefault(); item.balance = item.balance - Convert.ToDecimal(DebAmount1.Text); try { dbe.SaveChanges(); MessageBox.Show("Debit Money"); } catch { // throw new NotImplementedException(); MessageBox.Show("Debit Money"); } }
private void ToolStripMenuItem2_Click(object sender, EventArgs e) { newAccount newacc = new newAccount(); newacc.ShowDialog(); }