Example #1
0
        // Eliminar seleccionados
        protected void BtnDelete_Click(object sender, EventArgs e)
        {
            int count = 0;

            foreach (GridViewRow row in gridTalles.Rows)
            {
                CheckBox chk = (CheckBox)row.FindControl("chkDelete");
                if (chk.Checked)
                {
                    TextBox txtId      = (TextBox)row.FindControl("txtId");
                    TextBox txtNombre  = (TextBox)row.FindControl("txtNombre");
                    int     id         = Convert.ToInt32(txtId.Text.Trim());
                    string  nombre     = txtNombre.Text.Trim();
                    bool    eliminados = TalleLN.getInstance().eliminarTalle(id, nombre,
                                                                             Session["schema"].ToString());
                    if (!eliminados)
                    {
                        Response.Write(@"<script language='javascript'>alert('Error al eliminar el talle "
                                       + nombre + " .');</script>");
                    }
                    else
                    {
                        count = count + 1;
                    }
                }
            }
            Response.Write(@"<script language='javascript'>alert('Eliminados: " + count + " .');</script>");
            Response.Redirect(Request.Url.AbsoluteUri);
        }
Example #2
0
        protected void BindData()
        {
            List <Talle> listaTalles = TalleLN.getInstance().listaTalles(Session["schema"].ToString());

            gridTalles.DataSource = listaTalles;
            gridTalles.DataBind();
        }
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            string retorno = TalleLN.getInstance().nuevoTalle(txtNombre.Text.Trim(),
                                                              Session["schema"].ToString());

            txtNombre.Text = "";
            Response.Write(@"<script language='javascript'>alert('" + retorno + " .');</script>");
        }
        // cargar talles
        protected void cargarTalles()
        {
            List <Talle> list = TalleLN.getInstance().listaTalles(Session["schema"].ToString());

            foreach (Talle talle in list)
            {
                ListItem newItem = new ListItem(talle.nombre, talle.id.ToString(), true);
                ddlTalle.Items.Add(newItem);
            }
        }
Example #5
0
        // Aceptar actualizar datos
        protected void gridTalles_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row       = gridTalles.Rows[e.RowIndex];
            TextBox     txtId     = (TextBox)row.FindControl("txtEditId");
            TextBox     txtNombre = (TextBox)row.FindControl("txtEditNombre");
            int         id        = Convert.ToInt32(txtId.Text.Trim());
            string      nombre    = txtNombre.Text.Trim();

            bool retorno = TalleLN.getInstance().updateTalle(id, nombre, Session["schema"].ToString());

            if (retorno)
            {
                Response.Write(@"<script language='javascript'>alert('Talle actualizado correctamente.');</script>");
                Response.Redirect(Request.Url.AbsoluteUri);
            }
        }
Example #6
0
        // cargar ddls en modo edicion
        protected void gridArticulos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && gridArticulos.EditIndex == e.Row.RowIndex)
            {
                #region "cargar lista modelos"
                DropDownList  ddlModelos   = (DropDownList)e.Row.FindControl("ddlModelos");
                List <Modelo> listaModelos = ModeloLN.getInstance().listaModelos(Session["schema"].ToString());
                foreach (Modelo modelo in listaModelos)
                {
                    ListItem newItem = new ListItem(modelo.nombre, modelo.id.ToString(), true);
                    ddlModelos.Items.Add(newItem);
                }
                ddlModelos.DataBind();
                ddlModelos.Items.FindByText((e.Row.FindControl("lblModelo") as Label).Text).Selected = true;
                #endregion

                #region "cargar lista talles"
                DropDownList ddlTalles   = (DropDownList)e.Row.FindControl("ddlTalles");
                List <Talle> listaTalles = TalleLN.getInstance().listaTalles(Session["schema"].ToString());
                foreach (Talle talle in listaTalles)
                {
                    ListItem newItem = new ListItem(talle.nombre, talle.id.ToString(), true);
                    ddlTalles.Items.Add(newItem);
                }
                ddlTalles.DataBind();
                ddlTalles.Items.FindByText((e.Row.FindControl("lblTalle") as Label).Text).Selected = true;
                #endregion

                #region "cargar lista colores"
                DropDownList ddlColores   = (DropDownList)e.Row.FindControl("ddlColores");
                List <Color> listaColores = ColorLN.getInstance().listaColores(Session["schema"].ToString());
                foreach (Color color in listaColores)
                {
                    ListItem newItem = new ListItem(color.nombre, color.id.ToString(), true);
                    ddlColores.Items.Add(newItem);
                }
                ddlColores.DataBind();
                ddlColores.Items.FindByText((e.Row.FindControl("lblColor") as Label).Text).Selected = true;
                #endregion
            }
        }