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 void BtnAccept_Click(object sender, RoutedEventArgs e)
 {
     LoadingService.LoadingStart();
     CheckThee();
     if (_configuracion == null)
     {
         (await _configuracionesRepository.InsertDataAsync(new Configuracion
         {
             IdiomaId = _idiomaSelected.Id,
             Theme = _themeName,
             UsuarioId = IdentityServices.Instance.GetUserLogged().Id
         }))
         .Success(x =>
         {
             _pageUtilities.ShowMessageDialog("ConfiguraciĆ³n Actualizada correctamente");
         });
     }
     else
     {
         _configuracion.IdiomaId = _idiomaSelected.Id;
         _configuracion.Theme    = _themeName;
         (await _configuracionesRepository.UpdateDataAsync(_configuracion))
         .Success(x =>
         {
             _pageUtilities.ShowMessageDialog("ConfiguraciĆ³n Actualizada correctamente");
         });
     }
 }
        public MainContainerPage()
        {
            InitializeComponent();
            LoadingService.SetLoadingCallBack(() => Loading.IsLoading = true,
                                              () => Loading.IsLoading = false);
            NavigationService.Register((page, parameter) =>
            {
                contentFrame.Navigate(page, parameter, new DrillInNavigationTransitionInfo());
            },
                                       page =>
            {
                if (contentFrame.CanGoBack)
                {
                    contentFrame.BackStack.Remove(contentFrame.BackStack.ElementAt(contentFrame.BackStack.Count - 1));
                }
                contentFrame.Navigate(page, null, new DrillInNavigationTransitionInfo());
            },
                                       () =>
            {
                if (contentFrame.CanGoBack)
                {
                    contentFrame.BackStack.Remove(contentFrame.BackStack.ElementAt(contentFrame.BackStack.Count - 1));
                }
            },
                                       () =>
            {
                Application.Current.Exit();
            });


            Loaded += OnLoaded;
        }
        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);
            });
        }
        public IdiomasSettingsPage()
        {
            InitializeComponent();
            LoadingService.LoadingStart();

            LoadData();
        }
Example #6
0
 public void Refresh()
 {
     leftMenu.MarkAsRequireRender();
     productDropDown.MarkAsRequireRender();
     StateHasChanged();
     LoadingService.CloseFullScreenLoading();
 }
Example #7
0
 private async void BtnAccept_Click(object sender, RoutedEventArgs e)
 {
     LoadingService.LoadingStart();
     SelectedUsuario.SetRol((Rol)ListViewPermisos.SelectedItem);
     await(new UsuarioService().Update(SelectedUsuario));
     EditModeEnable = false;
     LoadingService.LoadingStop();
 }
Example #8
0
 public void ShowMessageDialog(string message, Action callBackSuccess = null)
 {
     MessageDialogService.Create(message, c =>
     {
         callBackSuccess?.Invoke();
         LoadingService.LoadingStop();
     }, null);
 }
Example #9
0
 public void Loading()
 {
     LoadingService.Show(new LoadingOption()
     {
         Background = "rgba(0, 0, 0, 0.1)",
         Text       = "ę‹¼å‘½åŠ č½½äø­",
         IconClass  = "el-icon-loading"
     });
 }
Example #10
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);
 }
        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 => { });
        }
        private async void ApbAccept_OnClick(object sender, RoutedEventArgs e)
        {
            LoadingService.LoadingStart();

            var newIdioma = new Idioma(NewIdiomaName, Traducciones.ToList());

            (await new IdiomaServices().Crear(newIdioma))
            .Success(x => { _pageUtilities.ShowMessageDialog($"El idioma {newIdioma.Nombre} fue creado existosamente"); })
            .Error(errors => { _pageUtilities.ShowMessageDialog(errors.First()); });
        }
        private async void LoadData()
        {
            LoadingService.LoadingStart();

            (await(new TraduccionesRepository()
                   .GetAllKeys())).Success(x =>
            {
                x.ForEach(s => Traducciones.Add(s));
                LoadingService.LoadingStop();
            }).Error(errors => _pageUtilities.ShowMessageDialog(errors.First()));
        }
Example #14
0
        protected async Task WithFullScreenLoading(Func <Task> action)
        {
            LoadingService.Show(new LoadingOption()
            {
                Background = "rgba(0, 0, 0, 0.1)",
                Text       = "",
                IconClass  = "el-icon-loading"
            });
            await action();

            LoadingService.CloseFullScreenLoading();
        }
        internal async Task CurrentPageChangedAsync(int page)
        {
            currentPage = page;
            if (CurrentPageChanged.HasDelegate)
            {
                RequireRender = true;
                LoadingService.Show();
                await CurrentPageChanged.InvokeAsync(page);

                LoadingService.CloseFullScreenLoading();
            }
        }
Example #16
0
        private async void SetLoginPolicy()
        {
            LoadingService.ShowLoadingStatus(true);
            var startTime = DateTime.Now;

            _log.Info("SetLoginPolicy method call started");
            try
            {
                CacheBusinessLogic.IpAddress = GetLocalIp();
                var loginPolicy = await _loginBussinessLogic.GetLoginPolicyAsync();

                var registerNumber = await new Helper().GetRegisterNumber();
                CacheBusinessLogic.RegisterNumber = (byte)registerNumber;
                NavigateService.Instance.NavigateToLogin();
            }
            catch (InternalServerException ex)
            {
                ShowNotification(ex.Error.Message, ShutDownApplication, ShutDownApplication, ApplicationConstants.ButtonWarningColor);
            }
            catch (ApiDataException ex)
            {
                _log.Warn(ex);
                ShowNotification(ex.Error.Message, ShutDownApplication, ShutDownApplication
                                 , ApplicationConstants.ButtonWarningColor);
            }
            catch (NullReferenceException ex)
            {
                _log.Warn(ex);

                ShowNotification(ApplicationConstants.ApiNotConnected, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            catch (ArgumentException ex)
            {
                _log.Warn(ex);

                ShowNotification(ApplicationConstants.LanguageNotSupported, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            catch (Exception ex)
            {
                _log.Warn(ex);
                ShowNotification(ApplicationConstants.SomethingBadHappned, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            finally
            {
                LoadingService.ShowLoadingStatus(false);
                var endTime = DateTime.Now;
                _log.Info(string.Format("Time Taken In Login Page is {0}ms", (endTime - startTime).TotalMilliseconds));
            }
        }
Example #17
0
        private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var folder = await StorageFolder.GetFolderFromPathAsync(UserDataPaths.GetDefault().Music);

            LoadingService.LoadingStart();
            StorageFolder assets = await folder.GetFolderAsync("Backups");

            (await new BackupServices().CreateBackup(assets.Path)).Success(x =>
            {
                _pageUtilities.ShowMessageDialog($"El backup {x}, fue creado correctamente");
                GetFiles();
            });
        }
Example #18
0
        private async void ButtonRestore_OnClick(object sender, RoutedEventArgs e)
        {
            if (BackupSelected != null)
            {
                LoadingService.LoadingStart();

                (await new BackupServices().RestoreLastBackup(BackupSelected.Path)).Success(x =>
                {
                    _pageUtilities.ShowMessageDialog($"El backup {x}, fue Restaurado correctamente");
                    GetFiles();
                });
            }
        }
Example #19
0
        /// <summary>
        /// Called when parameters change.
        /// </summary>
        /// <returns>The asynchronous test.</returns>
        protected override async Task OnParametersSetAsync()
        {
            if (Uid != lastUid)
            {
                lastUid = Uid;
                await LoadingService.WrapExecutionAsync(
                    async() =>
                    History =
                    await DocumentService.LoadDocumentHistoryAsync(lastUid));
            }

            await base.OnParametersSetAsync();
        }
Example #20
0
        public async Task WithFullScreenLoading(Func <Task <BaseResponse> > action, Action <BaseResponse> callback = null)
        {
            LoadingService.Show(new LoadingOption()
            {
                Background = "rgba(0, 0, 0, 0.1)",
                Text       = "",
                IconClass  = "el-icon-loading"
            });
            var result = await action();

            callback?.Invoke(result);
            LoadingService.CloseFullScreenLoading();
        }
Example #21
0
        /// <summary>
        /// Called when the <see cref="Document"/> identifier is set.
        /// </summary>
        /// <returns>An asynchronous task.</returns>
        protected override async Task OnParametersSetAsync()
        {
            var newUid = WebUtility.UrlDecode(Uid);

            if (newUid != uid)
            {
                var history = string.Empty;
                var query   = NavigationHelper.GetQueryString(
                    NavigationService.Uri);
                if (query.ContainsKey(nameof(history)))
                {
                    history = query[nameof(history)];
                }

                Loading  = false;
                NotFound = false;
                uid      = newUid;
                try
                {
                    Loading = true;
                    if (string.IsNullOrWhiteSpace(history))
                    {
                        await LoadingService.WrapExecutionAsync(
                            async() => Document = await
                            DocumentService.LoadDocumentAsync(uid));

                        NotFound = Document == null;
                        Audit    = false;
                    }
                    else
                    {
                        await LoadingService.WrapExecutionAsync(
                            async() => Document = await
                            DocumentService.LoadDocumentSnapshotAsync(Guid.Parse(history), uid));

                        Audit    = true;
                        NotFound = Document == null;
                    }

                    Loading = false;
                    await TitleService.SetTitleAsync($"Viewing {Title}");
                }
                catch
                {
                    NotFound = true;
                }
            }

            await base.OnParametersSetAsync();
        }
Example #22
0
 private async Task LoadDataAsync()
 {
     (await new LogRepository().Get())
     .Success(logs =>
     {
         logs.ForEach(x => Logs.Add(x));
         LoadingService.LoadingStop();
     })
     .Error(async x =>
     {
         var dialog = new MessageDialog("No hay logs");
         dialog.ShowAsync();
         LoadingService.LoadingStop();
     });
 }
Example #23
0
        private async Task EditMode()
        {
            LoadingService.LoadingStart();

            var respose = (await _usuarioRepository.GetUsuarioAsync(SelectedUsuario.Email));

            if (respose.SuccessResult)
            {
                SelectedUsuario = respose.Result;
                EditModeEnable  = true;
                var nodeToSelect = Permisos.FirstOrDefault(x => x.Nombre == SelectedUsuario.Rol.Nombre);
                ListViewPermisos.SelectedItem = nodeToSelect;
                PermisoSelected = nodeToSelect;
                LoadingService.LoadingStop();
            }
        }
 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);
     });
 }
Example #26
0
 private async Task LoadDataAsync()
 {
     (await new ConcursosRepository().Get())
     .Success(concursos =>
     {
         concursos?.ForEach(x => Concursos.Add(x));
         LoadingService.LoadingStop();
     })
     .Error(erros =>
     {
         ;
         _pageUtilities.ShowMessageDialog(erros.First(), () =>
         {
             LoadingService.LoadingStop();
             NavigationService.Close();
         });
     });
 }
 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);
     });
 }
Example #28
0
        private async void LoadBottlePages()
        {
            LoadingService.ShowLoadingStatus(true);
            var bottlePages = await _stockBusinessLogic.GetHotProductPages();

            Bottles = new ObservableCollection <BottleModel>(
                from b in bottlePages
                select new BottleModel
            {
                PageId   = b.PageId,
                PageName = b.PageName
            });

            foreach (var bottle in Bottles)
            {
                bottle.BottleDetails = await LoadBottles(bottle.PageId);
            }
            LoadingService.ShowLoadingStatus(false);
        }
Example #29
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);
                }
            }
        }
Example #30
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);
     });
 }