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); }
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); }