public ActionResult UserType(int?Code) { if (Code.HasValue && Code > 0) { return(View(dbUser.getUserTypebyId(Code.Value))); } return(View()); }
public ActionResult UserIndex() { var reqUser = dbUser.GetAllUsers(); reqUser.Select(x => x.SMIM_UserType_ST = dbUser.getUserTypebyId(x.UserTypeId == null ? 0 : x.UserTypeId.Value)).ToList(); return(View(reqUser)); }
public ActionResult Verification(Login tt) { if (Request.UrlReferrer == null || Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1] == "") { return(RedirectToAction("Login", "Login")); } try { MvcHtmlString urlEncrypt; string dashboard = ""; string sUserName = tt.id, sPassword = tt.password; if (!Membership.ValidateUser(sUserName, sPassword)) { return(Json(new { success = false, response = "Invalid User & Password." })); } else { FormsAuthentication.SetAuthCookie(sUserName, true); Session["UserInfo"] = sUserName; var respUserDetail = dbUser.GetUserByUserName(sUserName); // db.HRMS_UserMst_ST.Include(c => c.HRMS_UserType_ST).Where(a => a.UserName == sUserName).FirstOrDefault(); var respUserTypeDetail = dbUser.getUserTypebyId(respUserDetail.UserTypeId.Value); // db.HRMS_UserType_ST.Where(x => x.UserTypeId == respUserDetail.UserTypeId).FirstOrDefault(); if (respUserTypeDetail.Type == "A") { if (respUserDetail.LoginDate == null) { urlEncrypt = Encrypted.EncodedAction(null, "ChangePassword", "Login", new { user = respUserDetail.UserId.ToString(), OrgId = respUserDetail.OrgId == null ? 0 : respUserDetail.OrgId, CompanyId = respUserDetail.CompanyId == null ? 0 : respUserDetail.CompanyId }, null); dashboard = urlEncrypt.ToString(); } else { urlEncrypt = Encrypted.EncodedAction(null, "AdminDashboard", "Home", new { user = respUserDetail.UserId.ToString(), OrgId = 0, CompanyId = 0 }, null); dashboard = urlEncrypt.ToString(); Session["url"] = dashboard; } } else { if (respUserDetail.LoginDate == null) { urlEncrypt = Encrypted.EncodedAction(null, "ChangePassword", "Login", new { user = respUserDetail.UserId.ToString(), OrgId = respUserDetail.OrgId == null ? 0 : respUserDetail.OrgId, CompanyId = respUserDetail.CompanyId == null ? 0 : respUserDetail.CompanyId }, null); dashboard = urlEncrypt.ToString(); } else { urlEncrypt = Encrypted.EncodedAction(null, "AdminDashboard", "Home", new { user = respUserDetail.UserId.ToString(), OrgId = respUserDetail.OrgId == null ? 0 : respUserDetail.OrgId, CompanyId = respUserDetail.CompanyId == null ? 0 : respUserDetail.CompanyId }, null); dashboard = urlEncrypt.ToString(); Session["url"] = dashboard; } } } return(Json(new { success = true, response = dashboard })); } catch (Exception ex) { return(Json(new { success = false, response = ex.Message })); } }