private void AddThreeProduct(Label label, ProductProviderOrder order) { int i = 0; var listProd = order.GetListProducts(); while (i < 3 && i < listProd.Count) { label.Text += listProd[i].ProductName + " - " + listProd[i].Lot.QuantityProduct + " " + listProd[i].Measure.TypeMeasure; if (i == 2 || i + 1 == listProd.Count) { label.Text += "."; } else { label.Text += ", "; } i++; } }
public void SetOrder(ProductProviderOrder order) { if (order != null) { _orderNumberToConfirm = order.OrderId; LabelCurrentCost.Text = order.TotalSumOrder + "руб."; LabelCurrentNumberOrder.Text = order.OrderId.ToString(); LabelNameCurrentOrganization.Text = order.Provider.Name; foreach (var prod in order.GetListProducts()) { FlowLayoutPanel panelCurrentProduct = new FlowLayoutPanel(); panelCurrentProduct.Margin = new Padding(3, 5, 3, 5); panelCurrentProduct.Name = "PanelCurrentProduct"; panelCurrentProduct.Size = new Size(842, 50); Label labelProductName = new Label(); labelProductName.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 204); labelProductName.Margin = new Padding(3, 5, 3, 0); labelProductName.Name = "LabelProductName"; labelProductName.Size = new Size(166, 19); labelProductName.Text = "Название продукта: "; panelCurrentProduct.Controls.Add(labelProductName); Label labelCurrentProductName = new Label(); labelCurrentProductName.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, 204); labelCurrentProductName.Margin = new Padding(3, 5, 3, 0); labelCurrentProductName.Name = "LabelCurrentProductName"; labelCurrentProductName.Size = new Size(656, 19); labelCurrentProductName.Text = prod.ProductName; panelCurrentProduct.Controls.Add(labelCurrentProductName); Label labelNumberProduct = new Label(); labelNumberProduct.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 204); labelNumberProduct.Margin = new Padding(3, 5, 3, 0); labelNumberProduct.Name = "LabelNumberProduct"; labelNumberProduct.Size = new Size(146, 19); labelNumberProduct.Text = "Кол-во продукта:\r\n"; panelCurrentProduct.Controls.Add(labelNumberProduct); Label labelCurrentNumberProduct = new Label(); labelCurrentNumberProduct.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, 204); labelCurrentNumberProduct.Margin = new Padding(3, 5, 3, 0); labelCurrentNumberProduct.Name = "LabelCurrentNumberProduct"; labelCurrentNumberProduct.Size = new Size(222, 19); labelCurrentNumberProduct.Text = prod.Lot.QuantityProduct + " " + prod.Measure.TypeMeasure; panelCurrentProduct.Controls.Add(labelCurrentNumberProduct); PanelProductsInOrder.Controls.Add(panelCurrentProduct); } PanelOrderInfo.Visible = true; LabelOrderContent.Visible = true; PanelProductsInOrder.Visible = true; } else { MessageBox.Show( "К сожалению, накладная с таким номером не найдена. Проверьте правильность ввода и повторите поиска ещё раз", "Накладная отсутствует"); } }