private void btnTransfer_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe = new banking_dbEntities();
            decimal            b   = Convert.ToDecimal(txtFromAccountNumber.Text);
            var item = (from u in dbe.userAccounts
                        where u.Account_No == b
                        select u).FirstOrDefault();
            decimal b1          = Convert.ToDecimal(item.Balance);
            decimal totalbal    = Convert.ToDecimal(txtTransferAmount.Text);
            decimal transferacc = Convert.ToDecimal(txtDestinationAmount.Text);

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

                item2.Balance = item2.Balance + totalbal;
                item.Balance  = item.Balance - totalbal;

                Transfer transfer = new Transfer();
                transfer.Account_No = Convert.ToDecimal(txtFromAccountNumber.Text);
                transfer.ToTransfer = Convert.ToDecimal(txtDestinationAmount.Text);
                transfer.Date       = DateTime.UtcNow.ToString();
                transfer.Name       = txtName.Text;
                transfer.Balance    = Convert.ToDecimal(txtTransferAmount.Text);
                dbe.Transfers.Add(transfer);
                dbe.SaveChanges();
                MessageBox.Show("Transfer Money Succesfully");
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bi.RemoveAt(dataGridView1.SelectedRows[0].Index);
            dbe = new banking_dbEntities();
            decimal     a   = Convert.ToDecimal(txtAccountNumber.Text);
            userAccount acc = dbe.userAccounts.First(s => s.Account_No.Equals(a));

            dbe.userAccounts.Remove(acc);
            dbe.SaveChanges();
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            dbe = new banking_dbEntities();
            decimal     accountno   = Convert.ToDecimal(txtAccountNumber.Text);
            userAccount useraccount = dbe.userAccounts.First(s => s.Account_No.Equals(accountno));

            useraccount.Account_No  = Convert.ToDecimal(txtAccountNumber.Text);
            useraccount.Name        = txtName.Text;
            useraccount.Date        = dateTimePicker1.Value.ToString();
            useraccount.Mother_Name = txtMotherName.Text;
            useraccount.Father_Name = txtFatherName.Text;
            useraccount.PhoneNo     = txtPhoneNumber.Text;
            if (rdbMale.Checked == true)
            {
                useraccount.Gender = "Male";
            }
            else
            {
                if (rdbFemale.Checked == true)
                {
                    useraccount.Gender = "Female";
                }
            }
            if (rdbMarried.Checked == true)
            {
                useraccount.Martital_Status = "Married";
            }
            else
            {
                if (rdbUnmarried.Checked == true)
                {
                    useraccount.Martital_Status = "Unmarried";
                }
            }
            Image img = pictureBox1.Image;

            if (img.RawFormat != null)
            {
                if (ms != null)
                {
                    img.Save(ms, img.RawFormat);
                    useraccount.Picture = ms.ToArray();
                }
            }
            useraccount.Address  = txtAddress.Text;
            useraccount.District = txtDistrict.Text;
            useraccount.State    = txtState.Text;
            dbe.SaveChanges();
            MessageBox.Show("Record Updates ");
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (rdbMale.Checked)
            {
                gender = "Male";
            }
            else if (rdbFemale.Checked)
            {
                gender = "Female";
            }

            if (rdbMarried.Checked)
            {
                m_status = "Married";
            }
            else if (rdbUnmarried.Checked)
            {
                m_status = "Unmarried";
            }

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

            acc.Account_No      = Convert.ToDecimal(txtAccountNumber.Text);
            acc.Name            = txtName.Text;
            acc.DOB             = dtpDOB.Text;
            acc.PhoneNo         = txtPhoneNumber.Text;
            acc.Address         = txtAddress.Text;
            acc.District        = txtDist.Text;
            acc.State           = cboState.SelectedItem.ToString();
            acc.Gender          = gender;
            acc.Martital_Status = m_status;
            acc.Mother_Name     = txtMotherName.Text;
            acc.Father_Name     = txtFatherName.Text;
            acc.Balance         = Convert.ToDecimal(txtBalance.Text);
            acc.Date            = lblDate.Text;
            acc.Picture         = ms.ToArray();
            BSE.userAccounts.Add(acc);
            BSE.SaveChanges();
            MessageBox.Show("File Saved");
        }