private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 db = new bankmanagement_dbEntities2();

            if (usertxt.Text != string.Empty || passtxt.Text != string.Empty)
            {
                var user1 = db.Admins.FirstOrDefault(a => a.username.Equals(usertxt.Text));
                if (user1 != null)
                {
                    if (user1.password.Equals(passtxt.Text))
                    {
                        {
                            menu obj = new menu();
                            this.Hide();
                            obj.ShowDialog();
                        }
                    }
                    else
                    {
                        MessageBox.Show("password incorrect");
                    }
                }
                else
                {
                    MessageBox.Show("please fill in details");
                }
            }
            else
            {
                MessageBox.Show("enter deatils");
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 con = new bankmanagement_dbEntities2();
            decimal no         = Convert.ToDecimal(fromaccounttxt.Text);
            var     item       = (from u in con.userAccounts where u.Account_no == no select u).FirstOrDefault();
            decimal b1         = Convert.ToDecimal(item.balance);
            decimal totalbal   = Convert.ToDecimal(tranfertxt.Text);
            decimal trasferacc = Convert.ToDecimal(desaccounttxt.Text);

            if (b1 > totalbal)
            {
                userAccount item2 = (from u in con.userAccounts where u.Account_no == trasferacc select u).FirstOrDefault();
                item2.balance = item2.balance + totalbal;
                item.balance  = item.balance - totalbal;
                //on.SaveChanges();
                Transfer trans = new Transfer();
                trans.Account_no = Convert.ToDecimal(fromaccounttxt.Text);
                trans.Totransfer = Convert.ToDecimal(desaccounttxt.Text);
                trans.Date       = DateTime.UtcNow.ToString();
                trans.Name       = nametxt.Text;
                trans.Balance    = Convert.ToDecimal(tranfertxt.Text);
                con.Transfers.Add(trans);
                con.SaveChanges();
                MessageBox.Show("transfer complete");
            }
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 dbe = new bankmanagement_dbEntities2();
            decimal no       = Convert.ToDecimal(accnotxt.Text);
            var     accounts = dbe.userAccounts.Where(x => x.Account_no == no).SingleOrDefault();
            FD      farm     = new FD();

            farm.Account_no      = Convert.ToDecimal(accnotxt.Text);
            farm.Mode            = comboBox1.SelectedItem.ToString();
            farm.Rupees          = rupeestxt.Text;
            farm.period          = Convert.ToInt32(periodtxt.Text);
            farm.intrest         = Convert.ToDecimal(intresttxt.Text);
            farm.start_date      = DateTime.UtcNow.ToString("MM/dd/yyyy");
            farm.maturity_date   = (DateTime.UtcNow.AddDays(Convert.ToInt32(periodtxt.Text))).ToString("MM/dd/yyyy");
            farm.maturity_amount = ((Convert.ToDecimal(rupeestxt.Text) * Convert.ToInt32(periodtxt.Text) * Convert.ToDecimal(intresttxt.Text) / (100 * 12 * 30)) + (Convert.ToDecimal(rupeestxt.Text)));
            dbe.FDs.Add(farm);

            decimal amount      = Convert.ToDecimal(rupeestxt.Text);
            decimal totalamount = Convert.ToDecimal(accounts.balance);
            decimal fdamount    = totalamount - amount;

            accounts.balance = fdamount;
            dbe.SaveChanges();
            MessageBox.Show("fd started now");
        }
        private void loadaccount()
        {
            bmd = new bankmanagement_dbEntities2();
            var obj = bmd.userAccounts.ToArray();

            no            = obj.LastOrDefault().Account_no + 1;
            accnotxt.Text = Convert.ToString(no);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 con = new bankmanagement_dbEntities2();
            decimal no   = Convert.ToDecimal(fromaccounttxt.Text);
            var     item = (from u in con.userAccounts where u.Account_no == no select u).FirstOrDefault();

            nametxt.Text   = item.Name;
            amounttxt.Text = Convert.ToString(item.balance);
        }
        private void bindgrid()
        {
            //throw new NotImplementedException();
            dataGridView1.AutoGenerateColumns = false;
            bankmanagement_dbEntities2 bmd = new bankmanagement_dbEntities2();
            var items = bmd.userAccounts.ToList();

            dataGridView1.DataSource = items;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            b1.RemoveAt(dataGridView1.SelectedRows[0].Index);
            bs = new bankmanagement_dbEntities2();
            decimal     a   = Convert.ToDecimal(accnotxt.Text);
            userAccount acc = bs.userAccounts.First(s => s.Account_no.Equals(a));

            bs.userAccounts.Remove(acc);
            bs.SaveChanges();
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 con = new bankmanagement_dbEntities2();
            decimal no   = Convert.ToDecimal(accountxt.Text);
            var     item = (from u in con.userAccounts where u.Account_no == no select u).FirstOrDefault();


            //oldbalancetxt.Text = Convert.ToString(item.balance);
            //nametxt.Text = item.Name;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 con = new  bankmanagement_dbEntities2();
            decimal accno = Convert.ToDecimal(accountxt.Text);
            var     item  = con.userAccounts.Where(a => a.Account_no == accno).FirstOrDefault();

            accountxt.Text     = item.Account_no.ToString();
            nametxt.Text       = item.Name;
            oldbalancetxt.Text = Convert.ToString(item.balance);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            b1  = new BindingList <FD>();
            dbe = new bankmanagement_dbEntities2();
            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 button5_Click(object sender, EventArgs e)
        {
            b1 = new BindingList <userAccount>();
            bs = new bankmanagement_dbEntities2();
            var items = bs.userAccounts.Where(a => a.Name == nametxt.Text);

            foreach (var item1 in items)
            {
                b1.Add(item1);
            }
            dataGridView1.DataSource = b1;
        }
        private void button4_Click(object sender, EventArgs e)
        {
            b1 = new BindingList <userAccount>();
            bs = new bankmanagement_dbEntities2();
            decimal accno = Convert.ToDecimal(accnotxt.Text);
            var     items = bs.userAccounts.Where(a => a.Account_no == accno);

            foreach (var item1 in items)
            {
                b1.Add(item1);
            }
            dataGridView1.DataSource = b1;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 dbe = new bankmanagement_dbEntities2();
            decimal b    = Convert.ToDecimal(textBox1.Text);
            var     item = (from u in dbe.debits where u.Account_no == b select u);

            dataGridView1.DataSource = item.ToList();
            var item1 = (from u in dbe.deposit__ where u.Account_no == b select u);

            dataGridView2.DataSource = item1.ToList();
            var item2 = (from u in dbe.Transfers where u.Account_no == b select u);

            dataGridView3.DataSource = item2.ToList();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bs = new bankmanagement_dbEntities2();
            decimal     accno = Convert.ToDecimal(accnotxt.Text);
            userAccount us    = bs.userAccounts.First(s => s.Account_no.Equals(accnotxt));

            us.Account_no = Convert.ToDecimal(accnotxt.Text);
            us.Name       = nametxt.Text;
            us.Date       = dateTimePicker1.Value.ToString();
            us.mothername = mothertxt.Text;
            us.fathername = fathertxt.Text;
            us.Phoneno    = phonetxt.Text;
            if (maleradio.Checked == true)
            {
                us.Gender = "male";
            }
            else if (femaleradio.Checked == true)
            {
                us.Gender = "female";
            }
            if (marriedradio.Checked == true)
            {
                us.m_status = "married";
            }
            else if (singleradio.Checked == true)
            {
                us.m_status = "single";
            }
            Image img = pictureBox1.Image;

            if (img.RawFormat != null)
            {
                if (ms != null)
                {
                    img.Save(ms, img.RawFormat);
                    us.picture = ms.ToArray();
                }
            }
            us.Address  = addresstxt.Text;
            us.District = distxt.Text;
            us.state    = statetxt.Text;
            bs.SaveChanges();
            MessageBox.Show("record updated");
        }
Exemple #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 con = new bankmanagement_dbEntities2();
            NewAccount ac = new NewAccount();
            deposit__  dp = new deposit__();
            decimal    no = Convert.ToDecimal(accnotxt.Text);

            dp.Name        = nametxt.Text;
            dp.old_balance = Convert.ToDecimal(oldbalancetxt.Text);
            dp.depamount   = Convert.ToDecimal(dpamounttxt.Text);
            dp.Account_no  = Convert.ToDecimal(value: accnotxt.Text);
            dp.date        = datelabel.Text;
            dp.Mode        = comboBox1.SelectedItem.ToString();
            con.deposit__.Add(dp);
            con.SaveChanges();
            var item = (from u in con.userAccounts where u.Account_no == no select u).FirstOrDefault();

            item.balance = item.balance + Convert.ToDecimal(dpamounttxt.Text);
            con.SaveChanges();
            MessageBox.Show("deposit success");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (maleradio.Checked)
            {
                gender = "male";
            }
            else if (femaleradio.Checked)
            {
                gender = "female";
            }
            if (marriedradio.Checked)
            {
                m_status = "married";
            }
            else if (singleradio.Checked)
            {
                m_status = "single";
            }
            bmd = new bankmanagement_dbEntities2();
            userAccount acc = new userAccount();

            acc.Account_no = Convert.ToDecimal(accnotxt.Text);
            acc.Name       = nametxt.Text;
            acc.Dob        = dateTimePicker1.Value.ToString();
            acc.Phoneno    = phonetxt.Text;
            acc.Address    = addresstxt.Text;
            acc.District   = disttxt.Text;
            acc.state      = comboBox1.SelectedItem.ToString();
            acc.Gender     = gender;
            acc.m_status   = m_status;
            acc.fathername = fathertxt.Text;
            acc.mothername = mothertxt.Text;
            acc.balance    = Convert.ToDecimal(balancetxt.Text);
            acc.Date       = datelal.Text;
            acc.picture    = ms.ToArray();
            _ = bmd.userAccounts.Add(acc);
            _ = bmd.SaveChanges();
            _ = MessageBox.Show("succesfull");
            this.Hide();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bankmanagement_dbEntities2 dbe = new bankmanagement_dbEntities2();

            if (oldpass.Text != string.Empty || newpass.Text != string.Empty)
            {
                Admin user1 = dbe.Admins.FirstOrDefault(a => a.username.Equals(usertxt.Text));
                if (user1 != null)
                {
                    if (user1.password.Equals(oldpass.Text))
                    {
                        user1.password = newpass.Text;
                        dbe.SaveChanges();
                        MessageBox.Show("password changed");
                    }
                    else
                    {
                        MessageBox.Show("passwordincorrect");
                    }
                }
            }
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            bs = new bankmanagement_dbEntities2();
            decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
            var     item  = bs.userAccounts.Where(a => a.Account_no == accno).FirstOrDefault();

            accnotxt.Text   = item.Account_no.ToString();
            nametxt.Text    = item.Name;
            mothertxt.Text  = item.mothername;
            fathertxt.Text  = item.fathername;
            phonetxt.Text   = item.Phoneno;
            addresstxt.Text = item.Address;
            byte[]       img = item.picture;
            MemoryStream ms  = new MemoryStream(img);

            pictureBox1.Image = Image.FromStream(ms);
            distxt.Text       = item.District;
            statetxt.Text     = item.state;
            if (item.Gender == "male")
            {
                maleradio.Checked = true;
            }
            else if (item.Gender == "female")
            {
                femaleradio.Checked = true;
            }
            if (item.m_status == "married")
            {
                marriedradio.Checked = true;
            }

            else if (item.m_status == "single")
            {
                singleradio.Checked = true;
            }
        }