/// <summary> /// Create a new Department object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="abbreviation">Initial value of the Abbreviation property.</param> /// <param name="facultyId">Initial value of the FacultyId property.</param> public static Department CreateDepartment(global::System.Int32 id, global::System.String name, global::System.String abbreviation, global::System.Int32 facultyId) { Department department = new Department(); department.Id = id; department.Name = name; department.Abbreviation = abbreviation; department.FacultyId = facultyId; return department; }
/// <summary> /// Deprecated Method for adding a new object to the Departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDepartments(Department department) { base.AddObject("Departments", department); }
public void Import() { using (UniversitySheduleContainer cnt = new UniversitySheduleContainer("name=UniversitySheduleContainer")) { foreach (var g in readeddepartment) { if (g.Add) { Department newDepartment = new Department() { Abbreviation = g.Name, Name = g.Name, //Id = g.Id, FacultyId = 1, }; cnt.Departments.AddObject(newDepartment); } } cnt.SaveChanges(); Department virtualDepartment = new Department() { Abbreviation = "VIRT", Name = "Virtual", FacultyId = 1, }; cnt.Departments.AddObject(virtualDepartment); Auditorium virtualAudit = new Auditorium() { Building = 1, Number = "VIRTUAL", Seats = 9999999, Department = virtualDepartment, OpeningDate = "", ClosingDate = "", }; cnt.Auditoriums.AddObject(virtualAudit); cnt.SaveChanges(); } }