public OrderStateButtonViewModel(IEnumerable<Order> selectedOrders, OrderStateGroup stateGroup, OrderState model)
 {
     _selectedOrders = selectedOrders;
     Model = model;
     OrderStateGroup = stateGroup;
     if (string.IsNullOrEmpty(model.Name))
         model.Name = string.Format("[{0}]", Resources.NewProperty);
 }
Exemplo n.º 2
0
 public void UpdateOrderState(OrderStateGroup orderStateGroup, OrderState orderState, int userId)
 {
     if (orderStateGroup.Id == OrderStateGroupId && orderState.Name == OrderState && Locked && orderStateGroup.UnlocksOrder)
     {
         return;
     }
     if (orderState == null || (orderStateGroup.Id == OrderStateGroupId && orderState.Name == OrderState))
     {
         CalculatePrice      = true;
         DecreaseInventory   = true;
         IncreaseInventory   = false;
         OrderState          = "";
         OrderStateGroupName = "";
         OrderStateGroupId   = 0;
         if (orderStateGroup.UnlocksOrder && Id > 0)
         {
             Locked = true;
         }
         return;
     }
     CalculatePrice    = orderStateGroup.CalculateOrderPrice;
     DecreaseInventory = orderStateGroup.DecreaseOrderInventory;
     IncreaseInventory = orderStateGroup.IncreaseOrderInventory;
     if (orderStateGroup.UnlocksOrder)
     {
         Locked = false;
     }
     if (orderStateGroup.AccountTransactionTypeId > 0)
     {
         AccountTransactionTypeId = orderStateGroup.AccountTransactionTypeId;
     }
     if (IncreaseInventory && Quantity > 0)
     {
         Quantity = 0 - Quantity;
     }
     if (!IncreaseInventory && Quantity < 0)
     {
         Quantity = 0 - Quantity;
     }
     OrderState          = orderState.Name;
     OrderStateGroupName = orderStateGroup.Name;
     OrderStateGroupId   = orderStateGroup.Id;
 }
Exemplo n.º 3
0
 public void UpdateOrderState(OrderStateGroup orderStateGroup, OrderState orderState, int userId)
 {
     if (orderStateGroup.Id == OrderStateGroupId && orderState.Name == OrderState && Locked && orderStateGroup.UnlocksOrder) return;
     if (orderState == null || (orderStateGroup.Id == OrderStateGroupId && orderState.Name == OrderState))
     {
         CalculatePrice = true;
         DecreaseInventory = true;
         IncreaseInventory = false;
         OrderState = "";
         OrderStateGroupName = "";
         OrderStateGroupId = 0;
         if (orderStateGroup.UnlocksOrder && Id > 0) Locked = true;
         return;
     }
     CalculatePrice = orderStateGroup.CalculateOrderPrice;
     DecreaseInventory = orderStateGroup.DecreaseOrderInventory;
     IncreaseInventory = orderStateGroup.IncreaseOrderInventory;
     if (orderStateGroup.UnlocksOrder) Locked = false;
     if (orderStateGroup.AccountTransactionTypeId > 0)
         AccountTransactionTypeId = orderStateGroup.AccountTransactionTypeId;
     if (IncreaseInventory && Quantity > 0) Quantity = 0 - Quantity;
     if (!IncreaseInventory && Quantity < 0) Quantity = 0 - Quantity;
     OrderState = orderState.Name;
     OrderStateGroupName = orderStateGroup.Name;
     OrderStateGroupId = orderStateGroup.Id;
 }
Exemplo n.º 4
0
 public OrderState AddOrderState(string name)
 {
     var prp = new OrderState { Name = name };
     OrderStates.Add(prp);
     return prp;
 }
Exemplo n.º 5
0
 public OrderStateViewModel(OrderState model)
 {
     Model = model;
     if (string.IsNullOrEmpty(model.Name))
         model.Name = string.Format("[{0}]", Resources.NewProperty);
 }