public ActionResult Create([Bind(Include = "BillPayID,Account_No,PayeeID,Amount,ScheduleDate,Period,ModifyDate")] BillPay billPay)
        {
            if (Session["Email"] != null)
            {
                if (ModelState.IsValid)
                {
                    string email = Session["Email"].ToString();
                    var    res   = db.Account_Master_174797_Project.Where(a => a.Email.Equals(email)).First();
                    if (res.Balance > Convert.ToDouble(billPay.Amount))
                    {
                        res.Balance = res.Balance - Convert.ToDouble(billPay.Amount);
                        db.BillPays.Add(billPay);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ViewBag.Message("", "InSufficient Balance");
                    }
                }
                else
                {
                    ViewBag.Message("", "Payment not done, please check gain");
                }

                ViewBag.Account_No = new SelectList(db.Account_Master_174797_Project, "Account_No", "Account_Type", billPay.Account_No);
                ViewBag.PayeeID    = new SelectList(db.Payees, "PayeeID", "PayeeName", billPay.PayeeID);
                return(View(billPay));
            }
            else
            {
                return(RedirectToAction("LogIn", "Registration"));
            }
        }
        public ActionResult Create([Bind(Include = "PayeeID,PayeeName,Address,City,State,PostCode,Phone,ModifyDate")] Payee payee)
        {
            if (Session["Email"] != null)
            {
                if (ModelState.IsValid)
                {
                    db.Payees.Add(payee);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View(payee));
            }
            else
            {
                return(RedirectToAction("LogIn", "Registration"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Check_ID,Account_no,phoneno,address")] Check_174797_Project check_174797_Project)
        {
            if (Session["Email"] != null)
            {
                if (ModelState.IsValid)
                {
                    db.Check_174797_Project.Add(check_174797_Project);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }

                ViewBag.Account_no = new SelectList(db.Account_Master_174797_Project, "Account_No", "Account_Type", check_174797_Project.Account_no);

                return(View(check_174797_Project));
            }
            else
            {
                return(RedirectToAction("LogIn", "Registration"));
            }
        }
        public ActionResult Loan(Models.Loan_174797_Project user)
        {
            if (Session["Email"] != null)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        using (var db = new Training_20Feb_MumbaiEntities2())
                        {
                            var newUser = db.Loan_174797_Project.Create();
                            newUser.AccountID      = user.AccountID;
                            newUser.Email          = user.Email;
                            newUser.TypeofLoan     = user.TypeofLoan;
                            newUser.Loanammount    = user.Loanammount;
                            newUser.DurationofLoan = user.DurationofLoan;

                            newUser.EMI = user.EMI;
                            newUser.Applicationstatus = "In Progress...";

                            db.Loan_174797_Project.Add(newUser);
                            db.SaveChanges();
                            ViewBag.Message = "Successfully applied for the laon";
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Data is not correct");
                    }
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException e)
                {
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                          eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                              ve.PropertyName, ve.ErrorMessage);
                        }
                    }
                    throw;
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("LogIn", "Registration"));
            }
        }
Exemplo n.º 5
0
 public ActionResult Create([Bind(Include = "Transaction_ID,DateofTransaction,TypeofTransaction,Account_No,Amount")] Transactions_174797_Project transactions_174797_Project)
 {
     if (Session["Email"] != null)
     {
         if (ModelState.IsValid)
         {
             string email = Session["Email"].ToString();
             var    res   = db.Account_Master_174797_Project.Where(a => a.Email.Equals(email)).First();
             if (transactions_174797_Project.TypeofTransaction == "Withdraw")
             {
                 if (res.Balance > Convert.ToDouble(transactions_174797_Project.Amount))
                 {
                     res.Balance = res.Balance - Convert.ToDouble(transactions_174797_Project.Amount);
                     db.Transactions_174797_Project.Add(transactions_174797_Project);
                     db.SaveChanges();
                     return(RedirectToAction("Index"));
                 }
                 else
                 {
                     ViewBag.Message("", "InSufficient Balance");
                 }
             }
             else if (transactions_174797_Project.TypeofTransaction == "Deposit" || transactions_174797_Project.TypeofTransaction == "DD")
             {
                 res.Balance = res.Balance + Convert.ToDouble(transactions_174797_Project.Amount);
                 db.Transactions_174797_Project.Add(transactions_174797_Project);
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
         }
         ViewBag.Account_No = new SelectList(db.Account_Master_174797_Project, "Account_No", "Account_Type", transactions_174797_Project.Account_No);
         return(View(transactions_174797_Project));
     }
     else
     {
         return(RedirectToAction("LogIn", "Registration"));
     }
 }
Exemplo n.º 6
0
        public ActionResult ForgotPassword(string Email, string PassWord)
        {
            Training_20Feb_MumbaiEntities2 tr = new Training_20Feb_MumbaiEntities2();
            var details = tr.Account_Master_174797_Project.Single(u => u.Email == Email);

            if (details != null)
            {
                details.PassWord = PassWord;
                if (TryUpdateModel(details))
                {
                    tr.SaveChanges();
                    return(RedirectToAction("LogIn"));
                }
            }
            return(View());
        }
Exemplo n.º 7
0
 public ActionResult Register(Models.Account_Master_174797_Project user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var db = new Training_20Feb_MumbaiEntities2())
             {
                 var newUser = db.Account_Master_174797_Project.Create();
                 newUser.Account_No   = user.Account_No;
                 newUser.Account_Type = user.Account_Type;
                 newUser.Username     = user.Username;
                 newUser.PassWord     = user.PassWord;
                 //newUser.Balance = user.Balance;
                 newUser.Balance           = 10000;
                 newUser.Opening_Date      = user.Opening_Date;
                 newUser.Email             = user.Email;
                 newUser.HouseAddress      = user.HouseAddress;
                 newUser.Pancard_no        = user.Pancard_no;
                 newUser.AccountaccessMode = user.AccountaccessMode;
                 db.Account_Master_174797_Project.Add(newUser);
                 db.SaveChanges();
                 return(RedirectToAction("LogIn", "Registration"));
             }
         }
         else
         {
             ModelState.AddModelError("", "Data is not correct");
         }
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                               eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                   ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
     return(View());
 }
Exemplo n.º 8
0
 public BillPay CreateBillPay(int accountNo, int payeeId, decimal amount, DateTime scheduleDate, string period)
 {
     try
     {
         using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2())
         {
             BillPay billPay = new BillPay();
             billPay.Account_No   = accountNo;
             billPay.PayeeID      = payeeId;
             billPay.Amount       = amount;
             billPay.ScheduleDate = scheduleDate;
             billPay.Period       = period;
             billPay.Status       = "Y";
             billPay.ModifyDate   = DateTime.Now;
             db.BillPays.Add(billPay);
             db.SaveChanges();
             return(billPay);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }