Beispiel #1
0
        public void testInit()
        {
            _storage = new Storage();
            _student = new Student();
            _group = new Group();
            _semestr = new Semester();

            _student.FirstName = "Testowy";
            _student.LastName = "Test";
            _student.IndexNo = "123456";

            _group.Name = "TstwGrp$#^134";

            _semestr.Name = "78Z";

        }
Beispiel #2
0
 public void deleteSemester(Semester sem)
 {
     try
     {
         using (var db = new DataContext())
         {
             var original = db.Semesters.Find(sem.SemesterID);
             if (original != null)
             {
                 db.Semesters.Remove(original);
                 db.SaveChanges();
             }
         }
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
     catch (DbUpdateException)
     {
         MessageBox.Show("You can not delete semester which has realisation.", "Semester Deletion Error");
         return;
     }
     catch (DbEntityValidationException)
     { throw; }
 }
Beispiel #3
0
 public void createSemester(string NewSemName)
 {
     try
     {
         using (var db = new DataContext())
         {
             var sem = new Semester { Name = NewSemName };
             db.Semesters.Add(sem);
             db.SaveChanges();
         }
     }
     catch (DbEntityValidationException)
     { throw; }
 }
Beispiel #4
0
 public void deleteSemester(Semester sem)
 {
     try
     {
         using (var db = new DataContext())
         {
             var original = db.Semesters.Find(sem.SemesterID);
             if (original != null)
             {
                 db.Semesters.Remove(original);
                 db.SaveChanges();
             }
         }
     }
     catch (DbUpdateConcurrencyException)
     {
         throw new EresDataContextException("Blad polaczania z baza danych. Sprobuj jeszcze raz.", "Usuwanie semestru");
     }
     catch (DbUpdateException)
     {
         throw new EresDataContextException("Nie mozna usunac semestru z realizacja!", "Usuwanie semestru");
     }
     catch (DbEntityValidationException)
     {
         throw new EresDataContextException("Blad polaczania z baza danych.", "Usuwanie semestru");
     }
 }
Beispiel #5
0
 public void createSemester(string NewSemName)
 {
     try
     {
         using (var db = new DataContext())
         {
             var sem = new Semester { Name = NewSemName };
             db.Semesters.Add(sem);
             db.SaveChanges();
         }
     }
     catch (DbEntityValidationException)
     {
         throw new EresDataContextException("Blad polaczania z baza danych.", "Dodawanie semestru");
     }
 }