/// <summary> /// Loads the configuration settings. /// </summary> private void LoadConfigurationSettings() { //Load the dropdownlist StageBitz.Data.UserNotificationSetting userNotificationSetting = (from un in DataContext.UserNotificationSettings where un.RelatedTable == "Project" && un.RelatedId == ProjectID && un.UserID == UserID select un).FirstOrDefault(); if (userNotificationSetting != null) { chkIncludeMyNotifications.Checked = (bool)userNotificationSetting.ShowMyNotifications; } }
public static string GetNewNotificationCount(string ShowMyNotifications, string projectId) { using (PageBase pb = new PageBase()) { int projectID = Convert.ToInt32(projectId); StageBitz.Data.UserNotificationSetting userNotificationSetting = (from un in pb.DataContext.UserNotificationSettings where un.RelatedTable == "Project" && un.RelatedId == projectID && un.UserID == pb.UserID select un).FirstOrDefault(); int lastNotificationID = -1; if (userNotificationSetting != null) { lastNotificationID = (int)userNotificationSetting.LastNotificationId; } var notifications = (from p in pb.DataContext.Projects join n in pb.DataContext.Notifications on p.ProjectId equals n.ProjectId join u in pb.DataContext.Users on n.CreatedByUserId equals u.UserId join cModules in pb.DataContext.Codes on n.ModuleTypeCodeId equals cModules.CodeId join cOperations in pb.DataContext.Codes on n.OperationTypeCodeId equals cOperations.CodeId orderby n.NotificationId descending where p.ProjectId == projectID && n.NotificationId > lastNotificationID select new { NotificationId = n.NotificationId, CreatedbyUserID = u.UserId, }); int count = notifications.Count(); if (!Convert.ToBoolean(ShowMyNotifications)) { count = notifications.Where(n => n.CreatedbyUserID != pb.UserID).Count(); } if (lastNotificationID == -1) { count = 0; } return(count.ToString()); } }