public ScenarioModel(MapScenarioModel source, MapModel map, RepoInfo repo, ScenarioModel parent)
            : base(source.Id, repo)
        {
            Title   = source.Title;
            Summary = source.Summary;
            Parent  = parent;

            if (source.Children != null)
            {
                foreach (var childScenario in source.Children)
                {
                    ChildrenScenarios.Add(new ScenarioModel(childScenario, map, repo, this));
                }
            }

            if (source.ProposalExamples != null)
            {
                foreach (var proposal in source.ProposalExamples)
                {
                    var p = new ProposalExampleModel(this, proposal, map, repo);
                    if (p.Info != null)
                    {
                        // Don't allow duplicate proposals
                        if (!Proposals.Any(i => i.ProposalId == p.ProposalId))
                        {
                            Proposals.Add(p);
                        }
                    }
                }
            }
        }
 public bool accept(HQLCompletionProposal proposal)
 {
     Proposals.Add(proposal);
     return(true);
 }
Exemple #3
0
        static SeedGetter()
        {
            var fileName   = "dataseed.json";
            var path       = Path.Combine(Environment.CurrentDirectory, fileName);
            var jsonString = File.ReadAllTextAsync(path).Result;
            var seed       = JsonConvert.DeserializeObject <DataSeed>(jsonString);

            foreach (var user in seed.DeanEmployees)
            {
                var preparedUser = PrepareUser(user);
                Users.Add(preparedUser);
                DeanEmployees.Add(preparedUser);
            }
            foreach (var student in seed.Students)
            {
                var user = PrepareUser(student.ApplicationUser);
                Users.Add(user);
                student.ApplicationUser = null;
                student.UserId          = user.Id;

                //if (student.Id == Guid.Empty)
                //{
                //    student.Id = Guid.NewGuid();
                //}
                Students.Add(student);
            }
            foreach (var institute in seed.Institutes)
            {
                //if (institute.Id == Guid.Empty)
                //{
                //    institute.Id = Guid.NewGuid();
                //}

                foreach (var promoter in institute.Promoters)
                {
                    var user = PrepareUser(promoter.ApplicationUser);
                    Users.Add(user);
                    promoter.ApplicationUser = null;
                    promoter.UserId          = user.Id;
                    promoter.InstituteId     = institute.Id;
                    //if (promoter.Id == Guid.Empty)
                    //{
                    //    promoter.Id = Guid.NewGuid();
                    //}
                    Promoters.Add(promoter);
                }
                institute.Promoters = null;
                Institutes.Add(institute);
            }
            foreach (var faculty in seed.Faculties)
            {
                //if (faculty.Id == Guid.Empty)
                //{
                //    faculty.Id = Guid.NewGuid();
                //}

                foreach (var course in faculty.Courses)
                {
                    //if (course.Id == Guid.Empty)
                    //{
                    //    course.Id = Guid.NewGuid();
                    //}
                    course.FacultyId = faculty.Id;
                    foreach (var proposal in course.Proposals)
                    {
                        //if (proposal.Id == Guid.Empty)
                        //{
                        //    proposal.Id = Guid.NewGuid();
                        //}
                        proposal.CourseId     = course.Id;
                        proposal.StartingDate = new DateTime(2019, 10, 1);
                        Proposals.Add(proposal);
                    }
                    course.Proposals = null;
                    Courses.Add(course);
                }
                faculty.Courses = null;
                Faculties.Add(faculty);
            }
        }
Exemple #4
0
 public void Add(IProposal proposal)
 {
     Proposals.Add(proposal);
 }