Example #1
0
    protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        SolicitudBC s = new SolicitudBC();
        DataTable   dt;

        if (this.ViewState["filtrados"] == null)
        {
            dt = (DataTable)this.ViewState["lista"];
        }
        else
        {
            dt = (DataTable)this.ViewState["filtrados"];
        }
        if (e.CommandName == "ANDEN1")
        {
            int    index   = Convert.ToInt32(e.CommandArgument);
            int    soli_id = Convert.ToInt32(dt.Rows[index]["ID"]);
            int    luga_id = Convert.ToInt32(dt.Rows[index]["LUGA_ID1"]);
            string resultado;
            if (s.CargaPallets(soli_id, luga_id, out resultado, this.u.ID) && resultado == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Accion realizada correctamente');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true);
            }
            this.ObtenerSolicitudes(true);
        }
        if (e.CommandName == "ANDEN2")
        {
            int    index   = Convert.ToInt32(e.CommandArgument);
            int    soli_id = Convert.ToInt32(dt.Rows[index]["ID"]);
            int    luga_id = Convert.ToInt32(dt.Rows[index]["LUGA_ID2"]);
            string resultado;
            if (s.DescargaPallets(soli_id, luga_id, out resultado, this.u.ID) && resultado == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Accion realizada correctamente');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true);
            }
            this.ObtenerSolicitudes(true);
        }
    }