Exemple #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            if (maleradio.Checked)
            {
                gender = "male";
            }
            else if (femalereadio.Checked)
            {
                gender = "female";
            }
            if (marriedradio.Checked)
            {
                m_status = "married";
            }
            else if (unmarriedradio.Checked)
            {
                m_status = "Un-Married";
            }

            BSE = new banking_dbEntities();
            userAccount acc = new userAccount();

            acc.Account_No      = Convert.ToDecimal(accnotext.Text);
            acc.Name            = nametxt.Text;
            acc.DOB             = dateTimePicker1.Value.ToString();
            acc.PhoneNo         = phonetxt.Text;
            acc.Address         = addtxt.Text;
            acc.District        = disttxt.Text;
            acc.State           = comboBox1.SelectedItem.ToString();
            acc.Gender          = gender;
            acc.maritial_status = m_status;
            acc.balance         = Convert.ToDecimal(balancetxt.Text);
            acc.Date            = date1b1.Text;
            acc.Picture         = ms.ToArray();
            // BSE = SaveChanges();
            BSE.userAccount.Add(acc);
            // MessageBox.Show("file saved");

            try

            {
                // BSE = SaveChanges();
                MessageBox.Show("file saved");
            }

            catch

            {
                MessageBox.Show("file saved");
            }
        }
Exemple #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            try

            {
                bi.RemoveAt(dataGridView1.SelectedRows[0].Index);  //RemoveAt으로 List<T>의 지정된 인덱스에 있는 요소를 제거합니다.
                dbe = new banking_dbEntities();
                decimal     a   = Convert.ToDecimal(acctxt.Text);
                userAccount acc = dbe.userAccount.First(s => s.Account_No.Equals(a)); //db불러옴
                dbe.userAccount.Remove(acc);                                          //db 제거 해준다
                dbe.SaveChanges();                                                    //db 변경해준다
                //MessageBox.Show("file saved");

                // BSE = SaveChanges();
                MessageBox.Show("file saved");
            }

            catch

            {
                MessageBox.Show("file saved");
            }
        }
Exemple #3
0
        private void Button2_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe = new banking_dbEntities();
            decimal            b   = Convert.ToDecimal(fromacctxt.Text);
            var     item           = (from u in dbe.userAccount where u.Account_No == b select u).FirstOrDefault();
            decimal b1             = Convert.ToDecimal(item.balance);
            decimal totalbal       = Convert.ToDecimal(transfertxt.Text);//이체금액
            decimal transferacc    = Convert.ToDecimal(desaccounttxt.Text);

            if (b1 > totalbal)
            {
                userAccount item2 = (from u in dbe.userAccount where u.Account_No == transferacc select u).FirstOrDefault();

                item2.balance = item2.balance + totalbal;
                item.balance  = item.balance - totalbal;
                //dbe.SaveChanged();
                Transfer transfer = new Transfer();                          //Transfer transfer = new
                transfer.Account_No = Convert.ToDecimal(fromacctxt.Text);
                transfer.ToTransfer = Convert.ToDecimal(desaccounttxt.Text); //입금계좌번호
                transfer.Date       = DateTime.UtcNow.ToString();
                transfer.Name       = nametxt.Text;
                transfer.balance    = Convert.ToDecimal(amounttxt.Text);//db에 있는잔액을 가져온다

                dbe.Transfer.Add(transfer);
                dbe.SaveChanges();
                try
                {
                    dbe.SaveChanges();
                    MessageBox.Show("Transfer Money Successfully");
                }
                catch
                {
                    //  throw new NotImplementedException();
                    MessageBox.Show("Transfer Money Successfully");
                }
            }
        }