public static IDataReader GetQuickSnapshotReport(DateTime StartDate, DateTime EndDate, int CreatorId) { StartDate = DBCommon.GetUTCDate(Security.CurrentUser.TimeZoneId, StartDate); EndDate = DBCommon.GetUTCDate(Security.CurrentUser.TimeZoneId, EndDate); return(DBUserReport.GetQuickSnapshotReport(StartDate, EndDate, CreatorId)); }
public static DataView GetAlertsHistory(int userId, DateTime startDate, DateTime endDate, bool displayLastEventsFirst) { if (startDate == DateTime.MinValue) { startDate = DefaultStartDate; } if (endDate == DateTime.MinValue) { endDate = DefaultEndDate; } DataTable dt = null; using (IDataReader reader = DBUserReport.Message_GetByUserIdAndTimeFilter(userId, startDate, endDate, Security.CurrentUser.TimeZoneId)) { dt = new DataTable(); dt.Columns.Add(new DataColumn("send_time", System.Type.GetType("System.DateTime"))); dt.Columns.Add(new DataColumn("mess_text", System.Type.GetType("System.String"))); while (reader.Read()) { DataRow dr = dt.NewRow(); dr["send_time"] = (DateTime)reader["Sent"]; dr["mess_text"] = reader["Body"].ToString(); dt.Rows.Add(dr); } } DataView dv = dt.DefaultView; if (displayLastEventsFirst) { dv.Sort = "send_time DESC"; } return(dv); //Alert.GetAlertsHistory(UserId, StartDate, EndDate, DateTime.MinValue, "", DisplayLastEventsFirst); }
public static IDataReader SearchChat(int iUserId, int iChatId, DateTime dtFrom, DateTime dtTo, string sKeyWord, int iOrder) { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); return(DBUserReport.SearchChat(iUserId, iChatId, dtFrom, dtTo, sKeyWord, iOrder, DefaultBias)); }
public static IDataReader GetMostActiveGroupsByAssetVersionReport(DateTime FromDate, DateTime ToDate) { int TimeZoneId = Security.CurrentUser.TimeZoneId; FromDate = DBCommon.GetUTCDate(TimeZoneId, FromDate); ToDate = DBCommon.GetUTCDate(TimeZoneId, ToDate).AddDays(1); return(DBUserReport.GetMostActiveGroupsByAssetVersionReport(FromDate, ToDate)); }
/// <summary> /// ActiveAccounts, InactiveAccounts, NewProjectsCount, NewEventsCount, /// NewIncidentsCount, NewToDosCount, NewTasksCount, PortalLogins, ReOpenIncidentsCount /// </summary> private static IDataReader GetSecGroupStats(int GroupID, DateTime fromDate, DateTime toDate, bool ShowAll) { int TimeZoneId = Security.CurrentUser.TimeZoneId; fromDate = DBCommon.GetUTCDate(TimeZoneId, fromDate); toDate = DBCommon.GetUTCDate(TimeZoneId, toDate); return(DBUserReport.GetSecGroupStats(GroupID, fromDate, toDate, ShowAll)); }
/// <summary> /// Reader returns fields: /// GroupId, GroupName /// </summary> public static IDataReader GetListAvailableGroups(bool IsPartner) { if (!IsPartner /*Security.IsUserInGroup(InternalSecureGroups.Partner)*/) { return(DBUserReport.GetListAvailableGroups()); } else { return(DBUserReport.GetListAvailableGroupsForPartner(Security.CurrentUser.UserID)); } }
/// <summary> /// Reader returns fields: /// GroupId, GroupName, Level /// </summary> public static IDataReader GetListGroupsAsTree(bool IsPartner) { if (!IsPartner) { return(DBUserReport.GetListGroupsAsTree()); } else { int PartnerGroupId = DBUserReport.GetGroupForPartnerUser(Security.CurrentUser.UserID); return(DBUserReport.GetListGroupsByPartner(PartnerGroupId, true, true)); } }
/// <summary> /// Reader returns fields: /// GroupId, GroupName /// </summary> public static IDataReader GetListGroups(bool IsPartner) { if (!IsPartner /*Security.IsUserInGroup(InternalSecureGroups.Partner)*/) { return(DBUserReport.GetListGroups()); } else { int PartnerGroupId = DBUserReport.GetGroupForPartnerUser(Security.CurrentUser.UserID); return(DBUserReport.GetListGroupsByPartner(PartnerGroupId, true, true)); } }
public static DataView GetTop10Users(DateTime StartDate, DateTime EndDate) { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); DataTable dt = new DataTable("Top10writers"); dt.Columns.Add("Place"); dt.Columns.Add("Group"); dt.Columns.Add("Name"); dt.Columns.Add("TotalMessages"); using (IDataReader reader = DBUserReport.GetTop10Users(StartDate, EndDate, DefaultBias)) { int place = 1; while (reader.Read()) { int iUserId = reader.GetInt32(0); string sName = ""; int iIMGroupId = 0; using (IDataReader _obj = UserReport.GetUserInfoByOriginalId(iUserId)) { if (_obj.Read()) { sName = _obj["FirstName"].ToString() + " " + _obj["LastName"].ToString(); iIMGroupId = (int)_obj["IMGroupId"]; } else { continue; } } DataRow dr = dt.NewRow(); dr["Place"] = place.ToString(); dr["TotalMessages"] = reader.GetInt32(1).ToString(); dr["Name"] = sName; if (iIMGroupId > 0) { using (IDataReader _obj = UserReport.GetIMGroup(iIMGroupId)) { if (_obj.Read()) { dr["Group"] = _obj["IMGroupName"].ToString(); } } } dt.Rows.Add(dr); place++; } } return(dt.DefaultView); }
/// <summary> /// Reader returns fields: /// GroupId, GroupName, IMGroupId /// </summary> public static IDataReader GetGroup(int group_id) { return(DBUserReport.GetGroup(group_id)); }
/// <summary> /// Reader contains columns: /// User_Id, SessionBegin, SessionEnd /// </summary> public static IDataReader GetListIMSessionsByUserAndDate(int UserId, DateTime StartDate, DateTime EndDate) { int DefaultBias = UserReport.GetCurrentBias(); return(DBUserReport.GetListIMSessionsByUserAndDate(UserId, StartDate, EndDate, DefaultBias)); }
/// <summary> /// Reader returns fields: /// IMGroupId, IMGroupName, color, logo_version, is_partner /// </summary> public static IDataReader GetListIMGroup() { return(DBUserReport.GetIMGroup(0, false)); }
public static int GetGroupForPartnerUser(int UserId) { return(DBUserReport.GetGroupForPartnerUser(UserId)); }
/// <summary> /// Reader returns fields: /// UserId, Login, FirstName, LastName, Email, IsActive, IMGroupId, CreatedBy, Comments, IsExternal, IsPending, OriginalId /// </summary> public static IDataReader GetUserInfo(int user_id, bool check_rights) { return(DBUserReport.GetUserInfo(user_id)); }
/// <summary> /// Reader returns fields: /// GroupId, GroupName /// </summary> public static IDataReader GetListSecureGroup(int user_id) { return(DBUserReport.GetListSecureGroupExplicit(user_id)); }
/// <summary> /// LoginsClient, MsgSent, MsgReceived, ConfCreated, /// ConfMsgSent, FilesSent, FSBytes, FilesReceived, FRBytes /// </summary> public static DataTable GetUserStats(int UserID, DateTime fromDate, DateTime toDate) { DataTable table = new DataTable(); DataRow row; table.Columns.Add("LoginsClient", typeof(int)); table.Columns.Add("MsgSent", typeof(int)); table.Columns.Add("MsgReceived", typeof(int)); table.Columns.Add("ConfCreated", typeof(int)); table.Columns.Add("ConfMsgSent", typeof(int)); table.Columns.Add("FilesSent", typeof(int)); table.Columns.Add("FSBytes", typeof(long)); table.Columns.Add("FilesReceived", typeof(int)); table.Columns.Add("FRBytes", typeof(long)); row = table.NewRow(); int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); using (IDataReader reader = DBUserReport.GetUserStats(UserID, fromDate, toDate, DefaultBias)) { if (reader != null) { if (reader.Read()) { if (reader["LoginsClient"] != DBNull.Value) { row["LoginsClient"] = (int)reader["LoginsClient"]; } else { row["LoginsClient"] = 0; } if (reader["MsgSent"] != DBNull.Value) { row["MsgSent"] = (int)reader["MsgSent"]; } else { row["MsgSent"] = 0; } if (reader["MsgReceived"] != DBNull.Value) { row["MsgReceived"] = (int)reader["MsgReceived"]; } else { row["MsgReceived"] = 0; } if (reader["ConfCreated"] != DBNull.Value) { row["ConfCreated"] = (int)reader["ConfCreated"]; } else { row["ConfCreated"] = 0; } if (reader["ConfMsgSent"] != DBNull.Value) { row["ConfMsgSent"] = (int)reader["ConfMsgSent"]; } else { row["ConfMsgSent"] = 0; } if (reader["FilesSent"] != DBNull.Value) { row["FilesSent"] = (int)reader["FilesSent"]; } else { row["FilesSent"] = 0; } if (reader["FSBytes"] != DBNull.Value) { row["FSBytes"] = (long)reader["FSBytes"]; } else { row["FSBytes"] = 0; } if (reader["FilesReceived"] != DBNull.Value) { row["FilesReceived"] = (int)reader["FilesReceived"]; } else { row["FilesReceived"] = 0; } if (reader["FRBytes"] != DBNull.Value) { row["FRBytes"] = (long)reader["FRBytes"]; } else { row["FRBytes"] = 0; } } } } table.Rows.Add(row); return(table); }
public static IDataReader GetUsersByCompany() { return(DBUserReport.GetUsersByCompany()); }
/// <summary> /// Returns ArrayList of UserActivityInfo objects. /// </summary> public static ArrayList GetUsersActivity(DateTime fromDate, DateTime toDate, ActivityReportType type, int topCount) { ArrayList list = new ArrayList(); UserActivityInfo user; using (IDataReader reader = GetUsersByCompany()) { while (reader.Read()) { string sDisplayName = reader["DisplayName"].ToString(); int iIMGroupId = (int)reader["IMGroupId"]; int user_id = (int)reader["UserId"]; user = new UserActivityInfo(sDisplayName, iIMGroupId); list.Add(user); using (IDataReader _obj = UserReport.GetUserInfoByOriginalId(user_id)) { if (_obj.Read()) { user_id = (int)_obj["UserId"]; } else { continue; } } int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); switch (type) { case ActivityReportType.Messages: using (IDataReader _obj = DBUserReport.GetUserStats(user_id, fromDate, toDate, DefaultBias)) { if (_obj.Read()) { user.Count = (int)_obj["MsgSent"]; } } break; case ActivityReportType.FilesExchanged: using (IDataReader _obj = DBUserReport.GetUserStats(user_id, fromDate, toDate, DefaultBias)) { if (_obj.Read()) { user.Count = (int)_obj["FilesSent"]; } } break; case ActivityReportType.IMLogins: using (IDataReader _obj = DBUserReport.GetUserStats(user_id, fromDate, toDate, DefaultBias)) { if (_obj.Read()) { user.Count = (int)_obj["LoginsClient"]; } } break; case ActivityReportType.PortalLogins: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["PortalLogins"]; } } break; case ActivityReportType.CalendarEntries: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewEventsCount"]; } } break; case ActivityReportType.ActiveProjects: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewProjectsCount"]; } } break; case ActivityReportType.FilesPublished: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewAssetsCount"]; } } break; case ActivityReportType.FileVersionsPublished: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewAssetVersionsCount"]; } } break; case ActivityReportType.NewIssues: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewIncidentsCount"]; } } break; case ActivityReportType.NewTasks: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewTasksCount"]; } } break; case ActivityReportType.NewToDos: using (IDataReader _obj = GetQuickSnapshotReport(fromDate, toDate, user_id)) { if (_obj.Read()) { user.Count = (int)_obj["NewToDosCount"]; } } break; default: break; } } } // 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); }
public static bool GetMenuInAlerts(int UserId) { return(DBUserReport.GetMenuInAlerts(UserId)); }
/// <summary> /// Reader returns fields: /// UserId, Login, FirstName, LastName, Email, Activity, IMGroupId /// </summary> public static IDataReader GetUserInfoByOriginalId(int OriginalId) { return(DBUserReport.GetUserInfoByOriginalId(OriginalId)); }
public static int GetParentGroup(int group_id) { return(DBUserReport.GetParentGroup(group_id)); }
/// <summary> /// Reader returns fields: /// GroupId, GroupName, HasChildren /// </summary> public static IDataReader GetListChildGroups(int group_id) { return(DBUserReport.GetListChildGroups(group_id)); }
public static int GetFilesTransferred() { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); return(DBUserReport.GetFilesTransferred(DefaultStartDate, DefaultEndDate, DefaultBias)); }
public static IDataReader GetListActiveUsersInGroup(int group_id, bool check_security) { return(DBUserReport.GetListActiveUsersInGroup(group_id)); }
public static int GetAuthenticatedUsers(DateTime StartDate, DateTime EndDate) { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); return(DBUserReport.GetAuthenticatedUsers(StartDate, EndDate, DefaultBias)); }
public static int GetCountChatMessages() { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); return(DBUserReport.GetCountChatMessages(DefaultStartDate, DefaultEndDate, DefaultBias)); }
public static DataTable SearchHistory(DateTime fromDate, DateTime toDate, int userID, int userGroupId, int contUserID, int contUserGroupId, int msgType, string keyword, bool displayLastEventsFirst) { ArrayList UserList = new ArrayList(); ArrayList ContactList = new ArrayList(); using (IDataReader rdr = UserReport.GetListAllUsersInGroup(userGroupId)) { while (rdr.Read()) { if (rdr["OriginalId"] != DBNull.Value) { UserList.Add((int)rdr["OriginalId"]); } } } using (IDataReader rdr = UserReport.GetListAllUsersInGroup(contUserGroupId)) { while (rdr.Read()) { if (rdr["OriginalId"] != DBNull.Value) { ContactList.Add((int)rdr["OriginalId"]); } } } DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("FromFirst", typeof(string))); dt.Columns.Add(new DataColumn("FromLast", typeof(string))); dt.Columns.Add(new DataColumn("ToFirst", typeof(string))); dt.Columns.Add(new DataColumn("ToLast", typeof(string))); dt.Columns.Add(new DataColumn("mess_text", typeof(string))); dt.Columns.Add(new DataColumn("send_time", typeof(DateTime))); DataRow dr; int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); using (IDataReader reader = DBUserReport.SearchHistory(fromDate, toDate, userID, contUserID, msgType, keyword, displayLastEventsFirst, DefaultBias)) { while (reader.Read()) { dr = dt.NewRow(); int FromId = (int)reader["FromID"]; int ToId = (int)reader["ToID"]; if (msgType == 1) //in + out { if ((!UserList.Contains(FromId) || !ContactList.Contains(ToId)) && (!UserList.Contains(ToId) || !ContactList.Contains(FromId))) { continue; } } else if (msgType == 2) //in { if (!UserList.Contains(ToId) || !ContactList.Contains(FromId)) { continue; } } else //out { if (!UserList.Contains(FromId) || !ContactList.Contains(ToId)) { continue; } } dr["FromFirst"] = reader["FromFirst"].ToString(); dr["FromLast"] = reader["FromLast"].ToString(); dr["ToFirst"] = reader["ToFirst"].ToString(); dr["ToLast"] = reader["ToLast"].ToString(); dr["mess_text"] = reader["mess_text"].ToString(); dr["send_time"] = (DateTime)reader["send_time"]; dt.Rows.Add(dr); } } return(dt); }
public static int GetCountIMMessages(bool getInternal) { int DefaultBias = UserReport.GetTimeZoneBias(Security.CurrentUser.TimeZoneId); return(DBUserReport.GetCountIMMessages(DefaultStartDate, DefaultEndDate, getInternal, DefaultBias)); }
public static IDataReader GetChats(int iUserId) { return(DBUserReport.GetChats(iUserId)); }