public static int Delete(string tablename, string username, string primaryKeyName, int primaryKey, bool deleteVirtualValues) { string sql; if (deleteVirtualValues) { sql = SqlBuilder.BuildVirtualParameterizedDeleteStatement(tablename, primaryKeyName); } else { sql = SqlBuilder.BuildParameterizedDeleteStatement(tablename, primaryKeyName); } SqlCommand command = new SqlCommand(sql); SqlCommandUtils.AddIntInputParam(command, primaryKeyName, primaryKey); if (deleteVirtualValues) { command.Parameters.Add(new SqlParameter("@TableName", tablename)); command.Parameters.Add(new SqlParameter("@PrimaryKey", primaryKey)); } return(Delete(command, BuildAuditDeleteCommand(tablename, username, primaryKeyName, primaryKey.ToString(), null, null))); }
public static int GetChildren(string tablename, string primaryKeyName, string parentKeyName, int parentKey, IEnumerable <string> virtualFields, DataTable table) { SqlCommand command = new SqlCommand(SqlBuilder.BuildVirtualParameterizedSelectStatement(tablename, primaryKeyName, parentKeyName, virtualFields)); SqlCommandUtils.AddIntInputParam(command, parentKeyName, parentKey); return(Get(command, table)); }
public static int Get(string tablename, string primaryKeyName, int primaryKey, DataTable table) { string sql = SqlBuilder.BuildParameterizedSelectByStatement(tablename, primaryKeyName); SqlCommand command = new SqlCommand(sql); SqlCommandUtils.AddIntInputParam(command, primaryKeyName, primaryKey); return(Get(command, table)); }