private void SetSessionData(int empID, int roleID)
        {
            if (HttpContext.Current.Session[SessionVariables.EmployeeListUnderCurrentUser] == null)
            {
                List <int> modulesToBeChecked = new List <int>();
                DateTime   DateFrom           = DateTime.Now;
                DateTime   DateTo             = DateTime.Now;

                var roleMaster = EmpBusinessInstance.GetRoleMaster();
                HttpContext.Current.Session[SessionVariables.RoleMasters] = roleMaster.ToList();
            }

            //Get UserModuleList
            var userModules = EmpBusinessInstance.GetUserWebModules(empID);
        }
Exemple #2
0
        public ActionResult Index(WeddingViewModel model)
        {
            bool isSuccess = false;

            ExceptionEngine.AppExceptionManager.Process(() =>
            {
                isSuccess = EmpBusinessInstance.UpdateUserProfile(model.userProfile);
                //Update User session so that values can be updated.
                Session[PageConstants.SESSION_PROFILE_KEY] = EmpBusinessInstance.DisplayUserProfile(model.userProfile.UserID);

                if (isSuccess)
                {
                    ViewBag.Message = "User successfully updated.";
                }
                else
                {
                    ViewBag.ErrMessage = "OOPS something went wrong. Please try again later!";
                }
                ViewBag.isSuccess = isSuccess;
                ViewBag.ShowPopup = true;
            }, AspectEnums.ExceptionPolicyName.ServiceExceptionPolicy.ToString());
            return(View(model));
        }
Exemple #3
0
        public ActionResult Index()
        {
            UserProfileBO profile = new UserProfileBO();
            //UserWeddingSubscriptionBO weddingProfile = new UserWeddingSubscriptionBO();
            WeddingViewModel WVM = new WeddingViewModel();
            var weddingProfile   = Session[PageConstants.SESSION_WEDDING_PROFILE] as List <UserWeddingSubscriptionBO>;

            WVM.listTemplates     = weddingProfile.Select(x => x.TemplateMaster).ToList();
            WVM.userSubscriptions = weddingProfile;
            foreach (var temp in WVM.listTemplates)
            {
                temp.Weddings = WeddingBusinessInstance.GetUserWeddingDetail(UserID).Where(x => x.TemplateID == temp.TemplateID && x.IsDeleted == false).ToList();
            }
            if (Session[PageConstants.SESSION_PROFILE_KEY] == null)
            {
                WVM.userProfile = EmpBusinessInstance.DisplayUserProfile(UserID);
            }
            else
            {
                WVM.userProfile = Session[PageConstants.SESSION_PROFILE_KEY] as UserProfileBO;
            }

            return(View(WVM));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpContext requestContext = HttpContext.Current;

            bool IsValidUserSession = false;

            if (requestContext.Session[SessionVariables.AuthToken] != null && requestContext.Request.Cookies[CookieVariables.AuthToken] != null)
            {
                if (requestContext.Session[SessionVariables.AuthToken].ToString().Equals(requestContext.Request.Cookies[CookieVariables.AuthToken].Value))
                {
                    if (!(requestContext.Session[PageConstants.SESSION_USER_ID] == null || requestContext.Session[PageConstants.SESSION_ADMIN] == null))
                    {
                        #region  Validation for multiple session
                        var dailyLoginHistory = EmpBusinessInstance.GetActiveLogin((int)requestContext.Session[PageConstants.SESSION_USER_ID], (int)AspectEnums.AnnouncementDevice.Console);
                        if (dailyLoginHistory.SessionID == requestContext.Session.SessionID || requestContext.Session[PageConstants.SESSION_ADMIN] != null)
                        {
                            IsValidUserSession = true;
                            EmpProfile         = (UserProfileBO)requestContext.Session[PageConstants.SESSION_PROFILE_KEY];
                            EmpID  = (int)requestContext.Session[PageConstants.SESSION_USER_ID];
                            RoleID = (int)EmpProfile.RoleID;
                            SetSessionData(EmpID, RoleID);
                        }
                        #endregion
                    }
                }
            }
            if (!IsValidUserSession)
            {
                string loginURL = "~/Account/Login";
                //string loginURL = string.Format(AppUtil.GetAppSettings(AspectEnums.ConfigKeys.LoginURL), AppUtil.GetAppSettings(AspectEnums.ConfigKeys.HostName));
                loginURL             = string.Format("~/Account/Login?ReturnUrl={0}", HttpUtility.UrlEncode(requestContext.Request.RawUrl));
                filterContext.Result = new RedirectResult(loginURL);
                return;
            }
            base.OnActionExecuting(filterContext);
        }
Exemple #5
0
        private void GetRoleMaster()
        {
            var roleMaster = EmpBusinessInstance.GetRoleMaster();

            HttpContext.Session[SessionVariables.RoleMasters] = roleMaster.ToList();
        }