public OrderModel(IOrderEntityFactory entityFactory, coreModel.Order innerItem, OrderClient client, IOrderService orderService)
		{
			_entityFactory = entityFactory;
			_innerItem = innerItem;
			_OrderClient = client;
			_orderService = orderService;
		}
		public static bool IsReleaseable(this Shipment item, coreModel.Order ParentOrder, OrderClient client)
		{
			var retVal = !string.IsNullOrEmpty(item.ShippingAddressId)
					&& !Guid.Empty.Equals(item.ShippingMethodId)
					&& ParentOrder.GetCurrentStatus() != (int)OrderStatus.Pending
					&& ParentOrder.GetCurrentStatus() != (int)OrderStatus.AwaitingExchange
					&& client.CanChangeStatus(item, ShipmentStatus.Released.ToString());
			return retVal;
		}
		public static void SetCurrentStatus(this Shipment item, int value, OrderClient client)
		{
			var newStatus = (ShipmentStatus)value;

			if (client.CanChangeStatus(item, newStatus.ToString()))
			{
				item.Status = newStatus.ToString();
			}
			else
				throw new OperationCanceledException("[Shipment] Unable to transition: " + item.Status + " -> " + newStatus.ToString());

		}
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckoutController"/> class.
 /// </summary>
 /// <param name="storeClient">The store client.</param>
 /// <param name="paymentClient">The payment client.</param>
 /// <param name="userClient">The user client.</param>
 /// <param name="countryClient">The country client.</param>
 /// <param name="orderClient">The order client.</param>
 /// <param name="paymentOptions">The payment options.</param>
 public CheckoutController(StoreClient storeClient,
                           PaymentClient paymentClient,
                           UserClient userClient,
                           CountryClient countryClient,
                           OrderClient orderClient,
                           IPaymentOption[] paymentOptions)
 {
     _storeClient = storeClient;
     _paymentClient = paymentClient;
     _userClient = userClient;
     _countryClient = countryClient;
     _orderClient = orderClient;
     _paymentOptions = paymentOptions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountController" /> class.
 /// </summary>
 /// <param name="catalogClient">The catalog client.</param>
 /// <param name="userClient">The user client.</param>
 /// <param name="countryClient">The country client.</param>
 /// <param name="orderClient">The order client.</param>
 /// <param name="settingsClient">The settings client.</param>
 /// <param name="identitySecurity">The web security.</param>
 /// <param name="orderService">The order service.</param>
 public AccountController(CatalogClient catalogClient,
                          UserClient userClient,
                          CountryClient countryClient,
                          OrderClient orderClient,
                          SettingsClient settingsClient,
                          IdentityUserSecurity identitySecurity,
                          IOrderService orderService)
 {
     _catalogClient = catalogClient;
     _userClient = userClient;
     _countryClient = countryClient;
     _orderClient = orderClient;
     _settingsClient = settingsClient;
     _identitySecurity = identitySecurity;
     _orderService = orderService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountController" /> class.
 /// </summary>
 /// <param name="catalogClient">The catalog client.</param>
 /// <param name="userClient">The user client.</param>
 /// <param name="countryClient">The country client.</param>
 /// <param name="orderClient">The order client.</param>
 /// <param name="settingsClient">The settings client.</param>
 /// <param name="webSecurity">The web security.</param>
 /// <param name="oAuthSecurity">The o authentication security.</param>
 /// <param name="orderService">The order service.</param>
 public AccountController(CatalogClient catalogClient,
                          UserClient userClient,
                          CountryClient countryClient,
                          OrderClient orderClient,
                          SettingsClient settingsClient,
                          IUserSecurity webSecurity,
                          IOAuthWebSecurity oAuthSecurity,
                          IOrderService orderService)
 {
     _catalogClient = catalogClient;
     _userClient = userClient;
     _countryClient = countryClient;
     _orderClient = orderClient;
     _settingsClient = settingsClient;
     _webSecurity = webSecurity;
     _oAuthSecurity = oAuthSecurity;
     _orderService = orderService;
 }
		public RmaRequestViewModel(
			IViewModelsFactory<ICreateRefundViewModel> wizardVmFactory,
			IViewModelsFactory<IOrderViewModel> orderVmFactory,
			IAuthenticationContext authContext,
			RmaRequest rmaRequestItem,
			OrderViewModel parentViewModel, OrderClient client)
		{
			_wizardVmFactory = wizardVmFactory;
			_orderVmFactory = orderVmFactory;
			CurrentRmaRequest = rmaRequestItem;
			_authContext = authContext;
			_parentViewModel = parentViewModel;
			_orderClient = client;

			RmaRequestWizardDialogInteractionRequest = new InteractionRequest<Confirmation>();

			RmaRequestCancelCommand = new DelegateCommand(RaiseRmaRequestCancelInteractionRequest, () => CurrentRmaRequest.IsCancellable(client));
			RmaRequestCompleteCommand = new DelegateCommand(RaiseRmaRequestCompleteInteractionRequest, () => CurrentRmaRequest.IsCompletable(client));
			ExchangeOrderCreateCommand = new DelegateCommand(RaiseExchangeOrderCreateInteractionRequest, () => CurrentRmaRequest.IsAllowCreateExchangeOrder());
			ExchangeOrderViewCommand = new DelegateCommand(RaiseExchangeOrderViewInteractionRequest, () => CurrentRmaRequest.ExchangeOrder != null);
		}
		public ShipmentViewModel(OrderClient client, IViewModelsFactory<ISplitShipmentViewModel> splitVmFactory, IViewModelsFactory<ILineItemAddViewModel> wizardLineItemVmFactory, IViewModelsFactory<ILineItemViewModel> lineItemVmFactory, OrderViewModel orderViewModel, Shipment shipmentItem, IOrderEntityFactory entityFactory, IRepositoryFactory<IPricelistRepository> repositoryFactory, PriceListClient priceListClient)
		{
			_orderClient = client;
			ParentViewModel = orderViewModel;
			_currentOrder = orderViewModel._innerModel;
			CurrentShipment = shipmentItem;
			_entityFactory = entityFactory;
			_repositoryFactory = repositoryFactory;
			_priceListClient = priceListClient;
			_lineItemVmFactory = lineItemVmFactory;
			_wizardLineItemVmFactory = wizardLineItemVmFactory;
			_splitVmFactory = splitVmFactory;

			CommonShipmentConfirmRequest = orderViewModel.CommonOrderCommandConfirmRequest;

			ReleaseShipmentCommand = new DelegateCommand(RaiseReleaseShipmentInteractionRequest, () => CurrentShipment.IsReleaseable(_currentOrder.InnerItem, client));
			CompleteShipmentCommand = new DelegateCommand(RaiseCompleteShipmentInteractionRequest, () => CurrentShipment.IsCompletable(_currentOrder.InnerItem, client));
			CancelShipmentCommand = new DelegateCommand(RaiseCancelShipmentInteractionRequest, () => CurrentShipment.IsCancellable(_currentOrder.InnerItem, client));
			AddLineItemCommand = new DelegateCommand(RaiseAddLineItemInteractionRequest, () => CurrentShipment.IsModifyable(_currentOrder.InnerItem));
			MoveLineItemCommand = new DelegateCommand<ShipmentItem>(RaiseMoveLineItemInteractionRequest, x => x != null && CurrentShipment.IsModifyable(_currentOrder.InnerItem));
			RemoveLineItemCommand = new DelegateCommand<ShipmentItem>(RaiseRemoveLineItemInteractionRequest, x => x != null && CurrentShipment.IsModifyable(_currentOrder.InnerItem));
			ViewLineItemDetailsCommand = new DelegateCommand<object>(RaiseViewLineItemDetailsInteractionRequest, x => x != null);
		}
		public static bool IsCompletable(this Shipment item, coreModel.Order ParentOrder, OrderClient client)
		{
			var retVal = ParentOrder.GetCurrentStatus() != (int)OrderStatus.AwaitingExchange
						&& client.CanChangeStatus(item, ShipmentStatus.Shipped.ToString());

			return retVal;
		}
		public static bool IsCompletable(this RmaRequest item, OrderClient client)
		{
			return client.CanChangeStatus(item, RmaRequestStatus.Complete.ToString());
		}
		public static void Cancel(this RmaRequest item, OrderClient client)
		{
			item.SetCurrentStatus((int)RmaRequestStatus.Canceled, client);
		}
		public OrderModel(coreModel.Order innerItem, OrderClient client, IOrderService orderService)
			: this(new OrderEntityFactory(), innerItem, client, orderService)
		{
		}
		public static void Complete(this RmaRequest item, OrderClient client)
		{
			item.SetCurrentStatus((int)RmaRequestStatus.Complete, client);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="ReviewController" /> class.
 /// </summary>
 /// <param name="reviewRepository">The review repository.</param>
 /// <param name="reviewClient">The review client.</param>
 /// <param name="orderClient">The order client.</param>
 public ReviewController(IReviewRepository reviewRepository, ReviewClient reviewClient, OrderClient orderClient)
 {
     _repository = reviewRepository;
     _reviewClient = reviewClient;
     _orderClient = orderClient;
 }
		public static void Complete(this Shipment item, coreModel.Order ParentOrder, OrderClient client)
		{
			item.SetCurrentStatus((int)ShipmentStatus.Shipped, client);
		}
		public static void PickForPack(this Shipment item, OrderClient client)
		{
			item.SetCurrentStatus((int)ShipmentStatus.Packing, client);
		}
		public static void Release(this Shipment item, coreModel.Order ParentOrder, OrderClient client)
		{
			item.SetCurrentStatus((int)ShipmentStatus.Released, client);
		}
		public static void Cancel(this Shipment item, coreModel.Order ParentOrder, OrderClient client)
		{
			item.SetCurrentStatus((int)ShipmentStatus.Cancelled, client);
		}