Exemple #1
0
 public void AddInfo(ActivityInfo info)
 {
     if (info != null)
     {
         Count += info.Count;
     }
 }
Exemple #2
0
        /// <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 = IMGroup.GetIMGroupName(user.IMGroupId, string.Empty);
                    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;
        }
Exemple #3
0
        /// <summary>
        /// Returns ArrayList of ActivityInfo objects.
        /// </summary>
        public static ArrayList GetSecureGroupsActivity(DateTime fromDate, DateTime toDate, ActivityReportType type, int topCount)
        {
            ArrayList list = new ArrayList();
            ActivityInfo group;

            using (IDataReader reader = SecureGroup.GetListGroups())
            {
                while (reader.Read())
                {
                    string sDisplayName = Common.GetWebResourceString(reader["GroupName"].ToString());
                    int iGroupId = (int)reader["GroupId"];
                    group = new ActivityInfo(sDisplayName);
                    using (IDataReader _obj = GetSecGroupStats(iGroupId, fromDate, toDate, false))
                    {
                        if (_obj.Read())
                        {
                            switch (type)
                            {
                                case ActivityReportType.PortalLogins:
                                    group.Count = (int)_obj["PortalLogins"];
                                    break;
                                case ActivityReportType.CalendarEntries:
                                    group.Count = (int)_obj["NewEventsCount"];
                                    break;
                                case ActivityReportType.ActiveProjects:
                                    group.Count = (int)_obj["NewProjectsCount"];
                                    break;
                                /*								case ActivityReportType.FilesPublished:
                                                                    group.Count=(int)_obj["NewAssetsCount"];
                                                                    break;
                                                                case ActivityReportType.FileVersionsPublished:
                                                                    group.Count=(int)_obj["NewAssetVersionsCount"];
                                                                    break;
                                */
                                case ActivityReportType.NewIssues:
                                    group.Count = (int)_obj["NewIncidentsCount"];
                                    break;
                                case ActivityReportType.NewTasks:
                                    group.Count = (int)_obj["NewTasksCount"];
                                    break;
                                case ActivityReportType.NewToDos:
                                    group.Count = (int)_obj["NewToDosCount"];
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                    list.Add(group);
                }
            }

            // 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;
        }