public ActionResult LoginIn(LoginINM login) { // if (ModelState.IsValid) // { // if (login.UserName == "Admin" && login.Pwd == "Admin") // { // Session["GMS"] = "Y"; // Session["EPS"] = "Y"; // Session["OMS"] = "Y"; // Session["UserName"] = "******"; // Session["UserId"] = 102; // Session["ProfileId"] = 1; // //Session["ProfileCode"] = result.ProfileCode; // //Session["ProfileName"] = result.ProfileName; // Session["SessionId"] = Session.SessionID; // Session["IpAddress"] = HttpContext.Request.UserHostAddress; // //List<Menudetails_get_Result> menuresult = new List<Menudetails_get_Result>(); ; // //var menudb = entity.Menudetails_get((int)Session["ProfileId"], (string)Session["GMS"], (string)Session["EPS"], (string)Session["OMS"]).ToList(); // //foreach (Menudetails_get_Result mrs in menudb) // //{ // // menuresult.Add(mrs); // //} // //Session["MenuMaster"] = menuresult; // return RedirectToAction("Index", "Dashboard"); // } // else // { // TempData["StatusMsg"] = "IncorrectName and Password"; // } // } // else // { // TempData["StatusMsg"] = "Please fill the details Properly.!"; // } // return View("login"); //} return(RedirectToAction("Index", "Dashboard")); }
public ActionResult LoginIn(LoginINM login) { if (login != null) { AES256 aES256Enc = new AES256(); login.Pwd = aES256Enc.EncryptString(login.Pwd.Trim(), ConfigurationManager.AppSettings["AESkey1"].ToString()); using (SecurityDBEntities gMSEntities = new SecurityDBEntities()) { List <logindetails_get_Result> dbresult = gMSEntities.logindetails_get(login.UserName, login.Pwd).ToList(); if (dbresult.Count > 0) { foreach (logindetails_get_Result result in dbresult) { SessionSet session = new SessionSet(); session.SeeionSetLogin(result.UserId, result.UserName, result.Pwd, result.ProfileId, result.ProfileCode, result.ProfileName, result.CustName, result.ClientName, result.BranchName, result.ClustrNme, result.SiteName, result.ClientId, result.CustId, result.BranchId, result.ClustrId, result.SiteId); } //List<Menudetails_get_Result> menuresult = new List<Menudetails_get_Result>(); //var menudb = gMSEntities.Menudetails_get((int)Session["ProfileId"], Session["GMS"].ToString(), Session["EPS"].ToString(), Session["OMS"].ToString()); //foreach (Menudetails_get_Result mrs in menudb) //{ // menuresult.Add(mrs); //} //Session["MenuMaster"] = menuresult; //Session["SessionId"] = Session.SessionID; return(RedirectToAction("Index", "Home")); } else { TempData["StatusMsg"] = "Invalid User and Password."; return(RedirectToAction("Login", "Login")); } } } else { TempData["StatusMsg"] = "UserName and Password cannot be Empty"; } return(RedirectToAction("Login", "Login")); }