예제 #1
0
 /// <summary>
 ///     Clears all the global
 /// </summary>
 public static void ClearValues()
 {
     AccountingGroups.Clear();
     CostProfileGroups.Clear();
     CountriesOfOrigin.Clear();
     CustomerIdConversions.Clear();
     ExternalIdTypes.Clear();
     ItemCategories.Clear();
     ItemGroups.Clear();
     ItemIds.Clear();
     ItemIdSuffixes.Clear();
     ItemRecords.Clear();
     Languages.Clear();
     Licenses.Clear();
     LocalItemIds.Clear();
     MetaDescriptions.Clear();
     PricingGroups.Clear();
     ProductCategories.Clear();
     ProductFormats.Clear();
     ProductGoups.Clear();
     ProductLines.Clear();
     Properties.Clear();
     PsStatuses.Clear();
     RequestStatus.Clear();
     SpecialCharacters.Clear();
     TariffCodes.Clear();
     Territories.Clear();
     ToolTips.Clear();
     UpcProductFormatExceptions.Clear();
     Upcs.Clear();
     UserNames.Clear();
     UserRoles.Clear();
     WebCategoryList.Clear();
 }
        public async void Load()
        {
            try
            {
                var restaurantId = _dataService.Restaurant.Id;
                var httpResponse = await ShowProgressAsync(async() => await _categoryRepository.GetCategoriesAsync(restaurantId));

                if (httpResponse == null)
                {
                    return;
                }

                if (httpResponse.IsSuccess)
                {
                    ProductCategories.Clear();
                    foreach (var category in httpResponse.Value)
                    {
                        ProductCategories.Add(new CategoryWrapper(category));
                    }
                }
                else
                {
                    await _dialogService.ShowMessageAsync(httpResponse.Message, httpResponse.Title);
                }
            }
            catch (Exception ex)
            {
                _logService.Write(ex);
                await _dialogService.ShowMessageAsync(ex.Message);
            }
            finally
            {
                ((DelegateCommand)RefreshCommand).RaiseCanExecuteChanged();
                ((DelegateCommand)NewCategoryCommand).RaiseCanExecuteChanged();
            }
        }