private void LoadNotifications(bool bindData) { var d = new NotificationSubscriberServices().GetAllByAccountID(SecurityContextManager.Current.CurrentAccount.ID); rgNotifications.DataSource = d; if (bindData) { rgNotifications.DataBind(); } }
protected void ReportPostClicked(object o, EventArgs e) { if (SecurityContextManager.Current.CurrentURL.Contains("Flagged")) { var c = new CommentServices().GetByID(Convert.ToInt16(((LinkButton)o).Attributes["postid"])); c.FlaggedAsInappropriate = false; new CommentServices().Save(c); } else { var c = new CommentServices().GetByID(Convert.ToInt16(((LinkButton)o).Attributes["postid"])); c.FlaggedAsInappropriate = true; new CommentServices().Save(c); IdeaSeed.Core.Data.NHibernate.NHibernateSessionManager.Instance.CloseSession(); var nc = new CommentServices().GetByID(c.ID); var sb = new StringBuilder(); sb.Append(EmailHelper.EmailHTMLStart()); sb.Append("<div class='maincontainer'>"); sb.Append("<h2><span>Comment Flagged As Inappropriate</span></h2>"); sb.Append("<div class='maincontent'>"); sb.Append(SecurityContextManager.Current.CurrentUser.Name); sb.Append(" flagged the following comment as inappropriate.<br /><br />"); sb.Append("Comment ID: "); sb.Append(nc.ID.ToString()); sb.Append("<br />Entered For: "); sb.Append(nc.EnteredForRef.Name); sb.Append("<br />Entered By: "); sb.Append(nc.EnteredByRef.Name); sb.Append("<br />Comment: "); sb.Append(nc.Message); sb.Append("<br />Click here to view: <a href='"); sb.Append(ConfigurationManager.AppSettings["BASEURL"]); sb.Append("/Comments/"); sb.Append(c.ID.ToString()); sb.Append("'>HRRiver.com</a></div></div>"); sb.Append(EmailHelper.EmailHTMLEnd()); try { var list = new NotificationSubscriberServices().GetByNotificationID((int)Notification.FLAGGED_COMMENT); foreach (var sub in list) { IdeaSeed.Core.Mail.EmailUtils.SendEmail(sub.Subscriber.Email, "*****@*****.**", "", "", "A Comment Has Been Flagged", sb.ToString(), false, ""); } } catch (Exception exc) { } } LoadComments(); }
protected void NotificationsItemCommand(object o, GridCommandEventArgs e) { if (e.CommandName == RadGrid.InitInsertCommandName) { //e.Canceled = true; //var i = new HRR.Core.Domain.NotificationSubscriber(); //i.IsActive = false; //i.NotificationID = 0; //i.PersonID = 0; //i.ID = 0; //e.Item.OwnerTableView.InsertItem(i); } if (e.CommandName == RadGrid.PerformInsertCommandName) { var t = new HRR.Core.Domain.NotificationSubscriber(); t.NotificationID = Convert.ToInt32((e.Item.FindControl("ddlNotification") as HRR.Web.Controls.NotificationsDDL).SelectedValue); t.PersonID = Convert.ToInt32((e.Item.FindControl("ddlSubscriber") as HRR.Web.Controls.ManagersDDL).SelectedValue); t.IsActive = (e.Item.FindControl("cbIsActive") as IdeaSeed.Web.UI.CheckBox).Checked; t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID; new NotificationSubscriberServices().Save(t); } if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditableItem) { var t = new NotificationSubscriberServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]); t.NotificationID = Convert.ToInt32((e.Item.FindControl("ddlNotification") as HRR.Web.Controls.NotificationsDDL).SelectedValue); t.PersonID = Convert.ToInt32((e.Item.FindControl("ddlSubscriber") as HRR.Web.Controls.ManagersDDL).SelectedValue); t.IsActive = (e.Item.FindControl("cbIsActive") as IdeaSeed.Web.UI.CheckBox).Checked; t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID; new NotificationSubscriberServices().Save(t); } } if (e.CommandName == RadGrid.DeleteCommandName) { var t = new NotificationSubscriberServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]); new NotificationSubscriberServices().Delete(t); } LoadNotifications(true); }