/// <summary> /// Get All Tariff Rates based on search crateria /// </summary> public TariffRateResponse GetTariffRates(TariffRateSearchRequest tariffRateRequest) { int fromRow = (tariffRateRequest.PageNo - 1) * tariffRateRequest.PageSize; int toRow = tariffRateRequest.PageSize; var getTariffRateQuery = from tariffRate in DbSet join tariffType in db.TariffTypes on tariffRate.TariffTypeCode equals tariffType.TariffTypeCode where ((string.IsNullOrEmpty(tariffRateRequest.SearchString) || tariffRate.StandardRtMainCode.Contains(tariffRateRequest.SearchString) || tariffRate.StandardRtMainName.Contains(tariffRateRequest.SearchString)) && (!tariffRateRequest.OperationId.HasValue || tariffType.OperationId == tariffRateRequest.OperationId.Value) && (!tariffRateRequest.TariffTypeId.HasValue || tariffType.TariffTypeId == tariffRateRequest.TariffTypeId)) && !(tariffType.ChildTariffTypeId.HasValue) select new TariffRateContent { StandardRtMainId = tariffRate.StandardRtMainId, StandardRtMainCode = tariffRate.StandardRtMainCode, StandardRtMainName = tariffRate.StandardRtMainName, StandardRtMainDescription = tariffRate.StandardRtMainDescription, StartDt = tariffRate.StartDt, EndDt = tariffRate.EndDt, TariffTypeId = tariffType.TariffTypeId, TariffTypeCodeName = tariffType.TariffTypeCode + " - " + tariffType.TariffTypeName, OperationId = tariffType.OperationId, OperationCodeName = tariffType.Operation.OperationCode + " - " + tariffType.Operation.OperationName, }; IEnumerable <TariffRateContent> tariffRates = tariffRateRequest.IsAsc ? getTariffRateQuery.OrderBy(tariffRateClause[tariffRateRequest.TariffRateByOrder]) .Skip(fromRow) .Take(toRow) : getTariffRateQuery.OrderByDescending(tariffRateClause[tariffRateRequest.TariffRateByOrder]) .Skip(fromRow) .Take(toRow); return(new TariffRateResponse { TariffRates = tariffRates, TotalCount = getTariffRateQuery.Count() }); }
/// <summary> /// Get Stanadrd Rate Main /// </summary> /// <param name="tariffRateRequest"></param> /// <returns></returns> public TariffRateResponse LoadTariffRates(TariffRateSearchRequest tariffRateRequest) { return(standardRateMainRepository.GetTariffRates(tariffRateRequest)); }