Exemple #1
0
 public MoneyAccountService(IMoneyAccountRepository moneyAccountRepository, IUnitOfWork uow
                            , IEmployeeRepository employeeRepository)
 {
     _moneyAccountRepository = moneyAccountRepository;
     _uow = uow;
     _employeeRepository = employeeRepository;
 }
 public MoneyAccountEmployeeService(IMoneyAccountEmployeeRepository moneyAccountEmployeeRepository, IMoneyAccountRepository moneyAccountRepository,
                                    IEmployeeRepository employeeRepository, IUnitOfWork uow)
     : this(moneyAccountEmployeeRepository, uow)
 {
     this._employeeRepository     = employeeRepository;
     this._moneyAccountRepository = moneyAccountRepository;
 }
 public NetworkCreditService(INetworkCreditRepository networkCreditRepository, INetworkRepository networkRepository,
                             IMoneyAccountRepository moneyAccountRepository, IUnitOfWork uow, IEmployeeRepository employeeRepository)
     : this(networkCreditRepository, uow)
 {
     this._networkRepository      = networkRepository;
     this._moneyAccountRepository = moneyAccountRepository;
     _employeeRepository          = employeeRepository;
 }
Exemple #4
0
 public FiscalService(IFiscalRepository fiscalRepository, IEmployeeRepository employeeRepository, ICustomerRepository customerRepository,
                      IMoneyAccountRepository moneyAccountRepository
                      , IUnitOfWork uow)
     : this(fiscalRepository, uow)
 {
     this._employeeRepository = employeeRepository;
     this._customerRepository = customerRepository;
     _moneyAccountRepository  = moneyAccountRepository;
 }
        /// <summary>
        /// Intial System consists of:
        /// Three user: daniel with $120, jennie with $100, tom with $80
        /// Private Recipes: daniel has 2, jennie has 1, tom has 1 purchased from the market
        /// Public reicpes: daniel has 1 with price of 20, with review from tom
        /// </summary>
        public void InitializeSystem()
        {
            var userDaniel = DomainObjectsGenerator.GenerateRandoMoneyAccount("daniel");
            var userJennie = DomainObjectsGenerator.GenerateRandoMoneyAccount("jennie");
            var userTom = DomainObjectsGenerator.GenerateRandoMoneyAccount("tom");

            var recipeDaniel1 = DomainObjectsGenerator.GenerateRandomPrivateRecipe(4, userDaniel.UserId);
            var recipeDaniel2 = DomainObjectsGenerator.GenerateRandomPrivateRecipe(2, userDaniel.UserId);
            var recipeJennie1 = DomainObjectsGenerator.GenerateRandomPrivateRecipe(5, userJennie.UserId);

            var recipeOnMarket = PublicRecipe.ConvertFromPrivateRecipe(recipeDaniel1);
            recipeOnMarket.Id = GetRandomInt();
            if (recipeOnMarket.Items != null)
            {
                foreach (var recipeItem in recipeOnMarket.Items)
                {
                    recipeItem.Id = GetRandomInt();
                }
            }
            recipeOnMarket.Price = 20;
            recipeOnMarket.TimePublished = new DateTime(2016, 3, 20, 11, 0, 0);

            var tomsReview = DomainObjectsGenerator.GenerateRandomReview(recipeOnMarket);
            tomsReview.ReviewerUserId = userTom.UserId;
            tomsReview.Comment = "Good recipe";
            tomsReview.Rating = 4;
            recipeOnMarket.AddReview(tomsReview);

            _moneyAccounts = new List<MoneyAccount>
            {
                userDaniel,
                userJennie,
                userTom
            };

            _marketRecipes = new List<PublicRecipe>
            {
                recipeOnMarket
            };

            _moneyAccountRepository = new MoneyAccountRepository(_moneyAccounts);
            _publicRecipeRepository = new PublicRecipeRepository(_marketRecipes);

            _market = new Market(_publicRecipeRepository, _moneyAccountRepository);

            var recipeTom = _market.Purchase(recipeOnMarket.Id, "tom");
            recipeTom.PurchaseInformation.TimePurchased = new DateTime(2016, 4, 1, 9, 0, 0);

            _userRecipes = new List<PrivateRecipe>
            {
                recipeDaniel1,
                recipeDaniel2,
                recipeJennie1,
                recipeTom
            };
            _privateRecipeRepository = new PrivateRecipeRepository(_userRecipes);
        }
 public UserService(string userId, IMarket market, 
     IPrivateRecipeRepository privateRecipeRepo, 
     IPublicRecipeRepository publicRecipeRepo, 
     IMoneyAccountRepository moneyAccountRepo)
 {
     UserId = userId;
     _market = market;
     _privateRecipeRepo = privateRecipeRepo;
     _publicRecipeRepo = publicRecipeRepo;
     _moneyAccountRepo = moneyAccountRepo;
 }
 public Market(IPublicRecipeRepository publicRecipeRepo, IMoneyAccountRepository moneyAccountRepo)
 {
     _publicRecipeRepo = publicRecipeRepo;
     _moneyAccountRepo = moneyAccountRepo;
 }