示例#1
0
 public static void SetIncidentState(ForumStorage.NodeType nodeType, IncidentBoxDocument incidentBoxDocument, int IncidentId, int ThreadNodeId, ObjectStates state)
 {
     Issue2.SetStateByEmail(nodeType, incidentBoxDocument, IncidentId, ThreadNodeId, state);
 }
示例#2
0
文件: Issue2.cs 项目: 0anion0/IBN
        public static void SetStateByEmail(ForumStorage.NodeType nodeType, IncidentBoxDocument incidentBoxDocument, int IncidentId, int ThreadNodeId, ObjectStates state)
        {
            //if(ForumStorage.NodeType.Outgoing == nodeType || ForumStorage.NodeType.Internal == nodeType)
            {
                int stateId = (int)state;
                int oldStateId = -1;
                int responsibleId = -1;
                bool oldIsGroupResponsobility = false;
                using(IDataReader reader = Incident.GetIncidentTrackingState(IncidentId, false))
                {
                    if(reader.Read())
                    {
                        oldStateId = (int)reader["StateId"];
                        responsibleId = (int)reader["ResponsibleId"];
                        oldIsGroupResponsobility = (bool)reader["IsResponsibleGroup"];
                    }
                }

                if(stateId==(int)ObjectStates.ReOpen && oldStateId==(int)ObjectStates.Active)
                    return;

                using(DbTransaction tran = DbTransaction.Begin())
                {
                    if(stateId != oldStateId)
                        UpdateStateAndNotifyController(IncidentId, stateId, ThreadNodeId);

                    if(stateId == (int)ObjectStates.Active || stateId == (int)ObjectStates.ReOpen || stateId == (int)ObjectStates.Upcoming)
                    {
                        //set responsible if it's incoming and resp not set
                        if(responsibleId <= 0)
                        {
                            DbIssue2.UpdateResponsibility(IncidentId, Security.UserID, false);

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

                            SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Responsible_Assigned, IncidentId, Security.UserID);
                            IncidentForum.AddForumMesageWithResponsibleChange(IncidentId, ThreadNodeId, Security.UserID);
                        }
                    }
                    tran.Commit();
                }
            }
        }