コード例 #1
0
        public virtual JsonResult GetCountNotifications(
            string operationNumber, DataSourceRequest request)
        {
            var client        = new GlobalModelRepository();
            var notifications = client.GetNotificationsByUser(
                IDBContext.Current.UserName,
                operationNumber,
                request,
                GlobalCommonLogic.GetOperationDetailURL(),
                GlobalCommonLogic.GetOperationDraftDetailURL());

            notifications.New  = 0;
            notifications.Read = 0;
            foreach (var item in notifications.Data)
            {
                if (item.UserRead)
                {
                    notifications.Read++;
                }
                else
                {
                    notifications.New++;
                }
            }

            notifications.Total = notifications.New;

            return(Json(notifications));
        }
コード例 #2
0
        public virtual JsonResult MarkAsRead(List <int> ids)
        {
            var client        = new GlobalModelRepository();
            var response      = client.MarkNotificationsAsRead(ids);
            var serverMessage = "The notifications could not been marked as read";

            if (response)
            {
                serverMessage = "The notifications have been marked as read";

                //Refresh counters
                Globals.NotificationsHub.UpdateGlobalUserCounters();
            }

            return(Json(new
            {
                Ok = response, Message = serverMessage
            }));
        }
コード例 #3
0
        public virtual JsonResult GetData(string operationNumber, DataSourceRequest request)
        {
            var client = new GlobalModelRepository();
            var viewM  = client.GetNotificationsByUser(
                IDBContext.Current.UserName,
                operationNumber,
                request,
                GlobalCommonLogic.GetOperationDetailURL(),
                GlobalCommonLogic.GetOperationDraftDetailURL());

            string lang = IDBContext.Current.CurrentLanguage;

            foreach (var item in viewM.Data)
            {
                item.Subject = GlobalCommonLogic.BuildNotification(item.Body, "SUBJECT", lang);
                item.Body    = GlobalCommonLogic.BuildNotification(item.Body, "BODY", lang);
            }

            return(Json(viewM));
        }
コード例 #4
0
        public virtual JsonResult GetData(string operationNumber, string ticket)
        {
            string userName = null;

            if (ticket != null)
            {
                string[] arrTokenContent;
                string   error = SecurityUtils.TryDecodeToken(
                    ticket, HttpContext.Session, out arrTokenContent);

                if (!string.IsNullOrEmpty(error))
                {
                    Logger.GetLogger().WriteMessage("OperationHeaderController", error);
                    return(new JsonResult()
                    {
                        Data = error
                    });
                }

                userName = SecurityUtils.GetDecodedUser(arrTokenContent);
            }

            var globalModelRepClient = new GlobalModelRepository();
            OperationHeaderInfo operationHeader;

            if (userName == null)
            {
                operationHeader = globalModelRepClient.getOperationHeaderInformation(
                    operationNumber,
                    IDBContext.Current.CurrentLanguage,
                    IDBContext.Current.UserName);
            }

            operationHeader = globalModelRepClient.getOperationHeaderInformation(
                operationNumber,
                IDBContext.Current.CurrentLanguage,
                userName);

            return(Json(operationHeader, JsonRequestBehavior.AllowGet));
        }