/// <summary> /// Creates the order. /// </summary> public void CreateOrder() { //Get rid of any prior pending orders, before creating a new one DeletePendingOrder(); POSOrder order = new POSOrder(); order.ID = "" + (++orderNumber); CurrentOrder = order; AddOrder(order); }
/// <summary> /// Values the specified order. /// </summary> /// <param name="order">The order.</param> /// <returns>System.Int64.</returns> public long Value(POSOrder order) { if (AmountOff > 0) { return(AmountOff); } else { return((int)(order.PreTaxSubTotal * PercentageOff)); } }
/// <summary> /// Ons the order change. /// </summary> /// <param name="order">The order.</param> /// <param name="target">The target.</param> protected void onOrderChange(POSOrder order, OrderChangeTarget target) { if (order.status == OrderStatus.PENDING && order.Items.Count > 0) { order.status = OrderStatus.OPEN; } if (OrderChange != null) { OrderChange(order, target); } }
/* This will remove any other PENDING order before creating a new one. */ /// <summary> /// Deletes the pending order. /// </summary> private void DeletePendingOrder() { POSOrder delOrder = null; foreach (POSOrder order in Orders) { if (order.Status == POSOrder.OrderStatus.PENDING) { delOrder = order; break; } } if (delOrder != null) { Orders.Remove(delOrder); //This shouldn't trigger a onOrderListChange, as PENDING orders aren't displayed delOrder = null; } }
/// <summary> /// Adds the order. /// </summary> /// <param name="order">The order.</param> public void AddOrder(POSOrder order) { Orders.Add(order); onOrderListChange(this, OrderListAction.ADDED); }