예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe   = new banking_dbEntities();
            decimal            accno = Convert.ToDecimal(txtAccount.Text);
            var accounts             = dbe.userAccounts.Where(x => x.Account_No == accno).SingleOrDefault();
            FD  fdform = new FD();

            fdform.Account_No = Convert.ToDecimal(txtAccount.Text);
            fdform.Mode       = cboMode.SelectedItem.ToString();
            fdform.Dollar     = txtDolar.Text;
            //fdform.Period = Convert.ToInt32(txtPeriod.Text);
            fdform.Interest_Rate  = Convert.ToDecimal(txtInterest.Text);
            fdform.Start_Date     = DateTime.UtcNow.ToString("MM/dd/yyyy");
            fdform.Maturity_Date  = (DateTime.UtcNow.AddDays(Convert.ToInt32(txtPeriod.Text))).ToString("MM/dd/yyy");
            fdform.Maturity_Mount = ((Convert.ToDecimal(txtDolar.Text) * Convert.ToInt32(txtPeriod.Text) * Convert.ToDecimal(txtInterest.Text)) /
                                     (100 * 12 * 30)) + (Convert.ToDecimal(txtDolar.Text));

            dbe.FDs.Add(fdform);
            decimal amount      = Convert.ToDecimal(txtDolar.Text);
            decimal totalamount = Convert.ToDecimal(accounts.Balance);
            decimal fdamount    = totalamount - amount;

            accounts.Balance = fdamount;

            dbe.SaveChanges();
            MessageBox.Show("FD Started Now");
        }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe = new banking_dbEntities();

            if (txtPassword.Text != string.Empty || txtPassword.Text != string.Empty)
            {
                var user1 = dbe.Admin_Table.FirstOrDefault(a => a.UserName.Equals(txtUserName.Text));
                if (user1 != null)
                {
                    if (user1.Password.Equals(txtPassword.Text))
                    {
                        Menu m1 = new Menu();
                        m1.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Password Incorrect");
                        txtPassword.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Null Value");
                }
            }
            else
            {
                MessageBox.Show("Please Enter Username Anda Password");
            }
        }
예제 #3
0
        private void SaveDate()
        {
            banking_dbEntities dbe  = new banking_dbEntities();
            newAccount         nacc = new newAccount();
            debit dp = new debit();

            dp.Date        = lblDate.Text;
            dp.AccountNo   = Convert.ToDecimal(txtAccountNumber.Text);
            dp.Name        = txtName.Text;
            dp.OldBalancae = Convert.ToDecimal(txtOldBalance.Text);
            dp.Mode        = cboMode.SelectedItem.ToString();
            dp.DebAmount   = Convert.ToDecimal(txtAmount.Text);
            dbe.debits.Add(dp);
            dbe.SaveChanges();

            decimal b = Convert.ToDecimal(txtAccountNumber.Text);

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

            item.Balance = item.Balance - Convert.ToDecimal(txtAmount.Text);
            dbe.SaveChanges();
            MessageBox.Show("Debit Money");
        }
        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 dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            dbe = new banking_dbEntities();
            decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
            var     item  = dbe.userAccounts.Where(a => a.Account_No == accno).FirstOrDefault();

            txtAccountNumber.Text = item.Account_No.ToString();
            txtName.Text          = item.Name;
            txtMotherName.Text    = item.Mother_Name;
            txtFatherName.Text    = item.Father_Name;
            txtPhoneNumber.Text   = item.PhoneNo;
            txtAddress.Text       = item.Address;
            byte[]       img = item.Picture;
            MemoryStream ms  = new MemoryStream(img);

            pictureBox1.Image = Image.FromStream(ms);
            txtDistrict.Text  = item.District;
            txtState.Text     = item.State;
            if (item.Gender == "male")
            {
                rdbMale.Checked = true;
            }
            else if (item.Gender == "female")
            {
                rdbFemale.Checked = true;
            }
            if (item.Martital_Status == "Married")
            {
                rdbMarried.Checked = true;
            }
            else if (item.Martital_Status == "Unmarried")
            {
                rdbUnmarried.Checked = true;
            }
        }
        private void loadaccount()
        {
            BSE = new banking_dbEntities();
            var item = BSE.userAccounts.ToArray();

            //no = item.LastOrDefault().Account_No + 1;
            txtAccountNumber.Text = Convert.ToString(no);
        }
        private void bindgrid()
        {
            dataGridView1.AutoGenerateColumns = false;
            banking_dbEntities bs = new banking_dbEntities();
            var item = bs.userAccounts.ToList();

            dataGridView1.DataSource = item;
            //throw new NotImplementedException();
        }
        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 btnShowDetails_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();

            txtName.Text          = item.Name;
            txtCurrentAmount.Text = Convert.ToString(item.Balance);
        }
예제 #10
0
        private void ReviewData()
        {
            banking_dbEntities dbe = new banking_dbEntities();
            decimal            b   = Convert.ToDecimal(txtAccountNumber.Text);
            var item = (from u in dbe.userAccounts
                        where u.Account_No == b
                        select u).FirstOrDefault();

            txtName.Text       = item.Name;
            txtOldBalance.Text = Convert.ToString(item.Balance);
        }
예제 #11
0
        private void btnShow_Click(object sender, EventArgs e)
        {
            bl  = new BindingList <FD>();
            dbe = new banking_dbEntities();
            string date = dtpCtt.Value.ToString("MM/dd/yyyy");

            MessageBox.Show(date);
            var item = dbe.FDs.Where(a => a.Start_Date.Equals(date));

            dgvData.DataSource = item.ToList();
        }
        private void btnGetDetails_Click(object sender, EventArgs e)
        {
            banking_dbEntities context = new banking_dbEntities();
            decimal            b       = Convert.ToDecimal(txtAccountNumber.Text);
            var item = (from u in context.userAccounts
                        where u.Account_No == b
                        select u).FirstOrDefault();

            txtName.Text       = item.Name;
            txtOldBalance.Text = Convert.ToString(item.Balance);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            bi  = new BindingList <userAccount>();
            dbe = new banking_dbEntities();
            var item = dbe.userAccounts.Where(a => a.Name == txtName.Text);

            foreach (var item1 in item)
            {
                bi.Add(item1);
            }
            dataGridView1.DataSource = bi;
        }
        private void btnDetail_Click(object sender, EventArgs e)
        {
            bi  = new BindingList <userAccount>();
            dbe = new banking_dbEntities();
            decimal accno = Convert.ToDecimal(txtAccountNumber.Text);
            var     item  = dbe.userAccounts.Where(a => a.Account_No == accno);

            foreach (var item1 in item)
            {
                bi.Add(item1);
            }
            dataGridView1.DataSource = bi;
        }
        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");
        }
예제 #17
0
        private void btnShow_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe = new banking_dbEntities();
            decimal            b   = Convert.ToDecimal(textBox1.Text);
            var item = (from u in dbe.debits
                        where u.AccountNo == b
                        select u);

            dataGridView1.DataSource = item.ToList();

            var item1 = (from u in dbe.Deposits
                         where u.AccountNo == b
                         select u);

            dataGridView2.DataSource = item1.ToList();

            //var item2 = (from u in dbe.Transfers
            //             where u.AccountNo == b
            //             select u);
            //dataGridView3.DataSource = item2.ToList();
        }
예제 #18
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            banking_dbEntities dbe = new banking_dbEntities();

            if (txtOldPassword.Text != string.Empty || txtNewPassword.Text != string.Empty || txtRetype.Text != string.Empty)
            {
                Admin_Table user1 = dbe.Admin_Table.FirstOrDefault(a => a.UserName.Equals(txtUsername.Text));
                if (user1 != null)
                {
                    if (user1.Password.Equals(txtOldPassword.Text))
                    {
                        user1.Password = txtNewPassword.Text;
                        dbe.SaveChanges();
                        MessageBox.Show("Password Change Successfully");
                    }
                    else
                    {
                        MessageBox.Show("Password Incorrect");
                    }
                }
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            banking_dbEntities context = new banking_dbEntities();
            newAccount         acc     = new newAccount();
            Deposit            dp      = new Deposit();

            dp.Date        = lblDate.Text;
            dp.AccountNo   = Convert.ToDecimal(txtAccountNumber.Text);
            dp.Name        = txtName.Text;
            dp.OldeBalance = Convert.ToDecimal(txtOldBalance.Text);
            dp.Mode        = cboMode.SelectedItem.ToString();
            dp.DipAmount   = Convert.ToDecimal(txtAmount.Text);
            context.Deposits.Add(dp);
            context.SaveChanges();
            decimal b    = Convert.ToDecimal(txtAccountNumber.Text);
            var     item = (from u in context.userAccounts
                            where u.Account_No == b
                            select u).FirstOrDefault();

            item.Balance = item.Balance + Convert.ToDecimal(txtAmount.Text);
            context.SaveChanges();
            MessageBox.Show("Deposit Money Successfully");
        }
예제 #20
0
 private void Menu_Load(object sender, EventArgs e)
 {
     banking_dbEntities log = new banking_dbEntities();
 }