public void AddInfo(ActivityInfo info) { if (info != null) { Count += info.Count; } }
/// <summary> /// Returns ArrayList of ActivityInfo objects. /// </summary> public static ArrayList GetGroupsActivity(DateTime fromDate, DateTime toDate, ActivityReportType type, int topCount) { ArrayList list = new ArrayList(); Hashtable hash = new Hashtable(); ActivityInfo group; foreach (UserActivityInfo user in GetUsersActivity(fromDate, toDate, type, 0)) { group = (ActivityInfo)hash[user.IMGroupId]; if (group == null) { string sDisplayName = ""; using (IDataReader _group = UserReport.GetIMGroup(user.IMGroupId)) { if (_group.Read()) sDisplayName = _group["IMGroupName"].ToString(); } group = new ActivityInfo(sDisplayName); hash[user.IMGroupId] = group; list.Add(group); } group.AddInfo(user); } // Leave only topCount items if (topCount > 0) { list.Sort(); if (list.Count > topCount) list.RemoveRange(topCount, list.Count - topCount); } // Remove items with zero counter for (int i = 0; i < list.Count; ) { if (((ActivityInfo)list[i]).Count == 0) list.RemoveAt(i); else i++; } return list; }