public DataSet GetAll(string empresaid, tb_co_plantillacontable BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoPlantillacontable_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@creporte", SqlDbType.Char, 2).Value = BE.creporte;
                 cmd.Parameters.Add("@cgrupo", SqlDbType.Char, 2).Value = BE.cgrupo;
                 cmd.Parameters.Add("@dgrupo", SqlDbType.VarChar, 70).Value = BE.dgrupo;
                 cmd.Parameters.Add("@cuentaid", SqlDbType.Char, 10).Value = BE.cuentaid;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Delete(string empresaid, tb_co_plantillacontable BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoPlantillacontable_DELETE", cnx))
         {
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@creporte", SqlDbType.Char, 2).Value = BE.creporte;
                 cmd.Parameters.Add("@cgrupo", SqlDbType.Char, 2).Value = BE.cgrupo;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
             finally
             {
                 cnx.Close();
             }
         }
     }
 }
 public bool Update(string empresaid, tb_co_plantillacontable BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert_XML(string empresaid, tb_co_plantillacontable BE)
 {
     return tablaDA.Insert_XML(empresaid, BE);
 }
 public DataSet GetOne(string empresaid, tb_co_plantillacontable BE)
 {
     return tablaDA.GetOne(empresaid, BE);
 }
 public DataSet GetAllPartidasEEFFCuentas(string empresaid, tb_co_plantillacontable BE)
 {
     return tablaDA.GetAllPartidasEEFFCuentas(empresaid, BE);
 }
 public bool Insert_XML(string empresaid, tb_co_plantillacontable BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoPlantillacontable_INSERT_xml", cnx))
         {
             cmd.CommandTimeout = 0;
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@creporte", SqlDbType.Char, 7).Value = BE.creporte;
             cmd.Parameters.Add("@XML", SqlDbType.Xml).Value = BE.GetItemXML();
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAllPlantilla(string empresaid, tb_co_plantillacontable BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCo_PlantillaContable", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 //cmd.Parameters.Add("@codigo", SqlDbType.Char, 2).Value = BE.codigo;
                 //cmd.Parameters.Add("@descripcion", SqlDbType.VarChar, 70).Value = BE.descripcion;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAllPartidasEEFFCuentas(string empresaid, tb_co_plantillacontable BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoPartidasEEFF_Cuenta_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio;
                 cmd.Parameters.Add("@eeffid", SqlDbType.VarChar, 12).Value = BE.eeffid;
                 cmd.Parameters.Add("@partidaid", SqlDbType.VarChar, 12).Value = BE.partidaid;
                 cmd.Parameters.Add("@cuentaid", SqlDbType.VarChar, 13).Value = BE.cuentaid;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }