private void btnExtraOrder_Click(object sender, EventArgs e) { OrderControl oc = new OrderControl(wh); ListOfOrdersForms.Add(oc); OrderListPanel.Controls.Add(oc); }
public List <OrderControl> SetOrders() { ListOfOrdersForm = new List <OrderControl>(); for (int i = 0; i < 5; i++) { OrderControl oc = new OrderControl(this); ListOfOrdersForm.Add(oc); } return(ListOfOrdersForm); }
/// <summary> /// Opens the order settings panel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSet_Click(object sender, EventArgs e) { for (int i = 0; i < 5; i++) { OrderControl oc = new OrderControl(wh); ListOfOrdersForms.Add(oc); OrderListPanel.Controls.Add(oc); } TabControlMain.SelectedTab = TabPageOrderSettings; }
/// <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; }