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