Beispiel #1
0
        public Object getNotifcations(string appID, int empID, int max_notification_id)
        {
            var result = NotificationEngineDataService.GetNotifcations(appID, empID, max_notification_id);

            long maxId       = 0;
            int  unReadCount = 0;

            if (result.Count > 0)
            {
                maxId       = result.Max(p => p.NotificationID);
                unReadCount = result.Count(p => p.IsRead == false);
            }

            return(new
            {
                Notifications = result.Select(p => new
                {
                    NotificationID = p.NotificationID,
                    NotificationDetail = p.NotificationDetail,
                    IsRead = p.IsRead,
                    CreatedOn = p.CreatedOn.ToString("MM/dd/yyyy hh:mm tt"),
                    extraDataAsJson = p.extraDataAsJson
                }).ToList(),
                MaxID = maxId,
                UnReadCount = unReadCount
            });
        }
Beispiel #2
0
        public Object getNotifcations(long max_notification_id)
        {
            var myConnData = new CustomConnectionData();

            if (!GlobalDataManager._userIdentity.TryGetValue(Context.ConnectionId, out myConnData))
            {
                return(null);
            }

            var result = NotificationEngineDataService.GetNotifcations(myConnData.AppID, myConnData.UserID, max_notification_id);

            long maxId       = 0;
            int  unReadCount = 0;

            if (result.Count > 0)
            {
                maxId       = result.Max(p => p.ID);
                unReadCount = result.Count(p => p.IsRead == false);
            }

            return(new
            {
                Notifications = result.Select(p => new
                {
                    NotificationID = p.NotificationID,
                    NotificationDetail = p.NotificationDetail,
                    IsRead = p.IsRead,
                    CreatedOn = p.CreatedOn.ToString("MM/dd/yyyy hh:mm tt"),
                    extraDataAsJson = p.extraDataAsJson
                }).ToList(),
                MaxID = maxId,
                UnReadCount = unReadCount
            });
        }