Example #1
0
        public ActionResult _ListCars(string licencePlate)
        {
            List <CarDTO> _cars = new List <CarDTO>();

            if (string.IsNullOrWhiteSpace(licencePlate))
            {
                _cars = carLogic.List();
            }
            else
            {
                _cars = carLogic.List(licencePlate);
            }

            List <Tuple <CarDTO, CarModelDTO, CarMakeDTO> > cars = new List <Tuple <CarDTO, CarModelDTO, CarMakeDTO> >();


            foreach (CarDTO car in _cars)
            {
                CarModelDTO carModel = carModelLogic.Get(car.id_Car_Model);
                CarMakeDTO  carMake  = carMakeLogic.Get(carModel.id_Car_Make);

                cars.Add(new Tuple <CarDTO, CarModelDTO, CarMakeDTO>(car, carModel, carMake));
            }

            CarIndexListCarViewsModel vm = new CarIndexListCarViewsModel
            {
                Cars = cars
            };

            return(PartialView(vm));
        }
Example #2
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            int selectedId = (VehicleGrid.SelectedItem as CarVM).Id;
            var responce   = CarLogic.Delete(new CarVM
            {
                Id = selectedId,
            });

            if (responce.IsCompleted)
            {
                VehicleGrid.ItemsSource = CarLogic.List().Object;
            }
        }
Example #3
0
        private void BtnInsert_Click(object sender, RoutedEventArgs e)
        {
            var responce = CarLogic.AddOrUpdate(new Common.ViewModel.CarVM
            {
                Make           = tbCarMake.Text,
                Model          = tbCompanyName.Text,
                RegistrationNo = tbCarRegistrationNo.Text,
            });

            if (responce.IsCompleted)
            {
                var listresponce = CarLogic.List();
                if (listresponce.IsCompleted)
                {
                    Vehicle.dataGrid.ItemsSource = listresponce.Object;
                    this.Hide();
                }
            }
        }
        public ActionResult AssignationCar(int id)
        {
            BookingAssignationViewsModel vm = new BookingAssignationViewsModel();
            List <CarDTO> _cars             = carLogic.List();
            List <Tuple <CarDTO, CarModelDTO, CarMakeDTO> > cars = new List <Tuple <CarDTO, CarModelDTO, CarMakeDTO> >();
            BookingDTO booking = bookingLogic.GetByRequestBooking(id);

            foreach (CarDTO car in _cars)
            {
                CarModelDTO carModel = carModelLogic.Get(car.id_Car_Model);
                CarMakeDTO  carMake  = carMakeLogic.Get(carModel.id_Car_Make);

                cars.Add(new Tuple <CarDTO, CarModelDTO, CarMakeDTO>(car, carModel, carMake));
            }

            vm.Cars    = cars;
            vm.Booking = booking;

            return(View(vm));
        }
Example #5
0
        private void BtnUpdate_Click(object sender, RoutedEventArgs e)
        {
            var response = CarLogic.AddOrUpdate(new Common.ViewModel.CarVM()
            {
                Id             = _Id,
                Make           = tbCarMake.Text,
                Model          = tbCompanyName.Text,
                RegistrationNo = tbCarRegistrationNo.Text,
            }, true);

            if (response.IsCompleted)
            {
                var listResponse = CarLogic.List();
                if (listResponse.IsCompleted)
                {
                    Vehicle.dataGrid.ItemsSource = listResponse.Object;
                }
                this.Hide();
            }
            //Car updateCar = (from c in _db.Cars where c.CarId == _Id select c).SingleOrDefault();
            //var totalKm = Int32.Parse(tbCarKmIn.Text) - Int32.Parse(tbCarKmOut.Text);
            //var totalTime = DateTime.Parse(tbTImeIn.Value.Value.ToLongTimeString()) - DateTime.Parse(tbTimeOut.Value.Value.ToLongTimeString());

            //updateCar.CarKmIn = Int32.Parse(tbCarKmIn.Text);
            //updateCar.CarKmOut =Int32.Parse(tbCarKmOut.Text);
            //updateCar.CarMake = tbCarMake.Text;
            //updateCar.CarRegistrationNo = tbCarRegistrationNo.Text;
            //updateCar.DateIn = tbDateIn.SelectedDate.Value.ToShortDateString();
            //updateCar.DateOut =tbDateOut.SelectedDate.Value.ToShortDateString();
            //updateCar.KmBill = Int32.Parse(tbKmBill.Text);
            //updateCar.TImeIn = tbTImeIn.Value.Value.ToShortTimeString();
            //updateCar.TimeOut = tbTimeOut.Value.Value.ToShortTimeString();
            //updateCar.TimeBill = Int32.Parse(tbTimeBill.Text);
            //updateCar.TotalKm = totalKm;
            //updateCar.TotalTime = Convert.ToInt16(totalTime.TotalHours.ToString());

            //if (updateCar.CarOwner == "Own")
            //{
            //    updateCar.CarOwner = cbCarOwnerOwn.Content.ToString();
            //}
            //else if (updateCar.CarOwner == "Investor")
            //{
            //    updateCar.CarOwner = cbCarOwnerInvestor.Content.ToString();
            //}
            //else
            //{
            //    updateCar.CarOwner = cbCarOwnerNonPool.Content.ToString();
            //}

            //if(cbCarFuelStateFull.IsChecked == true)
            //{
            //    updateCar.CarFuelState = cbCarFuelStateFull.Content.ToString();
            //}
            //else if (cbCarFuelStateQuarter.IsChecked == true)
            //{
            //    updateCar.CarFuelState = cbCarFuelStateQuarter.Content.ToString();
            //}
            //else if(cbCarFuelStateHalf.IsChecked == true)
            //{
            //    updateCar.CarFuelState = cbCarFuelStateHalf.Content.ToString();
            //}
            //else
            //{
            //    updateCar.CarFuelState = cbCarFuelStateEmpty.Content.ToString();
            //}
            //_db.SaveChanges();
            //Vehicle.dataGrid.ItemsSource = _db.Cars.ToList();
            //this.Hide();
        }
Example #6
0
 private void Load()
 {
     VehicleGrid.ItemsSource = CarLogic.List().Object;
     dataGrid = VehicleGrid;
 }