Exemplo n.º 1
0
 public ReceiptController(IReceiptService receiptService, IOrderService orderService, IProductService productService, IDeliveryService deliveryService)
 {
     this.receiptService  = receiptService;
     this.orderService    = orderService;
     this.productService  = productService;
     this.deliveryService = deliveryService;
 }
Exemplo n.º 2
0
        public async Task GetAllByRecipientId_WithCorrectData_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ReceiptService GetAllByRecipient() method does not work properly.";

            var context = StopifyDbContextInMemoryFactory.InitializeContext();

            #region Dummy Data

            context.Users.Add(new StopifyUser());

            await context.SaveChangesAsync();

            context.Receipts.Add(new Receipt
            {
                IssuedOn  = DateTime.UtcNow.AddDays(10),
                Recipient = context.Users.First()
            });
            context.Receipts.Add(new Receipt
            {
                IssuedOn  = DateTime.UtcNow.AddDays(5),
                Recipient = context.Users.First()
            });

            await context.SaveChangesAsync();

            #endregion

            this.receiptService = new ReceiptService(context, new OrderService(context));

            string testId = context.Users.First().Id;

            List <ReceiptServiceModel> actualResults = await this.receiptService.GetAllByRecipientId(testId).ToListAsync();

            Assert.True(actualResults.Count == 2, errorMessagePrefix);
        }
 public EditModel(IReceiptService service, IMapper mapper, IStaffService serviceStaff, ICustomerService serviceCustomer)
 {
     _mapper          = mapper;
     _service         = service;
     _serviceStaff    = serviceStaff;
     _serviceCustomer = serviceCustomer;
 }
Exemplo n.º 4
0
 public ImageUploadController(IItemManager itemManager, IReceiptService receiptService,
                              IAuthenticationService authenticationService)
 {
     _itemManager           = itemManager;
     _receiptService        = receiptService;
     _authenticationService = authenticationService;
 }
Exemplo n.º 5
0
 public MainScreen(ReceiptService receiptService)
 {
     _receiptService   = receiptService;
     _photoImageGetter = new PhotoImageGetter();
     _fileImageGetter  = new FileImageGetter();
     InitializeComponent();
 }
Exemplo n.º 6
0
 public UsersController(IUserService userService, IValidator validator, IProductService productService, IReceiptService receiptService)
 {
     this.userService    = userService;
     this.validator      = validator;
     this.productService = productService;
     this.receiptService = receiptService;
 }
 public ReceiptController(IRepository <Receipt> receiptRepository,
                          IRepository <ReceiptItem> receiptItemRepository,
                          IRepository <Item> itemRepository,
                          IReceiptService receiptService,
                          IStoreService storeService,
                          IAutoNumberService autoNumberService,
                          IItemService itemService,
                          IUnitConversionService unitConversionService,
                          IDateTimeHelper dateTimeHelper,
                          ILocalizationService localizationService,
                          IPermissionService permissionService,
                          HttpContextBase httpContext,
                          IWorkContext workContext,
                          IDbContext dbContext)
 {
     this._receiptRepository     = receiptRepository;
     this._receiptItemRepository = receiptItemRepository;
     this._itemRepository        = itemRepository;
     this._localizationService   = localizationService;
     this._receiptService        = receiptService;
     this._storeService          = storeService;
     this._autoNumberService     = autoNumberService;
     this._itemService           = itemService;
     this._unitConversionService = unitConversionService;
     this._dateTimeHelper        = dateTimeHelper;
     this._permissionService     = permissionService;
     this._httpContext           = httpContext;
     this._workContext           = workContext;
     this._dbContext             = dbContext;
 }
Exemplo n.º 8
0
        public void SetUp()
        {
            var builder = new ConfigurationBuilder().
                          SetBasePath(Directory.GetCurrentDirectory()).
                          AddJsonFile("appsettings.json");

            Configuration = builder.Build();

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddDbContext <ProductContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ProductContext")));
            serviceCollection.AddScoped <ICalculateProductPrice, CalculateProductPrice>();
            serviceCollection.AddScoped <IReceiptService, ReceiptService>();
            serviceCollection.AddScoped <IRegisterService, RegisterService>();
            serviceCollection.AddScoped <IProductService, ProductService>();
            serviceCollection.AddScoped <ISupplyService, SupplyService>();
            serviceCollection.AddScoped <IMapperService, MapperService>();

            var serviceProvider = serviceCollection.BuildServiceProvider();

            CalculateProductPrice = serviceProvider.GetService <ICalculateProductPrice>();
            ReceiptService        = serviceProvider.GetService <IReceiptService>();
            RegisterService       = serviceProvider.GetService <IRegisterService>();
            ProductService        = serviceProvider.GetService <IProductService>();
            SupplyService         = serviceProvider.GetService <ISupplyService>();
        }
Exemplo n.º 9
0
        public async Task GetAllItems_WithDummData_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ItemService GetAllItems does not work properly.";

            var context = AuctionDbContextInMemory.InitializeContext();

            await SeedData(context);

            this.userService       = new UserService(context);
            this.receiptService    = new ReceiptService(context);
            this.cloudinaryService = new CloudinaryService(cloudinaryUtility);
            this.itemService       = new ItemService(context, cloudinaryService, userService, receiptService);

            List <Item> actualResults = await
                                        this.itemService.GetAllItems().ToListAsync();

            List <Item> expectedResults = GetDummyData();

            for (int i = 0; i < expectedResults.Count; i++)
            {
                var expectedEntry = expectedResults[i];
                var actualEntry   = actualResults[i];

                Assert.True(expectedEntry.Name == actualEntry.Name, errorMessagePrefix + "Names are different.");
                Assert.True(expectedEntry.Description == actualEntry.Description, errorMessagePrefix + "Descriptions are different.");
                Assert.True(expectedEntry.StartingPrice == actualEntry.StartingPrice, errorMessagePrefix + "Starting prices are different.");
                Assert.True(expectedEntry.BuyOutPrice == actualEntry.BuyOutPrice, errorMessagePrefix + "Buy out prices are different.");
            }
        }
Exemplo n.º 10
0
        public MessagesMainHandler(
            IMessageHandler[] messageHandlers,
            IMoneyOperationService moneyOperationService,
            IBillingPeriodService billingPeriodService,
            IReceiptService receiptService,
            IMenuProvider menuProvider,
            IMessenger messenger,
            ILogger logger)
        {
            if (messageHandlers == null)
            {
                throw new ArgumentNullException(nameof(messageHandlers));
            }
            _moneyOperationService = moneyOperationService ?? throw new ArgumentNullException(nameof(moneyOperationService));
            _billingPeriodService  = billingPeriodService ?? throw new ArgumentNullException(nameof(billingPeriodService));
            _receiptService        = receiptService ?? throw new ArgumentNullException(nameof(receiptService));
            _menuProvider          = menuProvider ?? throw new ArgumentNullException(nameof(menuProvider));
            _messenger             = messenger ?? throw new ArgumentNullException(nameof(messenger));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _messenger.OnMessage += OnMessage;

            _messageHandlersMap = messageHandlers
                                  .GroupBy(x => x.MessageType)
                                  .ToDictionary(x => x.Key, x => x.ToArray());
        }
Exemplo n.º 11
0
 /// <summary>
 /// constructor for Receipt controller
 /// </summary>
 /// <param name="receiptService"></param>
 /// <param name="logger"></param>
 public ReceiptController(
     IReceiptService receiptService,
     ILogger <ReceiptController> logger)
 {
     _logger  = new CustomLogger <ReceiptController>(logger);
     _service = (ReceiptService)receiptService;
 }
Exemplo n.º 12
0
 public ReceiptController(ICustomerService customerService, IReceiptService receiptService, IInvoiceService invoiceService, IDataAccess dataAccess)
 {
     this.customerService = customerService;
     this.receiptService  = receiptService;
     this.invoiceService  = invoiceService;
     this.dataAccess      = dataAccess;
 }
Exemplo n.º 13
0
 public ReceiptController(IChachedReceiptService receiptService)
 {
     this.receiptService        = receiptService;
     ReceiptsPriceMaxValue      = receiptService.GetReceiptsMaxValue();
     ReceiptsTransactionMethods = receiptService.GetReceiptsMethods();
     ReceiptsStoredYears        = receiptService.GetReceiptsYears();
 }
Exemplo n.º 14
0
        public async Task Buy_WithCorrectId_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ItemService Buy() does not work properly.";

            var context = AuctionDbContextInMemory.InitializeContext();

            await SeedData(context);

            this.userService       = new UserService(context);
            this.receiptService    = new ReceiptService(context);
            this.cloudinaryService = new CloudinaryService(cloudinaryUtility);
            this.itemService       = new ItemService(context, cloudinaryService, userService, receiptService);

            var dummyItemId = "EyePatchId";

            var dummyUser = new AuctionUser
            {
                Id = "Hugo"
            };

            context.Users.Add(dummyUser);

            bool actualResult = await this.itemService.Buy(dummyItemId, dummyUser.Id);

            Assert.True(actualResult, errorMessagePrefix);
        }
Exemplo n.º 15
0
 public ReceiptController(
     IGlobalService globalService,
     IReceiptService ReceiptService
     )
 {
     this._GlobalService  = globalService;
     this._ReceiptService = ReceiptService;
 }
Exemplo n.º 16
0
 public ReceiptController(IReceiptService receiptService,
                          IProductService productService,
                          UserManager <MISUser> userManger)
 {
     this.receiptService = receiptService;
     this.productService = productService;
     this.userManger     = userManger;
 }
Exemplo n.º 17
0
 public PackagesController(IPackageService packageService
                           , IUserService userService
                           , IReceiptService receiptService)
 {
     this.packageService = packageService;
     this.userService    = userService;
     this.receiptService = receiptService;
 }
Exemplo n.º 18
0
 public LivelController(IProductService productService, ICustomerService customerService, IInvoiceService invoiceService, IReceiptService receiptService, IInvoiceDetailService invoiceDetailService)
 {
     this.productService       = productService;
     this.customerService      = customerService;
     this.invoiceService       = invoiceService;
     this.receiptService       = receiptService;
     this.invoiceDetailService = invoiceDetailService;
 }
 public FinancialController(IPaymentService paymentService,
                            IReceiptService receiptService,
                            IBalanceService balanceService)
 {
     _paymentService = paymentService;
     _receiptService = receiptService;
     _balanceService = balanceService;
 }
Exemplo n.º 20
0
 public ReportService(MISDbContext dbContext,
                      ICompanyService companyService,
                      IReceiptService receiptService)
 {
     this.dbContext      = dbContext;
     this.companyService = companyService;
     this.receiptService = receiptService;
 }
Exemplo n.º 21
0
 public PackageController(IPackageService packageService,
                          IUserService userService,
                          IReceiptService receiptService)
 {
     _packageService = packageService;
     _userService    = userService;
     _receiptService = receiptService;
 }
Exemplo n.º 22
0
        public ViewAllReceiptsPage()
        {
            InitializeComponent();

            _receiptService = new ReceiptService();

            receiptsList.ItemsSource = _receiptService.GetAllReceipts();
        }
Exemplo n.º 23
0
 public ReportMessagesHandler(
     ICustomerService customerService,
     IReceiptService receiptService,
     IMessenger messenger)
 {
     _customerService = customerService ?? throw new ArgumentNullException(nameof(customerService));
     _receiptService  = receiptService ?? throw new ArgumentNullException(nameof(receiptService));
     _messenger       = messenger ?? throw new ArgumentNullException(nameof(messenger));
 }
Exemplo n.º 24
0
 public PackageService(
     PandaDbContext db,
     IReceiptService receipts,
     UserManager <User> userManager)
 {
     this.db          = db;
     this.receipts    = receipts;
     this.userManager = userManager;
 }
Exemplo n.º 25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="env"></param>
 /// <param name="service"></param>
 /// <param name="logger"></param>
 /// <param name="mapper"></param>
 /// <param name="userManager"></param>
 /// <param name="config"></param>
 public ReceiptController(IHostingEnvironment env, IReceiptService service, ILogger <ReceiptController> logger, IMapper mapper, UserManager <UserModel> userManager, IConfiguration config)
 {
     _logger      = logger;
     _service     = service;
     _mapper      = mapper;
     _userManager = userManager;
     _config      = config;
     _env         = env;
 }
 public POSTerminalService()
 {
     _calculatorService           = new CalculatorService();
     _createProductDetailsService = new CreateProductDetailsService();
     _productDiscountService      = new ProductDiscountService();
     _scanService    = new ScanService();
     _receiptService = new ReceiptService();
     _paymentService = new PaymentService(_paymentProcessor);
 }
Exemplo n.º 27
0
 public ItemService(AuctionDbContext context,
                    ICloudinaryService cloudinaryService,
                    IUserService userService,
                    IReceiptService receiptService)
 {
     this.context           = context;
     this.cloudinaryService = cloudinaryService;
     this.userService       = userService;
     this.receiptService    = receiptService;
 }
Exemplo n.º 28
0
 public RepairTaskService(ApplicationDbContext dbContext,
                          UserManager <User> userManager,
                          IPartService partService,
                          IReceiptService receiptService)
 {
     this.dbContext      = dbContext;
     this.userManager    = userManager;
     this.partService    = partService;
     this.receiptService = receiptService;
 }
Exemplo n.º 29
0
        public async Task Create_WithCorrectData_ShouldReturnSuccessfullyCreate()
        {
            string errorMessagePrefix = "ItemService GetAllItems does not work properly.";

            var context = AuctionDbContextInMemory.InitializeContext();

            await SeedData(context);

            this.userService    = new UserService(context);
            this.receiptService = new ReceiptService(context);

            Account cloudinaryCredentials = new Account(
                "auction-cloud",
                "245777487727621",
                "VcLN0NRPB7qs0WZv_U2AxMR79sc");

            var cloudinary = new Cloudinary(cloudinaryCredentials);

            this.cloudinaryService = new CloudinaryService(cloudinary);
            this.itemService       = new ItemService(context, cloudinaryService, userService, receiptService);

            var user = new AuctionUser
            {
                Id = "Hugo"
            };

            context.Users.Add(user);

            using (var stream = File.OpenRead(@"./Images/test.jpg"))
            {
                var file = new FormFile(stream, 0, stream.Length, null, Path.GetFileName(@"./Images/test.jpg"))
                {
                    Headers     = new HeaderDictionary(),
                    ContentType = "image/jpeg"
                };

                var dummyItem = new ItemCreateInputModel
                {
                    Name            = "Stick",
                    Category        = "Other",
                    Description     = "Somethin",
                    AuctionDuration = 12,
                    StartingPrice   = 334M,
                    BuyOutPrice     = 3412M,
                    Picture         = file,
                    AuctionHouse    = "Ember"
                };



                bool actualResult = await this.itemService.Create(dummyItem, user.Id);

                Assert.True(actualResult, errorMessagePrefix);
            }
        }
 public ReceiptController()
 {
     service = IoC.Resolve<IReceiptService>("ReceiptService");
     calendarService = IoC.Resolve<ICalendarService>("CalendarService");
     sobService = IoC.Resolve<ISetOfBookService>("SetOfBookService");
     customerService = IoC.Resolve<ICustomerService>("CustomerService");
     customerSiteService = IoC.Resolve<ICustomerSiteService>("CustomerSiteService");
     bankService = IoC.Resolve<IBankService>("BankService");
     bankAccountService = IoC.Resolve<IBankAccountService>("BankAccountService");
     currencyService = IoC.Resolve<ICurrencyService>("CurrencyService");
 }
Exemplo n.º 31
0
 public ReceiptController()
 {
     service             = IoC.Resolve <IReceiptService>("ReceiptService");
     calendarService     = IoC.Resolve <ICalendarService>("CalendarService");
     sobService          = IoC.Resolve <ISetOfBookService>("SetOfBookService");
     customerService     = IoC.Resolve <ICustomerService>("CustomerService");
     customerSiteService = IoC.Resolve <ICustomerSiteService>("CustomerSiteService");
     bankService         = IoC.Resolve <IBankService>("BankService");
     bankAccountService  = IoC.Resolve <IBankAccountService>("BankAccountService");
     currencyService     = IoC.Resolve <ICurrencyService>("CurrencyService");
 }
Exemplo n.º 32
0
 public ReceiptController(IReceiptService receiptService)
 {
     _receiptService = receiptService;
 }
Exemplo n.º 33
0
 static ReceiptHelper()
 {
     service = IoC.Resolve<IReceiptService>("ReceiptService");
 }
Exemplo n.º 34
0
 public HomeController(IUserService userService, IReceiptService receiptService)
 {
     _userService = userService;
       _receiptService = receiptService;
 }
Exemplo n.º 35
0
 public EconomyController(IUserService userService, IReceiptService receiptService)
 {
     _userService = userService;
       _receiptService = receiptService;
 }
Exemplo n.º 36
0
 public HomeController(IParticipantService participants, IReceiptService receipts)
 {
     _participantservice = participants;
     _receiptService = receipts;
 }