Exemplo n.º 1
0
 public GenerateStocks(
     ILogger <GenerateStocks> logger,
     IStockRepository stockRepository)
 {
     _logger          = logger;
     _stockRepository = stockRepository;
 }
Exemplo n.º 2
0
        public virtual void FillItemsFromStock(
            IUnitOfWork uow,
            IStockRepository stockRepository,
            int[] nomenclaturesToInclude,
            int[] nomenclaturesToExclude,
            string[] nomenclatureTypeToInclude,
            string[] nomenclatureTypeToExclude,
            int[] productGroupToInclude,
            int[] productGroupToExclude)
        {
            if (Warehouse == null)
            {
                return;
            }

            var selectedNomenclature = stockRepository.NomenclatureInStock(
                uow,
                Warehouse.Id,
                nomenclaturesToInclude,
                nomenclaturesToExclude,
                nomenclatureTypeToInclude,
                nomenclatureTypeToExclude,
                productGroupToInclude,
                productGroupToExclude);

            FillItemsFromStock(uow, selectedNomenclature);
        }
Exemplo n.º 3
0
 public StockService(
     IStockRepository stockRepository,
     IStockViewModelBuilderFactory stockViewModelBuilderFactory)
 {
     _stockRepository = stockRepository;
     _stockViewModelBuilderFactory = stockViewModelBuilderFactory;
 }
Exemplo n.º 4
0
 public InboundOrderController(IEmployeeRepository employeeRepository, ICompanyRepository companyRepository, IProductRepository productRepository, IStockRepository stockRepository)
 {
     this.employeeRepository = employeeRepository;
     this.stockRepository    = stockRepository;
     this.companyRepository  = companyRepository;
     this.productRepository  = productRepository;
 }
        public async Task <PaginatedCollection <StockResponse> > Handle(QueryStockCommand request, CancellationToken cancellationToken)
        {
            IExpressionSpecification <Stock> specification = ExpressionSpecification <Stock> .Default;

            if (!string.IsNullOrEmpty(request.ProductId))
            {
                specification = specification.And(new ProductIdIs(request.ProductId));
            }

            if (request.InStock.HasValue)
            {
                if (request.InStock.Value)
                {
                    specification = specification.And(new StockCountGreaterThan(0));
                }
                else
                {
                    specification = specification.And(new StockCountLessThan(1));
                }
            }

            IStockRepository            stockRepository     = _stockDbContext.StockRepository;
            PaginatedCollection <Stock> paginatedCollection = await stockRepository.GetAsync(specification, request.Offset, request.Limit, cancellationToken);

            PaginatedCollection <StockResponse> result = new PaginatedCollection <StockResponse>(paginatedCollection.TotalCount,
                                                                                                 paginatedCollection.Data
                                                                                                 .Select(stock => new StockResponse(stock.ProductId,
                                                                                                                                    stock.AvailableStock))
                                                                                                 .ToList());

            return(result);
        }
Exemplo n.º 6
0
        public HomeModule(IStockRepository quoteRepository)
            : base("/api")
        {
            _quoteRepository = quoteRepository;

            //Get["/"] = GetHome;
        }
Exemplo n.º 7
0
        public StockModule(IStockRepository quoteRepository)
            : base("/api")
        {
            _quoteRepository = quoteRepository;

            Get["/stock/{symbol}"] = GetStockBySymbol;
        }
Exemplo n.º 8
0
 public StockManagerService(IStockRepository repository,
                            IOrgRepository orgRepository, AuthoriseService service)
 {
     _repository       = repository;
     _orgRepository    = orgRepository;
     _authoriseService = service;
 }
        public StockItemData[] GetAllStockItems()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                IStockRepository stockRepository = _dataRepositoryFactory.GetDataRepository <IStockRepository>();

                List <StockItemData> stockItems = new List <StockItemData>();

                IEnumerable <StockItemsInfo> stockInfoSet = stockRepository.GetAllStockItemsInfo();
                foreach (StockItemsInfo stockItemsInfo in stockInfoSet)
                {
                    stockItems.Add(new StockItemData()
                    {
                        StockId = stockItemsInfo.Stock.Id,
                        PartId = stockItemsInfo.Part.Id,
                        PartDescription = stockItemsInfo.Part.Description,
                        Count = stockItemsInfo.Stock.Count,
                        CountDate = stockItemsInfo.Stock.CountDate,
                        Cost = stockItemsInfo.Stock.Count * (stockItemsInfo.Part.ComponentsCost + stockItemsInfo.Part.OwnCost),
                        Notes = stockItemsInfo.Stock.Notes
                    });
                }

                return stockItems.ToArray();
            }));
        }
Exemplo n.º 10
0
 public AddStockCommandHandler(IStockRepository stockRepository,
                               IYahooApiService apiService, ILogger <AddStockCommand> logger)
 {
     _stockRepository = stockRepository ?? throw new ArgumentNullException(nameof(stockRepository));
     _apiService      = apiService ?? throw new ArgumentNullException(nameof(apiService));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemplo n.º 11
0
 public StockManagerService(IStockRepository repository,
                            IOrgRepository orgRepository, AuthoriseFactory service)
 {
     _repository    = repository;
     _orgRepository = orgRepository;
     _factory       = service;
 }
Exemplo n.º 12
0
 public StockCommands(
     IStockRepository stockRepository,
     IStockService stockService)
 {
     _stockRepository = stockRepository;
     _stockService    = stockService;
 }
Exemplo n.º 13
0
 public StockAppService(
     IStockRepository stockRepository,
     IUnitOfWorkManager unitOfWorkManager)
     : base(unitOfWorkManager)
 {
     this._stockRepository = stockRepository;
 }
Exemplo n.º 14
0
        public IncomingInvoiceViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IWarehousePermissionService warehousePermissionService,
            IEmployeeService employeeService,
            IEntityExtendedPermissionValidator entityExtendedPermissionValidator,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            IOrderSelectorFactory orderSelectorFactory,
            IWarehouseRepository warehouseRepository,
            IRDLPreviewOpener rdlPreviewOpener,
            ICommonServices commonServices,
            IStockRepository stockRepository)
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.entityExtendedPermissionValidator = entityExtendedPermissionValidator ?? throw new ArgumentNullException(nameof(entityExtendedPermissionValidator));
            this.nomenclatureSelectorFactory       = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.orderSelectorFactory    = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            this.warehouseRepository     = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            this.rdlPreviewOpener        = rdlPreviewOpener ?? throw new ArgumentNullException(nameof(rdlPreviewOpener));
            _stockRepository             = stockRepository ?? throw new ArgumentNullException(nameof(stockRepository));
            warehousePermissionValidator = warehousePermissionService.GetValidator(CommonServices.UserService.CurrentUserId);

            canEditRectroactively = entityExtendedPermissionValidator.Validate(typeof(MovementDocument), CommonServices.UserService.CurrentUserId, nameof(RetroactivelyClosePermission));
            ConfigureEntityChangingRelations();

            ValidationContext.ServiceContainer.AddService(typeof(IWarehouseRepository), warehouseRepository);
            UserHasOnlyAccessToWarehouseAndComplaints =
                CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !CurrentUser.IsAdmin;
        }
Exemplo n.º 15
0
 public ProductController(IProductsRepository productRepository, ICurrencyRepository currencyRepository, IStockRepository stockRepository, ViewModelHelper viewModelHelper)
 {
     _productRepository  = productRepository;
     _currencyRepository = currencyRepository;
     _stockRepository    = stockRepository;
     _viewModelHelper    = viewModelHelper;
 }
Exemplo n.º 16
0
        public MovementDocumentViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IWarehousePermissionService warehousePermissionService,
            IEmployeeService employeeService,
            IEntityExtendedPermissionValidator entityExtendedPermissionValidator,
            INomenclatureSelectorFactory nomenclatureSelectorFactory,
            IOrderSelectorFactory orderSelectorFactory,
            IWarehouseRepository warehouseRepository,
            IUserRepository userRepository,
            IRDLPreviewOpener rdlPreviewOpener,
            ICommonServices commonServices,
            IStockRepository stockRepository)
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.entityExtendedPermissionValidator = entityExtendedPermissionValidator ?? throw new ArgumentNullException(nameof(entityExtendedPermissionValidator));
            this.nomenclatureSelectorFactory       = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.orderSelectorFactory    = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            this.warehouseRepository     = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            this.userRepository          = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            this.rdlPreviewOpener        = rdlPreviewOpener ?? throw new ArgumentNullException(nameof(rdlPreviewOpener));
            _stockRepository             = stockRepository ?? throw new ArgumentNullException(nameof(stockRepository));
            warehousePermissionValidator = warehousePermissionService.GetValidator(CommonServices.UserService.CurrentUserId);

            canEditRectroactively = entityExtendedPermissionValidator.Validate(typeof(MovementDocument), CommonServices.UserService.CurrentUserId, nameof(RetroactivelyClosePermission));
            ConfigureEntityChangingRelations();
            if (UoW.IsNew)
            {
                Entity.DocumentType = MovementDocumentType.Transportation;
                SetDefaultWarehouseFrom();
            }
            ValidationContext.ServiceContainer.AddService(typeof(IWarehouseRepository), warehouseRepository);
        }
 public AddItemToBasketCommand(
     IStockRepository stockRepository,
     IBasketRepository basketRepository)
 {
     _stockRepository  = stockRepository;
     _basketRepository = basketRepository;
 }
 public StockMessageFactory(IStockRepository repoA, IStockRepository repoB, IComparer<Stock> comparer, char userInput)
 {
     _repoA = repoA;
     _repoB = repoB;
     _comparer = comparer;
     _userInput = userInput;
 }
Exemplo n.º 19
0
        public void Initialize()
        {
            //Initialize services as "composition" root
            AutoMapper.Mapper.CreateMap <StockDTO, Stock>();
            AutoMapper.Mapper.CreateMap <Stock, StockDTO>();

            _stockRepository = A.Fake <IStockRepository>();

            A.CallTo(() => _stockRepository.GetById(ValidStockId))
            .Returns(new DTO.StockDTO
            {
                Id = ValidStockId
            });
            A.CallTo(() => _stockRepository.GetById(InvalidStockId)).Throws <StockNotFoundException>();
            A.CallTo(() => _stockRepository.DeleteById(InvalidStockId)).Throws <StockNotFoundException>();
            A.CallTo(() => _stockRepository.GetAllStock()).Returns(new List <Stock>()
            {
                new Stock()
                {
                    Id = "1", CurrentPrice = 64.95m, IssuingCompany = "NASDAQ", LastRecordedPrice = 64.98m, StockCode = "MSFT", StockName = "Microsoft Corporation"
                },
                new Stock()
                {
                    Id = "2", CurrentPrice = 963.90m, IssuingCompany = "NSE", LastRecordedPrice = 963.90m, StockCode = "INFY", StockName = "Infosys Ltd"
                }
            });

            _stockService = new StockService(_stockRepository);
        }
Exemplo n.º 20
0
 public PriceProvider(
     IOptions <PriceProviderOptions> options, // BOOKMARK: 3.1 explicit dependencies
     IStockRepository stockRepository)
 {
     _options         = options.Value;
     _stockRepository = stockRepository;
 }
Exemplo n.º 21
0
 public StockController(IStockRepository stockRepository, IProductsRepository productsRepository, ViewModelHelper viewModelHelper, ICurrencyRepository currencyRepository)
 {
     _stockRepository    = stockRepository;
     _productsRepository = productsRepository;
     _viewModelHelper    = viewModelHelper;
     _currencyRepository = currencyRepository;
 }
Exemplo n.º 22
0
 public UnitOfProducts(IProductRepository productRepository,
                       IStockRepository stockRepository,
                       BackOfficeContext context) : base(context)
 {
     ProductRepository = productRepository;
     StockRepository   = stockRepository;
 }
Exemplo n.º 23
0
        public void Initialize()
        {
            _stockRepository = A.Fake <IStockRepository>();
            _stockService    = new StockService(_stockRepository);

            _ValidSymbols = new List <string>()
            {
                "AAPL", "GOOG"
            };

            A.CallTo(() => _stockRepository.GetBySymbol(ValidSymbol)).Returns(new Stock()
            {
                Symbol = ValidSymbol
            });

            A.CallTo(() => _stockRepository.GetBySymbol(InvalidSymbol)).Throws <StockNotFoundException>();

            A.CallTo(() => _stockRepository.GetStocks(_ValidSymbols)).Returns(new List <Stock>()
            {
                new Stock()
                {
                    Symbol = ValidSymbol
                }
            });
        }
Exemplo n.º 24
0
        public void Setup()
        {
            _stockRepo = new StockRepository();

            products = new List <ProductsDataModel>();
            items    = new List <string>();

            products.Clear();
            products.Add(new ProductsDataModel()
            {
                Name  = "Biscuits",
                Price = 100,
            });
            products.Add(new ProductsDataModel()
            {
                Name  = "Milk",
                Price = 300,
            });
            items.Clear();
            items.Add("Bread");
            items.Add("Milk");
            items.Add("cheese");
            items.Add("Butter");
            items.Add("Biscuits");
        }
Exemplo n.º 25
0
        public StockService(IStockRepository stockRepository)
        {
            _stockRepository = stockRepository;

            AutoMapper.Mapper.CreateMap <StockDTO, Stock>();
            AutoMapper.Mapper.CreateMap <Stock, StockDTO>();
        }
 public ItemController(IItemRepository itemRepository, IStockRepository stockRepository /*, MyServices get*/)
 {
     //_get = new MyServices();
     //_get = new SequenceController(_sequenceRepository);
     _itemRepository  = itemRepository;
     _stockRepository = stockRepository;
 }
Exemplo n.º 27
0
 public OrderService(
     IOrderRepository orderRepository,
     IStockRepository stockRepository)
 {
     this.orderRepository = orderRepository;
     this.stockRepository = stockRepository;
 }
Exemplo n.º 28
0
 public InboundOrderController(IEmployeeRepository employeeRepository, ICompanyRepository companyRepository, IProductRepository productRepository, IStockRepository stockRepository)
 {
     _employeeRepository = employeeRepository;
     _stockRepository    = stockRepository;
     _companyRepository  = companyRepository;
     _productRepository  = productRepository;
 }
Exemplo n.º 29
0
 public Handler(IStockRepository stockRepository, ISalesChannelRepository salesChannelRepository,
                IUnitOfWork uow)
 {
     _stockRepository        = stockRepository;
     _salesChannelRepository = salesChannelRepository;
     _uow = uow;
 }
Exemplo n.º 30
0
 // private readonly UserManager<AppUser> _userManager;
 public PortfolioAccountsController(IStockRepository _repo
                                    // UserManager<AppUser> userManager
                                    )
 {
     __repo = _repo;
     // _userManager = userManager;
 }
 public OrderItemBonusCalculator(
     IStockRepository stockRepository,
     ILogger <OrderItemPriceCalculator> logger)
 {
     this.stockRepository = stockRepository;
     this.logger          = logger;
 }
Exemplo n.º 32
0
 public StockController(IStockRepository stockRepository, IStockLogRepository stocklogRepository,
                        IAppUserRepository appuserRepository)
 {
     _stockRepository    = stockRepository;
     _stocklogRepository = stocklogRepository;
     _appuserRepository  = appuserRepository;
 }
Exemplo n.º 33
0
 public RemoveItemFromBasketCommand(
     IStockRepository stockRepository,
     IBasketRepository basketRepository)
 {
     _stockRepository  = stockRepository;
     _basketRepository = basketRepository;
 }
        // ReSharper restore UnusedMember.Global
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdatePricesController"/> class.
        /// </summary>
        /// <param name="stockRepository">The stock repository.</param>
        // ReSharper disable UnusedMember.Global -- (This constructor is used by StructureMap.)
        public UpdatePricesController(IStockRepository stockRepository)
        {
            this.stockRepository = stockRepository;
            this.downloadErrorList = new Dictionary<string, string>();

            // TODO: Remove
            this.downloadErrorList.Add("ABCDEF", "Bad download.");
        }
Exemplo n.º 35
0
 public StockService(
     IUnitOfWork unitOfWork,
     IRepository<WAMS_STOCK> stockRepository,
     IStockRepository customRepository)
 {
     _unitOfWork = unitOfWork;
     _repository = stockRepository;
     _customRepository = customRepository;
 }
Exemplo n.º 36
0
 public StockManagerApp(IStockRepository repository,
     IOrgRepository orgRepository)
 {
     _repository = repository;
     _orgRepository = orgRepository;
 }
Exemplo n.º 37
0
 public StockService(IStockReader stockReader, IStockRepository stockRepository, ISettingRepository settingRepository)
 {
     _stockReader = stockReader;
     _stockRepository = stockRepository;
     _settingRepository = settingRepository;
 }
 // Dependency Injection
 public CompareController(IStockRepository repo)
 {
     _repo = repo;
 }
Exemplo n.º 39
0
 public StockRepositoryTestClass(IStockRepository stockRepository)
 {
     _StockRepository = stockRepository;
 }
 public StockMarketListener(IStockRepository stocks)
 {
     _stocks = stocks;
 }
Exemplo n.º 41
0
 public StockService(
     IStockRepository stockRepository
 )
 {
     StockRepository = stockRepository;
 }
Exemplo n.º 42
0
 public StockController(IStockRepository repos)
 {
     this.repository = repos;
 }
 // Dependency Injection
 public HomeController(IStockRepository repo)
 {
     _repo = repo;
 }
Exemplo n.º 44
0
 public StockTickerHub(IServiceBus bus, IStockRepository stocks)
 {
     _bus = bus;
     _stocks = stocks;
 }
Exemplo n.º 45
0
 public StockMarket(IStockRepository stocks)
 {
     _stocks = stocks;
     RangePercent = .01;
 }