//JDR: Overload 2: Verify if active user in seccion, also set loggedInPathLocation public static bool IsLoggedIn(System.Web.Mvc.Controller CurrentController) { if (UserAccount.IsLoggedIn()) { return(true); } //JDR: user is not loggedIn so Set LoggedInLocation for when he logges in UserAccount.SetLoggedInPathLocation(CurrentController); return(false); }
//JDR: Get ActiveUser variable public static dynamic Get() { if (!UserAccount.IsLoggedIn()) { return(false); } if (UserAccount.ActiveUser == null) { return(false); } return(UserAccount.ActiveUser); }
//JDR: Get specific element from ActiveUser object public static string Get(string element) { if (!UserAccount.IsLoggedIn()) { return(""); } if (UserAccount.ActiveUser == null) { return(""); } //JDR:Probably should have a logic here to verify if element exist //....... //JDR: Return element from object as string return(UserAccount.Get().GetType().GetProperty(element).GetValue(UserAccount.Get(), null).ToString()); }
//JDR: OVERLOAD 1: Private method to set ActiveUser using User model object or session private static bool SetActiveUser() { if (!UserAccount.IsLoggedIn()) { return(false); } //JDR: Set static variable for active user var activeUser = new { ID = HttpContext.Current.Session["UserID"], Email = HttpContext.Current.Session["UserEmail"], Name = HttpContext.Current.Session["UserName"] }; //JDR: Set static variable for active user UserAccount.Set(activeUser); return(true); }