Exemple #1
0
 private void tsbEliminar_Click(object sender, EventArgs e)
 {
     var rta = MessageBox.Show("¿Esta seguro que desea eliminar el usuario?", "Atencion", MessageBoxButtons.YesNo);
     if (rta == DialogResult.Yes)
     {
         int ID = ((Business.Entities.Persona)this.dgvPersonas.SelectedRows[0].DataBoundItem).ID;
         PersonaLogic per = new PersonaLogic();
         per.Delete(ID);
         this.Listar();
     }
 }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int legajo = (int)GridView1.DataKeys[e.RowIndex].Value;
        Business.Logic.PersonaLogic oPersona = new Business.Logic.PersonaLogic();
        bool error = false;
        try
        {
            oPersona.Delete(legajo);
        }
        catch
        {
            error = true;
        }

        if (error)
        {
            Page.Response.Redirect("ListadoAlumnos.aspx?exito=0");
        }
        else
        {
            Page.Response.Redirect("ListadoAlumnos.aspx?exito=1");
        }
    }
Exemple #3
0
 private void tsbEliminar_Click(object sender, EventArgs e)
 {
     var rta = MessageBox.Show("¿Esta seguro que desea eliminar la Persona seleccionada?", "Atencion", MessageBoxButtons.YesNo);
     if (rta == DialogResult.Yes)
     {
         try
         {
             int ID = ((Business.Entities.Persona)this.dgvPersonas.SelectedRows[0].DataBoundItem).ID;
             PersonaLogic per = new PersonaLogic();
             per.Delete(ID);
             this.Listar(cbxTipoPersona.SelectedItem.ToString());
         }
         catch (Exception ex)
         {
             this.Notificar("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }