public int Insert(InputContentInfo info) { int contentId; info.Taxis = GetMaxTaxis(info.InputId) + 1; info.BeforeExecuteNonQuery(); IDataParameter[] parms; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(info.Attributes, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { contentId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(contentId); }
public void Update(InputContentInfo info) { info.BeforeExecuteNonQuery(); IDataParameter[] parms; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(info.Attributes, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); }