private void button2_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();
            decimal             b   = Convert.ToDecimal(fromacctxt.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(transfertxt.Text);
            decimal transferacc = Convert.ToDecimal(desaccounttxt.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;
                //dbe.SaveChanges();
                Transfer transfer = new Transfer();
                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(transfertxt.Text);
                dbe.Transfers.Add(transfer);
                dbe.SaveChanges();
                MessageBox.Show("Transfer Money Sucessfully");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();

            if (usrtxt.Text != string.Empty || passtxt.Text != string.Empty)
            {
                var user1 = dbe.Admin_Table.FirstOrDefault(a => a.Username.Equals(usrtxt.Text));
                if (user1 != null)
                {
                    if (user1.Password.Equals(passtxt.Text))
                    {
                        Menu m1 = new Menu();
                        m1.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Username or Password Incorrect");
                    }
                }
                else
                {
                    MessageBox.Show("Null Value ");
                }
            }
            else
            {
                MessageBox.Show("Please Enter Username and Password");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();
            decimal             acc = Convert.ToDecimal(acctxt.Text);
            var accounts            = dbe.userAccounts.Where(x => x.Account_No == acc).SingleOrDefault();
            FD  fdform = new FD();

            fdform.Account_No      = Convert.ToDecimal(acctxt.Text);
            fdform.Mode            = comboBox1.SelectedItem.ToString();
            fdform.Rupees          = egptxt.Text;
            fdform.Period          = Convert.ToInt32(periodtxt.Text);
            fdform.Interest_rate   = Convert.ToDecimal(interesttxt.Text);
            fdform.Start_Date      = DateTime.UtcNow.ToString("MM/dd/yyyy");
            fdform.Maturity_Date   = (DateTime.UtcNow.AddMilliseconds(Convert.ToInt32(periodtxt.Text))).ToString("MM/dd/yyyy");
            fdform.Maturity_Amount = ((Convert.ToDecimal(egptxt.Text) * Convert.ToInt32(periodtxt.Text) * Convert.ToDecimal(interesttxt.Text))
                                      / (100 * 12 * 30)) + (Convert.ToDecimal(egptxt.Text));
            dbe.FDs.Add(fdform);
            decimal amount      = Convert.ToDecimal(egptxt.Text);
            decimal totalamount = Convert.ToDecimal(accounts.balance);
            decimal fdamount    = totalamount - amount;

            accounts.balance = fdamount;
            dbe.SaveChanges();
            MessageBox.Show("FD Started Now");
        }
        private void loadaccount()
        {
            BSE = new banking_dbEntities1();
            var item = BSE.userAccounts.ToArray();

            no             = item.LastOrDefault().Account_No + 1;
            accnotext.Text = Convert.ToString(no);
        }
        private void retrievedata()
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();
            decimal             b   = Convert.ToDecimal(acctxt.Text);
            var item = (from u in dbe.userAccounts where u.Account_No == b select u).FirstOrDefault();

            nametxt.Text   = item.Name;
            oldbaltxt.Text = Convert.ToString(item.balance);
        }
Ejemplo n.º 6
0
        private void bindgrid()
        {
            //throw new NotImplementedException();
            dataGridView1.AutoGenerateColumns = false;
            banking_dbEntities1 bs = new banking_dbEntities1();
            var item = bs.userAccounts.ToList();

            dataGridView1.DataSource = item;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();
            decimal             b   = Convert.ToDecimal(fromacctxt.Text);
            var item = (from u in dbe.userAccounts where u.Account_No == b select u).FirstOrDefault();

            nametxt.Text   = item.Name;
            amounttxt.Text = Convert.ToString(item.balance);
        }
        private void deletebutton3_Click(object sender, EventArgs e)
        {
            bi.RemoveAt(dataGridView1.SelectedRows[0].Index);
            dbe = new banking_dbEntities1();
            decimal     a   = Convert.ToDecimal(accnotext.Text);
            userAccount acc = dbe.userAccounts.First(s => s.Account_No.Equals(a));

            dbe.userAccounts.Remove(acc);
            dbe.SaveChanges();
        }
Ejemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            b1  = new BindingList <FD>();
            dbe = new banking_dbEntities1();
            string date = dateTimePicker1.Value.ToString("MM/dd/yyyy");

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

            dataGridView1.DataSource = item.ToList();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();
            decimal             b   = Convert.ToDecimal(textBox1.Text);
            var item = (from u in dbe.debits where u.AccountNo == b select u);

            dataGridView1.DataSource = item.ToList();
            var item2 = (from u in dbe.Transfers where u.Account_No == b select u);

            dataGridView3.DataSource = item2.ToList();
        }
        private void searchbutton5_Click(object sender, EventArgs e)
        {
            bi  = new BindingList <userAccount>();
            dbe = new banking_dbEntities1();
            var item = dbe.userAccounts.Where(a => a.Name == nametxt.Text);

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

            foreach (var item1 in item)
            {
                bi.Add(item1);
            }
            dataGridView1.DataSource = bi;
        }
        private void updatebutton1_Click(object sender, EventArgs e)
        {
            dbe = new banking_dbEntities1();
            decimal     accountno   = Convert.ToDecimal(accnotext.Text);
            userAccount useraccount = dbe.userAccounts.First(s => s.Account_No.Equals(accountno));

            useraccount.Account_No  = Convert.ToDecimal(accnotext.Text);
            useraccount.Name        = nametxt.Text;
            useraccount.Date        = dateTimePicker1.Value.ToString();
            useraccount.Mother_Name = mothertxt.Text;
            useraccount.Father_Name = fathertxt.Text;
            if (maleradio.Checked == true)
            {
                useraccount.Gender = "male";
            }
            else
            {
                if (femaleradio.Checked == true)
                {
                    useraccount.Gender = "female";
                }
            }
            if (marriedradio.Checked == true)
            {
                useraccount.maritial_status = "married";
            }
            else
            {
                if (unmarriedradio.Checked == true)
                {
                    useraccount.maritial_status = "Un-Married";
                }
            }
            Image img = pictureBox1.Image;

            if (img.RawFormat != null)
            {
                if (ms != null)
                {
                    img.Save(ms, img.RawFormat);
                    useraccount.Picture = ms.ToArray();
                }
            }
            useraccount.Address  = addtxt.Text;
            useraccount.District = disttxt.Text;
            useraccount.State    = statetxt.Text;
            dbe.SaveChanges();
            MessageBox.Show("Record Updated");
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (maleradio.Checked)
            {
                gender = "male";
            }
            else if (femaleradio.Checked)
            {
                gender = "female";
            }
            else if (otherradio.Checked)
            {
                gender = "other";
            }
            if (marriedradio.Checked)
            {
                m_status = "married";
            }
            else if (unmarriedradio.Checked)
            {
                m_status = "Un-Married";
            }
            BSE = new banking_dbEntities1();
            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.Mother_Name     = mothertxt.Text;
            acc.Father_Name     = fathertxt.Text;
            acc.balance         = Convert.ToDecimal(balanacetxt.Text);
            acc.Date            = datelbl.Text;
            acc.Picture         = ms.ToArray();
            BSE.userAccounts.Add(acc);
            BSE.SaveChanges();
            MessageBox.Show("File Saved");
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 context = new banking_dbEntities1();
            NewAccount          acc     = new NewAccount();
            Deposite            dp      = new Deposite();

            dp.Date       = datelbl.Text;
            dp.AccountNo  = acctxt.Text;
            dp.Name       = nametxt.Text;
            dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text);
            dp.Mode       = modetxt.SelectedItem.ToString();
            dp.DipAmount  = Convert.ToDecimal(amounttxt.Text);
            context.Deposites.Add(dp);
            context.SaveChanges();
            decimal b    = Convert.ToDecimal(acctxt.Text);
            var     item = (from u in context.userAccounts where u.Account_No == b select u).FirstOrDefault();

            item.balance = item.balance + Convert.ToDecimal(amounttxt.Text);
            context.SaveChanges();
            MessageBox.Show("Deposite Money Sucessfully");
        }
        private void savedata()
        {
            banking_dbEntities1 dbe  = new banking_dbEntities1();
            NewAccount          nacc = new NewAccount();
            debit dp = new debit();

            dp.Date       = datelbl.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");
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            dbe = new banking_dbEntities1();
            decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
            var     item  = dbe.userAccounts.Where(a => a.Account_No == accno).FirstOrDefault();

            accnotext.Text = item.Account_No.ToString();
            nametxt.Text   = item.Name;
            mothertxt.Text = item.Mother_Name;
            fathertxt.Text = item.Father_Name;
            phonetxt.Text  = item.PhoneNo;
            addtxt.Text    = item.Address;
            byte[]       img = item.Picture;
            MemoryStream ms  = new MemoryStream(img);

            pictureBox1.Image = Image.FromStream(ms);
            disttxt.Text      = item.District;
            statetxt.Text     = item.State;
            if (item.Gender == "male")
            {
                maleradio.Checked = true;
            }
            else if (item.Gender == "female")
            {
                femaleradio.Checked = true;
            }
            else if (item.Gender == "other")
            {
                otherradio.Checked = true;
            }
            if (item.maritial_status == "married")
            {
                marriedradio.Checked = true;
            }
            else if (item.maritial_status == "unmarried")
            {
                unmarriedradio.Checked = true;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            banking_dbEntities1 dbe = new banking_dbEntities1();

            if (oldpass.Text != string.Empty || newpass.Text != string.Empty || repass.Text != string.Empty)
            {
                Admin_Table user1 = dbe.Admin_Table.FirstOrDefault(a => a.Username.Equals(nametxt.Text));
                if (user1 != null)
                {
                    if (user1.Password.Equals(oldpass.Text))
                    {
                        user1.Password = newpass.Text;
                        dbe.SaveChanges();
                        MessageBox.Show("Password Change Sucessfully");
                    }
                    else
                    {
                        MessageBox.Show("Password Incorrect");
                    }
                }
            }
        }