/// <summary> /// Get All Service Rates based on search crateria /// </summary> public ServiceRateSearchResponse GetServiceRates(ServiceRateSearchRequest serviceRateSearchRequest) { int fromRow = (serviceRateSearchRequest.PageNo - 1) * serviceRateSearchRequest.PageSize; int toRow = serviceRateSearchRequest.PageSize; var getInsuranceRateQuery = from serviceRtMain in DbSet join tariffType in db.TariffTypes on serviceRtMain.TariffTypeCode equals tariffType.TariffTypeCode where ((string.IsNullOrEmpty(serviceRateSearchRequest.SearchString) || serviceRtMain.ServiceRtMainCode.Contains(serviceRateSearchRequest.SearchString) || serviceRtMain.ServiceRtMainName.Contains(serviceRateSearchRequest.SearchString)) && (!serviceRateSearchRequest.OperationId.HasValue || tariffType.OperationId == serviceRateSearchRequest.OperationId.Value) && (!serviceRateSearchRequest.TariffTypeId.HasValue || tariffType.TariffTypeId == serviceRateSearchRequest.TariffTypeId)) && !(tariffType.ChildTariffTypeId.HasValue) select new ServiceRtMainContent { ServiceRtMainId = serviceRtMain.ServiceRtMainId, ServiceRtMainCode = serviceRtMain.ServiceRtMainCode, ServiceRtMainName = serviceRtMain.ServiceRtMainName, ServiceRtMainDescription = serviceRtMain.ServiceRtMainDescription, StartDt = serviceRtMain.StartDt, TariffTypeId = tariffType.TariffTypeId, TariffTypeCodeName = tariffType.TariffTypeCode + " - " + tariffType.TariffTypeName, OperationId = tariffType.OperationId, OperationCodeName = tariffType.Operation.OperationCode + " - " + tariffType.Operation.OperationName, }; IEnumerable <ServiceRtMainContent> insuranceRtMains = serviceRateSearchRequest.IsAsc ? getInsuranceRateQuery.OrderBy(serviceRateClause[serviceRateSearchRequest.ServiceRateByOrder]) .Skip(fromRow) .Take(toRow) : getInsuranceRateQuery.OrderByDescending(serviceRateClause[serviceRateSearchRequest.ServiceRateByOrder]) .Skip(fromRow) .Take(toRow); return(new ServiceRateSearchResponse { ServiceRtMains = insuranceRtMains, TotalCount = getInsuranceRateQuery.Count() }); }
/// <summary> /// Load Service Rate Mains /// </summary> /// <param name="request"></param> /// <returns></returns> public ServiceRateSearchResponse LoadServiceRates(ServiceRateSearchRequest request) { return(serviceRtMainRepository.GetServiceRates(request)); }