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); }
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; }
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; }
public OrderState AddOrderState(string name) { var prp = new OrderState { Name = name }; OrderStates.Add(prp); return prp; }
public OrderStateViewModel(OrderState model) { Model = model; if (string.IsNullOrEmpty(model.Name)) model.Name = string.Format("[{0}]", Resources.NewProperty); }