예제 #1
0
 public void MyTestCleanup()
 {
     if (_repo != null)
     {
         _repo.Dispose();
         _repo = null;
     }
 }
예제 #2
0
    public static string GetBreezeMetadata(bool pretty = false)
    {
        var engine = new Engine().Execute("var setInterval;var setTimeout = setInterval = function(){}");     //if using an engine like V8.NET, would not be required - not part of DOM spec

        engine.Execute(File.ReadAllText(breezeJsPath));
        engine.Execute("var edmxMetadataStore = new breeze.MetadataStore();" +
                       "edmxMetadataStore.importMetadata(" + MedSimDtoRepository.GetEdmxMetadata() + ");" +
                       "edmxMetadataStore.exportMetadata();");
        var exportedMeta = JObject.Parse(engine.GetCompletionValue().AsString());

        AddValidators(exportedMeta);
        return(exportedMeta.ToString(pretty ? Formatting.Indented : Formatting.None));
    }
예제 #3
0
        public void MyTestInitialize()
        {
            Guid userId;
            IEnumerable <string> roles;

            using (var db = new MedSimDbContext())
            {
                userId = (from u in db.Users
                          where u.Email == "*****@*****.**"
                          select u.Id).First();
                roles = (from r in db.Roles
                         where r.Users.Any(u => u.UserId == userId)
                         select r.Name).ToList();
            }
            _repo = new MedSimDtoRepository(new MockIPrincipal());
        }
예제 #4
0
 public static ILookup <Guid, CourseDto> GetBookedManikins(IPrincipal user, Guid courseId, Guid[] departmentIds)
 {
     using (var repo = new MedSimDtoRepository(user))
     {
         var course = repo.Context.Courses.Include(c => c.CourseDays).Include(c => c.CourseFormat).AsNoTracking().First(c => c.Id == courseId);
         var start  = course.StartFacultyUtc;
         var finish = course.FinishCourseFacultyUtc();
         return((from csm in repo.GetCourseSlotManikins(new[] { "Course.CourseFormat.CourseType", "Course.Department.Institution", "Course.CourseDays", "Manikin" }, new string[0], '.')
                 let c = csm.Course
                         let lastDay = c.CourseDays.FirstOrDefault(cd => cd.Day == c.CourseFormat.DaysDuration)
                                       let cFinish = lastDay == null
                     ? DbFunctions.AddMinutes(c.StartFacultyUtc, c.DurationFacultyMins)
                     : DbFunctions.AddMinutes(lastDay.StartFacultyUtc, lastDay.DurationFacultyMins)
                                                     where departmentIds.Contains(csm.Manikin.DepartmentId) && c.Id != courseId && c.StartFacultyUtc <finish && cFinish> start
                                                     select new { csm.ManikinId, c })
                .ToLookup(a => a.ManikinId, a => a.c));
     }
 }
예제 #5
0
 public static IQueryable<CourseDto> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return repo.GetCourses(_includeList);
 }
예제 #6
0
 public static DbQuery<Course> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return GetCourseIncludes(repo.Context);
 }
예제 #7
0
 public static IQueryable <CourseDto> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return(repo.GetCourses(_includeList));
 }
예제 #8
0
 public static DbQuery <Course> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return(GetCourseIncludes(repo.Context));
 }