/// <summary>
 /// Deprecated Method for adding a new object to the Titles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTitles(Title title)
 {
     base.AddObject("Titles", title);
 }
Ejemplo n.º 2
0
        private void InstallApp()
        {
            StudyType Ochnaja = new StudyType
            {
                Name = "очная"
            };

            StudyType Zaochnaja = new StudyType
            {
                Name = "заочная"
            };

            StudyType unnamed3 = new StudyType
            {
                Name = "unnamed3"
            };

            StudyType unnamed4 = new StudyType
            {
                Name = "unnamed4"
            };

            Faculty IiVT = new Faculty
            {
                Name = "Информатика и вычислительная техника",
                Abbreviation = "ИиВТ",
            };

            FieldOfStudy Specialist = new FieldOfStudy
            {
                Name = "специалист"
            };

            FieldOfStudy Bakalavr = new FieldOfStudy
            {
                Name = "бакалавр"
            };

            FieldOfStudy Magistr = new FieldOfStudy
            {
                Name = "магистр"
            };

            LessonsType Lections = new LessonsType
            {
                Id = 1,
                Name = "лекция"
            };

            LessonsType Practics = new LessonsType
            {
                Id = 2,
                Name = "практика"
            };

            LessonsType Labs = new LessonsType
            {
                Id = 3,
                Name = "лабораторные"
            };

            LessonsSubType Comp = new LessonsSubType
            {
                Name = "компьютеры",
                LessonsTypeId = Labs.Id
            };

            LessonsSubType Stanki = new LessonsSubType
            {
                Name = "станки",
                LessonsTypeId = Labs.Id
            };

            Title prepod = new Title
            {
                Name = "преподаватель"
            };

            Faculty fac = new Faculty
            {
                Name = "факультет",
                Abbreviation = "фак"
            };

            Ring first = new Ring
            {
                Begin = "8:30",
                End = "9:50"
            };

            Ring second = new Ring
            {
                Begin = "10:00",
                End = "11:20"
            };

            Ring third = new Ring
            {
                Begin = "11:20",
                End = "12:50"
            };

            Ring fourth = new Ring
            {
                Begin = "13:30",
                End = "14:50"
            };

            Ring fifth = new Ring
            {
                Begin = "15:00",
                End = "16:20"
            };

            Ring sixth = new Ring
            {
                Begin = "16:30",
                End = "17:50"
            };

            Ring seventh = new Ring
            {
                Begin = "18:10",
                End = "19:30"
            };

            Auditorium a = new Auditorium
            {
                Building = 1,
                Number = "1-490",
                Seats = 50,
                OpeningDate = "",
                ClosingDate = "",
                DepartmentId = 1,
            };

            Degree d = new Degree
            {
                Name = "degree",
            };

            using (UniversitySheduleContainer cnt = new UniversitySheduleContainer("name=UniversitySheduleContainer"))
            {
                cnt.StudyTypes.AddObject(Ochnaja);
                cnt.StudyTypes.AddObject(Zaochnaja);
                cnt.StudyTypes.AddObject(unnamed3);
                cnt.StudyTypes.AddObject(unnamed4);
                cnt.Faculties.AddObject(IiVT);
                cnt.FieldsOfStudy.AddObject(Specialist);
                cnt.FieldsOfStudy.AddObject(Bakalavr);
                cnt.FieldsOfStudy.AddObject(Magistr);
                cnt.LessonsTypes.AddObject(Lections);
                cnt.LessonsTypes.AddObject(Practics);
                cnt.LessonsTypes.AddObject(Labs);
                cnt.LessonsSubTypes.AddObject(Comp);
                cnt.LessonsSubTypes.AddObject(Stanki);
                cnt.Titles.AddObject(prepod);
                cnt.Faculties.AddObject(fac);
                cnt.Rings.AddObject(first);
                cnt.Rings.AddObject(second);
                cnt.Rings.AddObject(third);
                cnt.Rings.AddObject(fourth);
                cnt.Rings.AddObject(fifth);
                cnt.Rings.AddObject(sixth);
                cnt.Rings.AddObject(seventh);
                cnt.Degrees.AddObject(d);
                //cnt.Auditoriums.AddObject(a);
                // И финальный аккорд - сохраняем все изменения в БД
                cnt.SaveChanges();
            }
        }
 /// <summary>
 /// Create a new Title object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static Title CreateTitle(global::System.Int32 id, global::System.String name)
 {
     Title title = new Title();
     title.Id = id;
     title.Name = name;
     return title;
 }