Example #1
0
        public void TestMethodSelectParkPlacesRow()
        {
            var viewmodel = new ParkingViewModel();

            //List<ParkPlaceRow> park = viewmodel.RowViewParkPlaces;
            Assert.AreEqual(1, 1);
        }
Example #2
0
        public void TestMethodSelectParkPlacesList()
        {
            var viewmodel = new ParkingViewModel();

            // ObservableCollection<ParkPlace> park = viewmodel.ParkPlaces;
            Assert.AreEqual(1, 1);
        }
        private ParkingViewModel CreateViewModelFromParking(Parking parking)
        {
            var viewModel = new ParkingViewModel
            {
                Id       = parking.Id,
                Name     = parking.Name,
                Position = new GeoCoordinate(parking.CoordX, parking.CoordY)
            };

            return(viewModel);
        }
 public ActionResult Create(ParkingViewModel Parking)
 {
     try
     {
         Parking.Save();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit(ParkingViewModel rVM)
 {
     try
     {
         rVM.Save();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #6
0
 public ControlPisos()
 {
     InitializeComponent();
     BindingContext = new ParkingViewModel();
     Device.StartTimer(TimeSpan.FromMilliseconds(100), () =>
     {
         Task.Factory.StartNew(async() =>
         {
             return(await loadData());
         });
         return(true);
     });
 }
        public ActionResult Delete(Guid id, ParkingViewModel Parking)
        {
            try
            {
                Parking.Delete();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Synchro()
 {
     try
     {
         ParkingViewModel.AddtoBase();
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         string errore = ex.Message;
         return(RedirectToAction("Index"));
     }
 }
Example #9
0
        public override ActionResult Index(ParkingBlock currentBlock)
        {
            ParkingGateway gateway = new ParkingGateway();

            ParkingGarage    garage = gateway.GetParkingGarage(currentBlock.Location);
            ParkingViewModel model  = new ParkingViewModel()
            {
                Heading           = currentBlock.Heading,
                Location          = currentBlock.Location,
                Address           = garage.Address,
                TotalCapacity     = garage.ParkingStatus.TotalCapacity,
                AvailableCapacity = garage.ParkingStatus.AvailableCapacity,
                IsOpen            = garage.ParkingStatus.Open,
                LastUpdated       = Convert.ToDateTime(garage.LastModifiedDate)
            };

            return(PartialView(model));
        }
Example #10
0
        public JsonParking ParkingList(int id)
        {
            List <ParkingViewModel> parkingList = new List <ParkingViewModel>();
            List <AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel> featureValuesList = new List <AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel>();
            JsonParking jsonParking = new JsonParking();

            try
            {
                var parking = _place.AirportParkingList(Convert.ToInt32(id));
                foreach (var item in parking)
                {
                    ParkingViewModel parkingOBJ = new ParkingViewModel();
                    if (item != null && item.AirportId != null)
                    {
                        parkingOBJ.Cost          = item.Cost.ToString();
                        parkingOBJ.Airport       = item.Name;
                        parkingOBJ.LocationX     = _address.FindById(item.AdressId).LocationX;
                        parkingOBJ.LocationY     = _address.FindById(item.AdressId).LocationY;
                        parkingOBJ.LocationR     = _address.FindById(item.AdressId).LocationR;
                        parkingOBJ.AddressDetail = _address.FindById(item.AdressId).Detail;
                        parkingOBJ.CityName      = _city.FindById(_address.FindById(_place.FindById(item.Id).AdressId).CityId).Name;
                        parkingOBJ.StateName     = _state.FindById(_city.FindById(_address.FindById(_place.FindById(item.Id).AdressId).CityId).CityStateId).Name;
                        parkingOBJ.Categori      = _category.FindById(item.CategoryId).CategoryName;
                        parkingList.Add(parkingOBJ);
                        var featurelist = _detail.FeatureValues(item.DetailId);
                        foreach (var x in featurelist)
                        {
                            AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel featureValue = new AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel();
                            featureValue.name  = x.name;
                            featureValue.value = x.value;
                            featureValuesList.Add(featureValue);
                        }
                        parkingOBJ.Detail = featureValuesList;
                    }
                }
                jsonParking.result = parkingList;
                return(jsonParking);
            }
            catch (Exception ex)
            {
                string Mes = ex.Message;
                return(jsonParking);
            }
        }
Example #11
0
        public ParkingDetail(IParking parking)
        {
            InitializeComponent();

            Parking = parking;
            var parkingViewModel = new ParkingViewModel(parking);

            BindingContext = parkingViewModel;
            UpdateFreePlacesCountColorText(parkingViewModel);

            string backIcon = null;
            string mapIcon  = null;

            switch (Device.RuntimePlatform)
            {
            case Device.UWP:
                backIcon = "Images/back_arrow.png";
                mapIcon  = "Images/map_pin.png";
                break;

            default:
                mapIcon = "map_pin.png";
                break;
            }

            ToolbarItems.Add(new ToolbarItem
            {
                Text            = AppResources.map,
                Command         = new Command(async() => await CrossExternalMaps.Current.NavigateTo(Parking.Name, Parking.Latitude, Parking.Longitude)),
                IconImageSource = mapIcon
            });

            ToolbarItems.Add(new ToolbarItem
            {
                Text            = AppResources.back,
                Command         = new Command(async() => await Navigation.PopModalAsync()),
                IconImageSource = backIcon
            });
        }
Example #12
0
 private void UpdateFreePlacesCountColorText(ParkingViewModel parkingViewModel)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         if (!labelDifference.IsVisible)
         {
             labelDifference.IsVisible = true;
         }
         if (parkingViewModel.Difference == 0)
         {
             labelDifference.TextColor = Color.Black;
         }
         else if (parkingViewModel.Difference > 0)
         {
             labelDifference.TextColor = Color.FromHex("#4CAF50");
         }
         else
         {
             labelDifference.TextColor = Color.FromHex("#FF5722");
         }
     });
 }
Example #13
0
        // Calculates parking space left & total parking ppaces
        // Made ParkingViewModel for display in index
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var total    = totalParkingSpaces;
            var vehicles = await db.VehicleModel.Include(v => v.VehicleType).Select(v => v.VehicleType.Capacity).ToListAsync();

            int sum = 0;

            foreach (var item in vehicles)
            {
                sum += item;
            }

            var space = totalParkingSpaces - sum;

            var model = new ParkingViewModel
            {
                ParkingSpacesLeft  = space,
                TotalParkingSpaces = total
            };

            return(View(model));
        }
Example #14
0
 public void TestMethodSelectParkPlace()
 {
     var viewmodel = new ParkingViewModel();
     //viewmodel.SelectedParkPlace = viewmodel.ParkPlaces.First();
     //Assert.AreEqual(5, viewmodel.SelectedParkPlace.Cel);
 }
Example #15
0
 public void TestMethodAantalParkPlaces()
 {
     var viewmodel = new ParkingViewModel();
     //Assert.AreEqual(8, viewmodel.ParkPlaces.Count);
 }
 // GET: Parking/Delete/5
 public ActionResult Delete(Guid id)
 {
     return(View(ParkingViewModel.GetById(id)));
 }
 public VehicleCheckOut()
 {
     InitializeComponent();
     DataContext = new ParkingViewModel();
 }
Example #18
0
 public async Task UpdateParking(ParkingViewModel parking)
 {
     await _parkingService.CreateParkingAsync(parking.Name, parking.Position.Latitude, parking.Position.Longitude);
 }
 // GET: Parking
 public ActionResult Index()
 {
     return(View(ParkingViewModel.GetAll()));
 }