protected void LoadDataListMedia() { GridViewNotification.DataSource = NotificationBLL.getNotificationByUserId(Userid); GridViewNotification.DataBind(); foreach (GridViewRow gvr in GridViewNotification.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { HiddenField hfdate = (HiddenField)gvr.FindControl("HiddenFieldAddedDate"); Label labeldate = (Label)gvr.FindControl("lblAddedDate"); DateTime date = Convert.ToDateTime(hfdate.Value); labeldate.Text = TimeAgo(date); HiddenField hfStatus = (HiddenField)gvr.FindControl("HiddenFieldStatus"); if (Convert.ToBoolean(hfStatus.Value) == false) { gvr.BackColor = System.Drawing.Color.FromName("#EFD2D8"); } // gvr.BackColor = System.Drawing.Color.FromName("#D0122B"); } } NotificationBLL.updateNotificationStatus(Userid); }
protected void NotificationCount() { // long nt = 0,newnt=0; // if (lblNotification.Text.Length > 0) // nt = Convert.ToInt64(lblNotification.Text); long cnotif = Convert.ToInt64(NotificationBLL.countNotification(userid).ToString()); lblNotification.Text = cnotif.ToString(); if (cnotif == 000) { lblNotification.Visible = false; } long crequest = Convert.ToInt64(FriendsBLL.countFriendRequests(userid, Global.PENDING).ToString()); lblFriendsRequest.Text = crequest.ToString(); if (crequest == 000) { lblFriendsRequest.Visible = false; } // newnt = Convert.ToInt64(lblNotification.Text); //if (newnt > nt) //{ //ScriptManager.RegisterClientScriptBlock(UpdatePanel3, UpdatePanel3.GetType(), "script", "insideJS();", true); //} }
public async Task <ActionResult> send_message() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <JGN_Messages_Recipents>(json); var _message = await MessageBLL.sendMessage(_context, data); // receiver message info var info = await SiteConfig.userManager.FindByIdAsync(data.to_uid); if (info != null) { // await _emailSender.SendMessage(_context, model.ContactEmail, model); } // generate and push notification var notif = new JGN_Notifications() { sender_id = data.message.from_uid, notification_type = (byte)NotificationTypes.Message, title = "New Message Received", body = data.message.subject, href = Config.GetUrl(SystemDirectoryPaths.MessageUrl), recipient_id = data.to_uid }; await NotificationBLL.postNotification(_context, notif); return(Ok(new { status = "success", message = "Message Sent", record = _message })); }
public ActionResult btnAdd_Click(FormCollection values) { var msg = NotificationBLL.SendMessage(values["Phone"], values["Title"], values["Content"]); ActiveWindow.HidePostBack(); ShowNotify(msg); return(UIHelper.Result()); }
protected void txtFriendSearch_TextChanged(object sender, EventArgs e) { string fid = HiddenField1.Value; if (fid.Length > 20) { UserBO objFriend = new UserBO(); objFriend = UserBLL.getUserByUserId(fid); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); //Response.Write(fid); TagsBO objTags = new TagsBO(); objTags.AtId = Photoid; objTags.Type = Global.PHOTO; objTags.UserId = Userid; objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = fid; objTags.FriendFName = objFriend.FirstName; objTags.FriendLName = objFriend.LastName; TagsBLL.insertTags(objTags); LoadDataListTags(); List <string> lst = new List <string>(); lst = TagsBLL.getTagsFriendId(Global.PHOTO, Photoid); LoadDataListComments(); if (Isfollow == true) { foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> tags on <a href=\"ViewPhoto.aspx?PhotoId=" + Photoid + "\">photo</a>"; objNotify.AtId = Photoid; objNotify.Type = Global.PHOTO; objNotify.UserId = item; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = Userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; msgtext = "Dear Pyramid Plus user," + objUser.FirstName + " " + objUser.LastName + " tags you photo "; // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email); NotificationBLL.insertNotification(objNotify); } } } }
public async Task <ActionResult> mark_as_read() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <JGN_Notifications>(json); await NotificationBLL.ReadMessage(_context, data.id); return(Ok(new { status = "success" })); }
public ActionResult SendNotification(string phone, string title, string content) { var msg = NotificationBLL.SendMessage(phone, title, content); return(new JsonResult { Data = msg }); }
private void LoadData() { var recordCount = 0; var stTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"); var endTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"); var data = NotificationBLL.GetList("", "", stTime, endTime, 1, 20, out recordCount); ViewBag.Grid1RecordCount = recordCount; ViewBag.Grid1DataSource = data; }
protected void InsertComments() { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); CommentsBO objClass = new CommentsBO(); objClass.MyComments = txtComments.Text; objClass.AtId = Photoid; objClass.Type = Global.PHOTO; objClass.UserId = Userid; objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; if (!objClass.MyComments.Equals("")) { CommentsDAL.insertComments(objClass); } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtComments.ClientID + "').value = '';", true); List <string> lst = new List <string>(); lst = CommentsDAL.getCommentsUserIdbyAtId(Global.PHOTO, Photoid); LoadDataListComments(); if (Isfollow == true) { foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); msgtext = "Dear Pyramid Plus user, Comments on your photos. "; NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> comments on <a href=\"ViewPhoto.aspx?PhotoId=" + Photoid + "\">photo</a>"; objNotify.AtId = Photoid; objNotify.Type = Global.PHOTO; objNotify.UserId = item; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = Userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; objNotify.Status = false; // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email); //sendEmail(objUserNotify.Email); NotificationBLL.insertNotification(objNotify); } } }
protected void txtFriendSearch_TextChanged(object sender, EventArgs e) { string fid = HiddenField1.Value; if (fid.Length > 20) { UserBO objFriend = new UserBO(); objFriend = UserBLL.getUserByUserId(fid); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); //Response.Write(fid); TagsBO objTags = new TagsBO(); objTags.AtId = Albumid; objTags.Type = Global.PHOTO_ALBUM; objTags.UserId = Userid; objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = fid; objTags.FriendFName = objFriend.FirstName; objTags.FriendLName = objFriend.LastName; TagsBLL.insertTags(objTags); LoadDataListTags(); List <string> lst = new List <string>(); lst = TagsBLL.getTagsFriendId(Global.PHOTO_ALBUM, Albumid); LoadDataListComments(); foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> tags on <a href=\"ViewPhotoAlbum.aspx?AlbumId=" + Albumid + "\">photo album</a>"; objNotify.AtId = Albumid; objNotify.Type = Global.VIDEO; objNotify.UserId = item; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = Userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; msgtext = "Dear Pyramid Plus user," + objUser.FirstName + " " + objUser.LastName + " tags you video "; NotificationBLL.insertNotification(objNotify); } } }
public ActionResult btnSearch_Click(JArray NotificationGrid_fields, string username, string title, DateTime startTime, DateTime endTime, int NotificationGrid_pageIndex, int NotificationGrid_pageSize) { var grid1 = UIHelper.Grid("NotificationGrid"); var recordCount = 0; var stTime = DateTime.Parse(startTime.ToString("yyyy-MM-dd") + " 00:00:00"); var edTime = DateTime.Parse(endTime.ToString("yyyy-MM-dd") + " 23:59:59"); var data = NotificationBLL.GetList(username, title, stTime, edTime, NotificationGrid_pageIndex + 1, NotificationGrid_pageSize, out recordCount); grid1.RecordCount(recordCount); grid1.DataSource(data, NotificationGrid_fields); return(UIHelper.Result()); }
public async Task <ActionResult> load_unread_notifs() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <NotificationEntity>(json); var _posts = await NotificationBLL.LoadItems(_context, data); foreach (var item in _posts) { item.from.img_url = UserUrlConfig.ProfilePhoto(item.from.Id, item.from.picturename, 0); } return(Ok(new { posts = _posts })); }
public async Task <ActionResult> check_notifs() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <NotificationEntity>(json); var check_unread_notifications = await NotificationBLL.Count(_context, data); var check_unread_messages = await MessageBLL.Count(_context, new MessageEntity() { isRead = false, To = data.RecipentID, loadReply = false }); return(Ok(new { notifs = check_unread_notifications, message_notifs = check_unread_messages })); }
void notif(string uid, string atid) { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(userid); UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(uid); NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> Share a <a href='UserData.aspx'>post</a>"; objNotify.AtId = atid; objNotify.Type = Global.SHARE; objNotify.UserId = uid; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; NotificationBLL.insertNotification(objNotify); }
/// <summary> /// To send route approval notification /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ApproverButton_Click(object sender, EventArgs e) { string ResultValue = string.Empty; string message = string.Empty; string WorkFlowCode = UtilBO.WorkflowRouteApproval; string emailSubject = string.Empty; string emailBody = string.Empty; ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteList objProjectRouteList = new ProjectRouteList(); objProjectRoute.WorkFlowApprover = UtilBO.WorkflowRouteApproval; objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute = objProjectRouteBLL.getWOrkFlowApprovalID(objProjectRoute); if ((objProjectRoute) != null) { (new NotificationBLL()).SendEmail(Convert.ToInt32(Session["PROJECT_ID"]), UtilBO.WorkflowRouteApproval); #region for sending SMS WIS_ConfigBO WIS_ConfigBO = new WIS_ConfigBO(); WIS_ConfigBLL WIS_ConfigBLL = new WIS_ConfigBLL(); WIS_ConfigBO = WIS_ConfigBLL.GetConfigSMSsending(); if (WIS_ConfigBO != null) { if (WIS_ConfigBO.MobileStatus == "Y") { string Result = string.Empty; string SendsmsTest = objProjectRoute.SmsText + objProjectRoute.ProjectCode + objProjectRoute.ProjectName; NotificationBO SMSNotificationBO = new NotificationBO(); NotificationBLL SMSNotificationBLL = new NotificationBLL(); SMSNotificationBO.ProviderMobileNo = WIS_ConfigBO.MobileNumber; SMSNotificationBO.ProviderPasword = WIS_ConfigBO.MobilePassword; SMSNotificationBO.ProviderURL = WIS_ConfigBO.SiteUrl; SMSNotificationBO.CellNumber = objProjectRoute.CellNumber; SMSNotificationBO.SmsText = SendsmsTest; Result = SMSNotificationBLL.SENDSMS(SMSNotificationBO); } } #endregion //NotificationObj.SendEmail(objProjectRoute.EmailID, objProjectRoute.EmailSubject, objProjectRoute.EmailBody, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); //ResultValue = NotificationObj.SendSMS(objProjectRoute.CellNumber, objProjectRoute.SmsText, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); ProjectRouteBO objApprovalHeaderSave = new ProjectRouteBO(); objApprovalHeaderSave.WorkFlowApproverID = objProjectRoute.WorkFlowApproverID; objApprovalHeaderSave.StatusID = objProjectRoute.StatusID; objApprovalHeaderSave.CreatedBy = Convert.ToInt32(Session["USER_ID"]); objApprovalHeaderSave.PageCode = "RTA"; objApprovalHeaderSave.ApproverUserID = objProjectRoute.ApproverUserID; objApprovalHeaderSave.WorkFlowDefinitionID = objProjectRoute.WorkFlowDefinitionID; #region email formate switch (WorkFlowCode) { case "RTA": emailSubject = string.Format("{0} {1}", objProjectRoute.EmailSubject, objProjectRoute.ProjectName); //emailBody = emailBody.Replace("@@PROJECTNAME", objProjectRoute.EmailBody); emailBody = objProjectRoute.EmailBody.Replace("@@PROJECTNAME", objProjectRoute.ProjectName); break; default: emailSubject = objProjectRoute.EmailSubject; break; } string approverName = objProjectRoute.ApproverUserName; StringBuilder sb = new StringBuilder(); sb.Append("Dear " + approverName + ","); sb.Append("<br/><br/>"); sb.Append(emailBody); sb.Append("<br/><br/>"); sb.Append("Thanks and Regards,"); sb.Append("<br/>"); sb.Append("WIS - UETCL Team"); #endregion objApprovalHeaderSave.EmailSubject = emailSubject; objApprovalHeaderSave.EmailBody = sb.ToString(); message = objProjectRouteBLL.AddApprovalTrackheader(objApprovalHeaderSave); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Route Approval Notification has been sent"; } if (message != "") { int ProjectId = Convert.ToInt32(Session["PROJECT_ID"]); findRouteStatusafterSave(ProjectId); getFinalRouteApprovalDetial(ProjectId); GetApproavlComments(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); ApproverButton.Visible = false; } } else { message = "Route Approver is not defined"; if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } findRouteStatusafterSave(Convert.ToInt32(Session["PROJECT_ID"])); }
/*--------------------------Notification Saving ---------------------*/ public void SaveNotification(NotificationBLL objNBLL) { query = "insert into Notification(Message) values('" + objNBLL.Message + "')"; objDBManager.ExecuteNonQuery(query); }
public DataTable GetNotification(NotificationBLL objNBLL) { query = "select * from Notification order by NotificationID DESC"; return(objDBManager.ExecuteDataTable(query)); }