public void DeleteDepartament(Departament d)
 {
     if (d != null)
     {
         SPDatabase.DB.Departaments.DeleteObject(d);
         SPDatabase.DB.SaveChanges();
     }
 }
 public void AddDepartament(NewDepartament departament)
 { 
     if (departament != null)
     {
         Departament d = new Departament()
         {
             Name = departament.DepartamentName
         };
         SPDatabase.DB.Departaments.AddObject(d);
         SPDatabase.DB.SaveChanges();
     }
 }
        public void ShouldNotCreateErrorMessageForCorrectFacultyName()
        {
            var departaments = new List<Departament>();
            var d = new Departament {Name = "Department"};
            departaments.Add(d);
            _newFaculty.FacultyName = "Kierunek";
            _newFaculty.Departaments = departaments.AsEnumerable();
            bool result = _newFaculty.IsValid;

            Assert.IsNotNull(_newFaculty);
            Assert.IsTrue(result);
            Assert.IsNull(_newFaculty.Errors);
        }
        private void FillWithFaculties(Departament dep)
        {
            listFaculties.Items.Clear();
            IEnumerable<Faculty> faculties = null;

            if (dep == null)
                faculties = FacultyController.Instance.ListFaculties();
            else
                faculties = FacultyController.Instance.ListFaculties(dep.DepartamentID);

            if (faculties != null)
                foreach (Faculty f in faculties)
                    listFaculties.Items.Add(f.Name);
        }
        private void FillWithInstitutes(Departament dep)
        {
            listInstitutes.Items.Clear();
            IEnumerable<Institute> institutes = null;

            if (dep == null)
                institutes = InstituteController.Instance.ListInstitutes();
            else
                institutes = InstituteController.Instance.ListInstitutes(dep.DepartamentID);

            if (institutes != null)
                foreach (Institute f in institutes)
                    listInstitutes.Items.Add(f.Name);
        }
 /// <summary>
 /// Create a new Departament object.
 /// </summary>
 /// <param name="departamentID">Initial value of the DepartamentID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static Departament CreateDepartament(global::System.Int32 departamentID, global::System.String name)
 {
     Departament departament = new Departament();
     departament.DepartamentID = departamentID;
     departament.Name = name;
     return departament;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Departaments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDepartaments(Departament departament)
 {
     base.AddObject("Departaments", departament);
 }