public static SpecialGroupCollection LoadForGroup(Int32 groupId) { SpecialGroupCollection SpecialGroups = new SpecialGroupCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT SpecialId"); selectQuery.Append(" FROM ac_SpecialGroups"); selectQuery.Append(" WHERE GroupId = @groupId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@groupId", System.Data.DbType.Int32, groupId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { SpecialGroup specialGroup = new SpecialGroup(); specialGroup.GroupId = groupId; specialGroup.SpecialId = dr.GetInt32(0); SpecialGroups.Add(specialGroup); } dr.Close(); } return(SpecialGroups); }
/// <summary> /// Loads the given SpecialGroup object from the given database data reader. /// </summary> /// <param name="specialGroup">The SpecialGroup object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(SpecialGroup specialGroup, IDataReader dr) { //SET FIELDS FROM ROW DATA specialGroup.SpecialId = dr.GetInt32(0); specialGroup.GroupId = dr.GetInt32(1); specialGroup.IsDirty = false; }
public static SpecialGroup Load(Int32 specialId, Int32 groupId) { SpecialGroup specialGroup = new SpecialGroup(); specialGroup.SpecialId = specialId; specialGroup.GroupId = groupId; specialGroup.IsDirty = false; return(specialGroup); }
public static bool Delete(Int32 specialId, Int32 groupId) { SpecialGroup specialGroup = new SpecialGroup(); if (specialGroup.Load(specialId, groupId)) { return(specialGroup.Delete()); } return(false); }
public static SaveResult Insert(SpecialGroup specialGroup) { return(specialGroup.Save()); }
public static bool Delete(SpecialGroup specialGroup) { return(specialGroup.Delete()); }
public static SaveResult Update(SpecialGroup specialGroup) { return(specialGroup.Save()); }