private void detailbutton_Click(object sender, EventArgs e)
        {
            Bank_Mangment_SystemEntities1 context = new Bank_Mangment_SystemEntities1();
            NewAccount acc = new NewAccount();
            Deposit    dp  = new Deposit();

            dp.Date       = datalbl.Text;
            dp.AccountNo  = Convert.ToDecimal(acctext.Text);
            dp.Name       = nametext.Text;
            dp.OldBalance = Convert.ToDecimal(oldbaltext.Text);
            dp.Mode       = comboBox1.SelectedItem.ToString();
            dp.DipAmount  = Convert.ToDecimal(amounttext.Text);
            context.SaveChanges();
            decimal b    = Convert.ToDecimal(acctext.Text);
            var     item = (from u in context.userAccounts where u.Account_No == b select u).FirstOrDefault();

            item.balance = item.balance + Convert.ToDecimal(amounttext.Text);
            context.SaveChanges();
            MessageBox.Show("Deposit Money Succesfully :)");
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bank_Mangment_SystemEntities1 dbe = new Bank_Mangment_SystemEntities1();
            NewAccount nacc = new NewAccount();
            debit      dp   = new debit();

            dp.Date       = datelabel.Text;
            dp.AccountNo  = Convert.ToDecimal(acctxt.Text);
            dp.Name       = nametxt.Text;
            dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text);
            dp.Mode       = comboBox1.SelectedItem.ToString();
            dp.DebAmount  = Convert.ToDecimal(amounttxt.Text);
            dbe.debits.Add(dp);
            dbe.SaveChanges();
            decimal b = Convert.ToDecimal(acctxt.Text);

            var item = (from u in dbe.userAccounts where u.Account_No == b select u).FirstOrDefault();

            item.balance = item.balance - Convert.ToDecimal(amounttxt.Text);
            dbe.SaveChanges();
            MessageBox.Show("Debit Money");
        }