public CallCenterBonusListModel GetCallCenterBonus(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords)
        {
            var callCenterbounsFilter = filter as CallCenterBonusFilter;

            if (callCenterbounsFilter == null || callCenterbounsFilter.PayPeriodId < 1 || string.IsNullOrEmpty(callCenterbounsFilter.PayRange))
            {
                totalRecords = 0;
                return(null);
            }

            var payDatesArray = callCenterbounsFilter.PayRange.Split('-');

            callCenterbounsFilter.StartDate = Convert.ToDateTime(payDatesArray[0]);
            callCenterbounsFilter.EndDate   = Convert.ToDateTime(payDatesArray[1]);

            var callCenterAgents = _payPeriodRepository.GetIdNamePairofUsersByRoleOrParentRole(callCenterbounsFilter, pageNumber, pageSize, out totalRecords);

            if (callCenterAgents.IsNullOrEmpty())
            {
                return(null);
            }

            var criterias = _payPeriodCriteriaRepository.GetByPayPeriodId(callCenterbounsFilter.PayPeriodId);

            var totalCalls = _payPeriodRepository.GetTotalCallcount(callCenterbounsFilter, callCenterAgents.Select(x => x.FirstValue));

            var totalBookedAppointment = _payPeriodRepository.GetTotalBookedCustomerCount(callCenterbounsFilter.StartDate.Value, callCenterbounsFilter.EndDate.Value, callCenterAgents.Select(x => x.FirstValue));

            var collection = _callCenterBonusReportingFactory.Create(callCenterAgents, totalCalls, totalBookedAppointment, criterias);

            return(new CallCenterBonusListModel {
                Collection = collection
            });
        }
Exemple #2
0
        public PayPeriodListModel Get(PayPeriodFilter filter, int pageNumber, int pageSize, out int totalRecords)
        {
            var payPeriod           = _payPeriodRepository.GetByFilter(filter, pageNumber, pageSize, out totalRecords);
            var payPeriodCritirieas = _payPeriodCriteriaRepository.GetByPayPeriodId(payPeriod.Select(x => x.Id).ToArray());
            var list = new List <long>();

            list.AddRange(payPeriod.Select(x => x.CreatedBy));
            list.AddRange(payPeriod.Where(x => x.ModifiedBy.HasValue).Select(x => x.ModifiedBy.Value));
            var userNamePair = _organizationRoleUserRepository.GetNameIdPairofUsers(list.ToArray());

            var listModel = new PayPeriodListModel();

            var collection = _payPeriodFactory.CreateViewModel(payPeriod, payPeriodCritirieas, userNamePair);

            collection = SetActivePayPeriod(collection);

            listModel.Collection = collection;
            listModel.Filter     = filter;

            return(listModel);
        }