public JsonResult GetNotifications() { List <NotificationCommon> obj = new List <NotificationCommon>(); var ds = _notifications.GetNotificationByUser(Session["UserId"].ToString()); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow rows in ds.Tables[0].Rows) { NotificationCommon objData = new NotificationCommon(); objData.Id = rows["Id"].ToString(); objData.Subject = rows["Subject"].ToString(); objData.CreatedDate = rows["CreatedDate"].ToString(); objData.Notification = rows["Notification"].ToString(); objData.ReadStatus = rows["ReadStatus"].ToString(); obj.Add(objData); } } var res = Json(obj); return(res); }
public List <NotificationCommon> GetAllNotification(string AgentId, string fromdate = "", string todate = "") { string sql = "EXEC sproc_agent_notification "; sql += "@flag = 'sa'"; sql += (string.IsNullOrEmpty(fromdate) ? "" : ", @formDate =" + DAO.FilterString(fromdate)); sql += (string.IsNullOrEmpty(todate) ? "" : ", @toDate =" + DAO.FilterString(todate)); sql += ",@user_id = " + DAO.FilterString(AgentId); var dt = DAO.ExecuteDataset(sql); List <NotificationCommon> notificationList = new List <NotificationCommon>(); if (dt != null) { foreach (DataRow item in dt.Tables[0].Rows) { NotificationCommon AC = new NotificationCommon { Id = item["Id"].ToString(), Subject = item["Subject"].ToString(), CreatedDate = item["CreatedDate"].ToString(), Notification = item["Notification"].ToString(), ReadStatus = item["ReadStatus"].ToString(), Type = item["type"].ToString() }; notificationList.Add(AC); } } return(notificationList); }
public List <NotificationCommon> ShowNotification(string User) { var list = new List <NotificationCommon>(); var sql = "Exec proc_tblNotification @flag=" + dao.FilterString("showNotification"); sql += ", @User="******"RowId"]), NotificationBody = item["NotificationBody"].ToString(), NotificationBy = item["NotificationBy"].ToString(), NotificationFor = item["NotificationFor"].ToString(), NotificationStatus = item["NotificationStatus"].ToString(), NotificationSubject = item["NotificationSubject"].ToString(), isRead = item["isRead"].ToString(), User = item["CreatedBy"].ToString(), CreatedDate = item["CreatedDate"].ToString() }; sn++; list.Add(common); } } return(list); }
public ActionResult Index(string fromdate, string todate) { NotificationCommon nc = new NotificationCommon(); nc.fromDate = fromdate; nc.toDate = todate; var notifications = _notifications.GetAllNotification(Session["UserId"].ToString(), fromdate, todate); //if ((nc.toDate) == "") //{ // this.ShowPopup(1, "Please select To Date"); //} if (notifications.Count == 0) { TempData["notificationmsg"] = " You don't have any notifications."; } return(View(notifications)); }