public FiguresController(ILogger <FiguresController> logger, IOrderStorage orderStorage) { _logger = logger; _orderStorage = orderStorage; _cartConvertor = new CartConvertor(); _figureCache = new FigureCache(RedisClient); }
public AdminCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) { _managerInfo = managementStorage.GetConfig(); _managementStorage = managementStorage; _orderStorage = orderStorage; _adminStorage = userStorage; }
public HomeController(IMessageService messageService, IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) { _messageService = messageService; _managementStorage = managementStorage; _orderStorage = orderStorage; _adminStorage = userStorage; }
/// <summary> /// Initializes a new instance of the <see cref="FiguresController"/> class. /// </summary> /// <param name="orderStorage">Хранилище заказов. реализация IOrderStorage, должна быть зарегистрирована в DI.</param> /// <param name="figuresStorage">Хранилище фигур, реализация IFiguresStorage, должна быть зарегистрирована в DI.</param> /// <param name="orderValidator">Проверщик заказа. реализация IOrderValidator, должна быть зарегистрирована в DI.</param> public FiguresController( IOrderStorage orderStorage, IFiguresStorage figuresStorage, IOrderValidator orderValidator) { this.orderStorage = orderStorage; this.figuresStorage = figuresStorage; this.orderValidator = orderValidator; }
public FiguresController(ILogger <FiguresController> logger, IOrderStorage orderStorage, IFiguresStorage figuresStorage) { // Сделаем сервис логирования обязательным, раз уж у нас высоконагруженный контроллер/экшен _logger = logger ?? throw new ArgumentNullException(nameof(logger)); // Без сервиса orderStorage контроллер не сможет выполнять свои функции и, если его не инжектировали, то рушим всё и сразу _orderStorage = orderStorage ?? throw new ArgumentNullException(nameof(orderStorage)); // Вместо ссылки на статический сервис, сделаем его инжектируемым, чтобы в будущем можно было легко протестировать и ничто нам не мешает сделать его как Singleton, но не здесь _figuresStorage = figuresStorage ?? throw new ArgumentNullException(nameof(orderStorage)); }
/// <summary> /// Initializes a new instance of the <see cref="OrderSubmitter"/> class. /// </summary> /// /// <param name="configuration">The configuration to use for influencing order submission behavior.</param> /// <param name="orderProductionClient">The client to use for interacting with the order production service.</param> /// <param name="orderStorage">The storage to use for orders.</param> /// <param name="logger">The logger to be used for emitting telemetry from the controller.</param> /// <param name="jsonSerializerSettings">The settings to use for JSON serializerion.</param> /// public OrderSubmitter(OrderSubmitterConfiguration configuration, IOrderProductionClient orderProductionClient, IOrderStorage orderStorage, ILogger logger, JsonSerializerSettings jsonSerializerSettings) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.orderProductionClient = orderProductionClient ?? throw new ArgumentNullException(nameof(orderProductionClient)); this.orderStorage = orderStorage ?? throw new ArgumentNullException(nameof(orderStorage)); this.Log = logger ?? throw new ArgumentNullException(nameof(logger)); this.jsonSerializerSettings = jsonSerializerSettings ?? throw new ArgumentNullException(nameof(jsonSerializerSettings)); this.rng = new Random(); }
/// <summary> /// Initializes a new instance of the <see cref="OrderProcessor"/> class. /// </summary> /// /// <param name="configuration">The configuration to use for influencing order processing behavior.</param> /// <param name="ecommerceClient">The client to use for interacting with the eCommerce service.</param> /// <param name="orderStorage">The storage to use for orders.</param> /// <param name="skuMetadataProcessor">The processor for the metadata associated with a SKU.</param> /// <param name="logger">The logger to be used for emitting telemetry from the controller.</param> /// <param name="clock">The clock instance to use for date/time related operations.</param> /// <param name="jsonSerializerSettings">The settings to use for JSON serializerion.</param> /// public OrderProcessor(OrderProcessorConfiguration configuration, IEcommerceClient ecommerceClient, IOrderStorage orderStorage, ISkuMetadataProcessor skuMetadataProcessor, ILogger logger, IClock clock, JsonSerializerSettings jsonSerializerSettings) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.ecommerceClient = ecommerceClient ?? throw new ArgumentNullException(nameof(ecommerceClient)); this.orderStorage = orderStorage ?? throw new ArgumentNullException(nameof(orderStorage)); this.skuMetadataProcessor = skuMetadataProcessor ?? throw new ArgumentNullException(nameof(skuMetadataProcessor)); this.Log = logger ?? throw new ArgumentNullException(nameof(logger)); this.clock = clock ?? throw new ArgumentNullException(nameof(clock)); this.jsonSerializerSettings = jsonSerializerSettings ?? throw new ArgumentNullException(nameof(jsonSerializerSettings)); this.rng = new Random(); }
/// <summary> /// Deletes an order from the pending submission storage. /// </summary> /// /// <param name="log">The logging instance to use for emitting information.</param> /// <param name="storage">The storage to use for the order.</param> /// <param name="partner">The partner associated with the order.</param> /// <param name="orderId">The unique identifier of the order to retrieve the detials of.</param> /// <param name="correlationId">An optional identifier used to correlate activities across the disparate parts of processing, including external interations.</param> /// <param name="emulatedResult">An optional emulated result to use in place of interacting with storage.</param> /// /// <returns>The result of the operation.</returns> /// protected virtual async Task <OperationResult> DeletePendingOrderAsync(ILogger log, IOrderStorage storage, string partner, string orderId, string correlationId = null, OperationResult emulatedResult = null) { OperationResult result; try { if (emulatedResult != null) { result = emulatedResult; } else { await storage.DeletePendingOrderAsync(partner, orderId); result = new OperationResult { Outcome = Outcome.Success, Reason = String.Empty, Recoverable = Recoverability.Final, Payload = String.Empty }; } log.Information("Order for {Partner}//{Order} has been deleted from the storage for pending sumbissions. Emulated: {Emulated}. Result: {Result}", partner, orderId, (emulatedResult != null), result); } catch (Exception ex) { log.Error(ex, "An error occured while depeting {Partner}//{Order} from pending submissions.", partner, orderId); return(OperationResult.ExceptionResult); } return(result); }
/// <summary> /// Stores an order as a final order which has completed submission. /// </summary> /// /// <param name="log">The logging instance to use for emitting information.</param> /// <param name="storage">The storage to use for the order.</param> /// <param name="createOrderMessage">The CreateOrderMessage representing the order.</param> /// <param name="correlationId">An optional identifier used to correlate activities across the disparate parts of processing, including external interations.</param> /// <param name="emulatedResult">An optional emulated result to use in place of interacting with storage.</param> /// /// <returns>The result of the operation.</returns> /// protected virtual async Task <OperationResult> StoreOrderAsCompletedAsync(ILogger log, IOrderStorage storage, CreateOrderMessage order, string correlationId = null, OperationResult emulatedResult = null) { OperationResult result; try { if (emulatedResult != null) { result = emulatedResult; } else { var key = await storage.SaveCompletedOrderAsync(order); result = new OperationResult { Outcome = Outcome.Success, Reason = String.Empty, Recoverable = Recoverability.Final, Payload = key }; } log.Information("Order details for {Partner}//{Order} have been saved as final. Emulated: {Emulated}. Result: {Result}", order?.Identity?.PartnerCode, order?.Identity?.PartnerOrderId, (emulatedResult != null), result); } catch (Exception ex) { log.Error(ex, "An error occured while saving {Partner}//{Order} as completed submission.", order.Identity.PartnerCode, order.Identity.PartnerOrderId); return(OperationResult.ExceptionResult); } return(result); }
public OrderRepository(IOrderStorage orderStorage) { _orderStorage = orderStorage; }
public OrderSender(IOrderStorage orderStorage, IAdminStorage userStorage) { _orderStorage = orderStorage; _userStorage = userStorage; }
public static void InitializeStorage(IOrderStorage storage) { orders = storage; }
public ShowPrintsCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public OrderService() { orderStorage = DependencyService.Get <IOrderStorage>(); }
public RemovePrintCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public OrderRepository(IOrderStorage orderStorage, ICurrencyConverter currencyConverter) { _orderStorage = orderStorage; _currencyConverter = currencyConverter; }
/// <summary> /// Retrieves an order from pending storage. /// </summary> /// /// <param name="log">The logging instance to use for emitting information.</param> /// <param name="storage">The storage to use for the order.</param> /// <param name="serializerSettings">The settings to use for JSON serialization operations.</param> /// <param name="partner">The partner associated with the order.</param> /// <param name="orderId">The unique identifier of the order to retrieve the detials of.</param> /// <param name="correlationId">An optional identifier used to correlate activities across the disparate parts of processing, including external interations.</param> /// <param name="emulatedResult">An optional emulated result to use in place of interacting with storage.</param> /// /// <returns>The result of the operation.</returns> /// protected virtual async Task <OperationResult <CreateOrderMessage> > RetrievePendingOrderAsync(ILogger log, IOrderStorage storage, JsonSerializerSettings serializerSettings, string partner, string orderId, string correlationId = null, OperationResult emulatedResult = null) { OperationResult <CreateOrderMessage> result; try { if (emulatedResult != null) { result = new OperationResult <CreateOrderMessage> { Outcome = emulatedResult.Outcome, Reason = emulatedResult.Reason, Recoverable = emulatedResult.Recoverable, Payload = (String.IsNullOrEmpty(emulatedResult.Payload)) ? null : JsonConvert.DeserializeObject <CreateOrderMessage>(emulatedResult.Payload, serializerSettings) }; } else { var storageResult = await storage.TryRetrievePendingOrderAsync(partner, orderId); if (!storageResult.Found) { log.Error("Order details for {Partner}//{Order} were not found in the pending order storage. Submission cannot continue. Emulated: {Emulated}.", partner, orderId, (emulatedResult != null)); return(new OperationResult <CreateOrderMessage> { Outcome = Outcome.Failure, Reason = FailureReason.OrderNotFoundInPendingStorage, Recoverable = Recoverability.Final, }); } result = new OperationResult <CreateOrderMessage> { Outcome = Outcome.Success, Reason = String.Empty, Recoverable = Recoverability.Final, Payload = storageResult.Order }; } log.Information("The order for {Partner}//{Order} was retrieved from pending storage. Emulated: {Emulated}. Result: {Result}", partner, orderId, (emulatedResult != null), result); } catch (Exception ex) { log.Error(ex, "An error occured while retrieving {Partner}//{Order} as pending submission.", partner, orderId); return(OperationResult <CreateOrderMessage> .ExceptionResult); } return(result); }
public GetPhoneNumberCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public FormOrderCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public OrderController(IOrderStorage orderStorage, SessionCartStorage sessionCartStorage) { _orderStorage = orderStorage; _sessionCartStorage = sessionCartStorage; }
public GetAddressComand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public OrderService(IOrderStorage storage) { _storage = storage; }
private readonly IFigureStorage _figureStorage; // хранилище фигур public FiguresController(ILogger <FiguresController> logger, IOrderStorage orderStorage, IFigureStorage figureStorage) { _logger = logger; _orderStorage = orderStorage; _figureStorage = figureStorage; }
public OrderRepository(IOrderStorage storage) { _storage = storage; }
public OrderLogic(IOrderStorage orderStorage) { _orderStorage = orderStorage; }
public GetNameCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public ChooseTypeCommand(IManagementStorage managementStorage, IAdminStorage userStorage, IOrderStorage orderStorage) : base(managementStorage, userStorage, orderStorage) { }
public OrderService(IFiguresStorage figuresStorage, IOrderStorage orderStorage) { _figuresStorage = figuresStorage; _orderStorage = orderStorage; }