Beispiel #1
0
        private void btnMoreItem_Click(object sender, EventArgs e)
        {
            OrderItemControl oi = new OrderItemControl();

            flowLayoutPanel1.Controls.Add(oi);
            this.ItemControlList.Add(oi);
        }
Beispiel #2
0
        /// <summary>
        /// Opens a File Explorer dialog box to upload .csv file with
        /// predefined order settings and populate the OrderListControls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpload_Click(object sender, EventArgs e)
        {
            HashSet <OrderControl> tempOCremove = new HashSet <OrderControl>();

            foreach (OrderControl oc in ListOfOrdersForms)
            {
                if (oc.TypeItem == "")
                {
                    tempOCremove.Add(oc);
                    OrderListPanel.Controls.Remove(oc);
                }
            }
            ListOfOrdersForms.RemoveAll(x => tempOCremove.Contains(x));

            foreach (Order o in csvh.OrderDetailsUpload())
            {
                OrderControl oc = new OrderControl(wh);
                oc.Width     = 1100;
                oc.StartTime = o.TimeStamp;
                oc.TypeItem  = o.Type;
                Product p = ProductList.possibleProducts.Find(x => x.Name == o.ItemsList[0].productItem.Name);
                oc.ItemControlList[0].chosenItem     = p;
                oc.ItemControlList[0].quantityOfItem = o.ItemsList[0].Quantity;

                for (int i = 1; i < o.ItemsList.Count; i++)
                {
                    oc.OrderItemFlowPanel.Controls.Add(new OrderItemControl());
                    OrderItemControl oic = oc.OrderItemFlowPanel.Controls[i] as OrderItemControl;
                    oic.Name  = "oic" + i;
                    oic.Width = 900;
                    Product ps = ProductList.possibleProducts.Find(x => x.Name == o.ItemsList[i].productItem.Name);
                    oic.chosenItem     = ps;
                    oic.quantityOfItem = o.ItemsList[i].Quantity;
                    oc.ItemControlList.Add(oic);
                }

                ListOfOrdersForms.Add(oc);
                OrderListPanel.Controls.Add(oc);
            }

            TabControlMain.SelectedTab = TabPageOrderSettings;
        }