Exemple #1
0
        public ReestrSettingViewModel(
            ModalNavigationStore modalNavigationStore,
            IBarrelStorageDataService barrelStorageDataService,
            IReestrSettingDataService reestrSettingDataService,
            IRecipeDataService recipeDataService,
            ICustomerDataService customerDataService)
        {
            _modalNavigationStore     = modalNavigationStore;
            _barrelStorageDataService = barrelStorageDataService;
            _reestrSettingDataService = reestrSettingDataService;
            _recipeDataService        = recipeDataService;
            _customerDataService      = customerDataService;

            this.WhenAnyValue(x => x.Password)
            .Throttle(TimeSpan.FromSeconds(1))
            .Where(x => !string.IsNullOrWhiteSpace(x))
            .ObserveOnDispatcher()
            .Subscribe(PasswordChecker);

            this.WhenAnyValue(x => x.SelectedRecipe)
            .Skip(1)
            .SelectMany(async(x) => await _barrelStorageDataService.GetLastBarrelNumber(x))
            .ObserveOnDispatcher()
            .Subscribe(number => ReestrSetting.InitialBarrelNumber = number + 1);

            Task.Run(Initialize);
            SubmitCommand = new DelegateCommand(ExecuteSubmitCommand);
            CancelCommand = new DelegateCommand(() => modalNavigationStore.Close());
        }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public IngredientController(IRecipeDataService recipeDataService, IIngredientCategorizer ingredientCategorizer,
			IAffiliateService affiliateService)
		{
			this.RecipeDataService = recipeDataService;
			this.IngredientCategorizer = ingredientCategorizer;
			this.AffiliateService = affiliateService;
		}
        public HomePageViewModel(INavigationService navigationService, ICategoriesDataService categoriesDataService, IDialogService dialogService, IRecipeDataService recipeDataService)
        {
            _navigationService     = navigationService;
            _categoriesDataService = categoriesDataService;
            _dialogService         = dialogService;
            _recipeDataService     = recipeDataService;

            _categories           = new ObservableCollection <Categories>();
            _recipes              = new ObservableCollection <Recipe>();
            isCategoryListVisible = true;
            isRecipeListVisible   = false;

            CategorySelectedCommand = new Command <Categories>(OnCategorySelectedCommand);
            GoToReceipe             = new Command <ObservableCollection <Categories> >(GotoRecipe);
            RecipeSelectedCommand   = new Command <Recipe>(OnRecipeSelectedCommand);
            Logout = new Command(OnLogout);

            MessagingCenter.Subscribe <AddCategoryViewModel>(this, MessageNames.CategoryChangedMessage, OnCategoryChanges);
            MessagingCenter.Subscribe <CategoryDetailViewModel>(this, MessageNames.CategoryChangedMessage, OnCategoryUpdate);
            MessagingCenter.Subscribe <AddNewReceipeViewModel>(this, MessageNames.RecipeAdded, UpdateMessageAboutRecipe);
            MessagingCenter.Subscribe <RecipeDetailViewModel>(this, MessageNames.RecipeDeleted, OnRecipeChange);
            MessagingCenter.Subscribe <RecipeDetailViewModel>(this, MessageNames.RecipeUpdate, OnRecipeChange);
            MessagingCenter.Subscribe <CategoryDetailViewModel>(this, MessageNames.CategoryDeleted, UpdateMessageAboutCategory);
            MessagingCenter.Subscribe <LoginPageViewModel, User>(this, MessageNames.TakeTheUser, OnGetUser);
        }
Exemple #4
0
 public RecipeViewModel(IRecipeDataService recipeDataService)
 {
     _recipeDataService = recipeDataService;
     CreateRecipe       = ReactiveCommand.CreateFromTask(ExecuteCreateRecipe);
     CreateRecipe.Subscribe(x => AddRecipe(x));
     Task.Run(Initialize);
 }
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public IngredientController(IRecipeDataService recipeDataService, IIngredientCategorizer ingredientCategorizer,
                             IAffiliateService affiliateService)
 {
     this.RecipeDataService     = recipeDataService;
     this.IngredientCategorizer = ingredientCategorizer;
     this.AffiliateService      = affiliateService;
 }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public PartnerController(IUnitOfWorkFactory<BrewgrContext> unitOfWorkFactory, IUserService userService, IPartnerService partnerService,
			IRecipeDataService recipeDataService)
		{
			this.UnitOfWorkFactory = unitOfWorkFactory;
			this.UserService = userService;
			this.PartnerService = partnerService;
			this.RecipeDataService = recipeDataService;
		}
Exemple #7
0
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public PartnerController(IUnitOfWorkFactory <BrewgrContext> unitOfWorkFactory, IUserService userService, IPartnerService partnerService,
                          IRecipeDataService recipeDataService)
 {
     this.UnitOfWorkFactory = unitOfWorkFactory;
     this.UserService       = userService;
     this.PartnerService    = partnerService;
     this.RecipeDataService = recipeDataService;
 }
Exemple #8
0
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public DefaultSendToShopEmailMessageFactory(IUserService userService, IPartnerService partnerService, IStringCryptoService stringCryptoService,
                                             IWebSettings webSettings, IRecipeDataService recipeDataService)
 {
     this.UserService         = userService;
     this.PartnerService      = partnerService;
     this.StringCryptoService = stringCryptoService;
     this.WebSettings         = webSettings;
     this.RecipeDataService   = recipeDataService;
 }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public DefaultSendToShopEmailMessageFactory(IUserService userService, IPartnerService partnerService, IStringCryptoService stringCryptoService,
			IWebSettings webSettings, IRecipeDataService recipeDataService)
		{
			this.UserService = userService;
			this.PartnerService = partnerService;
			this.StringCryptoService = stringCryptoService;
			this.WebSettings = webSettings;
			this.RecipeDataService = recipeDataService;
		}
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public DefaultSendToShopService(IBrewgrRepository repository, IPartnerIdResolver partnerIdResolver, IPartnerService partnerService, 
			IUserService userService, IStringCryptoService stringCryptoService, IWebSettings webSettings, IEmailSender emailSender,
			IRecipeDataService recipeDataService, ISendToShopEmailMessageFactory sendToShopEmailMessageFactory)
		{
			this.Repository = repository;
			this.PartnerIdResolver = partnerIdResolver;
			this.PartnerService = partnerService;
			this.UserService = userService;
			this.StringCryptoService = stringCryptoService;
			this.WebSettings = webSettings;
			this.EmailSender = emailSender;
			this.RecipeDataService = recipeDataService;
			this.SendToShopEmailMessageFactory = sendToShopEmailMessageFactory;
		}
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public DefaultSendToShopService(IBrewgrRepository repository, IPartnerIdResolver partnerIdResolver, IPartnerService partnerService,
                                 IUserService userService, IStringCryptoService stringCryptoService, IWebSettings webSettings, IEmailSender emailSender,
                                 IRecipeDataService recipeDataService, ISendToShopEmailMessageFactory sendToShopEmailMessageFactory)
 {
     this.Repository                    = repository;
     this.PartnerIdResolver             = partnerIdResolver;
     this.PartnerService                = partnerService;
     this.UserService                   = userService;
     this.StringCryptoService           = stringCryptoService;
     this.WebSettings                   = webSettings;
     this.EmailSender                   = emailSender;
     this.RecipeDataService             = recipeDataService;
     this.SendToShopEmailMessageFactory = sendToShopEmailMessageFactory;
 }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public DefaultBeerXmlRecipeImporter(IRecipeUnitConverter recipeUnitConverter, IRecipeDataService brewDataService, IBeerStyleService beerStyleService,
			IUserResolver userResolver)
		{
			this.RecipeUnitConverter = recipeUnitConverter;
			this.BrewDataService = brewDataService;
			this.BeerStyleService = beerStyleService;

			// Detect User Id
			var user = userResolver.Resolve();
			if(user != null)
			{
				this.UserId = user.UserId;
			}
		}
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public AdminController(IUnitOfWorkFactory<BrewgrContext> unitOfWorkFactory, IUserService userService, IAdminService adminService, 
			IMarketingService marketingService, IRecipeDataService brewDataService, IBeerStyleService beerStyleService,
			IAffiliateService affiliateService, IAuthenticationService authenticationService, ISendToShopService sendToShopService)
		{
			this.UnitOfWorkFactory = unitOfWorkFactory;
			this.UserService = userService;
			this.AdminService = adminService;
			this.MarketingService = marketingService;
			this.BrewDataService = brewDataService;
            this.BeerStyleService = beerStyleService;
			this.AffiliateService = affiliateService;
			this.AuthenticationService = authenticationService;
			this.SendToShopService = sendToShopService;
		}
Exemple #14
0
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public AdminController(IUnitOfWorkFactory <BrewgrContext> unitOfWorkFactory, IUserService userService, IAdminService adminService,
                        IMarketingService marketingService, IRecipeDataService brewDataService, IBeerStyleService beerStyleService,
                        IAffiliateService affiliateService, IAuthenticationService authenticationService, ISendToShopService sendToShopService)
 {
     this.UnitOfWorkFactory     = unitOfWorkFactory;
     this.UserService           = userService;
     this.AdminService          = adminService;
     this.MarketingService      = marketingService;
     this.BrewDataService       = brewDataService;
     this.BeerStyleService      = beerStyleService;
     this.AffiliateService      = affiliateService;
     this.AuthenticationService = authenticationService;
     this.SendToShopService     = sendToShopService;
 }
Exemple #15
0
        /// <summary>
        /// ctor the Mighty
        /// </summary>
        public DefaultBeerXmlRecipeImporter(IRecipeUnitConverter recipeUnitConverter, IRecipeDataService brewDataService, IBeerStyleService beerStyleService,
                                            IUserResolver userResolver)
        {
            this.RecipeUnitConverter = recipeUnitConverter;
            this.BrewDataService     = brewDataService;
            this.BeerStyleService    = beerStyleService;

            // Detect User Id
            var user = userResolver.Resolve();

            if (user != null)
            {
                this.UserId = user.UserId;
            }
        }
Exemple #16
0
        //ctr
        public AddRecipeViewModel(IRecipeDataService recipeData, ITagDataService tagData, ICategoryDataService categoryData, IFrameNavigationService navigationService)
        {
            _navigationService   = navigationService;
            _recipeDataService   = recipeData;
            _tagDataService      = tagData;
            _categoryDataService = categoryData;

            LoadCategories();

            LoadTags();

            AddRecipeCommand   = new RelayCommand(AddRecipe, () => IsRecipeValid());
            ResetRecipeCommand = new RelayCommand(ResetRecipe);
            AddTagCommand      = new RelayCommand(AddTag);
            RemoveTagCommand   = new RelayCommand <object>(RemoveTag);
        }
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public DefaultRecipeService(IBrewgrRepository repository, ICachingService cachingService, IUserResolver userResolver,
                             IRecipeDataService recipeDataService, IBeerStyleService beerStyleService, IPartnerIdResolver partnerIdResolver, IPartnerService partnerService,
                             IIngredientCategorizer ingredientCategorizer, IDataContextActivationInfo <BrewgrContext> dataContextActivationInfo, IUserService userService,
                             ISendToShopService sendToShopService)
 {
     this.Repository                = repository;
     this.CachingService            = cachingService;
     this.UserResolver              = userResolver;
     this.RecipeDataService         = recipeDataService;
     this.BeerStyleService          = beerStyleService;
     this.PartnerIdResolver         = partnerIdResolver;
     this.PartnerService            = partnerService;
     this.IngredientCategorizer     = ingredientCategorizer;
     this.DataContextActivationInfo = dataContextActivationInfo;
     this.UserService               = userService;
     this.SendToShopService         = sendToShopService;
 }
Exemple #18
0
        public AddNewReceipeViewModel(INavigationService navigationService, IRecipeDataService recipeDataService, IDialogService dialogService)
        {
            _navigationService = navigationService;
            _recipeDataService = recipeDataService;
            _dialogService     = dialogService;

            _myselectedcategory = new Categories();
            _userOnline         = new User();
            _recipe             = new Recipe();

            AddRecipeImageURL = new Command(OnAddRecipeImage);
            AddRecipe         = new Command(OnAddRecipe);
            AddNewCategory    = new Command(GoToCategoryPage);

            MessagingCenter.Subscribe <LoginPageViewModel, User>(this, MessageNames.TakeTheUser, OnReceiveLoggedUser);
            MessagingCenter.Subscribe <HomePageViewModel, ObservableCollection <Categories> >(this, MessageNames.CategoryChangedMessage, OnUpdateCategoryList);
        }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public SendToShopOrderPartnerNotificationMessage(Partner partner, PartnerSendToShopSettings partnerSendToShopSettings, 
			SendToShopOrder sendToShopOrder, User user, IStringCryptoService stringCryptoService, IWebSettings webSettings,
			IRecipeDataService recipeDataService)
		{
			this.Partner = partner;
			this.SendToShopOrder = sendToShopOrder;
			this.User = user;
			this.StringCryptoService = stringCryptoService;
			this.WebSettings = webSettings;

			this.Ingredients = recipeDataService.GetAllPublicIngredients();

			// Message Setup
			this.FormatAsHtml = true;
			this.Subject = "Brewgr.com - Send-To-Shop Order #:" + sendToShopOrder.SendToShopOrderId;
			this.SenderAddress = webSettings.SenderAddress;
			this.SenderDisplayName = webSettings.SenderDisplayName;
			this.ToRecipients.Add(partnerSendToShopSettings.DeliveryEmailAddress);
		}
        public CategoryDetailViewModel(INavigationService navigationService, ICategoriesDataService categoriesDataService, IRecipeDataService recipeDataService, IDialogService dialogService)
        {
            _navigationService     = navigationService;
            _categoriesDataService = categoriesDataService;
            _recipeDataService     = recipeDataService;
            _dialogService         = dialogService;

            RecipeSelectedCommand = new Command <Recipe>(OnRecipeSelectedCommand);
            DeleteCategory        = new Command(OnDeleteCategory);
            EditCategory          = new Command(OnEditCategory);
            SaveCategory          = new Command(OnSaveCategory);
            AddCategoryImageURL   = new Command(OnAddCategoryImageURL);

            MessagingCenter.Subscribe <RecipeDetailViewModel>(this, MessageNames.RecipeDeleted, UpdateRecipies);
            MessagingCenter.Subscribe <RecipeDetailViewModel>(this, MessageNames.RecipeUpdate, UpdateRecipie);
            MessagingCenter.Subscribe <LoginPageViewModel, User>(this, MessageNames.TakeTheUser, OnReceiveLoggedUser);

            InitialStateOfPage();
        }
        /// <summary>
        /// ctor the Mighty
        /// </summary>
        public SendToShopOrderPartnerNotificationMessage(Partner partner, PartnerSendToShopSettings partnerSendToShopSettings,
                                                         SendToShopOrder sendToShopOrder, User user, IStringCryptoService stringCryptoService, IWebSettings webSettings,
                                                         IRecipeDataService recipeDataService)
        {
            this.Partner             = partner;
            this.SendToShopOrder     = sendToShopOrder;
            this.User                = user;
            this.StringCryptoService = stringCryptoService;
            this.WebSettings         = webSettings;

            this.Ingredients = recipeDataService.GetAllPublicIngredients();

            // Message Setup
            this.FormatAsHtml      = true;
            this.Subject           = "Brewgr.com - Send-To-Shop Order #:" + sendToShopOrder.SendToShopOrderId;
            this.SenderAddress     = webSettings.SenderAddress;
            this.SenderDisplayName = webSettings.SenderDisplayName;
            this.ToRecipients.Add(partnerSendToShopSettings.DeliveryEmailAddress);
        }
        public RecipeDetailViewModel(INavigationService navigationService, IRecipeDataService recipeDataService, IDialogService dialogService)
        {
            _navigationService = navigationService;
            _recipeDataService = recipeDataService;
            _dialogService     = dialogService;

            DeleteRecipe    = new Command <Recipe>(OnDeleteRecipe);
            EditRecipe      = new Command(OnEditRecipe);
            SaveRecipe      = new Command(OnSaveRecipe);
            UploadNewImage  = new Command(OnUploadImage);
            ReadDescription = new Command(OnReadDescription);

            IsEditable               = true;
            IsEditVisible            = true;
            IsReadDescriptionVisible = true;
            IsSaveVisible            = false;
            IsUploadVisible          = false;
            isMessageVisible         = false;
        }
        public BarrelViewModel(IRecipeDataService recipeDataService, IBarrelStorageDataService barrelStorageDataService)
        {
            var canExecute = this
                             .WhenAnyValue(x => x.SelectedRecipe, x => x.BarrelStorage.TotalWeight,
                                           (selectedReice, total) => selectedReice != null && total > 0);

            this.WhenAnyValue(x => x.SelectedRecipeForFilter)
            .Where(x => x != null)
            .Select(x => x)
            .Subscribe(FilterCollection);

            BarrelStorage.ProductionDate = DateTime.Now;
            _recipeDataService           = recipeDataService;
            _barrelStorageDataService    = barrelStorageDataService;
            CreateRecipe = ReactiveCommand.CreateFromTask(ExecuteCreateBarrelStorage, canExecute);
            CreateRecipe.Subscribe(x => AddBarrelStorage(x));

            Task.Run(Initialize);
        }
        public CookbookViewModel(IRecipeDataService dataService, string mode = "All")
        {
            _dataService = dataService;

            LoadRecipeCommand          = new RelayCommand(LoadRecipe);
            LoadFavoriteRecipesCommand = new RelayCommand(LoadFavoriteRecipes);
            LoadAllRecipesCommand      = new RelayCommand(LoadRecipes);
            LoadDessertsCommand        = new RelayCommand(LoadDesserts);
            LoadSoupsCommand           = new RelayCommand(LoadSoups);
            LoadLunchesCommand         = new RelayCommand(LoadLunches);
            LoadDinnersCommand         = new RelayCommand(LoadDinners);
            LoadBreakfastsCommand      = new RelayCommand(LoadBreakfasts);
            LoadAppetizersCommand      = new RelayCommand(LoadAppetizers);

            LoadEditRecipeViewModelCommand = new RelayCommand(LoadAddRecipe);

            Mediator.Subscribe("LoadAll", LoadAllRecipes);
            Mediator.Subscribe("AddRecipe", AddRecipe);
            Mediator.Subscribe("RemoveRecipe", RemoveRecipe);
            if (mode == "All")
            {
                LoadAllRecipes("");
            }
        }
 /// <summary>
 /// ctor the Mighty
 /// </summary>
 public DefaultIngredientCategorizer(IRecipeDataService recipeDataService)
 {
     this.IngredientCategories = recipeDataService.GetIngredientCategories();
 }
Exemple #26
0
 public RecipeManager(IRecipeDataService dataService)
 {
     this.dataService = dataService;
 }