protected void Session_Start(object sender, EventArgs args) { NotificationComponents NC = new NotificationComponents(); var currentTime = DateTime.Now; HttpContext.Current.Session["LastUpdated"] = currentTime; NC.RegisterNotification(currentTime); }
//public JsonResult GetNotificationContacts() //{ // var notificationRegisterTime = Session["LastUpdated"] != null ? Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; // NotificationComponents NC = new NotificationComponents(); // var list = NC.GetContacts(notificationRegisterTime); // //update session here for get only new added contacts (notification) // Session["LastUpdate"] = DateTime.Now; // return new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; //} public JsonResult GetNotifications() { var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponents NC = new NotificationComponents(); var list = NC.GetContacts(notificationRegisterTime); //update session here for get only new added contacts (notification) Session["LastUpdated"] = DateTime.Now; return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult GetNotificationBooks() { var notificationRegisterTime = Session["LastUpdated"] != null ? Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponents NC = new NotificationComponents(); var list = NC.GetBooks(notificationRegisterTime); Session["LastUpdated"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetNotifications() { var userID = User.Identity.GetUserId(); var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponents NC = new NotificationComponents(); var list = NC.GetNotificationData(notificationRegisterTime, userID); //update session here for get only newly graded assignments (notification) Session["Lastupdate"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetMessageNotification() { System.Diagnostics.Debug.WriteLine("in home getMessnoti " + Session["LastUpdated"]); var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponents NC = new NotificationComponents(); var list = NC.Getmessages(notificationRegisterTime); System.Diagnostics.Debug.WriteLine("from noticomoponecnts" + list); Session["LastUpdated"] = DateTime.Now; System.Diagnostics.Debug.WriteLine("end check sess" + Session["LastUpdated"]); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetNotificationContacts() { //var notificationRegisterTime = Session["LastUpdated"] != null ? Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponents nc = new NotificationComponents(); List <Notifications> list = new List <Notifications>(); //if(Session["LastUpdated"] == null) list = nc.GetNotifications(null); //else // list = nc.GetNotifications(Convert.ToDateTime(Session["LastUpdated"])); //update session here for get only new added contacts (notification) Session["LastUpdated"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }