Example #1
0
        public int Insert(CouponInfo couponInfo)
        {
            var couponId = 0;

            IDataParameter[] parms = null;

            var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(couponInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);


            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        couponId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(couponId);
        }
Example #2
0
        public void Update(CouponInfo couponInfo)
        {
            IDataParameter[] parms = null;
            var sqlUpdate          = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(couponInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }
Example #3
0
        public void Update(CouponInfo couponInfo)
        {
            IDataParameter[] parms = null;
            var SQL_UPDATE         = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(couponInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            ExecuteNonQuery(SQL_UPDATE, parms);
        }
Example #4
0
        public int Insert(CouponInfo couponInfo)
        {
            var couponID = 0;

            IDataParameter[] parms = null;

            var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(couponInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);


            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        ExecuteNonQuery(trans, SQL_INSERT, parms);

                        couponID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(couponID);
        }