public void Listar()
 {
     List<Empleado> ar = new EmpleadoBL().List();
     if (ar.ToList().Count() > 0)
     {
         GridView1.DataSource = ar.ToList();
         GridView1.DataBind();
         //Formato();
     }
     else
     {
         GridView1.DataSource = null;
         GridView1.DataBind();
     }
 }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int i;
         EmpleadoBL a = new EmpleadoBL();
         int index = Convert.ToInt32(e.RowIndex);
         i = a.Eliminar(Convert.ToInt32(GridView1.Rows[index].Cells[2].Text.ToString()));
         if (i > 0)
         {
             Listar();
         }
     }
     catch (Exception)
     {
     }
 }
 protected void Registrar_Click(object sender, EventArgs e)
 {
     try
     {
         int i = 0;
         EmpleadoBL a = new EmpleadoBL();
         String es, se, fe ;
         if (CheckBox1.Checked == true) { es = "A"; } else { es = "I"; }
         if (CboSexo.Text.Trim().Equals("MASCULINO")) { se = "M"; } else { se = "F"; }
         fe = CboDia.Text.Trim() + "/" + CboMes.Text.Trim() + "/" + CboAnio.Text.Trim();
         i = a.Registrar(Convert.ToInt32(Txt_Empleado.Text.Trim()), CboArea.Text.Trim(), Txt_Horario.Text.Trim(), Txt_ApPaterno.Text.Trim(),
             Txt_ApMaterno.Text.Trim(), Txt_Nombre.Text.Trim(), Txt_DNI.Text.Trim(), fe, Txt_Tel.Text.Trim(), se, es);
         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) { }
 }