示例#1
0
        private async Task OrderPaymentFailed(OrderModel order, string v)
        {
            // Persist order
            var orderDataService = ServiceProxyUtils.GetOrderService(order.Id);
            var updatedOrder     = order.Clone();

            updatedOrder.State = OrderState.Failed;
            updatedOrder.Payment.ProcessingDate = DateTime.UtcNow;
            updatedOrder.Payment.Status         = PaymentStatus.Failed;

            updatedOrder = await orderDataService.Update(updatedOrder);

            // Send to topic "order payment failed"
            await NotifyTopic(this.serviceBusConfiguration.OrderPaymentFailedTopicName, new OrderFinalizedEvent(updatedOrder));
        }
示例#2
0
        public async Task <OrderModel> Update(OrderModel order)
        {
            var orders = await OrderDictionary();

            using (var tx = this.StateManager.CreateTransaction())
            {
                var updatedOrder = order.Clone();
                updatedOrder.LastUpdate = DateTime.UtcNow;
                await orders.SetAsync(tx, updatedOrder.Id, updatedOrder);

                await tx.CommitAsync();

                return(updatedOrder);
            }
        }
示例#3
0
        public OrderViewModel(OrderModel order)
        {
            OkCommand     = new RelayCommand(DoOk);
            CancelCommand = new RelayCommand(DoCancel);

            SelectedWorker = -1;
            Workers        = new WorkersManager().GetWorkers();

            if (order == null)
            {
                Order = new OrderModel();
            }
            else
            {
                Order          = order.Clone();
                SelectedWorker = Workers.IndexOf(Workers.Where(w => w.Id == order.Worker).FirstOrDefault());
            }
        }