//=============================================================================================== public ActionResult CreateCustomerPolicy() { if (Session["id"] != null) { //Get Customer int id = (int)Session["id"]; CustomerinfoDAORequest request = new CustomerinfoDAORequest(); CustomerinfoViewModel customer = request.GetCustomerById(id); ViewData["Customers"] = customer; //Get Policy int policyID = (int)TempData["PolicyID"]; PolicyDAORequest request1 = new PolicyDAORequest(); PolicyViewModel policy = request1.GetPolicyById(policyID); ViewData["Policies"] = policy; ViewData["Brands"] = GetBrandList(); //Get Total Payment PolicyTypeDAORequest request2 = new PolicyTypeDAORequest(); PolicytypeViewModel type = request2.GetTypeById(policy.policytypeid); ViewBag.Price = (decimal)(type.price * policy.policyduration); return(View()); } return(View()); }
public ActionResult UpdatePassword() { int id = (int)Session["id"]; string oldPassword = Request.Params["oldPassword"]; string newPassword = Request.Params["newPassword"]; string reNewPassword = Request.Params["reNewPassword"]; CustomerinfoDAORequest request = new CustomerinfoDAORequest(); var customer = request.GetCustomerById(id); if (!CheckNullField(oldPassword, newPassword, reNewPassword)) { if (CheckOldPassword(customer.password, oldPassword)) { if (CheckMatchNewPassword(newPassword, reNewPassword)) { customer.password = PasswordSecurity.Encrypt(newPassword); request.Update(customer); return(RedirectToAction("Index")); } else { TempData["Alert"] = "New password not match"; return(RedirectToAction("ChangePassword")); } } else { TempData["Alert"] = "Old Password is not corrent"; return(RedirectToAction("ChangePassword")); } } else { TempData["Alert"] = "Please Enter All Of Field"; return(RedirectToAction("ChangePassword")); } }