// GET: Admin public ActionResult ManageRoles() { var viewData = new List <CustomUserData>(); var users = db.Users.ToList(); foreach (var user in users) { var newUserData = new CustomUserData(); newUserData.FirstName = user.FirstName; newUserData.LastName = user.LastName; newUserData.Email = user.Email; newUserData.RoleName = userRoleHelper.ListUserRoles(user.Id).FirstOrDefault() ?? "Unassigned"; viewData.Add(newUserData); } // Right hand side control: This data will be used to power a Dropdown List in the View ViewBag.RoleName = new SelectList(db.Roles, "Name", "Name"); // Left hand side control: This data will be used to power ListBox in the View ViewBag.UserIds = new MultiSelectList(db.Users, "Id", "Email"); return(View(viewData)); }
public void CloneTo(UGuideMsgData _cloneData) { this.strMsgText = _cloneData.strMsgText; this.nGuideNodeID = _cloneData.nGuideNodeID; this.nGuideSignSpriteID = _cloneData.nGuideSignSpriteID; this.bImmediate = _cloneData.bImmediate; this.bModal = _cloneData.bModal; this.UserData = _cloneData.UserData; }
public UGuideMsgData() { strMsgText = null; nGuideNodeID = GUIDE.EGuideNodeID.GuideNodeID_None; nGuideSignSpriteID = -1; bImmediate = false; bModal = false; UserData = null; }
public UGuideMsgData(string _strMsg, GUIDE.EGuideNodeID _nGuideNodeID, int _nGuideSignSpriteID = -1, bool _bImmediate = false, bool _bModal = false, CustomUserData _userData = null) { strMsgText = _strMsg; nGuideNodeID = _nGuideNodeID; nGuideSignSpriteID = _nGuideSignSpriteID; bImmediate = _bImmediate; bModal = _bModal; UserData = _userData; }
public ActionResult Login(User objUser) { try { User checkUser = UserFactory.Instance.GetUserData(objUser.UserName); if (checkUser != null) { if (checkUser.Password == objUser.Password) { var objCustomUserData = new CustomUserData(); objCustomUserData.UserID = checkUser.Id; objCustomUserData.UserName = checkUser.UserName; objCustomUserData.DisplayName = checkUser.FirstName + " " + checkUser.LastName; JavaScriptSerializer serializer = new JavaScriptSerializer(); string userData = serializer.Serialize(objCustomUserData); FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket( 1, objCustomUserData.UserName, DateTime.Now, DateTime.Now.AddMinutes(30), true, userData); string encTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(faCookie); return(RedirectToAction("GetAllProducts", "Product")); } else { TempData["ErrorMsg"] = "Invalid credentials. Please relogin"; } } } catch (Exception ex) { _log.LogException(ex, "Login", "HomeController"); } return(View(objUser)); }
public ActionResult ManageRoles() { var viewData = new List <CustomUserData>(); var users = db.Users.ToList(); foreach (var user in users) { var newUserData = new CustomUserData(); newUserData.FirstName = user.FirstName; newUserData.LastName = user.LastName; newUserData.Email = user.Email; newUserData.RoleName = roleHelper.ListUserRoles(user.Id).FirstOrDefault() ?? "UnAssigned"; viewData.Add(newUserData); } ViewBag.RoleName = new SelectList(db.Roles, "Name", "Name"); ViewBag.UserIds = new MultiSelectList(db.Users, "Id", "Email"); return(View(viewData)); }