예제 #1
0
파일: Spotlight.cs 프로젝트: tjsas1/RHP
        public bool Save()
        {
            bool result = false;

            Database     db         = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbConnection connection = db.CreateConnection();

            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                SpotlightDAO spotlightDAO = new SpotlightDAO();
                if (spotlightDAO.IsSpotlightExist(this))
                {
                    result = spotlightDAO.Update(this, db, transaction);
                }
                else
                {
                    result = spotlightDAO.Insert(this, db, transaction);
                }

                transaction.Commit();
            }
            catch (System.Exception ex)
            {
                transaction.Rollback();
                result = false;
                throw ex;
            }
            finally
            {
                connection.Close();
            }
            return(result);
        }
예제 #2
0
        public bool Save()
        {
            bool result = false;

            Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbConnection connection = db.CreateConnection();
            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                SpotlightDAO spotlightDAO = new SpotlightDAO();
                if (spotlightDAO.IsSpotlightExist(this))
                {
                    result = spotlightDAO.Update(this, db, transaction);
                }
                else
                {
                    result = spotlightDAO.Insert(this, db, transaction);
                }

                transaction.Commit();
            }
            catch (System.Exception ex)
            {
                transaction.Rollback();
                result = false;
                throw ex;
            }
            finally
            {
                connection.Close();
            }
            return result;
        }