private HashSet<string> mRights = new HashSet<string>(); // A collection of fuse rights in this group. #endregion Fields #region Constructors /// <summary> /// Creates a new instance of FuseGroup and loads the group infomation from the database. /// </summary> /// <param name="ID">The numerical ID of the group.</param> /// <param name="Name">The name of the group.</param> /// <param name="dbClient">The database connection to use to.</param> public FuseGroup(ushort ID, string Name, DatabaseClient dbClient) { this.mName = Name; this.mChildGroups = new HashSet<ushort>(); ; dbClient.ClearParams(); // Remove any previous parameters from the database connection. dbClient.AddParamWithValue("id", ID); // Add ID as a parameter DataColumn dCol = dbClient.ReadDataColumn("SELECT valueid FROM fuse_item WHERE type = 'group' AND groupid = @id"); // Get all child groups of this group. if (dCol != null) // If any exist... for (int i = 0; i < dCol.Table.Rows.Count; i++) // Loop through them all... this.mChildGroups.Add((ushort)(uint)dCol.Table.Rows[i]["valueid"]); // And add each one to the collection of child groups. dCol = dbClient.ReadDataColumn("SELECT `fuse_right`.`right` AS `right` FROM `fuse_right`,`fuse_item` WHERE `fuse_item`.`type` = 'right' AND `fuse_item`.`groupid` = @id AND `fuse_item`.`valueid` = `fuse_right`.`id`"); // Get all fuse rights in this group from the database. if (dCol != null) // If there is fuse rights in this group... for (int i = 0; i < dCol.Table.Rows.Count; i++) // Loop through them all... mRights.Add((string)dCol.Table.Rows[i]["right"]); // And add each one to the collection of fuse rights }
private void CheckinUserParams(ref DatabaseClient dbClient) { dbClient.AddParamWithValue("@id", mID); dbClient.AddParamWithValue("@username", mUsername); dbClient.AddParamWithValue("@password", mPassword); dbClient.AddParamWithValue("@role", mRole); dbClient.AddParamWithValue("@signedup", mSignedUp); dbClient.AddParamWithValue("@email", mEmail); dbClient.AddParamWithValue("@dob", mDateOfBirth); dbClient.AddParamWithValue("@motto", mMotto); dbClient.AddParamWithValue("@figure", mFigure); dbClient.AddParamWithValue("@gender", mGender); dbClient.AddParamWithValue("@coins", mCoins); dbClient.AddParamWithValue("@films", mFilms); dbClient.AddParamWithValue("@gametickets", mGameTickets); dbClient.AddParamWithValue("@activitypoints", mActivityPoints); }
public bool DELETE(DatabaseClient dbClient) { dbClient.AddParamWithValue("@id", mID); dbClient.ExecuteQuery("DELETE FROM users WHERE id = @id;"); return true; }