Esempio n. 1
0
        public void Update(CardSNInfo cardSNInfo)
        {
            IDataParameter[] parms = null;
            var SQL_UPDATE         = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(cardSNInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            ExecuteNonQuery(SQL_UPDATE, parms);
        }
Esempio n. 2
0
        public int Insert(CardSNInfo cardSNInfo)
        {
            var cardSNID = 0;

            IDataParameter[] parms = null;

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


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

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

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

            return(cardSNID);
        }