Exemplo n.º 1
0
        private void crearBotones()
        {
            NegocioCategorias negCat     = new NegocioCategorias();
            ArrayList         categorias = negCat.getCate();

            foreach (Cate item in categorias)
            {
                Button e     = new Button();
                int    width = panel1.Width;

                if (i > width)
                {
                    i    = 0;
                    top += 70;
                }

                e.Name      = item._ID_Cate + "";
                e.Text      = item._nombre;
                e.Left      = i;
                e.Top       = top;
                e.Height    = 62;
                e.Width     = 62;
                e.TextAlign = ContentAlignment.MiddleCenter;
                i          += 70;



                panel1.Controls.Add(e);
            }
            top = 0;
            i   = 0;
        }
        private void llenarCombo()
        {
            NegocioCategorias negCat = new NegocioCategorias();

            ArrayList cat = negCat.getCate();

            foreach (Cate item in cat)
            {
                cmbCategoria.Items.Add(item._nombre);
            }
        }
Exemplo n.º 3
0
        public void cargarProductos()
        {
            NegocioCategorias negCli = new NegocioCategorias();

            System.Collections.IEnumerator mostrar = negCli.getCate().GetEnumerator();

            while (mostrar.MoveNext())
            {
                Cate    ca  = (Cate)mostrar.Current;
                TabPage tab = new TabPage();
                tab.Text = ca._nombre;
                tab.Name = ca._ID_Cate + "";
                tbcProducts.Controls.Add(tab);
            }



            NegocioProducto negPro = new NegocioProducto();

            IEnumerator tabpages = tbcProducts.TabPages.GetEnumerator();

            while (tabpages.MoveNext())
            {
                int izq = 10;
                int ar  = 10;

                TabPage tab = (TabPage)tabpages.Current;

                ArrayList productos = negPro.getProductosxcate(int.Parse(tab.Name));

                foreach (Producto itpro in productos)
                {
                    Label lbl = new Label();
                    lbl.Name      = itpro._ID_Producto + "";
                    lbl.Text      = itpro._nombre;
                    lbl.TextAlign = ContentAlignment.MiddleCenter;
                    lbl.Width     = 50;
                    lbl.Left      = izq;
                    if (izq > tab.Width)
                    {
                        izq = 0;
                        ar += 20;
                    }
                    lbl.Top = ar;
                    AsignarEventos(lbl);
                    tab.Controls.Add(lbl);

                    izq += 50;
                }
            }
        }