public List <MST_SALES_VOLUME> GetSalesVolume(SalesVolumeParamInput filter) { Expression <Func <MST_SALES_VOLUME, bool> > queryFilter = PredicateHelper.True <MST_SALES_VOLUME>(); if (filter != null) { if (filter.MonthFrom > 0) { queryFilter = queryFilter.And(c => c.MONTH >= filter.MonthFrom); } if (filter.MonthTo > 0) { queryFilter = queryFilter.And(c => c.MONTH <= filter.MonthTo); } if (filter.YearFrom > 0) { queryFilter = queryFilter.And(c => c.YEAR >= filter.YearFrom); } if (filter.YearTo > 0) { queryFilter = queryFilter.And(c => c.YEAR <= filter.YearTo); } if (!string.IsNullOrEmpty(filter.Type)) { queryFilter = queryFilter.And(c => c.TYPE.ToUpper() == filter.Type.ToUpper()); } if (!string.IsNullOrEmpty(filter.Regional)) { queryFilter = queryFilter.And(c => c.REGION.ToUpper() == filter.Regional.ToUpper()); } } return(_SalesVolumeRepository.Get(queryFilter, null, "").ToList()); }
private Expression <Func <REVERSAL, bool> > ProcessQueryFilter(ReversalGetByParamInput input) { Expression <Func <REVERSAL, bool> > queryFilter = PredicateHelper.True <REVERSAL>(); if (!string.IsNullOrEmpty(input.DateProduction)) { var dt = Convert.ToDateTime(input.DateProduction); queryFilter = queryFilter.And(c => c.PRODUCTION_DATE == dt); } if (!string.IsNullOrEmpty(input.PlantId)) { queryFilter = queryFilter.And(c => c.WERKS == input.PlantId); } if (!string.IsNullOrEmpty(input.UserId)) { if (input.UserRole != Enums.UserRole.Administrator) { queryFilter = queryFilter.And(c => input.ListUserPlants.Contains(c.WERKS)); } } return(queryFilter); }
public List <TRA_CTF> GetCtfDashboard(Login userLogin, bool isCompleted, string benefitType, string wtcType) { Expression <Func <TRA_CTF, bool> > queryFilter = PredicateHelper.True <TRA_CTF>(); if (isCompleted) { queryFilter = queryFilter.And(c => c.DOCUMENT_STATUS == Enums.DocumentStatus.Completed || c.DOCUMENT_STATUS == Enums.DocumentStatus.Cancelled); } else { queryFilter = queryFilter.And(c => c.DOCUMENT_STATUS != Enums.DocumentStatus.Completed && c.DOCUMENT_STATUS != Enums.DocumentStatus.Cancelled); } if (userLogin.UserRole == Enums.UserRole.User) { queryFilter = queryFilter.And(c => c.EMPLOYEE_ID == userLogin.EMPLOYEE_ID); } if (userLogin.UserRole == Enums.UserRole.HR) { queryFilter = queryFilter.And(c => c.VEHICLE_TYPE == benefitType); } if (userLogin.UserRole == Enums.UserRole.Fleet) { queryFilter = queryFilter.And(c => c.VEHICLE_TYPE == wtcType || c.VEHICLE_TYPE == benefitType); } return(_traCtfRepository.Get(queryFilter, null, "").ToList()); }
public List <SALES_BY_REGION_REPORT_DATA> GetAllSalesByRegion(SalesRegionGetByParamInput filter) { Expression <Func <SALES_BY_REGION_REPORT_DATA, bool> > queryFilter = PredicateHelper.True <SALES_BY_REGION_REPORT_DATA>(); if (filter != null) { if (filter.MonthFrom > 0) { queryFilter = queryFilter.And(c => c.REPORT_MONTH >= filter.MonthFrom); } if (filter.MonthTo > 0) { queryFilter = queryFilter.And(c => c.REPORT_MONTH <= filter.MonthTo); } if (filter.YearFrom > 0) { queryFilter = queryFilter.And(c => c.REPORT_YEAR >= filter.YearFrom); } if (filter.YearTo > 0) { queryFilter = queryFilter.And(c => c.REPORT_YEAR <= filter.YearTo); } if (!string.IsNullOrEmpty(filter.Region)) { queryFilter = queryFilter.And(c => c.REGION.ToUpper() == filter.Region.ToUpper()); } } return(_salesRegionRepository.Get(queryFilter, null, "").ToList()); }
public List <CFM_IDLE_REPORT_DATA> GetCfmIdle(CfmIdleGetByParamInput filter) { Expression <Func <CFM_IDLE_REPORT_DATA, bool> > queryFilter = PredicateHelper.True <CFM_IDLE_REPORT_DATA>(); if (filter != null) { if (filter.FromDate.HasValue) { queryFilter = queryFilter.And(c => c.START_IDLE >= filter.FromDate); } if (filter.ToDate.HasValue) { queryFilter = queryFilter.And(c => c.END_IDLE <= filter.ToDate); } if (!string.IsNullOrEmpty(filter.CostCenter)) { queryFilter = queryFilter.And(c => c.COST_CENTER == filter.CostCenter); } if (!string.IsNullOrEmpty(filter.PoliceNumber)) { queryFilter = queryFilter.And(c => c.POLICE_NUMBER.ToUpper() == filter.PoliceNumber.ToUpper()); } } return(_cfmIdleReportRepository.Get(queryFilter, null, "").ToList()); }
public MonthClosingDto GetDataByParam(MonthClosingGetByParam param) { Expression <Func <MONTH_CLOSING, bool> > queryFilter = PredicateHelper.True <MONTH_CLOSING>(); if (!string.IsNullOrEmpty(param.PlantId)) { queryFilter = queryFilter.And(c => c.PLANT_ID == param.PlantId && c.IS_ACTIVE == true); } if (param.ClosingDate != null) { queryFilter = queryFilter.And(c => c.CLOSING_DATE <= param.ClosingDate.Value && c.CLOSING_DATE.Value.Month == param.ClosingDate.Value.Month && c.CLOSING_DATE.Value.Year == param.ClosingDate.Value.Year); } if (param.DisplayDate != null) { queryFilter = queryFilter.And(c => c.CLOSING_DATE.Value.Month == param.DisplayDate.Value.Month && c.CLOSING_DATE.Value.Year == param.DisplayDate.Value.Year); } var dbData = _repository.Get(queryFilter).FirstOrDefault(); var mapResult = Mapper.Map <MonthClosingDto>(dbData); return(mapResult); }
public List <T001WCompositeDto> GetCompositeListByNppbkcIdWithFlag(string nppbkcId) { //check if NPPBKC flagged var nppbkcData = _nppbkcRepository.Get(c => c.NPPBKC_ID == nppbkcId).FirstOrDefault(); if (nppbkcData == null || !nppbkcData.FLAG_FOR_LACK1.HasValue || !nppbkcData.FLAG_FOR_LACK1.Value) { return(new List <T001WCompositeDto>()); } Expression <Func <T001W, bool> > queryFilter = PredicateHelper.True <T001W>(); //if (!string.IsNullOrEmpty(nppbkcId)) //{ //} queryFilter = queryFilter.And( c => !string.IsNullOrEmpty(c.NPPBKC_ID) && (c.NPPBKC_ID.Contains(nppbkcId) || c.NPPBKC_IMPORT_ID.Contains(nppbkcId))); var dbData = _repository.Get(queryFilter, null, includeTables); if (dbData == null) { throw new BLLException(ExceptionCodes.BLLExceptions.DataNotFound); } return(Mapper.Map <List <T001WCompositeDto> >(dbData)); }
public Expression <Func <TEntity, bool> > GetGridExpression(BaseGrid <TEntity> grid) { var expression = PredicateHelper.True <TEntity>(); var customFilterExpression = grid.GetCustomFilterExpression(); if (customFilterExpression != null) { expression = expression.And(customFilterExpression); } var searchExpression = grid.GetSearchExpression(); if (searchExpression != null) { expression = expression.And(searchExpression); } foreach (var filter in grid.Filters.Where(q => q.HasSelectedData)) { var filterExpression = _filterStore.FilterExpressionGeneratorStrategies[filter.Type].GetFilterLinqExpression(filter); if (filterExpression != null) { expression = expression.And(filterExpression); } } return(expression); }
public List <WasteStockDto> GetAllDataOrderByUserAndGroupRole(List <string> ListUserPlants, bool isSuperAdmin) { Func <IQueryable <WASTE_STOCK>, IOrderedQueryable <WASTE_STOCK> > orderByFilter = n => n.OrderBy(z => z.WERKS).ThenBy(z => z.MATERIAL_NUMBER); Expression <Func <WASTE_STOCK, bool> > queryFilter = PredicateHelper.True <WASTE_STOCK>(); if (!isSuperAdmin) { queryFilter = queryFilter.And(x => ListUserPlants.Contains(x.WERKS)); } var listData = _repository.Get(queryFilter, orderByFilter, _includeTables).ToList(); var result = Mapper.Map <List <WasteStockDto> >(listData); //feedback user 22-12-2015 //uom showed at waste stock must be in G foreach (var wasteStockDto in result) { wasteStockDto.Uom = "G"; } return(result); }
public List <Plant> GetPlantByNppbkc(string nppbkcId) { Expression <Func <T001W, bool> > queryFilter = PredicateHelper.True <T001W>(); if (!string.IsNullOrEmpty(nppbkcId)) { queryFilter = queryFilter.And(c => !string.IsNullOrEmpty(c.NPPBKC_ID) && (c.NPPBKC_ID.Contains(nppbkcId) || c.NPPBKC_IMPORT_ID.Contains(nppbkcId))); } var dbData = _repository.Get(queryFilter, null, includeTables); if (dbData == null) { throw new BLLException(ExceptionCodes.BLLExceptions.DataNotFound); } var toReturn = Mapper.Map <List <Plant> >(dbData); for (var i = 0; i < toReturn.Count; i++) { toReturn[i].IS_IMPORT_ID = toReturn[i].NPPBKC_IMPORT_ID == nppbkcId; } return(toReturn); }
public List <TRA_CSF> GetCsf(Login userLogin, bool isCompleted, string benefitType, string wtcType) { Expression <Func <TRA_CSF, bool> > queryFilter = PredicateHelper.True <TRA_CSF>(); if (isCompleted) { queryFilter = queryFilter.And(c => c.DOCUMENT_STATUS == Enums.DocumentStatus.Completed || c.DOCUMENT_STATUS == Enums.DocumentStatus.Cancelled); } else { queryFilter = queryFilter.And(c => c.DOCUMENT_STATUS != Enums.DocumentStatus.Completed && c.DOCUMENT_STATUS != Enums.DocumentStatus.Cancelled); } if (userLogin.UserRole == Enums.UserRole.User) { queryFilter = queryFilter.And(c => c.EMPLOYEE_ID == userLogin.EMPLOYEE_ID); } if (userLogin.UserRole == Enums.UserRole.HR) { queryFilter = queryFilter.And(c => c.VEHICLE_TYPE == benefitType); } if (userLogin.UserRole == Enums.UserRole.Fleet) { queryFilter = queryFilter.And(c => c.VEHICLE_TYPE == wtcType || (c.VEHICLE_TYPE == benefitType && (c.DOCUMENT_STATUS == Enums.DocumentStatus.WaitingFleetApproval || c.DOCUMENT_STATUS == Enums.DocumentStatus.InProgress || c.DOCUMENT_STATUS == Enums.DocumentStatus.Completed || c.DOCUMENT_STATUS == Enums.DocumentStatus.Cancelled))); } return(_csfRepository.Get(queryFilter, null, includeTables).ToList()); }
public List <MST_COST_OB> GetCostObByFilter(CostObParamInput filter) { Expression <Func <MST_COST_OB, bool> > queryFilter = PredicateHelper.True <MST_COST_OB>(); if (filter != null) { if (!string.IsNullOrEmpty(filter.Function)) { queryFilter = queryFilter.And(c => (c.FUNCTION_NAME == null ? "" : c.FUNCTION_NAME.ToUpper()) == (filter.Function == null ? "" : filter.Function.ToUpper())); } if (!string.IsNullOrEmpty(filter.Regional)) { queryFilter = queryFilter.And(c => (c.REGIONAL == null ? "" : c.REGIONAL.ToUpper()) == (filter.Regional == null ? "" : filter.Regional.ToUpper())); } if (!string.IsNullOrEmpty(filter.VehicleType)) { queryFilter = queryFilter.And(c => (c.VEHICLE_TYPE == null ? "" : c.VEHICLE_TYPE.ToUpper()) == (filter.VehicleType == null ? "" : filter.VehicleType.ToUpper())); } if (filter.Status.HasValue) { queryFilter = queryFilter.And(c => c.IS_ACTIVE == filter.Status.Value); } if (filter.Year.HasValue) { queryFilter = queryFilter.And(c => c.YEAR == filter.Year.Value); } } return(_costObRepository.Get(queryFilter, null, "").ToList()); }
public List <ZAAP_SHIFT_RPT> GetReversalData(string plant, string facode) { Expression <Func <ZAAP_SHIFT_RPT, bool> > queryFilter = PredicateHelper.True <ZAAP_SHIFT_RPT>(); string receiving102 = EnumHelper.GetDescription(Enums.MovementTypeCode.Receiving102); queryFilter = queryFilter.And(c => c.MVT == receiving102); if (plant != null) { queryFilter = queryFilter.And(c => c.WERKS == plant); } if (facode != null) { queryFilter = queryFilter.And(c => c.FA_CODE == facode); } //add filter minus 2 month from current date var filterMonth = DateTime.Now.AddMonths(-2).Date; var filterDate = new DateTime(filterMonth.Year, filterMonth.Month, 1); queryFilter = queryFilter.And(c => c.POSTING_DATE >= filterDate); var dbData = _repository.Get(queryFilter); return(dbData.ToList()); }
public List <LACK2> GetDashboardDataByParam(Lack2GetDashboardDataByParamInput input) { var queryFilter = PredicateHelper.True <LACK2>(); if (!string.IsNullOrEmpty(input.Creator)) { queryFilter = queryFilter.And(c => c.CREATED_BY == input.Creator); } if (!string.IsNullOrEmpty(input.Poa)) { queryFilter = queryFilter.And(c => c.APPROVED_BY == input.Poa || c.CREATED_BY == input.Poa); } if (input.PeriodMonth.HasValue) { queryFilter = queryFilter.And(c => c.PERIOD_MONTH == input.PeriodMonth.Value); } if (input.PeriodYear.HasValue) { queryFilter = queryFilter.And(c => c.PERIOD_YEAR == input.PeriodYear.Value); } if (input.UserRole != Enums.UserRole.Administrator) { queryFilter = queryFilter.And(c => input.ListUserPlants.Contains(c.LEVEL_PLANT_ID)); } return(_repository.Get(queryFilter).ToList()); }
public List <NlogDto> GetNlogByParam(NlogGetByParamInput input) { Expression <Func <NlogLogs, bool> > queryFilter = PredicateHelper.True <NlogLogs>(); if (!string.IsNullOrEmpty(input.FileName)) { queryFilter = queryFilter.And(c => c.FileName == input.FileName); } if (input.Month.HasValue) { queryFilter = queryFilter.And(c => c.Timestamp.Value.Month == input.Month); } if (!string.IsNullOrEmpty(input.LogDate)) { var dt = Convert.ToDateTime(input.LogDate); queryFilter = queryFilter.And(c => c.Timestamp.Value.Day == dt.Day && c.Timestamp.Value.Month == dt.Month && c.Timestamp.Value.Year == dt.Year); } Func <IQueryable <NlogLogs>, IOrderedQueryable <NlogLogs> > orderByFilter = n => n.OrderByDescending(z => z.Timestamp); var result = _repository.Get(queryFilter, orderByFilter, "").ToList(); return(Mapper.Map <List <NlogDto> >(result.ToList())); }
public List <KPI_REPORT_DATA> GetTransaction(KpiMonitoringGetByParamInput filter) { Expression <Func <KPI_REPORT_DATA, bool> > queryFilter = PredicateHelper.True <KPI_REPORT_DATA>(); if (filter != null) { if (filter.FromDate.HasValue) { queryFilter = queryFilter.And(c => c.EFFECTIVE_DATE >= filter.FromDate); } if (filter.ToDate.HasValue) { queryFilter = queryFilter.And(c => c.EFFECTIVE_DATE <= filter.ToDate); } if (!string.IsNullOrEmpty(filter.FormType)) { queryFilter = queryFilter.And(c => (c.FORM_TYPE == null ? "" : c.FORM_TYPE.ToUpper()) == filter.FormType.ToUpper()); } if (!string.IsNullOrEmpty(filter.VehicleUsage)) { queryFilter = queryFilter.And(c => (c.VEHICLE_USAGE == null ? "" : c.VEHICLE_USAGE.ToUpper()) == filter.VehicleUsage.ToUpper()); } if (!string.IsNullOrEmpty(filter.Location)) { queryFilter = queryFilter.And(c => (c.ADDRESS == null ? "" : c.ADDRESS.ToUpper()) == filter.Location.ToUpper()); } } return(_kpiMonitoringRepository.Get(queryFilter, null, "").ToList()); }
public TRA_CSF GetCsfById(long id) { Expression <Func <TRA_CSF, bool> > queryFilter = PredicateHelper.True <TRA_CSF>(); queryFilter = queryFilter.And(c => c.TRA_CSF_ID == id); return(_csfRepository.Get(queryFilter).FirstOrDefault()); }
public TRA_TEMPORARY GetTemporaryById(long id) { Expression <Func <TRA_TEMPORARY, bool> > queryFilter = PredicateHelper.True <TRA_TEMPORARY>(); queryFilter = queryFilter.And(c => c.TRA_TEMPORARY_ID == id); return(_traTempRepository.Get(queryFilter).FirstOrDefault()); }
public List <UOM> GetCK5ConvertedUoms() { Expression <Func <UOM, bool> > queryFilter = PredicateHelper.True <UOM>(); var allowedConvertedUoms = new List <string>(new[] { "KG", "G", "L", "Btg" }); queryFilter = queryFilter.And(c => allowedConvertedUoms.Contains(c.UOM_ID)); return(_repository.Get(queryFilter, null, "").ToList()); }
public List <LACK2> GetDetailReportsByParam(Lack2GetDetailReportByParamInput input) { Expression <Func <LACK2, bool> > queryFilter = PredicateHelper.True <LACK2>(); if (!string.IsNullOrEmpty(input.CompanyCode)) { queryFilter = queryFilter.And(c => c.BUKRS.Contains(input.CompanyCode)); } if (!string.IsNullOrEmpty(input.NppbkcId)) { queryFilter = queryFilter.And(c => c.NPPBKC_ID.Contains(input.NppbkcId)); } if (!string.IsNullOrEmpty(input.SendingPlantId)) { queryFilter = queryFilter.And(c => c.LEVEL_PLANT_ID.Contains(input.SendingPlantId)); } if (!string.IsNullOrEmpty(input.GoodType)) { queryFilter = queryFilter.And(c => c.EX_GOOD_TYP.Contains(input.GoodType)); } if (!string.IsNullOrEmpty(input.Poa)) { queryFilter = queryFilter.And(c => c.APPROVED_BY == input.Poa); } if (!string.IsNullOrEmpty(input.Creator)) { queryFilter = queryFilter.And(c => c.CREATED_BY == input.Creator); } if (input.PeriodMonth.HasValue) { queryFilter = queryFilter.And(c => c.PERIOD_MONTH == input.PeriodMonth.Value); } if (input.PeriodYear.HasValue) { queryFilter = queryFilter.And(c => c.PERIOD_YEAR == input.PeriodYear.Value); } if (input.UserRole != Enums.UserRole.Administrator) { queryFilter = queryFilter.And(c => input.ListUserPlant.Contains(c.LEVEL_PLANT_ID)); } var rc = _repository.Get(queryFilter, null, "LACK2_ITEM, LACK2_ITEM.CK5, LACK2_ITEM.CK5.PBCK1").ToList(); return(rc); }
public List <CK4C_ITEM> GetByPlant(List <string> plant, int month, int year) { Expression <Func <CK4C_ITEM, bool> > queryFilterCk4C = PredicateHelper.True <CK4C_ITEM>(); queryFilterCk4C = queryFilterCk4C.And( c => c.CK4C.REPORTED_MONTH == month && c.CK4C.REPORTED_YEAR == year && plant.Contains(c.WERKS)); return(_ck4CItemRepository.Get(queryFilterCk4C, null, "CK4C").ToList()); }
public List <ZAAP_SHIFT_RPT> GetForCFVsFa(ZaapShiftRptGetForLack1ReportByParamInput input) { Expression <Func <ZAAP_SHIFT_RPT, bool> > queryFilter = PredicateHelper.True <ZAAP_SHIFT_RPT>(); queryFilter = queryFilter.And(c => input.Werks.Distinct().Contains(c.WERKS)); queryFilter = queryFilter.And(x => x.POSTING_DATE >= input.BeginingDate && x.POSTING_DATE <= input.EndDate); var data = _repository.Get(queryFilter); return(data.ToList()); }
public List <ZAIDM_EX_MATERIAL> getAllMaterialByListMaterialAndPlant(List <string> materialList, List <string> plantList) { Expression <Func <ZAIDM_EX_MATERIAL, bool> > queryFilter = PredicateHelper.True <ZAIDM_EX_MATERIAL>(); queryFilter = queryFilter.And(x => materialList.Contains(x.STICKER_CODE)); queryFilter = queryFilter.And(x => plantList.Contains(x.WERKS)); var data = _repository.Get(queryFilter, null, "").ToList(); return(data); }
public List <UserTree> GetUserTree() { Expression <Func <USER, bool> > queryFilter = PredicateHelper.True <USER>(); var users = _repository.Get(queryFilter, null, null); if (users == null) { throw new BLLException(ExceptionCodes.BLLExceptions.DataNotFound); } return(Mapper.Map <List <UserTree> >(users)); }
public List <Ck4cItem> GetDataByParentPlant(string levelPlant) { Expression <Func <CK4C_ITEM, bool> > queryFilter = PredicateHelper.True <CK4C_ITEM>(); queryFilter = queryFilter.And(c => c.CK4C.PLANT_ID == levelPlant); var data = _repository.Get(queryFilter, null, includeTables).ToList(); data = data.OrderBy(c => c.PROD_DATE).ToList(); return(Mapper.Map <List <Ck4cItem> >(data)); }
public List <NO_OF_VEHICLE_REPORT_DATA> GetAllNoVehicle(VehicleGetByParamInput filter) { Expression <Func <NO_OF_VEHICLE_REPORT_DATA, bool> > queryFilter = PredicateHelper.True <NO_OF_VEHICLE_REPORT_DATA>(); if (filter != null) { if (filter.MonthFrom > 0) { queryFilter = queryFilter.And(c => c.REPORT_MONTH >= filter.MonthFrom); } if (filter.MonthTo > 0) { queryFilter = queryFilter.And(c => c.REPORT_MONTH <= filter.MonthTo); } if (filter.YearFrom > 0) { queryFilter = queryFilter.And(c => c.REPORT_YEAR >= filter.YearFrom); } if (filter.YearTo > 0) { queryFilter = queryFilter.And(c => c.REPORT_YEAR <= filter.YearTo); } if (!string.IsNullOrEmpty(filter.VehicleType)) { queryFilter = queryFilter.And(c => c.VEHICLE_TYPE.ToUpper() == filter.VehicleType.ToUpper()); } if (!string.IsNullOrEmpty(filter.SupplyMethod)) { queryFilter = queryFilter.And(c => c.SUPPLY_METHOD.ToUpper() == filter.SupplyMethod.ToUpper()); } if (!string.IsNullOrEmpty(filter.Regional)) { queryFilter = queryFilter.And(c => c.REGION.ToUpper() == filter.Regional.ToUpper()); } if (!string.IsNullOrEmpty(filter.Function)) { var listFunction = filter.Function.ToUpper().Split(',').ToList(); if (listFunction.Contains("OTHERS")) { queryFilter = queryFilter.And(c => listFunction.Contains(c.FUNCTION.ToUpper()) || (c.FUNCTION.ToUpper() != "SALES" && c.FUNCTION.ToUpper() != "MARKETING" && c.FUNCTION.ToUpper() != "OPERATIONS")); } else { queryFilter = queryFilter.And(c => listFunction.Contains(c.FUNCTION.ToUpper())); } } } return(_noVehRepository.Get(queryFilter, null, "").ToList()); }
public List <ZAIDM_EX_MATERIAL> getAllMaterial(string goodType) { Expression <Func <ZAIDM_EX_MATERIAL, bool> > queryFilter = PredicateHelper.True <ZAIDM_EX_MATERIAL>(); if (!string.IsNullOrEmpty(goodType)) { queryFilter = queryFilter.And(x => x.EXC_GOOD_TYP == goodType); } var data = _repository.Get(queryFilter, null, includeTables).ToList(); return(data.ToList()); }
public List <PRODUCTION> GetFactAllByParam(ProductionGetByParamInput input) { Expression <Func <PRODUCTION, bool> > queryFilter = PredicateHelper.True <PRODUCTION>(); if (!string.IsNullOrEmpty(input.Company)) { queryFilter = queryFilter.And(c => c.COMPANY_CODE == input.Company); } if (!string.IsNullOrEmpty(input.Plant)) { queryFilter = queryFilter.And(c => c.WERKS == input.Plant); } if (!string.IsNullOrEmpty(input.ProoductionDate)) { var dt = Convert.ToDateTime(input.ProoductionDate); queryFilter = queryFilter.And(c => c.PRODUCTION_DATE == dt); } if (input.Month > 0) { queryFilter = queryFilter.And(c => c.PRODUCTION_DATE.Month == input.Month); } if (input.Year > 0) { queryFilter = queryFilter.And(c => c.PRODUCTION_DATE.Year == input.Year); } if (!string.IsNullOrEmpty(input.UserId)) { var listUserPlant = _userPlantBll.GetPlantByUserId(input.UserId); var listPoaPlant = _poaMapBll.GetPlantByPoaId(input.UserId); queryFilter = queryFilter.And(c => listUserPlant.Contains(c.WERKS) || listPoaPlant.Contains(c.WERKS)); } Func <IQueryable <PRODUCTION>, IOrderedQueryable <PRODUCTION> > orderBy = null; { if (!string.IsNullOrEmpty(input.ShortOrderColumn)) { orderBy = c => c.OrderBy(OrderByHelper.GetOrderByFunction <PRODUCTION>(input.ShortOrderColumn)); } var dbData = _repository.Get(queryFilter, orderBy); if (dbData == null) { throw new BLLException(ExceptionCodes.BLLExceptions.DataNotFound); } var mapResult = dbData.ToList(); return(mapResult); } }
public List <VEHICLE_REPORT_DATA> GetVehicle(VehicleOverallReportGetByParamInput filter) { Expression <Func <VEHICLE_REPORT_DATA, bool> > queryFilter = PredicateHelper.True <VEHICLE_REPORT_DATA>(); if (filter != null) { if (filter.VehicleStatus.HasValue) { queryFilter = queryFilter.And(c => c.VEHICLE_STATUS == filter.VehicleStatus); } if (filter.FromDate.HasValue) { queryFilter = queryFilter.And(c => c.END_RENT >= filter.FromDate); } if (filter.ToDate.HasValue) { queryFilter = queryFilter.And(c => c.END_RENT <= filter.ToDate); } if (!string.IsNullOrEmpty(filter.SupplyMethod)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.SUPPLY_METHOD) == true ? "" : c.SUPPLY_METHOD.ToUpper()) == filter.SupplyMethod.ToUpper()); } if (!string.IsNullOrEmpty(filter.BodyType)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.BODY_TYPE) == true ? "" : c.BODY_TYPE.ToUpper()) == filter.BodyType.ToUpper()); } if (!string.IsNullOrEmpty(filter.VehicleType)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.VEHICLE_TYPE) == true ? "" : c.VEHICLE_TYPE.ToUpper()) == filter.VehicleType.ToUpper()); } if (!string.IsNullOrEmpty(filter.Vendor)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.VENDOR) == true ? "" :c.VENDOR.ToUpper()) == filter.Vendor.ToUpper()); } if (!string.IsNullOrEmpty(filter.Function)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.FUNCTION) == true ? "" :c.FUNCTION.ToUpper()) == filter.Function.ToUpper()); } if (!string.IsNullOrEmpty(filter.Regional)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.REGIONAL) == true ? "" : c.REGIONAL.ToUpper()) == filter.Regional.ToUpper()); } if (!string.IsNullOrEmpty(filter.City)) { queryFilter = queryFilter.And(c => (string.IsNullOrEmpty(c.CITY) == true ? "" :c.CITY.ToUpper()) == filter.City.ToUpper()); } } return(_vehicleReportRepository.Get(queryFilter, null, "").ToList()); }
public List <ZAIDM_EX_BRAND> GetByPlantAndFaCode(List <string> plant, List <string> faCode) { Expression <Func <ZAIDM_EX_BRAND, bool> > queryFilter = PredicateHelper.True <ZAIDM_EX_BRAND>(); var dbData = new List <ZAIDM_EX_BRAND>(); if (plant.Count > 0 && faCode.Count > 0) { queryFilter = queryFilter.And(b => plant.Contains(b.WERKS) && faCode.Contains(b.FA_CODE)); dbData = _repository.Get(queryFilter).ToList(); } return(dbData); }