예제 #1
0
        protected void gvListado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int    index;
            string codUsuario = string.Empty;

            switch (e.CommandName)
            {
            case "Edit":
                index = Convert.ToInt32(e.CommandArgument);

                codUsuario = this.gvListado.DataKeys[index][0].ToString();
                Response.Redirect("Usuario.aspx?Accion=" + Constantes.ACCION_EDITAR + "&Id=" + codUsuario);
                break;

            case "Delete":
                codUsuario = (string)(e.CommandArgument);
                if (BL_Usuario.EliminarUsuario(codUsuario))
                {
                    ListarUsuarios();
                    string script = "$(function(){bettosimport.util.showMessage('" + Constantes.SUCCESS_DEFAULT_MESSAGE + "','" + Constantes.ALERT_SUCCESS + "')})";
                    ScriptManager.RegisterStartupScript(this, Page.GetType(), "", script, true);
                }
                else
                {
                    string script = "$(function(){bettosimport.util.showMessage('" + Constantes.ERROR_DEFAULT_MESSAGE + "','" + Constantes.ALERT_DANGER + "')})";
                    ScriptManager.RegisterStartupScript(this, Page.GetType(), "", script, true);
                }
                break;
            }
        }