Ejemplo n.º 1
0
        //Methods
        private async Task GetCurrentTrip()
        {
            this.Loading = true;
            RaisePropertyChanged("Loading");

            await Task.Run(async() =>
            {
                Trip currenttrip = Task.FromResult <Trip>(await TripRepository.GetCurrentTrip()).Result;
                if (currenttrip != null)
                {
                    if (currenttrip.Active == true)
                    {
                        Trip.All trips_all = new Trip.All();


                        User.All user = await UsersRepository.GetUserById(currenttrip.Users_ID);
                        Bob.All bob   = await BobsRepository.GetBobById(currenttrip.Bobs_ID);
                        Users_Destinations destination = await DestinationRepository.GetDestinationById((currenttrip.Destinations_ID));
                        Party party      = await PartyRepository.GetPartyById(currenttrip.Party_ID);
                        Trip.All newTrip = new Trip.All();



                        newTrip.Trip        = currenttrip;
                        newTrip.Party       = party;
                        newTrip.User        = user;
                        newTrip.Bob         = bob;
                        newTrip.Destination = destination;

                        MoveCar(newTrip.Trip.Status_Name);
                        this.CurrentTrip = newTrip;
                    }
                    else
                    {
                        this.CurrentTrip = null;
                        //geen current trip nu
                    }
                }
                RaiseAll();
            });
        }
Ejemplo n.º 2
0
        private object GetTripObject()
        {
            try
            {
                Bob   selectedBob   = VindRitVM.SelectedBob.Bob;
                Party SelectedParty = VindRitVM.SelectedParty;
                Users_Destinations SelectedDestination = VindRitFilterVM.SelectedDestination;
                List <Friend.All>  selectedFriends     = VindRitFilterVM.SelectedFriends;
                BobsType           type    = VindRitFilterVM.SelectedBobsType;
                DateTime?          minDate = VindRitFilterVM.SelectedMinDate;
                int?rating = VindRitFilterVM.SelectedRating;

                if (SelectedDestination == null || selectedBob == null || SelectedParty == null || type == null)
                {
                    //trip afronden
                    TripDone();


                    return(null);
                }

                //destinations edit

                Trip trip = new Trip()
                {
                    Bobs_ID         = selectedBob.ID.Value,
                    Party_ID        = SelectedParty.ID,
                    Friends         = JsonConvert.SerializeObject(selectedFriends),
                    Destinations_ID = SelectedDestination.Destinations_ID
                };

                return(trip);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message.ToString());
                return(null);
                //return null;
            }
        }