示例#1
0
        public async Task <GetAgentCarriersManagementDto> getAgentCarriersManagement(GridChildInitialDto gridInitialDto)
        {
            int pageNo = gridInitialDto.pageNo;

            if (gridInitialDto.pageNo < 1)
            {
                pageNo = 1;
            }

            IQueryable <AgentCarrier> oAgentCarriers = _AgentCarriers.Include(i => i.carrier)
                                                       .Include(i => i.location)
                                                       .Where(i => i.agentId == gridInitialDto.parentId)
                                                       .AsQueryable();

            if (!string.IsNullOrEmpty(gridInitialDto.filter))
            {
                oAgentCarriers = oAgentCarriers
                                 .Where(w => w.carrier.fullName.Contains(gridInitialDto.filter) == true);
            }

            int totalRecordCount = await oAgentCarriers.AsNoTracking().CountAsync();

            GetAgentCarriersManagementDto oAgentCarriersManagDto = new GetAgentCarriersManagementDto();

            if (totalRecordCount != 0)
            {
                int totalPages = (int)Math.Ceiling((double)totalRecordCount / gridInitialDto.recordCountPerPage);

                if (pageNo > totalPages)
                {
                    pageNo = totalPages;
                }


                oAgentCarriersManagDto.getAgentCarriersDto = Mapper.Map <IEnumerable <AgentCarrier>, List <GetAgentCarriersDto> >
                                                                 (await oAgentCarriers.GetPageRecords(pageNo, gridInitialDto.recordCountPerPage).ToListAsync());

                oAgentCarriersManagDto.currentPage      = pageNo;
                oAgentCarriersManagDto.totalRecordCount = totalRecordCount;
            }
            oAgentCarriersManagDto.title = gridInitialDto.parentTitle;
            return(oAgentCarriersManagDto);
        }
示例#2
0
        public async Task <GetNegotiationplansManagementDto> getNegotiationplansManagement(GridChildInitialDto gridInitialDto)
        {
            int pageNo = gridInitialDto.pageNo;

            if (gridInitialDto.pageNo < 1)
            {
                pageNo = 1;
            }

            IQueryable <Negotiationplan> oNegotiationplans = _Negotiationplans.Where(i => i.negotiationId == gridInitialDto.parentId).AsQueryable();

            if (!string.IsNullOrEmpty(gridInitialDto.filter))
            {
                oNegotiationplans = oNegotiationplans
                                    .Where(w => w.planName.Contains(gridInitialDto.filter) == true);
            }

            int totalRecordCount = await oNegotiationplans.AsNoTracking().CountAsync();

            GetNegotiationplansManagementDto oGetNegotiationplansManagementDto = new GetNegotiationplansManagementDto();

            if (totalRecordCount != 0)
            {
                int totalPages = (int)Math.Ceiling((double)totalRecordCount / gridInitialDto.recordCountPerPage);

                if (pageNo > totalPages)
                {
                    pageNo = totalPages;
                }


                oGetNegotiationplansManagementDto.getNegotiationplansDto = Mapper.Map <IEnumerable <Negotiationplan>, List <GetNegotiationplansDto> >
                                                                               (await oNegotiationplans.GetPageRecords(pageNo, gridInitialDto.recordCountPerPage).ToListAsync());

                oGetNegotiationplansManagementDto.currentPage      = pageNo;
                oGetNegotiationplansManagementDto.totalRecordCount = totalRecordCount;
            }

            oGetNegotiationplansManagementDto.title           = gridInitialDto.parentTitle;
            oGetNegotiationplansManagementDto.parent_ParentId = gridInitialDto.parentId;

            return(oGetNegotiationplansManagementDto);
        }