예제 #1
0
        private async Task queriesAsync()
        {
            if (App.u == null)
            {
                var message = "No permitido usted no esta registrado";
                DependencyService.Get <IMessage>().LongTime(message);
            }
            else
            {
                var tokenSource2     = new CancellationTokenSource();
                CancellationToken ct = tokenSource2.Token;
                try
                {
                    Actividad   activity = (Actividad)this.BindingContext;
                    List <User> listUser = await FirebaseHelper.GetAllUsers();

                    List <Apuntado> listAp = await FirebaseHelper.GetApuntados();

                    List <Actividad> list = await FirebaseHelper.GetActivities();

                    var listFilter = from act in list
                                     join ap in listAp
                                     on act.ID equals ap.IDAct
                                     join user in listUser
                                     on ap.IDUser equals user.ID
                                     where (user.DNI == App.u.DNI && act.Titulo == activity.Titulo)
                                     select act;
                    if (listFilter.Count() > 0)
                    {
                        var message = "Ya estas apuntado";
                        DependencyService.Get <IMessage>().LongTime(message);
                    }
                    else if (activity.Plazas == 0)
                    {
                        var message = "No quedan mas plazas";
                        DependencyService.Get <IMessage>().LongTime(message);
                    }
                    else
                    {
                        await FirebaseHelper.AddApuntado(activity.ID, App.u.ID);

                        await FirebaseHelper.UpdateActividadPlazas(activity.ID);

                        Navigation.PushModalAsync(new MainPage());
                    }
                }
                catch (OperationCanceledException e)
                {
                    Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
                }
                finally
                {
                    tokenSource2.Dispose();
                }
            }
        }
예제 #2
0
 public PageChangeAct(Actividad a)
 {
     InitializeComponent();
     act = a;
     entryTitulo.Text       = act.Titulo;
     entryLugar.Text        = act.Lugar;
     editorDescripcion.Text = act.Descripccion;
     entryFoto.Text         = act.Foto;
     entryPrecio.Text       = act.Precio.ToString();
     fechaAct.Date          = act.Fecha;
     entryPlazas.Text       = act.Plazas.ToString();
     pickerBus.Title        = act.bus;
 }
예제 #3
0
        private async Task LoadListAsync()
        {
            var tokenSource2     = new CancellationTokenSource();
            CancellationToken ct = tokenSource2.Token;

            try
            {
                Actividad        act  = (Actividad)this.BindingContext;
                List <Actividad> list = await FirebaseHelper.GetActivities();

                lw_Act.ItemsSource = list;
            }
            catch (OperationCanceledException e)
            {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
            finally
            {
                tokenSource2.Dispose();
            }
        }
예제 #4
0
 public PageShowUsers(Actividad a)
 {
     InitializeComponent();
     act = a;
     LoadListAsync();
 }