Example #1
0
 public PaymentServices(IPaymentRepository repository, IMapper mapper, IUnitOfWork unitOfWork, IOrderNotificationService notification)
 {
     _mapper       = mapper;
     _repository   = repository;
     _unitOfWork   = unitOfWork;
     _notification = notification;
 }
Example #2
0
 public PizzaOrderService(
     MyPizzaDbContext context,
     IPaymentService paymentService,
     IStoreQueueService storeQueueService,
     IOrderNotificationService orderNotificationService,
     ILoggingService loggingService)
 {
     this.context                  = context;
     this.paymentService           = paymentService;
     this.storeQueueService        = storeQueueService;
     this.orderNotificationService = orderNotificationService;
     this.loggingService           = loggingService;
 }
 public OrderService(
     IOrderRepository orderRepository,
     IOrderPaymentService paymentService,
     IOrderShippingService shippingService,
     IOrderNotificationService notificationService,
     ILogger logger)
 {
     _orderRepository     = orderRepository;
     _paymentService      = paymentService;
     _shippingService     = shippingService;
     _notificationService = notificationService;
     _logger = logger;
 }
Example #4
0
 public Functions(IOrderNotificationService notificationService)
 {
     _ns = notificationService;
     _os = new OrderService(Db);
 }
Example #5
0
 public OrdersController(IUserFiles userFiles, IOrderNotificationService notificationService)
 {
     _userFiles = userFiles;
     _ns        = notificationService;
 }
Example #6
0
        public async Task <bool> AssignmentAmbassadorAsync(int id, int idOrder, IPrincipal user, IOrderNotificationService _ns)
        {
            OrderModel order = await _db.OrderModels.Include(x => x.OrderAmbassador).Include(x => x.RenderPieces).Include(x => x.OrderRequestor).FirstOrDefaultAsync(x => x.Id == idOrder);

            if (order == null)
            {
                return(false);
            }

            AmbassadorModel newAmbassador = await _db.AmbassadorModels.FindAsync(id);

            if (newAmbassador == null)
            {
                return(false);
            }

            AmbassadorModel oldAmbassador  = order.OrderAmbassador;
            OrderStatus     orderOldStatus = order.Status;

            order.OrderAmbassador   = newAmbassador;
            order.Status            = OrderStatus.PreAssigned;
            order.StatusLastUpdated = DateTime.UtcNow;
            order.RenderPieces.ForEach(p => p.Printed = false);
            if (user != null)
            {
                order.LogMessage(user, $"Change ambassador from {(oldAmbassador != null ? oldAmbassador.Email : "no-data")} to {newAmbassador.Email}");
            }

            await _db.SaveChangesAsync();

            await _ns.SendStatusChangeNotification(order, orderOldStatus, OrderStatus.PreAssigned);

            await _ns.SendAmbassadorChangedNotification(order, oldAmbassador, newAmbassador);

            return(true);
        }