Esempio n. 1
0
		public void UpdateGroups(DatabaseClient dbClient)
		{
			this.GroupMemberships = dbClient.ReadDataTable("SELECT * FROM group_memberships WHERE userid = " + Id);
			if (this.GroupMemberships != null)
			{
				foreach (DataRow dataRow in this.GroupMemberships.Rows)
				{
                    Group group = GroupManager.GetGroup((int)dataRow["groupid"]);
					if (group == null)
					{
						DataTable dataTable = dbClient.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow["groupid"] + " LIMIT 1;");
						IEnumerator enumerator2 = dataTable.Rows.GetEnumerator();
						try
						{
							while (enumerator2.MoveNext())
							{
								DataRow dataRow2 = (DataRow)enumerator2.Current;
                                if (!GroupManager.GroupList.ContainsKey((int)dataRow2["Id"]))
								{
                                    GroupManager.GroupList.Add((int)dataRow2["Id"], new Group((int)dataRow2["Id"], dataRow2, dbClient));
								}
							}
							continue;
						}
						finally
						{
							IDisposable disposable = enumerator2 as IDisposable;
							if (disposable != null)
							{
								disposable.Dispose();
							}
						}
					}
					if (!group.List.Contains((int)this.Id))
					{
						group.AddMember((int)this.Id);
					}
				}
				int num = dbClient.ReadInt32("SELECT groupid FROM user_stats WHERE Id = " + this.Id + " LIMIT 1");
                Group class2 = GroupManager.GetGroup(num);
				if (class2 != null)
				{
					this.GroupID = num;
				}
				else
				{
					this.GroupID = 0;
				}
			}
			else
			{
				this.GroupID = 0;
			}
		}