示例#1
0
    public void SetOrderBST(string customerName, List <Item> orderItems)
    {
        int     orderId = customerName.GetHashCode();
        BSTNode node    = tree.Find(orderId);

        if (node == null)
        {
            Order order = new Order()
            {
                id         = orderId,
                clientName = customerName,
                items      = new List <Item>()
            };

            tree.Insert(orderId, order);
        }
        else
        {
            orderId = node.GetData <Order>().clientName.GetHashCode();
            node.SetData(new Order
            {
                id         = orderId,
                clientName = customerName,
                items      = orderItems
            }, orderId);
        }
        List <Order> nodes = new List <Order>();

        tree.PreorderTraversal(nodes);
        OrderDataManager.UpdateOrders(nodes);
    }
    public void Proceed()
    {
        List <Order> ordersToHistory = OrderHistoryDataManager.Orders.orders;

        ordersToHistory.AddRange(OrderDataManager.Orders.orders);

        OrderHistoryDataManager.UpdateOrders(ordersToHistory);
        OrderDataManager.UpdateOrders(new List <Order>());
        controller.ClearTree();
        foreach (var order in orderGOList)
        {
            Destroy(order);
        }
    }
示例#3
0
        protected void OnButtonSaveClicked(object sender, EventArgs e)
        {
            _orderMgr.SetAllOrders(m_allOrders);
            if (m_updateOrders.Count > 0)
            {
                _orderMgr.UpdateOrders(m_updateOrders);
                m_updateOrders.Clear();
            }

            if (m_deleteOrders.Count > 0)
            {
                _orderMgr.DeleteOrders(m_deleteOrders);
                m_deleteOrders.Clear();
            }

            m_addOrders.Clear();
        }