public CatalogDescription GetDefaultCatalog() { CatalogDescription result = Catalogs .FirstOrDefault(catalog => catalog.Default) ?? Catalogs.First(); return(result); }
public AdminWindowViewModel() { string status_waiting = "Waiting..."; _dataBase = new MarketModel(); //DataBaseSaveOrdersCommand = new RelayCommand(DataBaseSaveOrdersCommandExecute, null); AddProductAddCommand = new RelayCommand(AddProductAddCommandExecute, null); AddProductCancelCommand = new RelayCommand(AddProductCancelCommandExecute, null); AddCatalogAddCommand = new RelayCommand(AddCatalogAddCommandExecute, null); AddCatalogCancelCommand = new RelayCommand(AddCatalogCancelCommandExecute, null); AddUserAddCommand = new RelayCommand(AddUserAddCommandExecute, null); AddUserCancelCommand = new RelayCommand(AddUserCancelCommandExecute, null); Orders = new ObservableCollection <DataBase.Orders>(_dataBase.Orders);//_dataBase.Orders.Local; Products = new ObservableCollection <Product>(_dataBase.Product); Users = new ObservableCollection <DataBase.Users>(_dataBase.Users); SelectedProductToDelete = Products.First(); SelectedCatalogToDelete = Catalogs.First(); SelectedUserToDelete = Users.First(); DeleteProductCommand = new RelayCommand(DeleteProductCommmandExecute, null); CancelDeletingProductCommand = new RelayCommand(CancelDeletingProductCommandExecute, null); DeleteCatalogCommand = new RelayCommand(DeleteCatalogCommandExecute, null); CancelDeletingCatalogCommand = new RelayCommand(CancelDeletingCatalogCommandExecute, null); DeleteUserCommand = new RelayCommand(DeleteUserCommandExecute, null); CancelDeletingUserCommand = new RelayCommand(CancelDeletingUserCommandExecute, null); DeletingCatalogStatusText = status_waiting; DeletingProductStatusText = status_waiting; DeletingUserStatusText = status_waiting; AddingCatalogStatusText = status_waiting; AddingProductStatusText = status_waiting; AddingUserStatusText = status_waiting; }
private void CancelDeletingCatalogCommandExecute(object obj) => SelectedCatalogToDelete = Catalogs.First();
protected override void InitializePropertiesForViewing() { OnUIThread(() => { //initialize available importers if (AvailableImporters == null) { AvailableImporters = new List <EntityImporterBase> { new ItemImporter(ImportEntityType.Product.ToString()), new ItemImporter(ImportEntityType.Sku.ToString()), new ItemImporter(ImportEntityType.Bundle.ToString()), new ItemImporter(ImportEntityType.Package.ToString()), new ItemImporter(ImportEntityType.DynamicKit.ToString()), new CategoryImporter(), new AssociationImporter(_catalogRepositoryFactory.GetRepositoryInstance()), new RelationImporter(_catalogRepositoryFactory.GetRepositoryInstance()), new LocalizationImporter(), new PriceImporter(_catalogRepositoryFactory.GetRepositoryInstance()), new ItemAssetImporter(), new TaxCategoryImporter(), new JurisdictionImporter(), new JurisdictionGroupImporter(), new TaxValueImporter(), new SeoImporter() }.ToArray(); } //if this is wizard overview step or edit dialog if (this is IImportJobOverviewStepViewModel || !IsWizardMode) { if (Catalogs == null) { Catalogs = _catalogRepositoryFactory.GetRepositoryInstance().Catalogs.ToArray(); } if (string.IsNullOrEmpty(InnerItem.EntityImporter) && EntityImporters != null) { InnerItem.EntityImporter = EntityImporters.First().ToString(); } if (this is IImportJobOverviewStepViewModel) { if (InnerItem.EntityImporter == ImportEntityType.Category.ToString() || InnerItem.EntityImporter == ImportEntityType.Product.ToString() || InnerItem.EntityImporter == ImportEntityType.Bundle.ToString() || InnerItem.EntityImporter == ImportEntityType.DynamicKit.ToString() || InnerItem.EntityImporter == ImportEntityType.Package.ToString() || InnerItem.EntityImporter == ImportEntityType.Sku.ToString()) { InnerItem.CatalogId = Catalogs.First().CatalogId; } } UpdatePropertySets(InnerItem.PropertySetId); CsvFileColumns = GetCsvColumns(); OnPropertyChanged("IsCatalogSelectable"); OnPropertyChanged("IsTypeSelectable"); OnPropertyChanged("IsPropertySetSelectable"); } }); }