Esempio n. 1
0
    public void llenarCombos()
    {
        cmbCategoria.Items.Clear();
        cmbProveedor.Items.Clear();

        listaCategoria = daoCategoria.ConsultarTodos();
        listaProveedor = daoProveedor.ConsultarTodos();
        if (listaCategoria != null)
        {
            for (int i = 0; i < listaCategoria.Count; i++)
            {
                ListItem itmc = new ListItem();
                itmc.Text = listaCategoria[i].Nombre;
                cmbCategoria.Items.Add(itmc);
            }
        }
        if (listaProveedor != null)
        {
            for (int i = 0; i < listaProveedor.Count; i++)
            {
                ListItem itmc = new ListItem();
                itmc.Text = listaProveedor[i].Nombre_proveedor;
                cmbProveedor.Items.Add(itmc);
            }
        }
    }
Esempio n. 2
0
    public void llenarTable()
    {
        List <Proveedor> lista = dao.ConsultarTodos();


        if (lista != null)
        {
            Table1.Rows.Clear();
            TableHeaderCell h0 = new TableHeaderCell();
            h0.Scope = TableHeaderScope.Column;
            h0.Text  = "Administrar";
            TableHeaderCell h1 = new TableHeaderCell();
            h1.Scope = TableHeaderScope.Column;
            h1.Text  = "ID";
            TableHeaderCell h2 = new TableHeaderCell();
            h2.Scope = TableHeaderScope.Column;
            h2.Text  = "Nombre";
            TableHeaderCell h3 = new TableHeaderCell();
            h3.Scope = TableHeaderScope.Column;
            h3.Text  = "Email";
            TableHeaderCell h4 = new TableHeaderCell();
            h4.Scope = TableHeaderScope.Column;
            h4.Text  = "Telefono";
            TableHeaderCell h5 = new TableHeaderCell();
            h5.Scope = TableHeaderScope.Column;
            h5.Text  = "Direccion";
            TableHeaderCell h6 = new TableHeaderCell();
            h6.Scope = TableHeaderScope.Column;
            h6.Text  = "Ciudad";
            TableHeaderRow hr = new TableHeaderRow();
            hr.Cells.Add(h0);
            hr.Cells.Add(h1);
            hr.Cells.Add(h2);
            hr.Cells.Add(h3);
            hr.Cells.Add(h4);
            hr.Cells.Add(h5);
            hr.Cells.Add(h6);
            Table1.Rows.Add(hr);
            for (int i = 0; i < lista.Count; i++)
            {
                Button btn1 = new Button();
                Button btn2 = new Button();
                btn1.Text        = "Upd";
                btn2.Text        = "Del";
                btn1.CssClass    = "btn btn-outline-info col-sm-6";
                btn1.PostBackUrl = "FrmRegistroProveedor.aspx";
                btn2.CssClass    = "btn btn-outline-danger col-sm-6";
                btn1.Click      += new EventHandler(this.ActionUpd);
                btn2.Click      += new EventHandler(this.ActionDel);
                TableCell c0 = new TableCell();
                c0.Controls.Add(btn1);
                c0.Controls.Add(btn2);

                TableCell cId = new TableCell();
                cId.Text = Convert.ToString(lista[i].Id);
                TableCell cNom = new TableCell();
                cNom.Text = lista[i].Nombre_proveedor;
                TableCell cEm = new TableCell();
                cEm.Text = lista[i].Email_proveedor;
                TableCell cTel = new TableCell();
                cTel.Text = lista[i].Telefono_proveedor;
                TableCell cDir = new TableCell();
                cDir.Text = lista[i].Direccion_proveedor;
                TableCell cCity = new TableCell();
                cCity.Text = lista[i].Ciudad_proveedor;



                TableRow tr = new TableRow();
                tr.Cells.Add(c0);
                tr.Cells.Add(cId);
                tr.Cells.Add(cNom);
                tr.Cells.Add(cEm);
                tr.Cells.Add(cTel);
                tr.Cells.Add(cDir);
                tr.Cells.Add(cCity);
                Table1.Rows.Add(tr);
            }
        }
    }