Beispiel #1
0
        public void Resolve(string resolution, ManagedSecurityContext sec)
        {
            switch (mInstance.Status.Name)
            {
            case "Resolved":
            case "Closed":
                throw new InvalidOperationException();
            }

            mInstance.Status     = ManagedBugStatus.Find(Session, "Resolved");
            mInstance.Resolution = ManagedBugResolution.Find(Session, resolution);
            Save(sec);
        }
Beispiel #2
0
        public void Reopen(ManagedSecurityContext sec)
        {
            switch (mInstance.Status.Name)
            {
            case "Resolved":
            case "Closed":
                break;

            default:
                throw new InvalidOperationException();
            }

            mInstance.Status = ManagedBugStatus.Find(Session, "Reopened");
            Save(sec);
        }
Beispiel #3
0
        public override Bug GetInstance(ISession session, ManagedSecurityContext sec)
        {
            Bug instance = base.GetInstance(session, sec);

            if (Id == 0)
            {
                instance.AccountId = GetOwner(session, AccountId, sec).Id;
                instance.Project   = session.Load <BugProject>(this.ProjectId);
            }

            instance.Subject = this.Subject;
            instance.Details = this.Details;
            if (!string.IsNullOrEmpty(this.Status))
            {
                instance.Status = ManagedBugStatus.Find(session, this.Status);
            }
            if (instance.Status == null)
            {
                instance.Status = session.Load <BugStatu>(ManagedBugStatus.FindId(session, "Open"));
            }
            if (!string.IsNullOrEmpty(this.Type))
            {
                instance.Type = ManagedBugType.Find(session, this.Type);
            }
            if (!string.IsNullOrEmpty(this.Priority))
            {
                instance.Priority = ManagedBugPriority.Find(session, this.Priority);
            }
            if (!string.IsNullOrEmpty(this.Severity))
            {
                instance.Severity = ManagedBugSeverity.Find(session, this.Severity);
            }
            if (!string.IsNullOrEmpty(this.Resolution))
            {
                instance.Resolution = ManagedBugResolution.Find(session, this.Resolution);
            }
            if (instance.Resolution == null)
            {
                instance.Resolution = session.Load <BugResolution>(ManagedBugResolution.FindId(session, "None"));
            }
            return(instance);
        }
Beispiel #4
0
        public void Close(ManagedSecurityContext sec)
        {
            switch (mInstance.Status.Name)
            {
            case "Resolved":
                break;

            default:
                throw new InvalidOperationException();
            }

            mInstance.Status = ManagedBugStatus.Find(Session, "Closed");
            Save(sec);

            // notify that the bug has been closed, account may not exist any more

            Session.Flush();

            ManagedAccount acct = new ManagedAccount(Session, mInstance.AccountId);

            ManagedSiteConnector.TrySendAccountEmailMessageUriAsAdmin(Session, acct,
                                                                      string.Format("EmailBugClosed.aspx?id={0}", mInstance.Id));
        }