コード例 #1
0
        public List <CarDTO> GetAllCar(CarListFilter filter)
        {
            Expression <Func <Car, bool> > exp = x => true;



            if (filter.AllCar)
            {
                exp = x => true;
            }
            else if (filter.Rented == true)
            {
                exp.And(x => x.IsRented == true && x.IsActive == true);
            }
            else if (filter.Deleted == true)
            {
                exp.And(x => x.IsDeleted == true);
            }

            List <CarDTO> dtos = new List <CarDTO>();
            var           cars = Singleton.Uow.GetRepository <Car>().Get(exp);

            foreach (var item in cars)
            {
                CarDTO dto = new CarDTO()
                {
                    Id                   = item.Id,
                    Plate                = item.Plate,
                    IsRented             = item.IsRented,
                    CylindeerVolume      = item.CylindeerVolume,
                    DailyPrice           = item.DailyPrice,
                    DateOfPurchase       = item.DateOfPurchase,
                    EngineCapacity       = item.EngineCapacity,
                    InspectionExpiryDate = item.InspectionExpiryDate,
                    InsuranceExpiryDate  = item.InsuranceExpiryDate,
                    CarClassEnum         = item.CarClassEnum,
                    CarColorEnum         = item.CarColorEnum,
                    FuelType             = item.FuelType,
                    DriverLicenceType    = item.DriverLicenceType,
                    IsActive             = item.IsActive
                };
                dtos.Add(dto);
            }

            return(dtos);
        }
コード例 #2
0
        private void ListLoad(CarListFilter filter)
        {
            List <CarDTO> car = new List <CarDTO>();

            if (filter != null)
            {
                car = _cc.GetAllCar(filter);
            }
            else
            {
                car = _cc.GetAllCar();
            }

            lstArac.DataSource    = null;
            lstArac.DisplayMember = "Plate";
            lstArac.ValueMember   = "Id";
            lstArac.DataSource    = car;
        }
コード例 #3
0
 public FormCarList()
 {
     InitializeComponent();
     _cc    = new CarController();
     filter = new CarListFilter();
 }