private void NewAccountToolStripMenuItem1_Click_1(object sender, EventArgs e) { formNewAccount newAcc = new formNewAccount(); //newAcc.MdiParent = this; newAcc.Show(); }
private void Button1_Click(object sender, EventArgs e) //details { //hre we have EDMX file, model1.edmx BankDataEntities context = new BankDataEntities(); formNewAccount acc = new formNewAccount(); Deposit dp = new Deposit(); int b = Convert.ToInt32(txtAccountNo.Text); var item = (from u in context.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); txtName.Text = item.Name.ToString(); txtOldBalance.Text = item.Balance.ToString(); dp.Date = lblDate.Text; dp.AccountNo = Convert.ToInt32(txtAccountNo.Text); dp.Name = txtName.Text; //dp.OldBalance = Convert.ToDecimal(txtOB.Text); // dp.Mode = comboBox1.SelectedItem.ToString(); ///dp.DipAmount = Convert.ToDecimal(txtDepositAmt.Text); context.Deposits.Add(dp); //context.SaveChanges(); //to check old balance //item.Balance = item.Balance + Convert.ToDecimal(txtDepositAmt.Text); }
private void BtnSave_Click(object sender, EventArgs e) { BankDataEntities dbe = new BankDataEntities(); formNewAccount nacc = new formNewAccount(); Debit wd = new Debit(); wd.Date = lblDate.Text; wd.AccountNo = Convert.ToInt32(txtAccountNo.Text); wd.Name = txtName.Text; wd.OldBalance = Convert.ToDecimal(txtOldBalance.Text); wd.Mode = comboBox1.SelectedItem.ToString(); wd.DebitAmount = Convert.ToDecimal(txtAmount.Text); dbe.Debits.Add(wd); dbe.SaveChanges(); decimal b = Convert.ToDecimal(txtAccountNo.Text); var item = (from u in dbe.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); item.Balance = item.Balance - NewMethod(); dbe.SaveChanges(); MessageBox.Show("Debit Money"); }