public void AddComment(Comment c) { alert = new Alert(); alert.CreateDate = c.CreateDate; if (c.SystemObjectID == 1) { _statusUpdateRepository = new StatusUpdateRepository(); StatusUpdate st = _statusUpdateRepository.GetStatusUpdateByID((int)c.SystemObjectRecordID); account=_accountRepository.GetAccountByID(st.SenderID); alertMessage = GetProfileUrl(c.CommentByUsername)+" bình luận status của "+ GetProfileUrl(account.UserName)+":" + c.Body; alert.Message = alertMessage; alert.AccountID = c.CommentByAccountID; alert.AlertTypeID = (int)AlertType.AlertTypes.Comment; SaveAlert(alert); Notification notification = new Notification(); string notify = "<a href=\"/UserProfile2.aspx?AccountID=" + c.CommentByAccountID.ToString() + "\">" + c.CommentByUsername + "</a>" + "vừa mới bình luận status của bạn: " + c.Body; notification.AccountID = st.SenderID; notification.CreateDate = c.CreateDate; notification.IsRead =false; notification.Body = notify; _notifycationRepository.SaveNotification(notification); } }
public AlertService() { _userSession = new UserSession(); _alertRepository = new AlertRepository(); _webContext = new WebContext(); alert = new Alert(); }
public void DeleteAlert(Alert alert) { using (SPKTDataContext spktDC = conn.GetContext()) { spktDC.Alerts.DeleteOnSubmit(alert); spktDC.SubmitChanges(); } }
public AlertService() { _userSession = new UserSession(); _alertRepository = new AlertRepository(); _webContext = new WebContext(); _friendRepository = new FriendRepository(); alert = new Alert(); _accountRepository = new AccountRepository(); _groupMemberRepository = new GroupMemberRepository(); _notifycationRepository = new NotificationRepository(); }
public void AddNewBlogPostAlert(Blog blog) { alert = new Alert(); alert.CreateDate = DateTime.Now; alert.AccountID = _userSession.CurrentUser.AccountID; alert.AlertTypeID = (int)AlertType.AlertTypes.NewBlogPost; alertMessage = "<div class=\"AlertHeader\">" + GetProfileImage(_userSession.CurrentUser.AccountID) + GetProfileUrl(_userSession.CurrentUser.UserName) + " has just added a new blog post: <b>" + blog.Title + "</b></div>"; alert.Message = alertMessage; SaveAlert(alert); SendAlertToFriends(alert); }
public void SaveAlert(Alert alert) { using (SPKTDataContext spktDC = conn.GetContext()) { if (alert.AlertID > 0) { spktDC.Alerts.Attach(alert, true); } else { alert.CreateDate = DateTime.Now; spktDC.Alerts.InsertOnSubmit(alert); } spktDC.SubmitChanges(); } }
private void SendAlertToGroup(Alert alert, Group group) { List<int> groupMembers = _groupMemberRepository.GetMemberAccountIDsByGroupID(group.GroupID); foreach (int id in groupMembers) { alert.AlertID = 0; alert.AccountID = id; SaveAlert(alert); notify.AccountID = alert.AccountID; notify.Body = alert.Message; notify.IsRead = false; _notifycationRepository.SaveNotification(notify); } }
private void SendAlertToFriends(Alert alert) { List<Friend> friends = _friendRepository.GetFriendsByAccountID(alert.AccountID); foreach (Friend friend in friends) { alert.AlertID = 0; alert.AccountID = friend.MyFriendAccountID; SaveAlert(alert); } }
private void SaveAlert(Alert alert) { _alertRepository.SaveAlert(alert); }
private void Init() { account = _userSession.CurrentUser; alert = new Alert(); alert.AccountID = account.AccountID; alert.CreateDate = DateTime.Now; notify = new Notification(); }
private void detach_Alerts(Alert entity) { this.SendPropertyChanging(); entity.Account = null; }
private void attach_Alerts(Alert entity) { this.SendPropertyChanging(); entity.Account = this; }
partial void DeleteAlert(Alert instance);
partial void UpdateAlert(Alert instance);
partial void InsertAlert(Alert instance);
public void AddUpdatedBlogPostAlert(Blog blog) { Init(); alert = new Alert(); alert.CreateDate = DateTime.Now; alert.AccountID = _userSession.CurrentUser.AccountID; alert.AlertTypeID = (int)AlertType.AlertTypes.NewBlogPost; alertMessage = "<div >" + GetProfileImage(_userSession.CurrentUser.AccountID) + GetProfileUrl(_userSession.CurrentUser.UserName) + " vừa mới cập nhật <b>" + "<a href=\"" + _webContext.RootUrl + "Blogs/ViewBlog" + ".aspx?BlogID=" + blog.BlogID + "\">" + blog.Title + "</a>" + "!</div>"; alert.Message = alertMessage; SaveAlert(alert); SendAlertToFriends(alert); }