Exemple #1
0
        private void newAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            newAccount newacc = new newAccount();

            //부모폼을 불러온다.
            newacc.MdiParent = this.MdiParent;
            newacc.Show();
            this.Close();
        }
        private void savedata()
        {   //각 텍스트 박스에 있는 정보를 debit테이블에 넣은후 데이터를 저장시킨다
            banking_dbEntities dbe  = new banking_dbEntities();
            newAccount         nacc = new newAccount();
            debit dp = new debit();

            dp.Date      = DateTime.UtcNow.ToString("MM/dd/yyyy");
            dp.Account   = Convert.ToDecimal(acctxt.Text);
            dp.Name      = nametxt.Text;
            dp.OldBalace = Convert.ToDecimal(oldbalancetxt.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("인출 완료");
        }
        private void button3_Click(object sender, EventArgs e)
        {
            banking_dbEntities context = new banking_dbEntities();
            newAccount         acc     = new newAccount();
            Deposit            dp      = new Deposit();

            dp.Date       = datelbl.Text;
            dp.AccountNo  = Convert.ToDecimal(textBox1.Text);
            dp.Name       = textBox2.Text;
            dp.OldBalance = Convert.ToDecimal(textBox3.Text);
            dp.Mode       = comboBox1.SelectedItem.ToString();
            dp.DipAmount  = Convert.ToDecimal(textBox4.Text);
            //텍스트박스의 정보를 deposit에 각 컬럼에 넣은 후 정보를 반영한다.
            context.Deposits.Add(dp);
            context.SaveChanges();
            decimal b    = Convert.ToDecimal(textBox1.Text);
            var     item = (from u in context.userAccounts
                            where u.Account_No == b
                            select u).FirstOrDefault(); // context 안에 있는 account_No 가 b와 같을때에 item안에 정보를 입력한다.

            item.balance = item.balance + Convert.ToDecimal(textBox4.Text);
            context.SaveChanges();
            MessageBox.Show("입금 완료");
        }