Example #1
0
        public static void SetPrivateStatus(int ThreadNodeId)
        {
            ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(ThreadNodeId);

            if (settings.Contains(ForumThreadNodeSetting.Outgoing))
            {
                settings.Remove(ForumThreadNodeSetting.Outgoing);
            }
            if (settings.Contains(ForumThreadNodeSetting.Incoming))
            {
                settings.Remove(ForumThreadNodeSetting.Incoming);
            }

            settings.Add(ForumThreadNodeSetting.Internal, "1");
        }
        private void dgForum_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "Resolution")
            {
                int nodeId = int.Parse(e.CommandArgument.ToString());
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(nodeId);
                coll.Add(ForumThreadNodeSetting.Resolution, "1");

                if (coll[ForumThreadNodeSetting.Internal] == null &&
                    coll[ForumThreadNodeSetting.Incoming] == null &&
                    coll[ForumThreadNodeSetting.Outgoing] == null)
                {
                    coll.Add(ForumThreadNodeSetting.Internal, "1");
                }
            }
            else if (e.CommandName == "Workaround")
            {
                int nodeId = int.Parse(e.CommandArgument.ToString());
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(nodeId);
                coll.Add(ForumThreadNodeSetting.Workaround, "1");

                if (coll[ForumThreadNodeSetting.Internal] == null &&
                    coll[ForumThreadNodeSetting.Incoming] == null &&
                    coll[ForumThreadNodeSetting.Outgoing] == null)
                {
                    coll.Add(ForumThreadNodeSetting.Internal, "1");
                }
            }
            else if (e.CommandName == "UnResolution")
            {
                int nodeId = int.Parse(e.CommandArgument.ToString());
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(nodeId);
                if (coll[ForumThreadNodeSetting.Resolution] != null)
                {
                    coll.Remove(ForumThreadNodeSetting.Resolution);
                }

                if (coll[ForumThreadNodeSetting.Internal] == null &&
                    coll[ForumThreadNodeSetting.Incoming] == null &&
                    coll[ForumThreadNodeSetting.Outgoing] == null)
                {
                    coll.Add(ForumThreadNodeSetting.Internal, "1");
                }
            }
            else if (e.CommandName == "UnWorkaround")
            {
                int nodeId = int.Parse(e.CommandArgument.ToString());
                ForumThreadNodeSettingCollection coll = new ForumThreadNodeSettingCollection(nodeId);
                if (coll[ForumThreadNodeSetting.Workaround] != null)
                {
                    coll.Remove(ForumThreadNodeSetting.Workaround);
                }

                if (coll[ForumThreadNodeSetting.Internal] == null &&
                    coll[ForumThreadNodeSetting.Incoming] == null &&
                    coll[ForumThreadNodeSetting.Outgoing] == null)
                {
                    coll.Add(ForumThreadNodeSetting.Internal, "1");
                }
            }
            else if (e.CommandName == "ReSend")
            {
                int emailMessageId = int.Parse(e.CommandArgument.ToString());
                try
                {
                    EMailRouterOutputMessage.Send(IncidentId, emailMessageId);
                    WasFarwarded   = 1;
                    ForwardedEMail = emailMessageId;
                }
                catch
                {
                    WasFarwarded   = -1;
                    ForwardedEMail = emailMessageId;
                }
            }
            else if (e.CommandName == "ReSendOut")
            {
                int emailMessageId = int.Parse(e.CommandArgument.ToString());
                try
                {
                    EMailRouterOutputMessage.Send(IncidentId, emailMessageId);
                    WasFarwarded   = 1;
                    ForwardedEMail = emailMessageId;
                }
                catch
                {
                    WasFarwarded   = -1;
                    ForwardedEMail = emailMessageId;
                }
            }
            else if (e.CommandName == "Reply")
            {
                try
                {
                    int emailMessageId = int.Parse(e.CommandArgument.ToString());

                    if (pc["IncForum_ReplyOutlook"] == "1")
                    {
                        Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", "mail.msg"));
                        HttpContext.Current.Response.ContentType = "application/msoutlook";

                        MsgMessage.Open(IncidentId, emailMessageId,
                                        HttpContext.Current.Response.OutputStream);
                    }
                    else if (pc["IncForum_ReplyEML"] == "1")
                    {
                        Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", "mail.eml"));
                        HttpContext.Current.Response.ContentType = "message/rfc822";
                        MsgMessage.OpenEml(IncidentId, emailMessageId,
                                           HttpContext.Current.Response.OutputStream);
                    }

                    Response.End();
                }
                catch (Exception ex)
                {
                    HttpContext.Current.Trace.Write(ex.Message);
                }
            }
        }