コード例 #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();
            }
        }
コード例 #2
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();
     }
 }
コード例 #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();
            }
        }
コード例 #4
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();
     }
 }