Example #1
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(entradaIdTextbox.Text);

            if (id != 0)
            {
                RepositorioEntrada repositorio = new RepositorioEntrada();
                if (repositorio.Buscar(id) != null)
                {
                    if (repositorio.Eliminar(id))
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "toastr_message", script: "toastr['success']('Eliminado con Exito');", addScriptTags: true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "toastr_message", script: "toastr['error']('No se pudo eliminar');", addScriptTags: true);
                    }
                    Limpiar();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "toastr_message", script: "toastr['error']('No existe');", addScriptTags: true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "toastr_message", script: "toastr['warning']('Seleccione un ID');", addScriptTags: true);
            }
        }
Example #2
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            GridViewRow        grid        = GridView.SelectedRow;
            RepositorioEntrada repositorio = new RepositorioEntrada();
            int id      = Utils.ToInt(IdTextBox.Text);
            var entrada = repositorio.Buscar(id);

            if (entrada != null)
            {
                if (repositorio.Eliminar(id))
                {
                    Utils.ShowToastr(this.Page, "Exito Eliminado", "error");
                    Limpiar();
                }
                else
                {
                    Utils.ShowToastr(this.Page, "No Eliminado", "error");
                }
            }
            else
            {
                Utils.ShowToastr(this, "No existe", "Error", "error");
            }
            repositorio.Dispose();
        }
        protected void eliminarutton_Click(object sender, EventArgs e)
        {
            RepositorioEntrada repositorio = new RepositorioEntrada();
            int id = Utils.ToInt(entradaIdTextBox.Text);

            var entrada = repositorio.Buscar(id);

            if (entrada != null)
            {
                if (repositorio.Eliminar(id))
                {
                    Utils.ShowToastr(this, "Eliminado", "Exito", "success");
                    LimpiaObjetos();
                }
                else
                {
                    Utils.ShowToastr(this, "No se pudo eliminar", "Error", "error");
                }
            }
            else
            {
                Utils.ShowToastr(this, "No existe", "Error", "error");
            }
        }