public int Insert(string tableName, Hashtable ht, DbTransaction isOpenTrans) { object obj2 = 0; StringBuilder builder = DatabaseCommon.InsertSql(tableName, ht); DbParameter[] parameter = DatabaseCommon.GetParameter(ht); obj2 = DbHelper.ExecuteNonQuery(isOpenTrans, CommandType.Text, builder.ToString(), parameter); return(Convert.ToInt32(obj2)); }
public int Insert <T>(T entity, DbTransaction isOpenTrans) { object obj2 = 0; StringBuilder builder = DatabaseCommon.InsertSql <T>(entity); DbParameter[] parameter = DatabaseCommon.GetParameter <T>(entity); obj2 = DbHelper.ExecuteNonQuery(isOpenTrans, CommandType.Text, builder.ToString(), parameter); return(Convert.ToInt32(obj2)); }
public int Update <T>(T entity) { object obj2 = 0; StringBuilder builder = DatabaseCommon.UpdateSql <T>(entity); DbParameter[] parameter = DatabaseCommon.GetParameter <T>(entity); obj2 = DbHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), parameter); if (Convert.ToInt32(obj2) < 1) { StringBuilder builderTmp = DatabaseCommon.InsertSql <T>(entity); obj2 = DbHelper.ExecuteNonQuery(CommandType.Text, builderTmp.ToString(), parameter); } return(Convert.ToInt32(obj2)); }