public ActionResult InspectorLogin(HighAuthorityLogin inspectorlogin)
        {
            string message = "";

            ViewBag.Message = message;
            using (MortgageDbEntities dc = new MortgageDbEntities())
            {
                var v = dc.InspectorDetails.Where(a => a.EmailId == inspectorlogin.EmailId).FirstOrDefault();
                if (v != null)
                {
                    if (string.Compare((inspectorlogin.Password), v.Password) == 0)
                    {
                        Session["id"] = v.InspectorId;
                        return(RedirectToAction("index", "Home"));
                    }
                    else
                    {
                        message = "Invalid Credential provided";
                    }
                }
                else
                {
                    message = "Invalid Credential provided";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
        public ActionResult RejectForm(int ApplicationId)
        {
            using (MortgageDbEntities db = new MortgageDbEntities())
            {
                //updating status in loanForm
                var loanform = db.LoanForms.FirstOrDefault(x => x.ApplicationId == ApplicationId);
                if (loanform == null)
                {
                    throw new Exception("Invalid id: " + ApplicationId);
                }
                loanform.Status = "Rejected";
                db.LoanForms.Attach(loanform);
                var entry = db.Entry(loanform);
                entry.Property(e => e.Status).IsModified = true;

                //updating status in StatusTrack
                var status = db.StatusTracks.FirstOrDefault(x => x.ApplicationId == ApplicationId);
                status.Status = "Inspector Rejected";
                db.StatusTracks.Attach(status);
                var statustrackentry = db.Entry(status);
                statustrackentry.Property(e => e.Status).IsModified = true;

                db.SaveChanges();
                string mailbody = " < br />< br /> We are very Sorry to inform you that your Appliction is Rejected on<strong> Santander UK </ strong > " +
                                  "<br><br> you can try it later!!";
                string subjectmail = "your Application is Rejected";
                SendEmail(loanform.EmailId, mailbody, subjectmail);

                return(RedirectToAction("InspectorView"));
            }
        }
        public ActionResult AdminSectionLogIn(AdminLogin adminlogin)
        {
            string message = "";

            ViewBag.Message = message;
            using (MortgageDbEntities dc = new MortgageDbEntities())
            {
                var v = dc.AdminDetails.Where(a => a.EmailId == adminlogin.EmailId).FirstOrDefault();
                if (v != null)
                {
                    if ((string.Compare((adminlogin.Password), v.Password) == 0) && (string.Compare((adminlogin.Role), v.Role) == 0))
                    {
                        if (v.Role == "Manager")
                        {
                            Session["id"] = v.Id;
                            return(RedirectToAction("index", "Home"));
                        }
                        else if (v.Role == "Inspector")
                        {
                        }
                    }
                    else
                    {
                        message = "Invalid Credential provided";
                    }
                }
                else
                {
                    message = "Invalid Credential provided";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
 public bool IsEmailExist(string emailID)
 {
     using (MortgageDbEntities dc = new MortgageDbEntities())
     {
         var v = dc.UserRegisters.Where(a => a.EmailId == emailID).FirstOrDefault();
         return(v != null);
     }
 }
        public ActionResult AfterInspection()
        {
            using (MortgageDbEntities dc = new MortgageDbEntities())
            {
                var v = dc.LoanForms.Where(a => a.Status == "Inspector Approved");


                var loanForms = dc.LoanForms.Include(l => l.AdminDetail);
                return(View(v.ToList()));
            }
        }
        public ActionResult InspectorView()
        {
            using (MortgageDbEntities dc = new MortgageDbEntities())
            {
                int userid = int.Parse(Session["id"].ToString());
                var v      = dc.LoanForms.Where(a => a.InspectorId == userid && a.Status == "Inspector Assigned");


                var loanForms = db.LoanForms.Include(l => l.AdminDetail);
                return(View(v.ToList()));
            }
        }
        public ActionResult Registration(UserRegister userRegister)
        {
            bool   Status  = false;
            string message = "";

            // Model Validation
            if (ModelState.IsValid)
            {
                // //Email is already Exist
                var isExist = IsEmailExist(userRegister.EmailId);
                if (isExist)
                {
                    ModelState.AddModelError("Email Exist", "Email Address already exist");
                    return(View(userRegister));
                }
                #region Password Hashing
                userRegister.Password        = Crypto.Hash(userRegister.Password);
                userRegister.ConfirmPassword = Crypto.Hash(userRegister.ConfirmPassword);
                #endregion
                #region Save to Database
                using (MortgageDbEntities dc = new MortgageDbEntities())
                {
                    dc.UserRegisters.Add(userRegister);
                    dc.SaveChanges();
                    // SendVerificationLinkEmail(user.EmailID, user.ActivationCode.ToString());
                    message = "Registration Successfully done";
                    Status  = true;
                }
                #endregion
                SendEmail(userRegister.EmailId);
            }
            else

            {
                message = "InValid Request";
            }
            ViewBag.Message = message;
            ViewBag.Status  = Status;

            //Generate Activation Code

            //Password Hashing
            //Save data to database
            //Send Email to user



            return(RedirectToAction("LogIn", "LoginRegister"));
        }
Exemple #8
0
        public ActionResult LogIn(UserLogin login, string ReturnUrl)
        {
            string message = "";

            ViewBag.Message = message;
            using (MortgageDbEntities dc = new MortgageDbEntities())
            {
                var v = dc.UserRegisters.Where(a => a.EmailId == login.EmailId).FirstOrDefault();
                if (v != null)
                {
                    if (string.Compare(Crypto.Hash(login.Password), v.Password) == 0)
                    {
                        int    timeout   = login.RememerMe ? 525600 : 1;
                        var    ticket    = new FormsAuthenticationTicket(login.EmailId, login.RememerMe, timeout);
                        string encrypted = FormsAuthentication.Encrypt(ticket);
                        var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                        FormsAuthentication.SetAuthCookie(login.EmailId, false);
                        cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                        cookie.HttpOnly = true;
                        Response.Cookies.Add(cookie);
                        if (Url.IsLocalUrl(ReturnUrl))
                        {
                            return(Redirect(ReturnUrl));
                        }
                        else
                        {
                            Session["Emailid"] = login.EmailId;
                            return(RedirectToAction("index", "Home"));
                        }
                    }
                    else
                    {
                        message = "Invalid Credentials provided";
                    }
                }
                else
                {
                    message = "Invalid Credentials provided";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
        public ActionResult InsertStatus(int ApplicationId, int InspectorId, string EmailId)
        {
            using (MortgageDbEntities db = new MortgageDbEntities())
            {
                StatusTrack status = new StatusTrack();
                status.ApplicationId = ApplicationId;
                //var email = Session["Emailid"].ToString();
                var user = db.UserRegisters.Where(x => x.EmailId == EmailId).FirstOrDefault();
                status.UserId      = user.UserId;
                status.AuthorityId = InspectorId;
                status.Date        = DateTime.Now.Date;
                status.Status      = "Application in Inspection";

                db.StatusTracks.Add(status);
                db.SaveChanges();

                //return RedirectToAction("InspectorView");
                return(RedirectToAction("Index"));
            }
        }
 public ActionResult FileUpload(HttpPostedFileBase file)
 {
     if (file != null)
     {
         MortgageDbEntities db           = new MortgageDbEntities();
         string             ImageName    = System.IO.Path.GetFileName(file.FileName);
         string             physicalPath = Server.MapPath("~/Pics/" + ImageName);
         file.SaveAs(physicalPath);
         LoanForm loanform = new LoanForm();
         loanform.Name         = Request.Form["Name"];
         loanform.EmailId      = Request.Form["EmailId"];
         loanform.PhoneNo      = decimal.Parse(Request.Form["PhoneNo"]);
         loanform.Address      = Request.Form["Address"];
         loanform.Salary       = decimal.Parse(Request.Form["Salary"]);
         loanform.PropertyType = Request.Form["PropertyType"];
         loanform.DOB          = DateTime.Parse(Request.Form["DOB"]);
         loanform.ImageUrl     = ImageName;
         loanform.Status       = "Active";
         db.LoanForms.Add(loanform);
         db.SaveChanges();
     }
     return(RedirectToAction("../LoanForms/Success/"));
 }