Ejemplo n.º 1
0
        //To Update the deposit details and save into th db
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            try
            {
                banking_dbEntities1 context = new banking_dbEntities1();
                NewAccountForm      acc     = new NewAccountForm();
                Deposit             dp      = new Deposit();
                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.DipAmount  = Convert.ToDecimal(amounttxt.Text);
                context.Deposits.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("Deposited Money Sucessfully");
                MessageBox.Show("Deposited Money Sucessfully", "Deposit information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception occurred");
            }
        }
Ejemplo n.º 2
0
 //function to accept account no intrest rate etc and start FD calculation
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         banking_dbEntities1 dbe   = new banking_dbEntities1();
         decimal             accno = Convert.ToDecimal(accnotxt.Text);
         var accounts = dbe.userAccounts.Where(x => x.Account_No == accno).SingleOrDefault();
         FD  fdform   = new FD();
         fdform.Accoun_no       = (accnotxt.Text);
         fdform.mode            = comboBox1.SelectedItem.ToString();
         fdform.rupees          = Convert.ToDecimal(rupeestxt.Text);
         fdform.period          = Convert.ToInt32(periodtxt.Text);
         fdform.intrest_rate    = Convert.ToDecimal(intresttxt.Text);
         fdform.start_date      = DateTime.UtcNow.ToString("MM/dd/yyy");
         fdform.Maturity_date   = (DateTime.UtcNow.AddDays(Convert.ToInt32(periodtxt.Text))).ToString("MM/dd/yyy");
         fdform.Maturity_amount = ((Convert.ToDecimal(rupeestxt.Text) * Convert.ToInt32(periodtxt.Text) * Convert.ToDecimal(intresttxt.Text)) /
                                   (100 * 12 * 30)) + (Convert.ToDecimal(rupeestxt.Text));
         dbe.FDs.Add(fdform);
         decimal amount      = Convert.ToDecimal(rupeestxt.Text);
         decimal totalamount = Convert.ToDecimal(accounts.balance);
         decimal fdamount    = totalamount - amount;
         accounts.balance          = fdamount;
         dbe.Entry(accounts).State = EntityState.Modified;
         //dbe.userAccounts.Add(accounts);
         dbe.SaveChanges();
         //MessageBox.Show("FD Started Now");
         MessageBox.Show("FD Started Now", "FD information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception occurred");
     }
 }
Ejemplo n.º 3
0
 //updates the account holder details
 private void UpdateButton_Click(object sender, EventArgs e)
 {
     try
     {
         dbe = new banking_dbEntities1();
         decimal     accountno   = Convert.ToDecimal(acctxt.Text);
         userAccount useraccount = dbe.userAccounts.First(s => s.Account_No.Equals(accountno));
         useraccount.Account_No = Convert.ToDecimal(acctxt.Text);
         useraccount.Name       = Nametxt.Text;
         useraccount.Date       = dateTimePicker1.Value.ToString();
         useraccount.MotherName = mothertxt.Text;
         useraccount.FatherName = fathertxt.Text;
         useraccount.Phoneno    = phonetxt.Text;
         if (maleradio.Checked == true)
         {
             useraccount.Gender = "male";
         }
         else
         {
             if (femaleradio.Checked == true)
             {
                 useraccount.Gender = "female";
             }
         }
         if (marriedradio.Checked == true)
         {
             useraccount.martial_status = "married";
         }
         else
         {
             if (unmarriedradio.Checked == true)
             {
                 useraccount.martial_status = "unmarried";
             }
         }
         Image img = pictureBox1.Image;
         if (img.RawFormat != null)
         {
             if (ms != null)
             {
                 img.Save(ms, img.RawFormat);
                 useraccount.Picture = ms.ToArray();
             }
         }
         useraccount.Address  = addresstxt.Text;
         useraccount.District = disttxt.Text;
         useraccount.State    = statetxt.Text;
         dbe.SaveChanges();
         MessageBox.Show("Record updated", "Record information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception occurred");
     }
 }
 //save new account details of the user and store to db
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         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 = "unmarried";
         }
         BSE = new banking_dbEntities1();
         userAccount acc = new userAccount();
         acc.Account_No     = Convert.ToDecimal(accnotext.Text);
         acc.Name           = nametext.Text;
         acc.DOB            = dateTimePicker1.Value.ToString();
         acc.Phoneno        = phonetext.Text;
         acc.Address        = addresstext.Text;
         acc.District       = districttext.Text;
         acc.State          = comboBox1.SelectedItem.ToString();
         acc.Gender         = gender;
         acc.martial_status = m_status;
         acc.MotherName     = mothertext.Text;
         acc.FatherName     = fathertext.Text;
         acc.balance        = Convert.ToDecimal(balancetext.Text);
         //acc.Date = datel
         acc.Picture = ms.ToArray();
         BSE.userAccounts.Add(acc);
         BSE.SaveChanges();
         //MessageBox.Show("file saved");
         MessageBox.Show("File Saved", "File information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception occurred");
     }
 }
Ejemplo n.º 5
0
 //deletes the details of the account
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         bi.RemoveAt(UpdateGridView.SelectedRows[0].Index);
         dbe = new banking_dbEntities1();
         decimal     a   = Convert.ToDecimal(acctxt.Text);
         userAccount acc = dbe.userAccounts.First(s => s.Account_No.Equals(a));
         dbe.userAccounts.Remove(acc);
         dbe.SaveChanges();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception occurred");
     }
 }
Ejemplo n.º 6
0
 //to let the user change password
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         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(usrtxt.Text));
             if (user1 != null)
             {
                 if (user1.Password.Equals(oldpass.Text))
                 {
                     user1.Password = newpass.Text;
                     dbe.SaveChanges();
                     //MessageBox.Show("Password changed successfully");
                     MessageBox.Show("Password changed successfully", "Password information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     //MessageBox.Show("Password Incorrect");
                     MessageBox.Show("Password Incorrect", "Password information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 //MessageBox.Show("Password Incorrect");
                 MessageBox.Show("UserName is a required field", "Username Needed", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             //MessageBox.Show("Password Incorrect");
             MessageBox.Show("Mandatory Values can not be blank", "Mandatory Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception occurred");
     }
 }
Ejemplo n.º 7
0
        //to commit the changes of transferring money from one account to the other
        private void TransferButton_Click(object sender, EventArgs e)
        {
            try
            {
                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 Successfull");
                    MessageBox.Show("Transfer Money Successfull", "Money Transfer information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception occurred");
            }
        }