Esempio n. 1
0
        private static IEnumerable<Discipline> GetTestDisciplines()
        {
            Discipline math = new Discipline() { Name = "Math" };
            Discipline algebra = new Discipline() { Name = "Algebra", Parent = math };
            Discipline groupTheory = new Discipline() { Name = "Group Theory", Parent = algebra };
            Discipline combinatorialGroupTheory = new Discipline() { Name = "Combinatorial Group Theory", Parent = groupTheory };
            Discipline finiteFieldsTheory = new Discipline() { Name = "Finite Fields", Parent = algebra };
            Discipline geometry = new Discipline() { Name = "Geometry", Parent = math };
            Discipline analynicGeometry = new Discipline() { Name = "Analytic Geometry", Parent = geometry };
            Discipline differentialGeometry = new Discipline() { Name = "Differential Geometry", Parent = geometry };
            Discipline topology = new Discipline() { Name = "Topology", Parent = math };
            Discipline differentialTopology = new Discipline() { Name = "Differential Topology", Parent = topology };
            Discipline combinatorialTopology = new Discipline() { Name = "Combinatorial Topology", Parent = topology };
            Discipline generalTopology = new Discipline() { Name = "General Topology", Parent = topology };
            Discipline physic = new Discipline() { Name = "Physic" };
            Discipline mechanics = new Discipline() { Name = "mechanics", Parent = physic };
            Discipline thermodynamics = new Discipline() { Name = "Thermodynamics", Parent = physic };

            yield return math;
            yield return algebra;
            yield return groupTheory;
            yield return combinatorialGroupTheory;
            yield return finiteFieldsTheory;
            yield return geometry;
            yield return differentialGeometry;
            yield return analynicGeometry;
            yield return topology;
            yield return differentialTopology;
            yield return combinatorialTopology;
            yield return generalTopology;
            yield return physic;
            yield return mechanics;
            yield return thermodynamics;
        }
Esempio n. 2
0
 private static Discipline CreateDiscipline(string name, Discipline parent)
 {
     var discipline = new Discipline();
     discipline.Parent = parent;
     discipline.Name = new DirectoryInfo(name).Name;
     return discipline;
 }
Esempio n. 3
0
 public static Discipline Map(DisciplineViewModel viewModel)
 {
     Discipline discipline = new Discipline();
     discipline.Id = viewModel.Id;
     discipline.Name = viewModel.Name;
     discipline.ParentId = viewModel.ParentId;
     return discipline;
 }
Esempio n. 4
0
 public static DisciplineViewModel Map(Discipline discipline)
 {
     DisciplineViewModel viewModel = new DisciplineViewModel();
     viewModel.Id = discipline.Id;
     viewModel.ParentId = discipline.Parent != null
         ? discipline.Parent.Id
         : 0;
     viewModel.Name = discipline.Name;
     return viewModel;
 }
Esempio n. 5
0
 private static void CreateDiscipline(
     AcademyEntities entities,
     string name,
     Discipline parent)
 {
     var discipline = CreateDiscipline(name, parent);
     entities.Disciplines.Add(discipline);
     entities.SaveChanges();
     foreach (var child in Directory.GetDirectories(name))
     {
         CreateDiscipline(entities, child, discipline);
     }
 }
Esempio n. 6
0
 private IEnumerable<Discipline> GetAllChildren(Discipline root)
 {
     var children = new List<Discipline> {root};
     AddChildren(root, children);
     return children;
 }