Example #1
0
        public PendingApprovalViewModel GetApproval(string AssignedTo, string BatchNo, string DateFrom, string DateTo, string Type, string ApprovalPage)
        {
            PendingApprovalViewModel obj = new PendingApprovalViewModel();

            using (var db = new MainDbContext())
            {
                try
                {
                    glog.Debug("GetApproval: Entry");
                    var pendingApproval = db.Database.SqlQuery <PendingApproval>(
                        "exec RetrievePendingApproval @AssignedTo,@BatchNo,@DateFrom,@DateTo,@Type,@ApprovalPage",
                        new SqlParameter("@AssignedTo", string.IsNullOrWhiteSpace(AssignedTo) ? "" : AssignedTo),
                        new SqlParameter("@BatchNo", string.IsNullOrWhiteSpace(BatchNo) ? "" : BatchNo),
                        new SqlParameter("@Type", string.IsNullOrWhiteSpace(Type) ? "" : Type),
                        new SqlParameter("@DateFrom", string.IsNullOrWhiteSpace(DateFrom) ? "" : DateTime.ParseExact(DateFrom, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")),
                        new SqlParameter("@DateTo", string.IsNullOrWhiteSpace(DateTo) ? "" : DateTime.ParseExact(DateTo, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")),
                        new SqlParameter("@ApprovalPage", string.IsNullOrWhiteSpace(ApprovalPage) ? "" : ApprovalPage)
                        ).ToList();

                    obj.PendingApproval = pendingApproval;
                    obj.PendingCount    = pendingApproval.Count;
                }
                catch (Exception ex)
                {
                    var result = new ResultViewModel();
                    glog.Error("GetApproval Exception: " + ex.Message);
                    result.Status  = 0;
                    result.Message = "Please contact MIS, error: " + ex.Message;
                    glog.Debug("GetApproval: Exit");
                }
            }
            glog.Debug("GetApproval: Exit");
            return(obj);
        }
        public static void ApplyClassCollection(PendingApprovalViewModel pendingApprovalViewModel)
        {
            if (pendingApprovalViewModel.PendingApprovalItems != null)
            {
                // Business rule
                foreach (var pendingApprovalItem in pendingApprovalViewModel.PendingApprovalItems)
                {
                    foreach (var item in pendingApprovalItem.PendingApprovalViewItems)
                    {
                        item.ClassCollection = "pendingapprovaltablelist";

                        if (item.ExceptionItemMaxWeight != -1)
                        {
                            item.ExceptionClassCollection = item.ExceptionItemMaxWeight < 300
                                                                ? "exceptionIcon exceptionIcon0"
                                                                : "exceptionIcon exceptionIcon1";
                        }

                        if (item == pendingApprovalItem.PendingApprovalViewItems.First())
                        {
                            item.ClassCollection = item.ClassCollection + " first";
                        }

                        if (item == pendingApprovalItem.PendingApprovalViewItems.Last())
                        {
                            item.ClassCollection = item.ClassCollection + " last";
                        }
                    }
                }
            }
        }
 public ActionResult ApprovedView(string SubMenuId)
 {
     #region Check UserGroup when user direct key in URL
     if (!(_clsGlobal.CheckUserGroup(((ClaimsIdentity)User.Identity).FindFirst("UserGroupCode").Value, Convert.ToInt16(SubMenuId))))
     {
         ViewData["Message"] = "You Have No Access Rights For This Module!, error: Invalid Access Rights";
     }
     #endregion  Check UserGroup when user direct key in URL
     PendingApprovalViewModel vm = new PendingApprovalViewModel();
     vm.ApprovalPage = "IsHistory";
     SelectList lstType = new SelectList(_clsApproval.GetApprovalName());
     ViewBag.ListOfApprovalName = lstType;
     return(View(vm));
 }
 public ActionResult ReassignView(string SubMenuId)
 {
     #region Check UserGroup when user direct key in URL
     if (!(_clsGlobal.CheckUserGroup(((ClaimsIdentity)User.Identity).FindFirst("UserGroupCode").Value, Convert.ToInt16(SubMenuId))))
     {
         ViewData["Message"] = "You Have No Access Rights For This Module!, error: Invalid Access Rights";
     }
     #endregion  Check UserGroup when user direct key in URL
     PendingApprovalViewModel vm = new PendingApprovalViewModel();
     vm.ApprovalPage = "IsReassign";
     SelectList lstType = new SelectList(_clsApproval.FnRetriveApprovingOfficer(), "Value", "Text");
     ViewBag.ListOfReassignApprovalOfficer = lstType;
     return(View(vm));
 }
        public ActionResult ApprovalView(string SubMenuId)
        {
            #region Check UserGroup when user direct key in URL
            if (!(_clsGlobal.CheckUserGroup(((ClaimsIdentity)User.Identity).FindFirst("UserGroupCode").Value, Convert.ToInt16(SubMenuId))))
            {
                ViewData["Message"] = "You Have No Access Rights For This Module!, error: Invalid Access Rights";
            }
            #endregion  Check UserGroup when user direct key in URL

            PendingApprovalViewModel vm = new PendingApprovalViewModel();
            string AssignedTo           = _clsApproval.GetCurrentAssignToCode(User.Identity.Name);
            string BatchNo = String.Empty;
            vm = _clsApproval.GetApproval(AssignedTo, BatchNo, "", "", "", "IsPending");
            vm.ApprovalPage = "IsPending";
            return(View(vm));
        }
Example #6
0
        public static PendingApprovalViewModel RetrievePendingApprovalViewModel(PendingApprovalListState pendingApprovalListState, List <int> userAccountIds, int userAccountId, string searchTerm, Guid companyId, int channelId, int divisionId, Guid branchId)
        {
            if (pendingApprovalListState == null)
            {
                pendingApprovalListState = new PendingApprovalListState();
            }

            if (userAccountIds == null)
            {
                userAccountIds = new List <int>();
            }

            PendingApprovalViewData pendingApprovalViewData = LoanServiceFacade.RetrievePendingApprovalItemsView(userAccountIds,
                                                                                                                 pendingApprovalListState.CurrentPage,
                                                                                                                 pendingApprovalListState.SortColumn.GetStringValue(),
                                                                                                                 pendingApprovalListState.SortDirection,
                                                                                                                 pendingApprovalListState.ActivityType,
                                                                                                                 userAccountId,
                                                                                                                 searchTerm,
                                                                                                                 companyId,
                                                                                                                 channelId,
                                                                                                                 divisionId,
                                                                                                                 branchId
                                                                                                                 );

            if (pendingApprovalViewData == null)
            {
                pendingApprovalViewData = new PendingApprovalViewData {
                    PendingApprovalViewItems = new List <PendingApprovalViewItem>(), TotalItems = 0, TotalPages = 0
                };
            }

            PendingApprovalViewModel pendingApprovalViewModel = new PendingApprovalViewModel
            {
                ActivityTypeList     = new List <ActivityType>(Enum.GetValues(typeof(ActivityType)).Cast <ActivityType>()),
                PendingApprovalItems = pendingApprovalViewData.PendingApprovalViewItems,
                PageCount            = pendingApprovalViewData.TotalPages,
                TotalItems           = pendingApprovalViewData.TotalItems
            };

            PendingApprovalGridHelper.ProcessPagingOptions(pendingApprovalListState, pendingApprovalViewModel);
            PendingApprovalGridHelper.ApplyClassCollection(pendingApprovalViewModel);

            return(pendingApprovalViewModel);
        }
        public ActionResult OnSearchApprovedView(string AssignTo, string BatchNo, string DateFrom, string DateTo, string Type, string ApprovalPage)
        {
            PendingApprovalViewModel vm = new PendingApprovalViewModel();

            vm = _clsApproval.GetApproval(AssignTo, BatchNo, DateFrom, DateTo, Type, ApprovalPage);
            vm.ApprovalPage = !string.IsNullOrEmpty(DateFrom) ? "IsHistory" : "IsReassign";
            ViewData["NoPendingApproval"] = "";
            if (vm.PendingApproval.Count == 0 && string.IsNullOrEmpty(AssignTo))
            {
                ViewData["NoPendingApproval"] = "No approval found on selected date range. Please try another date!";
            }
            else if (vm.PendingApproval.Count == 0 && !string.IsNullOrEmpty(AssignTo))
            {
                ViewData["NoPendingApproval"] = "No approval found on selected Batch No and Approving Officer. Please try another details!";
            }

            return(PartialView("_ApprovalListPartialView", vm));
        }
        public static void ProcessPagingOptions(PendingApprovalListState pendingApprovalListState, PendingApprovalViewModel pendingApprovalViewModel)
        {
            if (pendingApprovalViewModel.PageCount % 10 == 0)
            {
                pendingApprovalViewModel.PageGroups = (pendingApprovalViewModel.PageCount / 10);
            }
            else
            {
                pendingApprovalViewModel.PageGroups = (pendingApprovalViewModel.PageCount / 10) + 1;
            }

            pendingApprovalViewModel.PageGroups = ( int )pendingApprovalViewModel.PageGroups;
            if (pendingApprovalViewModel.PageCount % 10 != 0)
            {
                pendingApprovalViewModel.LastPageItems = pendingApprovalViewModel.PageCount % 10;
            }
            else
            {
                pendingApprovalViewModel.LastPageItems = 10;
            }

            pendingApprovalViewModel.CurrentPage = pendingApprovalListState.CurrentPage;

            if (pendingApprovalViewModel.CurrentPage % 10 != 0)
            {
                pendingApprovalViewModel.StartPage = ( int )(pendingApprovalViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((pendingApprovalViewModel.CurrentPage) / 10) + 1) == pendingApprovalViewModel.PageGroups)
                {
                    pendingApprovalViewModel.EndPage      = ( int )(pendingApprovalViewModel.CurrentPage / 10) * 10 + pendingApprovalViewModel.LastPageItems;
                    pendingApprovalViewModel.LastPageDots = true;
                }
                else
                {
                    pendingApprovalViewModel.EndPage      = ( int )(pendingApprovalViewModel.CurrentPage / 10) * 10 + 10;
                    pendingApprovalViewModel.LastPageDots = false;
                }
            }
            else
            {
                pendingApprovalViewModel.StartPage = ( int )((pendingApprovalViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((pendingApprovalViewModel.CurrentPage - 1) / 10) + 1) == pendingApprovalViewModel.PageGroups)
                {
                    pendingApprovalViewModel.EndPage      = ( int )(pendingApprovalViewModel.CurrentPage / 10) * 10;
                    pendingApprovalViewModel.LastPageDots = true;
                }
                else
                {
                    pendingApprovalViewModel.EndPage      = ( int )((pendingApprovalViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    pendingApprovalViewModel.LastPageDots = false;
                }
            }
        }
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            /* State retrieval */
            PendingApprovalViewModel pendingApprovalViewModel = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null)
            {
                pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString());
            }
            else
            {
                pendingApprovalViewModel = new PendingApprovalViewModel();
            }

            PendingApprovalListState pendingApprovalListState = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null)
            {
                pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState];
            }
            else
            {
                pendingApprovalListState = new PendingApprovalListState();
            }

            UserAccount user = null;

            if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name)
            {
                user = (UserAccount)_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);
            }

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            /* parameter processing */
            Int32 newPageNumber = 0;

            if (!InputParameters.ContainsKey("Page"))
            {
                throw new ArgumentException("Page number was expected!");
            }
            else
            {
                newPageNumber = Convert.ToInt32(InputParameters["Page"]);
            }

            pendingApprovalListState.CurrentPage = newPageNumber;

            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState,
                                                                                                  _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                              ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]
                                                              : new List <int> {
            }, user.UserAccountId,
                                                                                                  searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId);


            _viewName  = "Queues/_pendingapproval";
            _viewModel = pendingApprovalViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml();
            _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState;
        }
Example #10
0
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            /* State retrieval */
            PendingApprovalViewModel pendingApprovalViewModel = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null)
            {
                pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString());
            }
            else
            {
                pendingApprovalViewModel = new PendingApprovalViewModel();
            }

            PendingApprovalListState pendingApprovalListState = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null)
            {
                pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState];
            }
            else
            {
                pendingApprovalListState = new PendingApprovalListState();
            }

            UserAccount user = null;

            if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);
            }

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            /* parameter processing */
            PendingApprovalAttribute newSortColumn;

            if (!InputParameters.ContainsKey("Column"))
            {
                throw new ArgumentException("Column value was expected!");
            }
            else
            {
                newSortColumn = ( PendingApprovalAttribute )Enum.Parse(typeof(PendingApprovalAttribute), InputParameters["Column"].ToString());
            }

            // switch direction
            if (pendingApprovalListState.SortColumn == newSortColumn && pendingApprovalListState.SortDirection == "ASC")
            {
                pendingApprovalListState.SortDirection = "DESC";
            }
            else
            {
                pendingApprovalListState.SortDirection = "ASC";
            }

            pendingApprovalListState.SortColumn  = newSortColumn;
            pendingApprovalListState.CurrentPage = 1;

            /* Command processing */
            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            var pendingApprovalViewData = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState,
                                                                                                     _httpContext.Session[SessionHelper.UserAccountIds] !=
                                                                                                     null
                                                                                    ? (List <int>)
                                                                                                     _httpContext.Session[
                                                                                                         SessionHelper.UserAccountIds]
                                                                                    : new List <int> {
            },
                                                                                                     user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId);


            if (pendingApprovalViewModel != null)
            {
                pendingApprovalViewModel.PendingApprovalItems = pendingApprovalViewData.PendingApprovalItems;
                pendingApprovalViewModel.PageCount            = pendingApprovalViewData.PageCount;
                pendingApprovalViewModel.TotalItems           = pendingApprovalViewData.TotalItems;

                PendingApprovalGridHelper.ProcessPagingOptions(pendingApprovalListState, pendingApprovalViewModel);
            }


            _viewName  = "Queues/_pendingapproval";
            _viewModel = pendingApprovalViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml();
            _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState;
        }
Example #11
0
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            PendingApprovalListState pendingApprovalListState = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.PendingApprovalListState] != null))
            {
                pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState];
            }
            else
            {
                pendingApprovalListState = new PendingApprovalListState();
            }

            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
                userFilterViewModel.FilterContext = FilterContextEnum.PendingApproval;
            }
            else
            {
                // possible state retrieval?
                userFilterViewModel = new FilterViewModel
                {
                    FilterContext = FilterContextEnum.PendingApproval
                };
            }

            Boolean refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true";

            // reset Page Number to 1st on Tab change
            if (!refresh)
            {
                pendingApprovalListState.CurrentPage = 1;
            }

            UserAccount user = null;

            if (_httpContext.Session[SessionHelper.UserData] != null)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                throw new InvalidOperationException("UserData is null");
            }

            var pendingApprovalViewModel = new PendingApprovalViewModel();

            pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState,
                                                                                                  _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                              ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]
                                                              : new List <int> {
            }, user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId);

            _viewName  = "Queues/_pendingapproval";
            _viewModel = pendingApprovalViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml();
            _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState;
            _httpContext.Session[SessionHelper.FilterViewModel]          = userFilterViewModel.ToXml();
            _httpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.PendingApproval;
        }
Example #12
0
        public IHttpActionResult Get(int familyId)
        {
            using (bkContext context = new bkContext())
            {
                Family f = context.Families.Where(x => x.FamilyID == familyId).FirstOrDefault();
                if (f == null)
                {
                    return(BadRequest("Family record cannot be loaded."));
                }

                List <bk_GetFamilyMembers_Result> members = context.bk_GetFamilyMembers(familyId).ToList();

                FamilyViewModel fvm = new FamilyViewModel();
                fvm.FamilyNative   = f.FamilyNative;
                fvm.Address1       = f.Address1;
                fvm.Address2       = f.Address2;
                fvm.CategoryID     = f.CategoryID;
                fvm.City           = f.City;
                fvm.District       = f.District;
                fvm.Country        = f.Country;
                fvm.FamilyID       = f.FamilyID;
                fvm.NukhID         = f.NukhID;
                fvm.PostalCode     = f.PostalCode;
                fvm.State          = f.State;
                fvm.HeadOfFamilyID = f.HeadOfFamilyID;
                fvm.CanEdit        = CanEditFamily(f.FamilyID);

                Member hofMember = f.Member;
                if (hofMember != null)
                {
                    fvm.HeadOfFirstName = hofMember.FirstName;
                    fvm.HeadOfLastName  = hofMember.LastName;
                }

                foreach (var item in members)
                {
                    var tmp = new FamilyMemberViewModel();

                    tmp.DOB               = item.DOB;
                    tmp.MaritalStatusId   = item.MaritalStatusID;
                    tmp.MemberID          = item.MemberID;
                    tmp.Name              = $"{item.FirstName} {item.LastName}";
                    tmp.CanEdit           = CanEditMember(f.FamilyMemberAssociations.ToList(), item.MemberID);
                    tmp.MatrimonialExists = item.MatrimonialExists.Value;
                    tmp.Gender            = item.Gender;
                    tmp.Alive             = item.Alive;
                    tmp.DOD               = item.DOD;
                    tmp.PaternalFamilyId  = item.PaternalFamilyId;
                    if (tmp.PaternalFamilyId.HasValue)
                    {
                        tmp.PaternalFamilyName = string.Format("{0}, {1}", item.PaternalFamilyName, item.PaternalFamilyAddress);
                    }

                    tmp.MaternalFamilyId = item.MaternalFamilyId;
                    if (tmp.MaternalFamilyId.HasValue)
                    {
                        tmp.MaternalFamilyName = string.Format("{0}, {1}", item.MaternalFamilyName, item.MaternalFamilyAddress);
                    }

                    if (!string.IsNullOrEmpty(item.rFirstName))
                    {
                        tmp.RelatedToName = $"{item.rFirstName} {item.rLastName}";
                    }

                    tmp.RelationTypeId  = item.RelationTypeId;
                    tmp.DefaultFamilyId = item.DefaultFamilyId;

                    fvm.Members.Add(tmp);
                }

                fvm.Members = fvm.Members.OrderByDescending(x => x.Age).ToList();

                List <bk_PendingApprovals_Result> approvals = context.bk_PendingApprovals(LoggedInMemberId).ToList();
                foreach (var item in approvals)
                {
                    var tmp = new PendingApprovalViewModel();

                    tmp.AddedByFirstName = item.AddedByFirstName;
                    tmp.AddedById        = item.AddedById;
                    tmp.AddedByLastName  = item.AddedByLastName;
                    tmp.AddedOn          = item.AddedOn;
                    tmp.AddedToFirstName = item.AddedToFirstName;
                    tmp.AddedToId        = item.AddedToId;
                    tmp.AddedToLastName  = item.AddedToLastName;
                    tmp.FamilyId         = item.FamilyId;

                    fvm.PendingApprovals.Add(tmp);
                }

                return(Ok(fvm));
            }
        }
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            /* State retrieval */
            PendingApprovalViewModel pendingApprovalViewModel = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null)
            {
                pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString());
            }
            else
            {
                pendingApprovalViewModel = new PendingApprovalViewModel();
            }

            PendingApprovalListState pendingApprovalListState = null;

            if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null)
            {
                pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState];
            }
            else
            {
                pendingApprovalListState = new PendingApprovalListState();
            }

            UserAccount user = null;

            if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);
            }

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            /* parameter processing */
            if (!InputParameters.ContainsKey("ActivityFilter"))
            {
                throw new ArgumentException("ActivityFilter value was expected!");
            }

            var newActivityFilterValue = ( GridActivityTypeFilter )Enum.Parse(typeof(GridActivityTypeFilter), InputParameters["ActivityFilter"].ToString());

            pendingApprovalListState.ActivityType = newActivityFilterValue;

            // on date filter change, reset page number
            pendingApprovalListState.CurrentPage = 1;

            /* Command processing */
            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }
            pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState,
                                                                                                  _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                                              ? (List <int>)
                                                                                                  _httpContext.Session[SessionHelper.UserAccountIds]
                                                                              : new List <int> {
            },
                                                                                                  user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId);

            _viewName  = "Queues/_pendingApproval";
            _viewModel = pendingApprovalViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml();
            _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState;
        }