示例#1
0
        //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);
        }
示例#2
0
        //JDR: Get ActiveUser variable
        public static dynamic Get()
        {
            if (!UserAccount.IsLoggedIn())
            {
                return(false);
            }
            if (UserAccount.ActiveUser == null)
            {
                return(false);
            }

            return(UserAccount.ActiveUser);
        }
示例#3
0
        //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());
        }
示例#4
0
        //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);
        }