public AsyncPlan(AsyncESAPI ACurrent, PlanSetup pIn, Patient ptIn, AsyncCourse cIn) { A = ACurrent; pt = ptIn; p = pIn; Course = cIn; UID = p.UID; HistoryDateTime = p.HistoryDateTime; Id = p.Id; NumFractions = p.UniqueFractionation.NumberOfFractions; HashId = Convert.ToInt32(p.Id.GetHashCode() + p.Course.Id.GetHashCode() + UID.GetHashCode()); Dose = p.TotalPrescribedDose.Dose; IsDoseValid = p.IsDoseValid; if (p.StructureSet == null) { Valid = false; } else { StructureSetId = p.StructureSet.Id; StructureSetUID = p.StructureSet.UID; foreach (Structure s in p.StructureSet.Structures) { StructureIds.Add(s.Id); _Structures.Add(s.Id, s); var AS = new AsyncStructure(ACurrent, s, p.StructureSet.Id, p.StructureSet.UID); Structures.Add(s.Id, AS); } } PlanType = ComponentTypes.Plan; }
public AsyncPlan(AsyncESAPI ACurrent, PlanSum psIn, Patient ptIn, AsyncCourse cIn) { A = ACurrent; pt = ptIn; Course = cIn; ps = psIn; Id = ps.Id; var dates = ps.PlanSetups.Select(x => x.HistoryDateTime).OrderByDescending(x => x); HistoryDateTime = ps.PlanSetups.Select(x => x.HistoryDateTime).OrderByDescending(x => x).FirstOrDefault(); PlanType = ComponentTypes.Sum; NumFractions = 0; Dose = 0; if (ps.StructureSet == null) { Valid = false; } else { StructureSetId = ps.StructureSet.Id; StructureSetUID = ps.StructureSet.UID; foreach (Structure s in ps.StructureSet.Structures) { StructureIds.Add(s.Id); _Structures.Add(s.Id, s); Structures.Add(s.Id, new AsyncStructure(ACurrent, s, ps.StructureSet.Id, ps.StructureSet.UID)); } } foreach (PlanSetup p in ps.PlanSetups) { ConstituentPlans.Add(new AsyncPlan(A, p, ptIn, cIn)); } HashId = Convert.ToInt32(ps.Id.GetHashCode() + ps.Course.Id.GetHashCode() + string.Concat(ConstituentPlans.Select(x => x.UID)).GetHashCode()); UID = String.Join("+", ConstituentPlans.Select(x => x.UID)); }
public async Task <AsyncCourse> GetCourse(string CourseId, IProgress <int> progress) { if (!CourseIds.Contains(CourseId)) { return(null); } AsyncCourse c = await A.ExecuteAsync(new Func <Patient, AsyncCourse>((p) => { if (p.Courses.Select(x => x.Id).Contains(CourseId)) { Course C = p.Courses.Where(x => x.Id == CourseId).Single(); return(new AsyncCourse(A, C, p, progress)); } else { return(null); } })); if (c != null) { return(c); } else { return(null); } //Courses.Add(CourseId, c); // } //} //return Courses[CourseId]; }