public ActionResult ManageCallCenterTeam(CallCenterTeamListModelFilter filter = null, int pageNumber = 1)
        {
            try
            {
                int totalRecords;
                var model = _callCenterTeamService.GetCallCenterTeams(pageNumber, _pageSize, filter, out totalRecords) ??
                            new CallCenterTeamListModel();

                model.Filter = filter;

                var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
                Func <int, string> urlFunc =
                    pn =>
                    Url.Action(currentAction,
                               new
                {
                    pageNumber = pn,
                    filter.Name
                });

                model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);

                IoC.Resolve <ILogManager>().GetLogger <Global>().Info("Call Upload going to return view @" + DateTime.Now);

                return(View(model));
            }
            catch (Exception ex)
            {
                IoC.Resolve <ILogManager>().GetLogger <Global>().Error(ex.Message);
                IoC.Resolve <ILogManager>().GetLogger <Global>().Error("Call Center Team Detail Stack Trace :" + ex.StackTrace);
                var model = new CallCenterTeamListModel();
                model.Filter = filter;
                return(View(model));
            }
        }
Esempio n. 2
0
        public IEnumerable <CallCenterTeam> GetByFilter(int pageNumber, int pageSize, CallCenterTeamListModelFilter filter, out int totalRecords)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                if (filter == null)
                {
                    totalRecords = linqMetaData.CallCenterTeam.Count();

                    var entities = linqMetaData.CallCenterTeam.Where(x => x.IsActive).OrderByDescending(p => p.DateCreated).TakePage(pageNumber, pageSize).Select(x => x).ToArray();
                    return(AutoMapper.Mapper.Map <IEnumerable <CallCenterTeamEntity>, IEnumerable <CallCenterTeam> >(entities));
                }
                else
                {
                    var query = (from c in linqMetaData.CallCenterTeam where c.IsActive select c);

                    if (!string.IsNullOrEmpty(filter.Name))
                    {
                        query = (from c in query
                                 where c.Name.Contains(filter.Name.Trim())
                                 select c);
                    }
                    totalRecords = query.Count();
                    var entities = query.OrderByDescending(p => p.DateCreated).TakePage(pageNumber, pageSize).Select(x => x).ToArray();
                    return(AutoMapper.Mapper.Map <IEnumerable <CallCenterTeamEntity>, IEnumerable <CallCenterTeam> >(entities));
                }
            }
        }