Ejemplo n.º 1
0
        private async void BtnAccept_Click(object sender, RoutedEventArgs e)
        {
            LoadingService.LoadingStart();

            var rol = (await new RolRepository().Get()).Result.FirstOrDefault(x => x.Nombre == "Comprador");

            Comprador.Usuario = (new Usuario(Email, new HashService().Hash(Password), rol));

            (await new CompradoresServices().Registrar(Comprador))
            .Success(s =>
            {
                MessageDialogService.Create("Comprador Registrado Existosamente", c =>
                {
                    LoadingService.LoadingStop();
                    NavigationService.NavigatePop <Dashboard>();
                }, null);
            })
            .Error(erros =>
            {
                MessageDialogService.Create("Error al Crear el Comprador", c =>
                {
                    LoadingService.LoadingStop();
                }, null);
            });
        }
        private async Task LoadDataAsync()
        {
            (await new ConcursosRepository().GetAsync())
            .Success(concursos =>
            {
                var oncursosToCheck = concursos.Where(c => (c.Status == (int)ConcursoStatusEnum.Nuevo || c.Status == (int)ConcursoStatusEnum.Cerrado) &&
                                                      c.ConcursoProveedores.Any(p => p.Proveedor.UsuarioId == IdentityServices.Instance.GetUserLogged().Id
                                                                                &&
                                                                                p.Status != (int)ProveedorConcursoStatusEnum.Rechazado))?.ToList();

                foreach (var item in oncursosToCheck)
                {
                    var concursoProveedor = item.ConcursoProveedores.First(f => f.Proveedor.UsuarioId == IdentityServices.Instance.GetUserLogged().Id);
                    Concursos.Add(new ConcursoParaOfertar(item, concursoProveedor));
                }

                LoadingService.LoadingStop();
            })
            .Error(async x =>
            {
                MessageDialogService.Create("No hay concursos para mostrar", c =>
                {
                    LoadingService.LoadingStop();
                }, null);
            });
        }
Ejemplo n.º 3
0
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var concurso = (ConcursoViewModel)e.AddedItems.First();

            if (concurso.ListoParaAbrir)
            {
                if (concurso.Concurso.Status == (int)ConcursoStatusEnum.Abierto
                    ||
                    concurso.Concurso.Status == (int)ConcursoStatusEnum.Cerrado)
                {
                    NavigationService.Navigate <ConcursoAbiertoPage>(new { Concurso = concurso });
                }
                else
                {
                    MessageDialogService.Create("Este concurso esta listo para ser abierto!!", c =>
                    {
                        NavigationService.Navigate <ConcursoAbiertoPage>(new { Concurso = concurso });
                    }, null);
                }
            }
            else
            {
                NavigationService.Navigate <DetalleConcursoPage>(new { ConcursoId = concurso.Concurso.Id });
            }
        }
Ejemplo n.º 4
0
 public void ShowMessageDialog(string message, Action callBackSuccess = null)
 {
     MessageDialogService.Create(message, c =>
     {
         callBackSuccess?.Invoke();
         LoadingService.LoadingStop();
     }, null);
 }
Ejemplo n.º 5
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     LoadingService.LoadingStart();
     MessageDialogService.Create("Error Global. Contacte al administrador", c =>
     {
         LoadingService.LoadingStop();
         NavigationService.NavigatePop <Dashboard>();
     }, null);
 }
Ejemplo n.º 6
0
        private async void BtnRechazar_Click(object sender, RoutedEventArgs e)
        {
            var userId = IdentityServices.Instance.GetUserLogged().Id;

            MessageDialogService.Create("Si rechaza las normas del concurso, estara rechanzado la inscripción al concurso. ¿Está seguro que desea continuar?", async c =>
            {
                await new ConcursoServices().RechazarTerminosYCondiciones(_concursoId, userId);
                NavigationService.Navigate <ListConcursosOfertarPage>();
            }, x => { });
        }
Ejemplo n.º 7
0
        private void ApbCancel_OnClick(object sender, RoutedEventArgs e)
        {
            LoadingService.LoadingStart();

            MessageDialogService.Create("¿Esta seguro que desea descargar los cambios?", c =>
            {
                LoadingService.LoadingStop();
                NavigationService.NavigatePop <IdiomasSettingsPage>();
            }, command => { });
        }
Ejemplo n.º 8
0
        private async void BtnAcept_Click(object sender, RoutedEventArgs e)
        {
            var userId = IdentityServices.Instance.GetUserLogged().Id;

            await new ConcursoServices().AceptarTerminosYCondiciones(_concursoId, userId);

            MessageDialogService.Create("Gracias por aceptar los terminos y condiciones, ahora puede realiar su oferta.", c =>
            {
                NavigationService.Navigate <ListConcursosOfertarPage>();
            }, x => { });
        }
Ejemplo n.º 9
0
 private async Task LoadDataAsync()
 {
     (await new ProveedoresRepository().Get())
     .Success(proveedores =>
     {
         proveedores?.ForEach(x => Proveedores.Add(x));
         LoadingService.LoadingStop();
     })
     .Error(async x =>
     {
         MessageDialogService.Create("No hay Proveedores", c =>
         {
             LoadingService.LoadingStop();
             NavigationService.NavigatePop <Dashboard>();
         }, null);
     });
 }
 private async void LoadData()
 {
     (await(new IdiomasRepository()
            .Get())).Success(x =>
     {
         x.ForEach(s => Idiomas.Add(new IdiomaViewModel(s)));
         LoadingService.LoadingStop();
     })
     .Error(erros =>
     {
         MessageDialogService.Create(erros.First(), c =>
         {
             LoadingService.LoadingStop();
             NavigationService.Close();
         }, null);
     });
 }
Ejemplo n.º 11
0
        private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtNewPermiso.Text))
            {
                var selectedPermissiosn = GetSelectedPermissions();
                var newRol = new Rol(txtNewPermiso.Text);

                newRol.Permissions.AddRange(selectedPermissiosn);
                var response = await new RolesServices().CreatAsync(newRol);
                if (response.SuccessResult)
                {
                    MessageDialogService.Create("Permiso creado exitosamente", async c =>
                    {
                        LoadingService.LoadingStop();
                        await LoadDataAsync();
                    }, null);
                }
            }
        }
Ejemplo n.º 12
0
 private async Task LoadDataAsync()
 {
     (await new ConcursosRepository().GetAsync())
     .Success(concursos =>
     {
         concursos?.Where(x => x.Comprador.UsuarioId == IdentityServices.Instance.GetUserLogged().Id)
         .ToList()
         ?.ForEach(x => Concursos.Add(new ConcursoViewModel(x)));
         LoadingService.LoadingStop();
     })
     .Error(async x =>
     {
         MessageDialogService.Create(x.First(), c =>
         {
             LoadingService.LoadingStop();
             NavigationService.Close();
         }, null);
     });
 }
Ejemplo n.º 13
0
 private async Task LoadDataAsync()
 {
     (await new RolRepository().Get())
     .Success(roles =>
     {
         Permisos.Remove(x => true);
         roles?.ForEach(x => Permisos.Add(x));
         var list = FillTree(roles, new List <TreeViewNode>());
         list.ToList().ForEach(x => trvPermisos.RootNodes.Add(x));
         LoadingService.LoadingStop();
     })
     .Error(x =>
     {
         MessageDialogService.Create("No hay Roles", c =>
         {
             LoadingService.LoadingStop();
             NavigationService.NavigatePop <Dashboard>();
         }, null);
     });
 }
        private void ApbAccept_OnClick(object sender, RoutedEventArgs e)
        {
            LoadingService.LoadingStart();

            MessageDialogService.Create("¿Desea salvar todos los cambios realizados en los idiomas?", async command =>
            {
                foreach (var idioma in Idiomas)
                {
                    await new IdiomasRepository()
                    .UpdateDataAsync(idioma.Idioma);
                }
                AsyncHelper.CallAsyncMethod(() => new IdiomasRepository().GetByName(SettingsServices.Idioma.Nombre))
                .Success(idioma =>
                         SettingsServices.SetIdioma(idioma));
                LoadingService.LoadingStop();
            },
                                        command =>
            {
                LoadingService.LoadingStop();
            });
        }
Ejemplo n.º 15
0
 private async void BtnAcept_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(Nombre)
         ||
         string.IsNullOrWhiteSpace(Descripcion))
     {
         MessageDialogService.Create("Debe completar todos los campos");
     }
     else
     {
         LoadingService.LoadingStart();
         (await(new TerminosYCondicionesRepository()).InsertDataAsync(new Entities.TerminosYCondiciones(Nombre, Descripcion)))
         .Success(x =>
         {
             MessageDialogService.Create("Terminos y condiciones creado exitosamente", c =>
             {
                 LoadingService.LoadingStop();
                 NavigationService.NavigatePop <Dashboard>();
             }, null);
         });
     }
 }
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var concurso = (ConcursoParaOfertar)e.AddedItems.First();

            if (concurso.ConcursoProveedor.Ganador)
            {
                NavigationService.Navigate <ConfirmacionGanadorPage>(new
                {
                    Concurso          = concurso.Concurso,
                    ConcursoProveedor = concurso.ConcursoProveedor
                });
            }
            else if (concurso.ConcursoProveedor.AceptoTerminosYCondiciones)
            {
                if (concurso.Concurso.FechaInicio < DateTime.Now)
                {
                    NavigationService.Navigate <OfertarConcursoPage>(new
                    {
                        ConcursoId          = concurso.Concurso.Id,
                        ConcursoProveedorId = concurso.ConcursoProveedor.Id
                    });
                }
                else
                {
                    MessageDialogService.Create("El concurso todavia no se encuentra listo para ofertar");
                }
            }
            else
            {
                MessageDialogService.Create("Usted no acepto los terminos y condiciones generales todavia. Desea acceder a los terminos y condiciones para poder aceptarlos?", c =>
                {
                    NavigationService.Navigate <AceptarTerminosYCondicionesPage>(new
                    {
                        ConcursoId = concurso.Concurso.Id
                    });
                }, x => { });
            }
        }
Ejemplo n.º 17
0
        private async void BtnAccept_Click(object sender, RoutedEventArgs e)
        {
            LoadingService.LoadingStart();



            (await new ProveedoresServices().Registrar(Proveedor, Email, Password))
            .Success(s =>
            {
                MessageDialogService.Create("Proveedor Registrador Existosamente", c =>
                {
                    LoadingService.LoadingStop();
                    NavigationService.NavigatePop <Dashboard>();
                }, null);
            })
            .Error(erros =>
            {
                MessageDialogService.Create("Error al Crear el Proveedor", c =>
                {
                    LoadingService.LoadingStop();
                }, null);
            });
        }