Exemplo n.º 1
0
        protected void DeleteMessageClicked(object o, EventArgs e)
        {
            var m = new MessageRecipientServices().GetByID(Convert.ToInt32(((IdeaSeed.Web.UI.LinkButton)o).Attributes["itemid"]));

            m.MessageFolderID = (int)MessageFolder.TRASH;
            new MessageRecipientServices().Save(m);
            LoadMessages();
        }
Exemplo n.º 2
0
        private void UpdateMessageStatus()
        {
            var r = new MessageRecipientServices().GetByRecipientMessageID(SecurityContextManager.Current.CurrentUser.ID, CurrentMessage.ID);

            if (r != null)
            {
                r.MessageStatusTypeID = (int)MessageStatusType.READ;
                new MessageRecipientServices().Save(r);
            }
        }
Exemplo n.º 3
0
        protected void ArchiveMessageClicked(object o, EventArgs e)
        {
            var r = new MessageRecipientServices().GetByRecipientMessageID(SecurityContextManager.Current.CurrentUser.ID, CurrentMessage.ID);

            if (r != null)
            {
                r.MessageFolderID = (int)MessageFolder.ARCHIVE;
                new MessageRecipientServices().Save(r);
                Response.Redirect("/Messages");
            }
        }
Exemplo n.º 4
0
        protected void ActionSelectedIndexChanged(object o, EventArgs e)
        {
            switch (ddlActions.SelectedValue)
            {
            case "0":
                foreach (DataListItem i in dlMessages.Items)
                {
                    var cb = (IdeaSeed.Web.UI.CheckBox)i.FindControl("cbSelected");
                    if (cb.Checked)
                    {
                        var m = new MessageRecipientServices()
                                .GetByID(
                            Convert.ToInt32(
                                cb.Attributes["itemid"]));
                        m.MessageStatusTypeID = (int)MessageStatusType.READ;
                        new MessageRecipientServices().Save(m);
                    }
                }
                LoadMessages();
                break;

            case "1":
                foreach (DataListItem i in dlMessages.Items)
                {
                    var cb = (IdeaSeed.Web.UI.CheckBox)i.FindControl("cbSelected");
                    if (cb.Checked)
                    {
                        var m = new MessageRecipientServices()
                                .GetByID(
                            Convert.ToInt32(
                                cb.Attributes["itemid"]));
                        m.MessageStatusTypeID = (int)MessageStatusType.UNREAD;
                        new MessageRecipientServices().Save(m);
                    }
                }
                LoadMessages();
                break;

            case "2":
                foreach (DataListItem i in dlMessages.Items)
                {
                    var cb = (IdeaSeed.Web.UI.CheckBox)i.FindControl("cbSelected");
                    if (cb.Checked)
                    {
                        var m = new MessageRecipientServices()
                                .GetByID(
                            Convert.ToInt32(
                                cb.Attributes["itemid"]));
                        m.MessageFolderID = (int)MessageFolder.ARCHIVE;
                        new MessageRecipientServices().Save(m);
                    }
                }
                LoadMessages();
                break;

            case "3":
                foreach (DataListItem i in dlMessages.Items)
                {
                    var cb = (IdeaSeed.Web.UI.CheckBox)i.FindControl("cbSelected");
                    if (cb.Checked)
                    {
                        var m = new MessageRecipientServices()
                                .GetByID(
                            Convert.ToInt32(
                                cb.Attributes["itemid"]));
                        m.MessageFolderID = (int)MessageFolder.TRASH;
                        new MessageRecipientServices().Save(m);
                    }
                }
                LoadMessages();
                break;

            case "4":
                foreach (DataListItem i in dlMessages.Items)
                {
                    var cb = (IdeaSeed.Web.UI.CheckBox)i.FindControl("cbSelected");
                    if (cb.Checked)
                    {
                        var m = new MessageRecipientServices()
                                .GetByID(
                            Convert.ToInt32(
                                cb.Attributes["itemid"]));
                        m.MessageStatusTypeID = (int)MessageStatusType.REPORT_TO_HR;
                        new MessageRecipientServices().Save(m);
                        foreach (var s in new NotificationSubscriberServices().GetByNotificationIDAccountID((int)Notification.REPORT_MESSAGE_TO_HR, SecurityContextManager.Current.CurrentAccount.ID))
                        {
                            if (m.RecipientID != s.PersonID)
                            {
                                var n = new MessageRecipient();
                                n.MessageFolderID     = (int)MessageFolder.INBOX;
                                n.MessageID           = m.MessageID;
                                n.MessageStatusTypeID = (int)MessageStatusType.REPORT_TO_HR;
                                n.RecipientID         = s.Subscriber.ID;
                                n.RecipientTypeID     = (int)RecipientType.TO;
                                new MessageRecipientServices().Save(n);
                                var sb = new StringBuilder();
                                sb.Append(EmailHelper.EmailHTMLStart());
                                sb.Append("<div class='maincontainer'>");
                                sb.Append("<h2><span>Message Flagged For Review</span></h2>");
                                sb.Append("<div class='maincontent'>");
                                sb.Append(SecurityContextManager.Current.CurrentUser.Name);
                                sb.Append(" reported a message as inappropriate and has flagged it for your review.  Click here to view: <a href='");
                                sb.Append(ConfigurationManager.AppSettings["BASEURL"]);
                                sb.Append("/Messages/");
                                sb.Append(n.ID.ToString());
                                sb.Append("'>HRRiver.com</a></div></div>");
                                sb.Append(EmailHelper.EmailHTMLEnd());
                                IdeaSeed.Core.Mail.EmailUtils.SendEmail(s.Subscriber.Email, "*****@*****.**", "Message Flagged For Review", sb.ToString());
                            }
                        }
                    }
                }
                ddlActions.SelectedIndex = 0;
                LoadMessages();
                break;
            }
        }
Exemplo n.º 5
0
        private void LoadMessages()
        {
            var list = new List <MessageRecipient>();

            switch (HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Count() - 1])
            {
            case "Messages":
            case "Inbox":
                list = new MessageRecipientServices()
                       .GetByRecipientFolderID(SecurityContextManager.Current.CurrentUser.ID, (int)MessageFolder.INBOX)
                       .OrderByDescending(o => o.MessageRef.DateCreated)
                       .ToList <MessageRecipient>();
                lblCurrentFolder.Text = "Inbox";
                divInboxNav.Attributes.Remove("class");
                divInboxNav.Attributes["class"] = "selecteditem";
                break;

            case "Sent":
                list = new MessageRecipientServices()
                       .GetByRecipientFolderID(SecurityContextManager.Current.CurrentUser.ID, (int)MessageFolder.SENT)
                       .OrderByDescending(o => o.MessageRef.DateCreated)
                       .ToList <MessageRecipient>();
                lblCurrentFolder.Text = "Sent";
                divSentNav.Attributes.Remove("class");
                divSentNav.Attributes["class"] = "selecteditem";
                break;

            case "Archived":
                list = new MessageRecipientServices()
                       .GetByRecipientFolderID(SecurityContextManager.Current.CurrentUser.ID, (int)MessageFolder.ARCHIVE)
                       .OrderByDescending(o => o.MessageRef.DateCreated)
                       .ToList <MessageRecipient>();
                lblCurrentFolder.Text = "Archive";
                divArchivedNav.Attributes.Remove("class");
                divArchivedNav.Attributes["class"] = "selecteditem";
                break;

            case "Trash":
                list = new MessageRecipientServices()
                       .GetByRecipientFolderID(SecurityContextManager.Current.CurrentUser.ID, (int)MessageFolder.TRASH)
                       .OrderByDescending(o => o.MessageRef.DateCreated)
                       .ToList <MessageRecipient>();
                lblCurrentFolder.Text = "Trash";
                divTrashNav.Attributes.Remove("class");
                divTrashNav.Attributes["class"] = "selecteditem";
                break;

            default:
                list = new MessageRecipientServices()
                       .GetByRecipientFolderID(SecurityContextManager.Current.CurrentUser.ID, (int)MessageFolder.INBOX)
                       .OrderByDescending(o => o.MessageRef.DateCreated)
                       .ToList <MessageRecipient>();
                lblCurrentFolder.Text = "Inbox";
                divInboxNav.Attributes.Remove("class");
                divInboxNav.Attributes["class"] = "selecteditem";
                break;
            }
            if (list.Count > 0)
            {
                lblNoMessages.Visible = false;
                dlMessages.DataSource = list;
                dlMessages.DataBind();
            }
            else
            {
                dlMessages.DataSource = null;
                dlMessages.DataBind();
                lblNoMessages.Visible = true;
                lblNoMessages.Text    = "No Messages Found";
            }
        }