Exemplo n.º 1
0
 public BeerService(IBeerElasticsearch beerElasticsearch, IBeerRepository beerRepository, IUserService userService, IBreweryService breweryService)
 {
     _beerElasticsearch = beerElasticsearch;
     _beerRepository    = beerRepository;
     _userService       = userService;
     _breweryService    = breweryService;
 }
        public TextFirstPourNotificationHandler(ITapRepository tapRepository,
                                                IKegRepository kegRepository,
                                                ITextMessageService textMessageService,
                                                IEmailService emailService,
                                                IBeerRepository beerRepository)
        {
            if (tapRepository == null)
            {
                throw new ArgumentNullException("tapRepository");
            }
            if (kegRepository == null)
            {
                throw new ArgumentNullException("kegRepository");
            }
            if (textMessageService == null)
            {
                throw new ArgumentNullException("textMessageService");
            }
            if (emailService == null)
            {
                throw new ArgumentNullException("emailService");
            }
            if (beerRepository == null)
            {
                throw new ArgumentNullException("beerRepository");
            }

            _tapRepository      = tapRepository;
            _kegRepository      = kegRepository;
            _textMessageService = textMessageService;
            _emailService       = emailService;
            _beerRepository     = beerRepository;
        }
Exemplo n.º 3
0
 public VintriController(IBeerRepository beerRepository, BaseClassDataBaseRepository dataBaseRepository,
                         IUserResponseFactory userResponseFactory)
 {
     _beerRepository      = beerRepository;
     _dataBaseRepository  = dataBaseRepository;
     _userResponseFactory = userResponseFactory;
 }
Exemplo n.º 4
0
        public BeerOrchestrator(IBeerRepository beerRepository, IBreweryRepository breweryRepository, ITapRepository tapRepository, IKegRepository kegRepository, IStyleRepository styleRepository)
        {
            if (beerRepository == null)
            {
                throw new ArgumentNullException("beerRepository");
            }
            if (breweryRepository == null)
            {
                throw new ArgumentNullException("breweryRepository");
            }
            if (tapRepository == null)
            {
                throw new ArgumentNullException("tapRepository");
            }
            if (kegRepository == null)
            {
                throw new ArgumentNullException("kegRepository");
            }
            if (null == styleRepository)
            {
                throw new ArgumentException("styleRepository");
            }

            _beerRepository    = beerRepository;
            _breweryRepository = breweryRepository;
            _tapRepository     = tapRepository;
            _kegRepository     = kegRepository;
            _styleRepository   = styleRepository;
        }
Exemplo n.º 5
0
        public MainViewModel(ISettingsRepository settingsRepository, IBeerRepository beerRepository, IInteractionService interactionService, IDrinkerCycleRepository drinkerCycleRepository, IHistoryNavigationService navigationService, IProgressService progressService)
        {
            _settingsRepository = settingsRepository;
            _beerRepository = beerRepository;
            _interactionService = interactionService;
            _drinkerCycleRepository = drinkerCycleRepository;
            _navigationService = navigationService;
            _progressService = progressService;

            _addBeer = new RelayCommand(AddBeer);
            _removeBeer = new RelayCommand(RemoveBeer, () => CanRemoveBeer);
            _addGroup = new RelayCommand(AddGroup, () => CanAddGroup);

            _refreshCommand = new RelayCommand(Refresh, () => CanRefresh);
            _openSettingsCommand = new RelayCommand(OpenSettings);

            Messenger.Default.Register<Messages>(this, EvaluateMessages);

            if (IsInDesignMode)
            {
                DrinkerCycles = _drinkerCycleRepository.GetSampleCycles();
                UserInformation = settingsRepository.GetSampleUserInformations();
            }
            else
            {
                Initialize();
            }
        }
Exemplo n.º 6
0
 public BeersController(IBreweryRepository breweryRepository,
                        IBeerRepository beerRepository,
                        BreweryContext breweryContext) : base(breweryContext)
 {
     this.breweryRepository = breweryRepository;
     this.beerRepository    = beerRepository;
 }
Exemplo n.º 7
0
 public BeerService(IBeerRepository beerRepository, IBrandRepository brandRepository, IBeerTypeRepository typeRepository, IValidator validator)
 {
     this.BeerRepository  = beerRepository ?? throw new NullReferenceException("Repository can't be null");
     this.BrandRepository = brandRepository ?? throw new NullReferenceException("Repository can't be null");
     this.TypeRepository  = typeRepository ?? throw new NullReferenceException("Repository can't be null");
     this.Validator       = validator ?? throw new NullReferenceException("Validator can't be null");
 }
Exemplo n.º 8
0
 public BeerService(IBeerElasticsearch beerElasticsearch, IBeerRepository beerRepository, IUserService userService, IBreweryService breweryService)
 {
     _beerElasticsearch = beerElasticsearch;
     _beerRepository = beerRepository;
     _userService = userService;
     _breweryService = breweryService;
 }
Exemplo n.º 9
0
 public OrderService(IOrderRepository orderRepository, IBeerRepository beerRepository, ICustomerRepository customerRepository, IValidator validator, IEmailHelper emailHelper)
 {
     this.OrderRepository    = orderRepository ?? throw new NullReferenceException("Repository can't be null");
     this.BeerRepository     = beerRepository ?? throw new NullReferenceException("Repository can't be null");
     this.CustomerRepository = customerRepository ?? throw new NullReferenceException("Repository can't be null");
     this.Validator          = validator ?? throw new NullReferenceException("Validator can't be null");
     this.EmailHelper        = emailHelper ?? throw new NullReferenceException("Email helper can't be null");
 }
Exemplo n.º 10
0
 public GetBeers(IBeerRepository beerRepository)
 {
     if (beerRepository == null)
     {
         throw new ArgumentNullException(nameof(beerRepository));
     }
     _beerRepository = beerRepository;
 }
Exemplo n.º 11
0
 public BeerService(
     IBeerRepository beerRepository,
     IUnitOfWork unitOfWork
     )
 {
     _beerRepository = beerRepository;
     _unitOfWork     = unitOfWork;
 }
Exemplo n.º 12
0
 public ProvidersController(IProviderRepository providerRepository,
                            IBeerRepository beerRepository,
                            IBeerProviderRepository beerProviderRepository,
                            BreweryContext breweryContext) : base(breweryContext)
 {
     this.providerRepository     = providerRepository;
     this.beerRepository         = beerRepository;
     this.beerProviderRepository = beerProviderRepository;
 }
Exemplo n.º 13
0
 public UserService(IUserElasticsearch userElasticsearch, IUserRepository userRepository, IBreweryElasticsearch breweryElasticsearch, IBreweryRepository breweryRepository, IBeerRepository beerRepository, IBeerElasticsearch beerElasticsearch)
 {
     _userElasticsearch    = userElasticsearch;
     _userRepository       = userRepository;
     _breweryElasticsearch = breweryElasticsearch;
     _breweryRepository    = breweryRepository;
     _beerRepository       = beerRepository;
     _beerElasticsearch    = beerElasticsearch;
 }
Exemplo n.º 14
0
 public UserService(IUserElasticsearch userElasticsearch, IUserRepository userRepository, IBreweryElasticsearch breweryElasticsearch, IBreweryRepository breweryRepository, IBeerRepository beerRepository, IBeerElasticsearch beerElasticsearch)
 {
     _userElasticsearch = userElasticsearch;
     _userRepository = userRepository;
     _breweryElasticsearch = breweryElasticsearch;
     _breweryRepository = breweryRepository;
     _beerRepository = beerRepository;
     _beerElasticsearch = beerElasticsearch;
 }
        public virtual void RegisterAllUserAccount()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();
        }
Exemplo n.º 16
0
 public BeerService(IOptions <ElasticSearchSettings> elasticsearchSettings, IBeerElasticsearch beerElasticsearch,
                    IBeerRepository beerRepository, IBreweryService breweryService, ICalculation calculation, ILogger <BeerService> logger)
 {
     _elasticsearchSettings = elasticsearchSettings.Value;
     _beerRepository        = beerRepository;
     _breweryService        = breweryService;
     _beerElasticsearch     = beerElasticsearch;
     _calculation           = calculation;
     _logger = logger;
 }
Exemplo n.º 17
0
        public KegOrchestrator(IKegRepository kegRepository, ITapRepository tapRepository, IBeerRepository beerRepository)
        {
            if (kegRepository == null) throw new ArgumentNullException("kegRepository");
            if (tapRepository == null) throw new ArgumentNullException("tapRepository");
            if (beerRepository == null) throw new ArgumentNullException("beerRepository");

            _kegRepository = kegRepository;
            _tapRepository = tapRepository;
            _beerRepository = beerRepository;
        }
Exemplo n.º 18
0
        private static void Repository()
        {
            IBeerRepository repo = Database.As <IBeerRepository>();

            // single object operations
            Beer b = new Beer()
            {
                Name = "Double IPA", Flavor = "IPA"
            };

            repo.InsertBeer(b);
            b.Name = "Tripel IPA";
            repo.UpdateBeer(b);
            repo.UpsertBeer(b);

            int totalRows;
            var results = repo.FindBeersByFlavor("IPA", out totalRows);

            repo.DeleteBeer(b.Id);

            // multiple object operations
            Beer b2 = new Beer()
            {
                Name = "Tripel IPA"
            };
            Beer b3 = new Beer()
            {
                Name = "Quad IPA (eek!)"
            };
            List <Beer> beers = new List <Beer>()
            {
                b, b2
            };

            repo.InsertBeers(beers);
            beers.Add(b3);
            repo.UpsertBeers(beers);

            // wildcard find
            IList <Beer> ipas = repo.FindBeers(new { Name = "%IPA%", NameOperator = "LIKE" });

            Console.WriteLine("There are {0} IPAs in the database", ipas.Count);

            // clean up
            repo.DeleteBeers(beers.Select(beer => beer.Id));

            // create a receipt
            Receipt r = new Receipt()
            {
                Id = 1, Name = "John Smith"
            };

            repo.UpsertReceipt(r);
            repo.DeleteReceipt(r.Id);
        }
Exemplo n.º 19
0
 public BeerServiceImplementationB
 (
     IBeerRepository beerRepo,
     IStorageRepository storageRepo,
     IBrewingMaterialRepository brewingMaterialRepo
 )
 {
     m_beerRepository            = beerRepo;
     m_storageRepository         = storageRepo;
     m_brewingMaterialRepository = brewingMaterialRepo;
 }
Exemplo n.º 20
0
 public BeersController(IBeerRepository thisRepo = null)
 {
     if (thisRepo == null)
     {
         this.beerRepo = new EFBeerRepository();
     }
     else
     {
         this.beerRepo = thisRepo;
     }
 }
Exemplo n.º 21
0
 public void TextFixtureSetup()
 {
     AutoMapperConfiguration.Configure();
     _breweryElasticsearch = new BreweryElasticsearch();
     _breweryRepository    = new BreweryRepository();
     _userElasticsearch    = new UserElasticsearch();
     _userRepository       = new UserRepository();
     _userService          = new UserService(_userElasticsearch, _userRepository, _breweryElasticsearch, _breweryRepository, _beerRepository, _beerElasticsearch);
     _breweryService       = new BreweryService(_breweryRepository, _breweryElasticsearch, _userService);
     _beerRepository       = new BeerRepository();
     _beerElasticsearch    = new BeerElasticsearch();
     _beerService          = new BeerService(_beerElasticsearch, _beerRepository, _userService, _breweryService);
 }
Exemplo n.º 22
0
 public void TextFixtureSetup()
 {
     AutoMapperConfiguration.Configure();
     _breweryElasticsearch = new BreweryElasticsearch();
     _breweryRepository = new BreweryRepository();
     _userElasticsearch = new UserElasticsearch();
     _userRepository = new UserRepository();
     _userService = new UserService(_userElasticsearch,_userRepository,_breweryElasticsearch,_breweryRepository,_beerRepository,_beerElasticsearch);
     _breweryService = new BreweryService(_breweryRepository, _breweryElasticsearch, _userService);
     _beerRepository = new BeerRepository();
     _beerElasticsearch = new BeerElasticsearch();
     _beerService = new BeerService(_beerElasticsearch,_beerRepository,_userService,_breweryService);
 }
        public AnalyticsOrchestrator(IKegRepository kegRepository, IBeerRepository beerRepository, IStoredEventRepository storedEventRepository, ITapRepository tapRepository, IStyleRepository styleRepository)
        {
            if (null == kegRepository) throw new ArgumentNullException("kegRepository");
            if (null == beerRepository) throw new ArgumentNullException("beerRepository");
            if (null == storedEventRepository) throw new ArgumentNullException("storedEventRepository");
            if (tapRepository == null) throw new ArgumentNullException("tapRepository");
            if (styleRepository == null) throw new ArgumentNullException("styleRepository");

            _kegRepository = kegRepository;
            _beerRepository = beerRepository;
            _storedEventRepository = storedEventRepository;
            _tapRepository = tapRepository;
            _styleRepository = styleRepository;
        }
Exemplo n.º 24
0
        public BeerOrchestrator(IBeerRepository beerRepository, IBreweryRepository breweryRepository, ITapRepository tapRepository, IKegRepository kegRepository, IStyleRepository styleRepository)
        {
            if (beerRepository == null) throw new ArgumentNullException("beerRepository");
            if(breweryRepository == null) throw new ArgumentNullException("breweryRepository");
            if (tapRepository == null) throw new ArgumentNullException("tapRepository");
            if (kegRepository == null) throw new ArgumentNullException("kegRepository");
            if(null == styleRepository) throw new ArgumentException("styleRepository");

            _beerRepository = beerRepository;
            _breweryRepository = breweryRepository;
            _tapRepository = tapRepository;
            _kegRepository = kegRepository;
            _styleRepository = styleRepository;
        }
Exemplo n.º 25
0
        public PhotosController(IBeerRepository repo, IMapper mapper,
                                IOptions <CloudinarySettings> cloudinaryConfig)
        {
            _cloudinaryConfig = cloudinaryConfig;
            _mapper           = mapper;
            _repo             = repo;

            Account acc = new Account(
                _cloudinaryConfig.Value.CloudName,
                _cloudinaryConfig.Value.ApiKey,
                _cloudinaryConfig.Value.ApiSecret
                );

            _cloudinary = new Cloudinary(acc);
        }
        public virtual void AddUserRolesCache()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <UserRolesCacheModel> v = i.GetAllRoleDetails();


            foreach (var item in v)
            {
                base.AddUserRolesCache(item.RoleId, item.RoleName);
            }
        }
        public virtual new void AddItems()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <ApplicationCacheModel> v = i.GetBeerByType();

            foreach (var item in v)
            {
                AddItem(item.Key, item.Value.ToUpper());
            }
            AddItem("TotalCaches", v.Count.ToString());
            AddItem("LastCachedOn", DateTime.Now.ToString("MM-dd-yyyy  hh:mm tt"));
        }
        public virtual new void GetAllUsersAccountsToCache()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <UserAccountCacheModel> v  = i.GetAllUsers();
            IList <UserRolesCacheModel>   v1 = i.GetAllUserRoleDetails();

            foreach (var item in v)
            {
                item.Roles = v1.Where(x => x.UserId == item.UserId).Select(x => x.RoleName).ToList();
                AddUserAccountToCache(item.UserName, item);
            }
        }
        public virtual void RefreshApplicationCacheItems()
        {
            base.RemoveApplicationCacheItems();

            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <ApplicationCacheModel> v = i.GetBeerByType();

            foreach (var item in v)
            {
                AddItem(item.Key, item.Value.ToUpper());
            }
        }
Exemplo n.º 30
0
        public KegOrchestrator(IKegRepository kegRepository, ITapRepository tapRepository, IBeerRepository beerRepository)
        {
            if (kegRepository == null)
            {
                throw new ArgumentNullException("kegRepository");
            }
            if (tapRepository == null)
            {
                throw new ArgumentNullException("tapRepository");
            }
            if (beerRepository == null)
            {
                throw new ArgumentNullException("beerRepository");
            }

            _kegRepository  = kegRepository;
            _tapRepository  = tapRepository;
            _beerRepository = beerRepository;
        }
        public virtual void RefreshDashBoardWidgetDetails()
        {
            string                    sqlConnection             = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection              c                         = new SqlConnection(sqlConnection);
            IBeerRepository           i                         = c.As <IBeerRepository>();
            DashBoardWidgetCacheModel dashBoardWidgetCacheModel = new DashBoardWidgetCacheModel();

            dashBoardWidgetCacheModel = i.RefreshDashBoardWidgetDetails();

            List <DashBoardWidgetCacheModel> fileEncryptionDetailsChart = new List <DashBoardWidgetCacheModel>();

            fileEncryptionDetailsChart = i.GetFileEncryptionDetailsForDashBoard();

            dashBoardWidgetCacheModel.FileUploadChartLables = "'" + string.Join("','", fileEncryptionDetailsChart.Select(x => x.FileUploadChartLables)) + "'";

            dashBoardWidgetCacheModel.FileUploadChartData = string.Join(",", fileEncryptionDetailsChart.Select(x => x.FileUploadChartData));


            base.AddDashBoardDetails("Widgets", dashBoardWidgetCacheModel);
        }
Exemplo n.º 32
0
        public void ShouldReturnBeerTestGroups()
        {
            //Arrange
            var buildDir       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var testFileOutput = File.ReadAllText($"{buildDir}{TestFilePath}");
            var readerMock     = new Mock <IFileReader>();

            readerMock.Setup(x => x.Read(It.IsAny <string>())).Returns(testFileOutput);
            _beerRepository = new JsonBeerRepository(readerMock.Object);

            //Act
            var beerGroups = _beerRepository.GetBeerGroups();

            //Assert
            Assert.IsTrue(beerGroups.Count > 0);
            Assert.IsTrue(beerGroups.Count == 2);
            Assert.AreEqual(beerGroups[0].Title, "News");
            Assert.AreEqual(beerGroups[0].Slides[0].Url, "url_to_image");
            Assert.AreEqual(beerGroups[1].Title, "Most Popular");
            Assert.AreEqual(beerGroups[1].Slides[2].Caption, "Popular 3");
        }
Exemplo n.º 33
0
        public KegNearingEmptyNotificationHandler(ITapRepository tapRepository, IKegRepository kegRepository, IEmailService emailService, IBeerRepository beerRepository)
        {
            if (tapRepository == null)
            {
                throw new ArgumentNullException("tapRepository");
            }
            if (kegRepository == null)
            {
                throw new ArgumentNullException("kegRepository");
            }
            if (emailService == null)
            {
                throw new ArgumentNullException("emailService");
            }
            if (beerRepository == null)
            {
                throw new ArgumentNullException("beerRepository");
            }

            _tapRepository  = tapRepository;
            _kegRepository  = kegRepository;
            _emailService   = emailService;
            _beerRepository = beerRepository;
        }
Exemplo n.º 34
0
 public FallController(ITapRepository tapRepository, IKegRepository kegRepository, IBeerRepository beerRepository)
 {
     _tapRepository = tapRepository;
     _kegRepository = kegRepository;
     _beerRepository = beerRepository;
 }
Exemplo n.º 35
0
		public BeersController(IBeerRepository beerRepository)
		{
			_beerRepository = beerRepository;
		}
Exemplo n.º 36
0
 public BeerService(IBeerRepository repo, ICurrentUserResolver currentUserResolver)
 {
     _repo = repo;
     _currentUserResolver = currentUserResolver;
 }
Exemplo n.º 37
0
 public StoreController(IBeerRepository beerRepository)
 {
     _beerRepository = beerRepository;
 }
Exemplo n.º 38
0
 public HomeController(IBeerRepository repository)
 {
     _repository = repository;
 }
Exemplo n.º 39
0
 public HomeController()
 {
     _repository = new BeerRepository();
 }
Exemplo n.º 40
0
 public BeerService(IBeerElasticsearch beerElasticsearch, IBeerRepository beerRepository)
 {
     _beerElasticsearch = beerElasticsearch;
     _beerRepository = beerRepository;
 }
 public void TestFixtureSetUp()
 {
     _beerRepository = new BeerDapperRepository();
 }
 public BeerController(IBeerRepository beerRepository)
 {
     this.beerRepository = beerRepository;
 }
 public BeerController(IBeerRepository repo)
 {
     _repo = repo;
 }