public bool Delete(string empresaid, tb_plla_periodovacacional BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaPeriodovacacional_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@idperiodo", SqlDbType.Char).Value = BE.idperiodo;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Delete(string empresaid, tb_plla_periodovacacional BE)
 {
     //return tablaDA.Delete(empresaid, BE);
     bool zreturn = tablaDA.Delete(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }
 public DataSet GetOne(string empresaid, tb_plla_periodovacacional BE)
 {
     //return tablaDA.GetOne(empresaid, tipoplla);
     DataSet xreturn = null;
     xreturn = tablaDA.GetOne(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetAll_MaxCodigo(string empresaid, tb_plla_periodovacacional BE)
 {
     //return tablaDA.GetAll_MaxRubro(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll_MaxCodigo(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetAll_CONSULTAIR(string empresaid, tb_plla_periodovacacional BE)
 {
     //return tablaDA.GetAll_CONSULTAIR(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll_CONSULTAIR(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetAll(string empresaid, tb_plla_periodovacacional BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaPeriodovacacional_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@idperiodo", SqlDbType.Char).Value = BE.idperiodo;
                 cmd.Parameters.Add("@periodo", SqlDbType.Char).Value = BE.periodo;
                 cmd.Parameters.Add("@glosa", SqlDbType.VarChar).Value = BE.glosa;
                 //cmd.Parameters.Add("@status", SqlDbType.Decimal).Value = BE.status;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Insert_Update(string empresaid, tb_plla_periodovacacional BE, DataTable Detalle)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         bool xreturn = true;
         int lcont = 0;
         for (lcont = 0; lcont <= Detalle.Rows.Count - 1; lcont++)
         {
             using (SqlCommand cmd = new SqlCommand("gspTbPllaPeriodovacacional_InsertUpdate", cnx))
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@idperiodo", SqlDbType.Char).Value = Detalle.Rows[lcont]["idperiodo"];
                 cmd.Parameters.Add("@periodo", SqlDbType.Char).Value = Detalle.Rows[lcont]["periodo"];
                 cmd.Parameters.Add("@glosa", SqlDbType.VarChar).Value = Detalle.Rows[lcont]["glosa"];
                 cmd.Parameters.Add("@status", SqlDbType.Decimal).Value = Detalle.Rows[lcont]["status"];
                 try
                 {
                     cnx.Open();
                     if (cmd.ExecuteNonQuery() > 0)
                     {
                         xreturn = true;
                     }
                     else
                     {
                         xreturn = false;
                     }
                     cnx.Close();
                 }
                 catch (Exception ex)
                 {
                     Sql_Error = ex.Message;
                     //throw new Exception(ex.Message);
                     xreturn = false;
                     cnx.Close();
                 }
             }
         }
         return xreturn;
     }
 }
 public bool Insert(string empresaid, tb_plla_periodovacacional BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaPeriodovacacional_INSERT", cnx))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@idperiodo", SqlDbType.Char).Value = BE.idperiodo;
             cmd.Parameters.Add("@periodo", SqlDbType.Char).Value = BE.periodo;
             cmd.Parameters.Add("@glosa", SqlDbType.VarChar).Value = BE.glosa;
             cmd.Parameters.Add("@status", SqlDbType.Decimal).Value = BE.status;
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll_PERIODOS(string empresaid, tb_plla_periodovacacional BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("periodos_CONSULTA", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@perianio", string.IsNullOrEmpty(BE.idperiodo) ? (object)DBNull.Value : BE.idperiodo);
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll_MaxCodigo(string empresaid, tb_plla_periodovacacional BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaPeriodovacacional_MAXCODIGO", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Insert_Update(string empresaid, tb_plla_periodovacacional BE, DataTable Detalle)
 {
     //return tablaDA.Insert(empresaid, BE);
     bool zreturn = tablaDA.Insert_Update(empresaid, BE, Detalle);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }