Beispiel #1
0
        //Buenas Miguel no he conseguido hacer que lo que se crea sea un user control, creo que esa era la solucion
        //valida y hacia todo más visual y comodo pero lo he echo asi par que por lo menos se viera que se hacer lo de crear
        //nuevos objetos en un bucle.
        public void showOrders(string orderID)
        {
            flowLayoutPanel.Controls.Clear();
            var ordermodel = new OrderModel();

            ordermodel.orderLineNumber = DataAcces.GetDetalls(orderID);

            foreach (OrderDetaills product in ordermodel.orderLineNumber)
            {
                //orderLineNmberControl orderLine = new orderLineNmberControl();
                //PictureBox picBox = new PictureBox();

                /*bool door = false;
                 * var linesImg = new productLines();
                 * int random = 0;
                 * while (door == false)
                 * {
                 *  Random rnd = new Random();
                 *  random = rnd.Next(1, 128);
                 *
                 *  linesImg = DataAcces.GetIMG(random);
                 *  if (linesImg != null)
                 *  {
                 *      MemoryStream ms = new MemoryStream(productLines.image);
                 *      Image largePhoto = Image.FromStream(ms);
                 *      picBox.Image = largePhoto;
                 *      door = true;
                 *  }
                 * }*/


                Label l1 = new Label();
                l1.Text = "|||";
                Label l2 = new Label();
                l2.Text = product.productCode;
                Label l3 = new Label();
                l3.Text = product.quantityOrdered.ToString();
                Label l4 = new Label();
                l4.Text = product.priceEach.ToString();
                Label l5 = new Label();

                int i = product.quantityOrdered;
                int n = product.priceEach;
                int m = i * n;

                l5.Text = m.ToString();


                flowLayoutPanel.Controls.Add(l2);
                flowLayoutPanel.Controls.Add(l3);
                flowLayoutPanel.Controls.Add(l4);
                flowLayoutPanel.Controls.Add(l5);
                flowLayoutPanel.Controls.Add(l1);
            }
        }