Exemple #1
0
        private void ProcOrder(OrderCommand command)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                OrderFacade facade = new OrderFacade(uow);
                IFacadeUpdateResult <OrderData> result = null;

                switch (command)
                {
                case OrderCommand.Accept:
                    result = facade.OrderAccept(Order.OrderId);
                    break;

                case OrderCommand.Reject:
                    result = facade.OrderReject(Order.OrderId);
                    break;

                case OrderCommand.Delivering:
                    result = facade.OrderDelivering(Order.OrderId);
                    break;

                case OrderCommand.Complete:
                    result = facade.OrderComplete(Order.OrderId);
                    break;

                case OrderCommand.Incomplete:
                    result = facade.OrderIncomplete(Order.OrderId);
                    break;
                }

                if (result.IsSuccessful)
                {
                    // retrieve saved order info
                    // remove this line on May.23, move retrieve action to caller page
                    //Order = facade.RetrieveOrderInfo(Order.OrderId, new OrderInfoConverter());
                    if (OrderChanged != null)
                    {
                        InstanceChangedEventArgs arg = new InstanceChangedEventArgs(Order);
                        OrderChanged(this, arg);
                    }
                }
                else
                {
                    // Deal with Update result
                    //ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }