Beispiel #1
0
        public void InsertCategoria(Categoria oCategoria)
        {
            SqlConnection oConn = new SqlConnection(Constants.connectionString);

            oConn.Open();
            SqlTransaction oTran = oConn.BeginTransaction();

            try
            {
                using (CategoriaDataAccess tDataAccess = new CategoriaDataAccess())
                {
                    tDataAccess.Insert(oConn, oTran, oCategoria);
                }
                oTran.Commit();
            }
            catch (Exception ex)
            {
                oTran.Rollback();
                throw ex;
            }
            finally
            {
                oConn.Close();
                oTran.Dispose();
            }
        }
 public DataSet GetCategorias()
 {
     SqlConnection oConn = new SqlConnection(Constants.connectionString);
     oConn.Open();
     try
     {
         using (CategoriaDataAccess tDataAccess = new CategoriaDataAccess())
         {
             return tDataAccess.GetAll(oConn, null);
         }
     }
     finally
     {
         oConn.Close();
     }
 }
Beispiel #3
0
        public DataSet GetCategorias()
        {
            SqlConnection oConn = new SqlConnection(Constants.connectionString);

            oConn.Open();
            try
            {
                using (CategoriaDataAccess tDataAccess = new CategoriaDataAccess())
                {
                    return(tDataAccess.GetAll(oConn, null));
                }
            }
            finally
            {
                oConn.Close();
            }
        }
 public void InsertCategoria(Categoria oCategoria)
 {
     SqlConnection oConn = new SqlConnection(Constants.connectionString);
     oConn.Open();
     SqlTransaction oTran = oConn.BeginTransaction();
     try
     {
         using (CategoriaDataAccess tDataAccess = new CategoriaDataAccess())
         {
             tDataAccess.Insert(oConn, oTran, oCategoria);
         }
         oTran.Commit();
     }
     catch (Exception ex)
     {
         oTran.Rollback();
         throw ex;
     }
     finally
     {
         oConn.Close();
         oTran.Dispose();
     }
 }