示例#1
0
        public List <VehicleOverallReportDto> GetVehicle(VehicleOverallReportGetByParamInput filter)
        {
            var data   = _vehicleOverallReportService.GetVehicle(filter);
            var redata = Mapper.Map <List <VehicleOverallReportDto> >(data);

            return(redata);
        }
        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 ActionResult Index()
        {
            var model = new VehicleOverallReportModel();

            model = Initial(model);

            var filter = new VehicleOverallReportGetByParamInput();

            filter.FromDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            filter.ToDate   = DateTime.Today;

            var data     = _vehicleOverallReportBLL.GetVehicle(filter);
            var ListData = Mapper.Map <List <VehicleOverallItem> >(data);

            model.ListVehicle = ListData;
            return(View(model));
        }