private void Button_Click_add_trip(object sender, RoutedEventArgs e)
        {
            AddNewTrip ant = new AddNewTrip(username, this);

            Updated = false;
            this.NavigationService.Navigate(ant);
        }
        public void clickEdit(object sender, RoutedEventArgs e)
        {
            var  item      = ((Button)sender).DataContext;
            var  itemIndex = allTripsListBox.Items.IndexOf(item);
            Trip pushTrip  = trips[itemIndex];

            if (pushTrip.Admin != username)
            {
                MessageBox.Show("You cannot edit this trip - only admin can");
            }
            else
            {
                Tuple <bool, List <User> > memTuple = controller.getAllMem(pushTrip);
                if (!memTuple.Item1)
                {
                    Utils.Instance.errorAndExit("Error trying access members records");
                }
                List <User> mem = memTuple.Item2;
                Tuple <bool, List <Attraction> > attTuple = controller.getAllAtt(pushTrip);
                if (!attTuple.Item1)
                {
                    Utils.Instance.errorAndExit("Error trying access attractions records");
                }
                List <Attraction> att = attTuple.Item2;
                AddNewTrip        ant = new AddNewTrip(this, pushTrip, att, mem);
                Updated = false;
                NavigationService.Navigate(ant);
            }
        }
Esempio n. 3
0
        private void addNewTripButton_Click(object sender, RoutedEventArgs e)
        {
            AddNewTrip nt = new AddNewTrip(username);

            NavigationService.Navigate(nt);
        }