public DataSet GetAll(string empresaid, tb_co_rubrocompras BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRubrocompras_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid;
                 cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 100).Value = BE.rubroname;
                 cmd.Parameters.Add("@cuentaid", SqlDbType.Char, 10).Value = BE.cuentaid;
                 cmd.Parameters.Add("@cuentaname", SqlDbType.VarChar, 100).Value = BE.cuentaname;
                 cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status;
                 cmd.Parameters.Add("@nestado", SqlDbType.Int).Value = BE.nestado;
             }
             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_rubrocompras BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRubrocompras_DELETE", cnx))
         {
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll_IR(string empresaid, tb_co_rubrocompras BE)
 {
     //return tablaDA.GetAll_IR(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll_IR(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public bool Update(string empresaid, tb_co_rubrocompras BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_co_rubrocompras BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetAll(string empresaid, tb_co_rubrocompras BE)
 {
     return tablaDA.GetAll(empresaid, BE);
 }
 public DataSet GetAll_IR(string empresaid, tb_co_rubrocompras BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRubrocompras_SEARCH_IR", 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("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid;
             }
             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(string empresaid, tb_co_rubrocompras BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbCoRubrocompras_INSERT", cnx))
                {
                    cmd.CommandTimeout = 0;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid;
                    cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 100).Value = BE.rubroname;
                    cmd.Parameters.Add("@cuentaid", SqlDbType.Char, 10).Value = BE.cuentaid;
                    cmd.Parameters.Add("@cuentaname", SqlDbType.VarChar, 100).Value = BE.cuentaname;
                    cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status;

                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
        private void POnerDatos()
        {
            string xCuenta = "";
            if (txtCuenta.Enabled)
            {
                xCuenta = txtCuenta.Text;
            }

            string xRubro = "";
            if (txtRubro.Enabled)
            {
                xRubro = txtRubro.Text;
            }

            string xDescripcion = "";
            if (txtDescripcion.Enabled)
            {
                xDescripcion = txtDescripcion.Text;
            }

            try
            {
                tb_co_rubrocomprasBL BL = new tb_co_rubrocomprasBL();
                tb_co_rubrocompras BE = new tb_co_rubrocompras();

                BE.rubroid = xRubro;
                BE.rubroname = xDescripcion;
                BE.cuentaid = xCuenta;
                BE.nestado = xestado;
                PCGCURSOR = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if ((PCGCURSOR.Rows.Count > 0))
            {
                GridExaminar.AutoGenerateColumns = false;
                GridExaminar.DataSource = PCGCURSOR;
                CargaDatos();
                Ponedatos();
            }
            else
            {
                sw_load = false;
            }
        }