public void Listar()
 {
     List<Area> ar = new AreaBL().List();
     if (ar.ToList().Count() > 0)
     {
         GridView1.DataSource = ar.ToList();
         GridView1.DataBind();
     }
     else
     {
         GridView1.DataSource = null;
         GridView1.DataBind();
     }
 }
 public void ListarArea()
 {
     List<Area> ar = new AreaBL().List();
     if (ar.ToList().Count() > 0)
     {
         foreach (Area a in ar)
         {
             CboArea.Items.Add(a.Nom_area);
         }
     }
     else
     {
         CboArea.DataSource = null;
     }
 }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int i;
         AreaBL a = new AreaBL();
         int index = Convert.ToInt32(e.RowIndex);
         i = a.Eliminar(GridView1.Rows[index].Cells[2].Text.ToString());
         if (i > 0) {
             Listar();
         }
     }
     catch (Exception)
     {
     }
 }
 protected void Registrar_Click(object sender, EventArgs e)
 {
     try
     {
         int i;
         AreaBL a = new AreaBL();
         i = a.Registrar(Txt_Area.Text.Trim(),Txt_Sigla.Text.Trim());
         if (i > 0) {
             LblResult.CssClass = "text-success";
             LblResult.Text = "La operación se realizó exitosamente.";
         }
         else {
             LblResult.CssClass = "text-error";
             LblResult.Text = "Ocurrio un error, Comuníquese con soporte tecnico.";
         }
     }
     catch(Exception) { }
 }