Пример #1
0
        public JsonResult GetNotificationWidget()
        {
            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetNotifications(User.Identity.Name);

            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #2
0
        public JsonResult GetNotificationContacts()
        {
            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetNotifications(notificationRegisterTime);

            Session["LastUpdate"] = DateTime.Now;
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #3
0
        public JsonResult GetNotification()
        {
            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent aNotificationComponent = new NotificationComponent();
            var list = aNotificationComponent.GetNotifications(notificationRegisterTime);

            //update session here for get only new added contacts (notification)
            Session["LastUpdate"] = DateTime.Now;
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #4
0
        public JsonResult GetNotifications()
        {
            var userID = (int)Session["userID"];

            try
            {
                NotificationComponent NC = new NotificationComponent();
                var notifications        = NC.GetNotifications(userID);
                var output = notifications.Select(s => new { Message = s.Message + " " + s.DateNotification.ToShortDateString() + " " + s.DateNotification.ToShortTimeString(), s.URL, s.ID, s.Avatar, s.ID_Project });
                return(new JsonResult {
                    Data = output, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Пример #5
0
        public JsonResult GetNotificationContacts(string WhenCalled)
        {
            string user = User.Identity.GetUserName();
            string name = dbContext.Users.Where(x => x.Email == user).FirstOrDefault().Name;

            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetNotifications(Convert.ToDateTime(Session["LastUpdated"]), name);

            //update session here for get only new added contacts (notification)
            if (WhenCalled == "update")
            {
                Session["LastUpdated"] = DateTime.Now;
            }
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }