Ejemplo n.º 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");
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        public static int CreateFromEmail(
			string title,
			string description,
			int project_id,
			int type_id,
			int priority,
			int severity_id,
			int task_time,
			int expected_duration, 
			int expected_response_time,
			int expected_assign_time,
			ArrayList categories,
			ArrayList incident_categories,
			int IncidentBoxId,
			int EMailMessageId,
			PrimaryKeyId orgUid,
			PrimaryKeyId contactUid,
			int mustResponsibleId,
			bool useDuration,
			DateTime expResolveDate
			)
        {
            if (!Company.CheckDiskSpace())
                throw new MaxDiskSpaceException();

            // OZ 2009-03-11 Fixed AccessDeniedException if user is inactive
            //if (!CanCreate(project_id))
            //    throw new AccessDeniedException();

            title = title.Replace("<", "&lt;").Replace(">", "&gt;");

            DateTime now = DateTime.UtcNow;

            object oProjectId = null;
            if (project_id > 0)
                oProjectId = project_id;

            EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

            //			int SenderUserID = -1; // TODO: Find User By Email
            //			int UserId = Security.CurrentUser.UserID;
            //			if (SenderUserID > 0)
            //				UserId = SenderUserID;

            if (orgUid == PrimaryKeyId.Empty && contactUid == PrimaryKeyId.Empty)
            {
                Client client = Common.GetClient(mi.SenderEmail);
                if (client != null)
                {
                    if (client.IsContact)
                    {
                        contactUid = client.Id;
                    }
                    else
                    {
                        orgUid = client.Id;
                    }
                }
            }

            int stateId, managerId, responsibleId;
            bool isResposibleGroup;
            ArrayList users = new ArrayList();

            Issue2.GetIssueBoxSettings(IncidentBoxId, out stateId, out managerId, out responsibleId, out isResposibleGroup, users);

            // O.R. [2008-09-09]: Exclude inactive users
            if (responsibleId > 0 && User.GetUserActivity(responsibleId) != User.UserActivity.Active)
                responsibleId = -1;

            ArrayList activeUsers = new ArrayList();
            foreach (int userId in users)
            {
                if (User.GetUserActivity(userId) == User.UserActivity.Active)
                    activeUsers.Add(userId);
            }
            //

            //ak [2009-06-10] responsible from creation page (IncidentEdit1)
            if (mustResponsibleId > 0)
            {
                responsibleId = mustResponsibleId;

                // O.R. [2009-12-17] upcoming state with responsible fix
                if (stateId == (int)ObjectStates.Upcoming)
                    stateId = (int)ObjectStates.Active;

                isResposibleGroup = false;
            }

            IncidentBox box = IncidentBox.Load(IncidentBoxId);
            if (useDuration)
                expResolveDate = DBCalendar.GetFinishDateByDuration(box.Document.GeneralBlock.CalendarId, now, expected_duration);
            else
            {
                expResolveDate = User.GetUTCDate(expResolveDate);
                expected_duration = DBCalendar.GetDurationByFinishDate(box.Document.GeneralBlock.CalendarId, now, expResolveDate);
            }

            int IncidentId;
            using(DbTransaction tran = DbTransaction.Begin())
            {
                // Remove from Pending
                PendingEMailMessageRow.DeleteByEMailMessageId(EMailMessageId);

                // Add to white list
                if (PortalConfig.UseAntiSpamFilter && PortalConfig.AutoFillWhiteList)
                    WhiteListItem.Create(mi.SenderEmail);

                IncidentId = DBIncident.Create(oProjectId, Security.UserID,
                    title, description, now,
                    type_id, priority, stateId, severity_id, true, task_time,
                    IncidentBoxId, responsibleId, isResposibleGroup ? 1 : 0,
                    contactUid, orgUid,
                    expected_duration, expected_response_time, expected_assign_time,
                    expResolveDate, useDuration);

                string Identifier = TicketUidUtil.Create(box.IdentifierMask, IncidentId);
                DBIncident.UpdateIdentifier(IncidentId, Identifier);

                // Categories
                foreach(int CategoryId in categories)
                {
                    DBCommon.AssignCategoryToObject((int)INCIDENT_TYPE, IncidentId, CategoryId);
                }

                // Incident Categories
                foreach(int CategoryId in incident_categories)
                {
                    DBIncident.AssignIncidentCategory(IncidentId, CategoryId);
                }

                foreach(int UserId in activeUsers)
                {
                    DbIssue2.ResponsibleGroupAddUser(IncidentId, UserId);
                }

                // Update Incident Identifier
                //string Ticket = TicketUidUtil.Create(box.IdentifierMask,IncidentId);
                //DBIncident.UpdateIdentifier(IncidentId, Ticket);

                // Forum
                // Upload Forum Message
                BaseIbnContainer FOcontainer = BaseIbnContainer.Create("FileLibrary",string.Format("IncidentId_{0}",IncidentId));
                ForumStorage forumStorage = (ForumStorage)FOcontainer.LoadControl("ForumStorage");

                ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(EMailMessageInfo.ExtractTextFromHtml(mi.HtmlBody),
                    DateTime.UtcNow,
                    Security.UserID,
                    EMailMessageId,
                    (int)ForumStorage.NodeContentType.EMail);

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                settings.Add(ForumThreadNodeSetting.Incoming, "1");
                settings.Add(ForumThreadNodeSetting.Question, "1");

                // O.R: Recalculating project TaskTime
                if (project_id > 0 && task_time > 0)
                    TimeTracking.RecalculateProjectTaskTime(project_id);

                // 2006-12-12 OZ: Register EMail External Recepient
                EMailIssueExternalRecipient.Create(IncidentId, mi.SenderEmail);

                string emailFrom = EMail.EMailRouterOutputMessage.FindEMailRouterPublicEmail(IncidentId);

                ArrayList excludeUsers = EMailRouterOutputMessage.Send(IncidentId, EMailMessageId);

                //SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Created, IncidentId, -1, sendAutoReply ? mi.SenderEmail : null, emailFrom, excludeUsers);
                // 2007-02-12 OZ: Auto reply per Issue Box
                EMailRouterOutputMessage.SendAutoReply(IncidentId, emailFrom, mi.SenderEmail);

                // O.R.[2008-12-16]: Recalculate Current Responsible
                DBIncident.RecalculateCurrentResponsible(IncidentId);

                // O.R. [2009-06-15]: Recalculate project dates
                if (project_id > 0 && PortalConfig.UseIncidentDatesForProject && !useDuration)
                    Project.RecalculateDates(project_id);

                if(project_id > 0)
                    SystemEvents.AddSystemEvents(SystemEventTypes.Project_Updated_IssueList_IssueAdded, project_id, IncidentId, excludeUsers);
                Issue2.SendAlertsForNewIssue(IncidentId, managerId, responsibleId, activeUsers, excludeUsers);

                // 2007-02-15: OZ: New Message Addon
                Issue2.SetNewMessage(IncidentId, true);
                //

                // O.R. [2008-09-22]: Gate for sender
                Issue2.UpdateMailSenderEmail(IncidentId, mi.SenderEmail);

                tran.Commit();
            }

            return IncidentId;
        }
Ejemplo n.º 4
0
        public static int Create(
			string title,
			string description,
			int project_id,
			int type_id,
			int priority,
			int severity_id,
			int task_time,
			int expected_duration, 
			int expected_response_time,
			int expected_assign_time,
			int creator_id,
			ArrayList categories,
			ArrayList incident_categories,
			string FileName,
			System.IO.Stream _inputStream,
			bool IsEmail,
			DateTime creation_date, 
			int IncidentBoxId,
			PrimaryKeyId contactUid,
			PrimaryKeyId orgUid,
			int mustResponsibleId,
			bool useDuration,
			DateTime expResolveDate
			)
        {
            if (!Company.CheckDiskSpace())
                throw new MaxDiskSpaceException();

            if (!CanCreate(project_id))
                throw new AccessDeniedException();

            // DateTime creation_date = DateTime.UtcNow;

            title = title.Replace("<", "&lt;").Replace(">", "&gt;");

            object oProjectId = null;
            if (project_id > 0)
                oProjectId = project_id;

            IncidentBox box = null;

            if(IncidentBoxId <= 0)
            {
                IncidentInfo info = new IncidentInfo();
                info.Description = description;
                info.GeneralCategories = categories;
                info.IncidentCategories = incident_categories;
                info.PriorityId = priority;
                info.SeverityId = severity_id;
                info.Title = title;
                info.TypeId = type_id;
                info.ContactUid = contactUid;
                info.OrgUid = orgUid;

                if (project_id > 0)
                    info.ProjectId = project_id;

                if(creator_id < 0)
                    info.CreatorId = Security.CurrentUser.UserID;
                else
                    info.CreatorId = creator_id;

                box = IncidentBoxRule.Evaluate(info);
                if (box == null)
                    throw new ArgumentNullException("box");
                IncidentBoxId = box.IncidentBoxId;
            }
            else
                box = IncidentBox.Load(IncidentBoxId);

            // OZ: Fixed expected_duration and expected_response_time
            if (expected_duration <= 0)
                expected_duration = box.Document.GeneralBlock.ExpectedDuration;
            if (expected_response_time <= 0)
                expected_response_time = box.Document.GeneralBlock.ExpectedResponseTime;
            if (expected_assign_time <= 0)
                expected_assign_time = box.Document.GeneralBlock.ExpectedAssignTime;
            //

            if (task_time <= 0)
                task_time = box.Document.GeneralBlock.TaskTime;

            int stateId, managerId, responsibleId;
            bool isResposibleGroup;
            ArrayList users = new ArrayList();

            Issue2.GetIssueBoxSettings(IncidentBoxId, out stateId, out managerId, out responsibleId, out isResposibleGroup, users);

            // O.R. [2008-09-09]: Exclude inactive users
            if (responsibleId > 0 && User.GetUserActivity(responsibleId) != User.UserActivity.Active)
                responsibleId = -1;

            ArrayList activeUsers = new ArrayList();
            foreach (int userId in users)
            {
                if (User.GetUserActivity(userId) == User.UserActivity.Active)
                    activeUsers.Add(userId);
            }
            //

            //ak [2009-06-10] responsible from creation page (IncidentEdit1)
            if (mustResponsibleId > 0)
            {
                responsibleId = mustResponsibleId;
                isResposibleGroup = false;
            }

            if (useDuration)
                expResolveDate = DBCalendar.GetFinishDateByDuration(box.Document.GeneralBlock.CalendarId, creation_date, expected_duration);
            else
            {
                expResolveDate = User.GetUTCDate(expResolveDate);
                expected_duration = DBCalendar.GetDurationByFinishDate(box.Document.GeneralBlock.CalendarId, creation_date, expResolveDate);
            }

            int issueId;
            using(DbTransaction tran = DbTransaction.Begin())
            {
                issueId = DBIncident.Create(oProjectId, creator_id,
                    title, description, creation_date,
                    type_id, priority, stateId, severity_id, IsEmail, task_time,
                    IncidentBoxId, responsibleId, isResposibleGroup?1:0, contactUid, orgUid,
                    expected_duration, expected_response_time, expected_assign_time, expResolveDate, useDuration);

                string Identifier = TicketUidUtil.Create(box.IdentifierMask,issueId);
                DBIncident.UpdateIdentifier(issueId, Identifier);

                // Categories
                foreach(int CategoryId in categories)
                {
                    DBCommon.AssignCategoryToObject((int)INCIDENT_TYPE, issueId, CategoryId);
                }

                // Incident Categories
                foreach(int CategoryId in incident_categories)
                {
                    DBIncident.AssignIncidentCategory(issueId, CategoryId);
                }

                foreach(int UserId in activeUsers)
                {
                    DbIssue2.ResponsibleGroupAddUser(issueId, UserId);
                }

                ForumStorage.NodeContentType _type = (FileName != String.Empty && _inputStream != null) ?
                    ForumStorage.NodeContentType.TextWithFiles : ForumStorage.NodeContentType.Text;
                // Forum
                BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", issueId));
                ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage");

                if(description != String.Empty || (FileName != String.Empty && _inputStream != null))
                {
                    ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(description, creator_id, (int)_type);
                    if(FileName != String.Empty && _inputStream != null)
                    {
                        BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id));
                        FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage");
                        fs.SaveFile(FileName, _inputStream);
                    }

                    ForumThreadNodeSettingCollection settings1 = new ForumThreadNodeSettingCollection(info.Id);
                    settings1.Add(ForumThreadNodeSetting.Internal, "1");
                    settings1.Add(ForumThreadNodeSetting.Question, "1");
                }

                // O.R: Recalculating project TaskTime
                if (project_id > 0 && task_time > 0)
                    TimeTracking.RecalculateProjectTaskTime(project_id);

                // O.R.[2008-12-16]: Recalculate Current Responsible
                DBIncident.RecalculateCurrentResponsible(issueId);

                // O.R. [2009-06-15]: Recalculate project dates
                if (project_id > 0 && PortalConfig.UseIncidentDatesForProject && !useDuration)
                    Project.RecalculateDates(project_id);

                SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Created, issueId);
                if(project_id > 0)
                    SystemEvents.AddSystemEvents(SystemEventTypes.Project_Updated_IssueList_IssueAdded, project_id, issueId);

                Issue2.SendAlertsForNewIssue(issueId, managerId, responsibleId, activeUsers, null);

                tran.Commit();
            }

            return issueId;
        }
Ejemplo n.º 5
0
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            bool withResponse = false;

            if (this.IsPostBack)
            {
                try
                {
                    string sUserLight = "userlight";

                    // check user's name and password here
                    UserLight currentUser = Security.GetUser(Login.Value, Password.Value);
                    if (currentUser == null)
                        throw new HttpException(405, "Your login or password is invalid.");

                    // Security Addon [3/2/2004]
                    UserLight retUser = null;
                    if (HttpContext.Current.Items.Contains(sUserLight))
                    {
                        retUser = (UserLight)HttpContext.Current.Items[sUserLight];
                        HttpContext.Current.Items.Remove(sUserLight);
                    }
                    HttpContext.Current.Items.Add(sUserLight, currentUser);
                    // End Security Addon [3/2/2004]

                    // New Folder System Addon [12/27/2005]
                    string ContainerName = "FileLibrary";
                    string ContainerKey = String.Empty;
                    int objectId = Int32.Parse(ObjectId.Value);
                    int objectTypeId = Int32.Parse(ObjectTypeId.Value);
                    int folderId = 0;

                    switch ((ObjectTypes)objectTypeId)
                    {
                        case ObjectTypes.Project:
                            ContainerKey = "ProjectId_" + objectId.ToString();
                            break;
                        case ObjectTypes.Issue:
                            ContainerKey = string.Empty;
                            break;
                        case ObjectTypes.Task:
                            ContainerKey = "TaskId_" + objectId.ToString();
                            break;
                        case ObjectTypes.CalendarEntry:
                            ContainerKey = "EventId_" + objectId.ToString();
                            break;
                        case ObjectTypes.Folder:
                            ContainerKey = "Workspace";
                            if (objectId != 0)
                            {
                                folderId = objectId;
                                ContainerKey = Mediachase.IBN.Business.ControlSystem.DirectoryInfo.GetContainerKey(folderId);
                            }
                            break;
                        case ObjectTypes.Document:
                            ContainerKey = "DocumentId_" + objectId.ToString();
                            break;
                        case ObjectTypes.ToDo:
                            ContainerKey = "ToDoId_" + objectId.ToString();
                            break;
                    }
                    if (ContainerKey != String.Empty)
                    {
                        Mediachase.IBN.Business.ControlSystem.BaseIbnContainer bic = Mediachase.IBN.Business.ControlSystem.BaseIbnContainer.Create(ContainerName, ContainerKey);
                        Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

                        if (folderId == 0)
                            folderId = fs.Root.Id;

                        string fileName = Path.GetFileName(PublishedFile.PostedFile.FileName);
                        if (FileName.Value != string.Empty)
                        {
                            fileName = FileName.Value;
                        }
                        /*int	index = 0;
                        while (fs.FileExist(fileName, folderId))
                        {
                            fileName = Path.GetFileNameWithoutExtension(PublishedFile.PostedFile.FileName) + (index++).ToString();
                            fileName += Path.GetExtension(PublishedFile.PostedFile.FileName);
                        }*/
                        fs.SaveFile(folderId, fileName, PublishedFile.PostedFile.InputStream);
                    }
                    else if ((ObjectTypes)objectTypeId == ObjectTypes.List)
                    {
                        string xml = SaveNParseExcel(PublishedFile.PostedFile.FileName, PublishedFile.PostedFile.InputStream);

                        Response.BinaryWrite(System.Text.Encoding.UTF8.GetBytes(xml));
                        withResponse = true;
                    }
                    else if ((ObjectTypes)objectTypeId == ObjectTypes.Issue)
                    {
                        string fileName = Path.GetFileName(PublishedFile.PostedFile.FileName);
                        if (FileName.Value != string.Empty)
                        {
                            fileName = FileName.Value;
                        }

                        // OZ: 2008-08-19 Add Process Eml Attachments
                        if (Path.GetExtension(fileName).ToLower() == ".eml")
                        {
                            // Calculate email box
                            int emailBoxId = EMailRouterOutputMessage.FindEMailRouterPublicId(objectId);

                            // Save Email to email storage
                            int eMailMessageId = EMailMessage.CreateFromStream(emailBoxId, PublishedFile.PostedFile.InputStream);

                            EMailMessage.AddToIncidentMessage(false, objectId, eMailMessageId);

                            try
                            {
                                ArrayList excludeUsers = EMailRouterOutputMessage.Send(objectId, eMailMessageId);
                                SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, objectId, -1, excludeUsers);
                            }
                            catch (Exception ex)
                            {
                                System.Diagnostics.Trace.WriteLine(ex);
                                //Log.WriteError(ex.ToString());
                            }
                        }
                        // Process Default files
                        else
                        {
                            BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", objectId));
                            ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage");

                            ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(string.Empty, Security.CurrentUser.UserID, (int)ForumStorage.NodeContentType.TextWithFiles);

                            BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id));
                            FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage");

                            fs.SaveFile(fileName, PublishedFile.PostedFile.InputStream);

                            ForumThreadNodeSettingCollection settings1 = new ForumThreadNodeSettingCollection(info.Id);
                            settings1.Add(ForumThreadNodeSetting.Internal, "1");
                        }
                    }
                    // End New Folder System Addon [12/27/2005]

                    // Security Addon [3/2/2004]
                    HttpContext.Current.Items.Remove(sUserLight);
                    HttpContext.Current.Items.Add(sUserLight, retUser);
                    // End Security Addon [3/2/2004]
                }
                catch (Exception ex)
                {
                    throw new HttpException(405, "Internal Exception", ex);
                }
                if (!withResponse)
                {
                    this.Response.Write("Published Completed");
                }
                this.Response.End();
            }
        }
Ejemplo n.º 6
0
        public static void SetWorkaroundStatus(int ThreadNodeId)
        {
            ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(ThreadNodeId);

            settings.Add(ForumThreadNodeSetting.Workaround, "1");
        }
Ejemplo n.º 7
0
        public static void SetResolutionStatus(int ThreadNodeId)
        {
            ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(ThreadNodeId);

            settings.Add(ForumThreadNodeSetting.Resolution, "1");
        }
Ejemplo n.º 8
0
        public static void UpdateQuickTracking(int IssueId, string Message, int ResponsibleId, bool IsResponsibleGroup, DataTable ResponsibleGroup)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                int NodeId = -1;
                if (Message != null && Message.Trim().Length > 0)
                {
                    BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IssueId));
                    ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage");
                    ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(Message, Security.UserID, 1);

                    ForumThreadNodeSettingCollection settings1 = new ForumThreadNodeSettingCollection(info.Id);
                    settings1.Add(ForumThreadNodeSetting.Internal, "1");
                    NodeId = info.Id;

                    SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, IssueId);
                }
                UpdateTrackingState(IssueId, NodeId, ResponsibleId, IsResponsibleGroup, ResponsibleGroup);

                tran.Commit();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Updates the quick tracking.
        /// </summary>
        /// <param name="issueId">The issue id.</param>
        /// <param name="message">The message.</param>
        /// <param name="stateId">The state id.</param>
        /// <param name="priorityId">The priority id.</param>
        /// <param name="issueBoxId">The issue box id.</param>
        /// <param name="projectId">The project id.</param>
        /// <param name="responsibleId">The responsible id.</param>
        /// <param name="isResponsibleGroup">if set to <c>true</c> [is responsible group].</param>
        /// <param name="responsibleGroup">The responsible group.</param>
        /// <param name="decline">if set to <c>true</c> [decline].</param>
        /// <param name="useNewResponsible">if set to <c>true</c> [use new responsible from Issue Box].</param>
        public static void UpdateQuickTracking(int issueId, string message, int stateId, int priorityId, int? issueBoxId, int? projectId, int responsibleId, bool isResponsibleGroup, DataTable responsibleGroup, bool decline, bool useNewResponsible)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                int nodeId = -1;
                if (message != null && message.Trim().Length > 0)
                {
                    BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", issueId));
                    ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage");
                    ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(message, Security.UserID, 1);

                    ForumThreadNodeSettingCollection settings1 = new ForumThreadNodeSettingCollection(info.Id);
                    settings1.Add(ForumThreadNodeSetting.Internal, "1");
                    nodeId = info.Id;

                    SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, issueId);
                }

                if (issueBoxId.HasValue && projectId.HasValue && Incident.CanChangeProject(issueId))
                {
                    UpdateProject(issueId, projectId.Value, false);
                    UpdateIncidentBox(issueId, issueBoxId.Value, false);

                    if (useNewResponsible)
                    {
                        decline = false;
                        responsibleGroup.Rows.Clear();

                        IncidentBox box = IncidentBox.Load(issueBoxId.Value);

                        ResponsibleAssignType responsibleAssignType = box.Document.GeneralBlock.ResponsibleAssignType;
                        if (responsibleAssignType == ResponsibleAssignType.Manual)
                        {
                            responsibleId = -1;
                            isResponsibleGroup = false;
                        }
                        else if (responsibleAssignType == ResponsibleAssignType.CustomUser)
                        {
                            responsibleId = box.Document.GeneralBlock.Responsible;
                            isResponsibleGroup = false;
                        }
                        else // Pool
                        {
                            responsibleId = -1;
                            isResponsibleGroup = true;

                            List<int> responsibleUsers = new List<int>();
                            foreach (int principalId in box.Document.GeneralBlock.ResponsiblePool)
                            {
                                if (User.IsGroup(principalId))
                                {
                                    using (IDataReader reader = DBGroup.GetListUsersInGroup(principalId))
                                    {
                                        while (reader.Read())
                                        {
                                            if (!responsibleUsers.Contains((int)reader["UserId"]) && (int)reader["Activity"] == 3)
                                                responsibleUsers.Add((int)reader["UserId"]);
                                        }
                                    }
                                }
                                else
                                {
                                    if (!responsibleUsers.Contains(principalId) && User.GetUserActivity(principalId) == User.UserActivity.Active)
                                        responsibleUsers.Add(principalId);
                                }
                            }

                            // responsibleGroup
                            foreach (int principalId in responsibleUsers)
                            {
                                DataRow row = responsibleGroup.NewRow();
                                row["PrincipalId"] = principalId;
                                row["IsNew"] = true;
                                row["ResponsePending"] = true;

                                responsibleGroup.Rows.Add(row);
                            }
                        }

                    }
                }

                UpdateTrackingState(issueId, nodeId, stateId, priorityId, responsibleId, isResponsibleGroup, responsibleGroup, decline);

                tran.Commit();
            }
        }
Ejemplo n.º 10
0
        public static void AddForumMessage2(int issueId, string messText, 
			int nodeType, ArrayList nodeAttribute, bool toSend, int stateId,
			string FileName1, System.IO.Stream inputStream1,
			string FileName2, System.IO.Stream inputStream2,
			string FileName3, System.IO.Stream inputStream3)
        {
            int oldState;
            using(IDataReader reader = Incident.GetIncident(issueId, false))
            {
                reader.Read();
                oldState = (int)reader["StateId"];
            }

            using(DbTransaction tran = DbTransaction.Begin())
            {
                ForumThreadNodeInfo info = null;
                if (messText.Trim() != String.Empty || FileName1 != String.Empty || FileName2 != String.Empty || FileName3 != String.Empty)
                {
                    BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", issueId));
                    ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage");

                    info = forumStorage.CreateForumThreadNode(messText, Security.CurrentUser.UserID, nodeType);

                    if (FileName1 != String.Empty && inputStream1 != null)
                    {
                        BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id));
                        FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage");
                        fs.SaveFile(FileName1, inputStream1);
                    }

                    if (FileName2 != String.Empty && inputStream2 != null)
                    {
                        BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id));
                        FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage");
                        fs.SaveFile(FileName2, inputStream2);
                    }

                    if (FileName3 != String.Empty && inputStream3 != null)
                    {
                        BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id));
                        FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage");
                        fs.SaveFile(FileName3, inputStream3);
                    }

                    ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                    //if(toSend)
                    //{
                    //    settings.Add(ForumThreadNodeSetting.Outgoing, "1");
                    //    //EMailRouterOutputMessage.SendOutgoing(issueId, info.Id);
                    //}
                    //else
                    settings.Add(ForumThreadNodeSetting.Internal, "1");

                    foreach(string sAttr in nodeAttribute)
                        settings.Add(sAttr, "1");

                    SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, issueId);
                }

                if(stateId > 0 && stateId != oldState)
                    UpdateStateAndNotifyController(issueId, stateId, info.Id);

                tran.Commit();
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Adds the internal E mail2 incident.
        /// </summary>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="EMailMessageId">The E mail message id.</param>
        /// <param name="SenderName">Name of the sender.</param>
        /// <param name="SenderEmail">The sender email.</param>
        /// <returns></returns>
        private static int AddInternalEMail2Incident(int IncidentId, int EMailMessageId, string SenderName, string SenderEmail)
        {
            ForumThreadNodeInfo info = null;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                BaseIbnContainer FOcontainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IncidentId));
                ForumStorage forumStorage = (ForumStorage)FOcontainer.LoadControl("ForumStorage");

                int SenderUserID = Security.UserID;
                EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

                info = forumStorage.CreateForumThreadNode(EMailMessageInfo.ExtractTextFromHtml(mi.HtmlBody),
                    DateTime.UtcNow,
                    Security.UserID,
                    EMailMessageId,
                    (int)ForumStorage.NodeContentType.EMail);

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                settings.Add(ForumThreadNodeSetting.Outgoing, "1");

                if (HttpContext.Current != null && HttpContext.Current.Items.Contains(ForumThreadNodeSetting.AllRecipients))
                    settings.Add(ForumThreadNodeSetting.AllRecipients, HttpContext.Current.Items[ForumThreadNodeSetting.AllRecipients].ToString());

                tran.Commit();
            }

            return info.Id;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Adds the external E mail to incident.
        /// </summary>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="EMailMessageId">The E mail message id.</param>
        /// <param name="message">The message.</param>
        private static int AddExternalEMail2Incident(int IncidentId, int EMailMessageId, string SenderName, string SenderEmail)
        {
            ForumThreadNodeInfo info = null;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                BaseIbnContainer FOcontainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IncidentId));
                ForumStorage forumStorage = (ForumStorage)FOcontainer.LoadControl("ForumStorage");

                EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

                info = forumStorage.CreateForumThreadNode(EMailMessageInfo.ExtractTextFromHtml(mi.HtmlBody),
                    DateTime.UtcNow,
                    Security.UserID,
                    EMailMessageId,
                    (int)ForumStorage.NodeContentType.EMail);

                // 2006-12-12 OZ: Register EMail External Recepient
                if (!EMailIssueExternalRecipient.Contains(IncidentId, SenderEmail))
                    EMailIssueExternalRecipient.Create(IncidentId, SenderEmail);

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                settings.Add(ForumThreadNodeSetting.Incoming, "1");

                if (HttpContext.Current != null && HttpContext.Current.Items.Contains(ForumThreadNodeSetting.AllRecipients))
                    settings.Add(ForumThreadNodeSetting.AllRecipients, HttpContext.Current.Items[ForumThreadNodeSetting.AllRecipients].ToString());

                // O.R. [2008-09-19]: Recalculate Expected Dates
                DBIncident.RecalculateExpectedResponseDate(IncidentId);
                DBIncident.RecalculateExpectedAssignDate(IncidentId);

                tran.Commit();
            }

            return info.Id;
        }