Exemple #1
0
        public void TestExceptionPraznoIme()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor ba = new Bachelor("", "Hrenovica", dr, "0611996175021", dt, "shrenovica2", "pass");
        }
Exemple #2
0
        public void FillInSusiInfo(Student student, StudentInfo studentInfo, IEnumerable <CourseInfo> courseInfo)
        {
            // TODO: edit when SUSI API is available

            student.FirstName = studentInfo.FirstName;
            student.LastName  = studentInfo.LastName;
            student.Email     = "*****@*****.**";

            Tuple <int, int> startEndYears = studentInfo.GetStartEndYear();
            Bachelor         bachelor      = new Bachelor
            {
                StartYear = startEndYears.Item1,
                EndYear   = startEndYears.Item2,
                Specialty = StudentManager.programmeMapping[studentInfo.Programme],
                Subjects  = courseInfo.Select(x => x.ToSubject()).ToList(),
            };

            FMIEdu fmiEdu = new FMIEdu
            {
                Bachelor = bachelor,
            };

            student.FMIInfo = fmiEdu;

            db.SaveChanges();
        }
Exemple #3
0
        private static void Main()
        {
            var b1 = new Bachelor
            {
                FirstName  = "Ivan",
                SecondName = "Korotkov",
                Faculty    = "Math"
            };

            var m1 = new Master
            {
                FirstName  = "Ivan",
                SecondName = "Korotkov",
                Faculty    = "Math",
                Degree     = new Degree
                {
                    GraduationDate = DateTime.Today,
                    Domain         = "Programming"
                }
            };

            var studs = new List <Student> {
                b1, m1
            };

            Serialize(studs);
            var studs2 = Deserialize();
        }
        public MainStudent get()
        {
            Bachelor student = new Bachelor();

            student.Name    = "Ali Ahmadi";
            student.Number  = 98060100001;
            student.Study   = "Computer";
            student.Level   = "Bachelor";
            student.Lessons = new List <Lesson>()
            {
                new Lesson("Math", 20124, 2, 15),
                new Lesson("Job", 20125, 2, 14),
                new Lesson("Sport", 20126, 2, 18),
                new Lesson("Literature", 20127, 2, 18),
                new Lesson("Programming", 20128, 3, 15),
                new Lesson("Network", 20129, 2, 18),
                new Lesson("System", 20130, 2, 18),
            };

            foreach (Lesson lesson in student.Lessons)
            {
                student.Scores += lesson.Score;
            }
            student.Average = student.Scores / student.Lessons.Count;
            student.Project = "Test";
            return(student);
        }
Exemple #5
0
        public void FillInSusiInfo(Student student, StudentInfo studentInfo, IEnumerable <CourseInfo> courseInfo)
        {
            student.FirstName = studentInfo.FirstName;
            student.LastName  = studentInfo.LastName;

            Tuple <int, int> startEndYears = studentInfo.GetStartEndYear();
            Bachelor         bachelor      = new Bachelor
            {
                StartYear           = startEndYears.Item1,
                EndYear             = startEndYears.Item2,
                CurrentCourse       = studentInfo.Year,
                Specialty           = StudentManager.programmeMapping[studentInfo.Programme],
                Subjects            = courseInfo.Select(x => x.ToSubject()).ToList(),
                CurrentAverageGrade = courseInfo.Average(x => x.Grade)
            };

            FMIEdu fmiEdu = new FMIEdu
            {
                Bachelor = bachelor,
            };

            student.FMIInfo = fmiEdu;

            db.SaveChanges();
        }
Exemple #6
0
    static void Main(string[] args)
    {
        Master   myDegree   = new Master("MBA", 12);
        Bachelor myBachelor = new Bachelor("Computer Science", 20);
        Course   CS50       = new Course("CS50", "Introduction to Programming", 3, Course.CourseType.Required);
        Course   COP2360    = new Course("COP2360", "Introduction to C#", 6, Course.CourseType.Required);
        Course   CS2700     = new Course("CS2700", "Introduction to SQL", 4, Course.CourseType.Required);
        Course   CS2840     = new Course("CS2840", "Introduction to Server Side Programming", 5, Course.CourseType.Required);
        Course   CS1030     = new Course("CS1030", "Oracle", 2, Course.CourseType.Required);

        Student Lily = new Student("Lily", myBachelor);



        Student Edilma   = new Student("Edilma", myBachelor);
        Student Damian   = new Student("Damian", myBachelor);
        Student Sparkles = new Student("Sparkles", myBachelor);

        Lily.ClassesTaken.Add(CS50);
        Edilma.ClassesTaken.Add(CS50);
        Damian.ClassesTaken.Add(CS50);
        Sparkles.ClassesTaken.Add(CS50);

        Console.WriteLine($"Lily is taken {Lily.ClassesTaken.Count} classes");



        CS50.Roaster.Add(Lily);
        CS50.Roaster.Add(Edilma);
        CS50.Roaster.Add(Damian);
        CS50.Roaster.Add(Sparkles);


        var list = CS50.getRoaster();

        foreach (Student student in list)
        {
            Console.WriteLine(student.Name);
        }


        //Console.WriteLine($"Degree Type = {myDegree.GetType()}");
        //Console.WriteLine($"Course Name = {myCourse.CourseName}");
        //Console.WriteLine($"Course Type? = {myCourse.courseType}");
        Console.WriteLine($"Is Student Enrolled? = {Lily.enrolled}");

        var isDegree = myDegree is Degree;

        //Console.WriteLine($"Is Degree - {isDegree}");
        //Console.WriteLine($"Degree Name = {myDegree.Name}");
        //Console.WriteLine($"Did you complete your degree? {myDegree.isComplete}");

        myDegree.allowGraduation();
        //Console.WriteLine("The student complete his credits");
        myDegree.allowGraduation();
        //Console.WriteLine($"Can you graduate? {myDegree.isComplete}");

        Console.Read();
    }
Exemple #7
0
        public void TestXMLDatoteka()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor bach = new Bachelor(Convert.ToString(TestContext.DataRow["Ime"]), Convert.ToString(TestContext.DataRow["Prezime"]), DateTime.ParseExact(Convert.ToString(TestContext.DataRow["DatumRodjenja"]), "dd.MM.yyyy", CultureInfo.InvariantCulture), Convert.ToString(TestContext.DataRow["MaticniBroj"]), DateTime.ParseExact(Convert.ToString(TestContext.DataRow["DatumZavrsetka"]), "dd.MM.yyyy", CultureInfo.InvariantCulture), Convert.ToString(TestContext.DataRow["KorisnickoIme"]), Convert.ToString(TestContext.DataRow["Lozinka"]));

            Assert.IsTrue(bach.DajIme() == Convert.ToString(TestContext.DataRow["Ime"]));
        }
Exemple #8
0
        public void TestBachelorConstructor()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor bach = new Bachelor("Sanja", "Hrenovica", dr, "0611996175013", dt, "shrenovica", "pass");

            Assert.IsNotNull(bach);
        }
Exemple #9
0
        public void TestDuzinaIndexa()
        {
            DateTime dr      = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt      = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            Bachelor ba      = new Bachelor("Selma", "Hrenovica", dr, "0611996175021", dt, "shrenovica2", "pass");
            String   pattern = @"^([0-9]){5}$";
            Regex    reg     = new Regex(pattern);

            StringAssert.Matches(ba.DajBrojIndexa(), reg);
        }
Exemple #10
0
        public void TestBrojStudenata()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor bach = new Bachelor("Sanja", "Hrenovica", dr, "0611996175013", dt, "shrenovica", "pass");

            faks.RegistrujStudenta(bach);
            istudentska = new MockStudentska(faks);
            Assert.IsTrue(istudentska.brojStudenata() == 1);
        }
Exemple #11
0
        public void TestDajPotvrdu()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor bach = new Bachelor("Sanja", "Hrenovica", dr, "0611996175013", dt, "shrenovica", "pass");

            faks.RegistrujStudenta(bach);
            istudentska = new MockStudentska(faks);
            StringAssert.Equals("Podnesite zahtjev za potvrdu", istudentska.dajPotvrdu(Convert.ToInt32(bach.DajBrojIndexa())));
        }
Exemple #12
0
        public void TestDodajAktivniPredmet()
        {
            DateTime dr   = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt   = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            Bachelor bach = new Bachelor("Sanja", "Hrenovica", dr, "0611996175013", dt, "shrenovica", "pass");
            Predmeti p    = new Predmeti("matematika", 40, 12, 100, 5, "odg", "prva godina studija");

            bach.DodajAktivniPredmet(p);
            List <Predmeti> predmetiTest = bach.dajAktivnePredmete();

            CollectionAssert.Contains(predmetiTest, p);
        }
Exemple #13
0
        public void TestListaStudenata()
        {
            Fakultet faks = new Fakultet("etf", "Sarajevo");
            DateTime dr   = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt   = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            Bachelor ba   = new Bachelor("Selma", "Hrenovica", dr, "0611996175021", dt, "shrenovica2", "pass");

            faks.RegistrujStudenta("Sanja", "Hrenovica", dr, "0611996175013", dt, 2, "Sarajevo", "shrenovica", "pass");
            faks.dodajuListuStudenata(ba);
            List <Bachelor> listaTest = faks.dajListuStudenata();

            Assert.IsTrue(listaTest.Count == 2);
        }
 public ActionResult DeleteConfirmed(int id)
 {
     if (Session["UserId"] != null)
     {
         Bachelor bachelor = db.Bachelors.Find(id);
         db.Bachelors.Remove(bachelor);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("LoginMaster", "Admins"));
     }
 }
Exemple #15
0
        public void TestPretragaStudenata()
        {
            Fakultet faks = new Fakultet("etf", "Sarajevo");
            DateTime dr   = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt   = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            Master   ma   = new Master("Sanja", "Hrenovica", dr, "0611996175013", dt, 17583, "Sarajevo", "shrenovica", "pass");
            Bachelor ba   = new Bachelor("Selma", "Hrenovica", dr, "0611996175021", dt, "shrenovica2", "pass");

            faks.RegistrujStudenta(ba);
            faks.RegistrujStudenta(ma);
            List <Bachelor> listaTest = faks.PretraziStudente(ma.DajBrojIndexa());

            CollectionAssert.DoesNotContain(listaTest, ba);
        }
Exemple #16
0
        public void TestUkupnoOsoba()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dp = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2018", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Fakultet             faks = new Fakultet("etf", "Sarajevo");
            PrivremeniUposlenici pu   = new PrivremeniUposlenici("osoba", "prezime", dr, "0611996175013", "pozicija1", "srednja strucna sprema", "titula1", Convert.ToDecimal(200.00), dp, dt);

            faks.RegistrujUposlenogPrivremeno(pu);
            faks.RegistrujUposlenogPrivremeno(pu);
            Bachelor ba = new Bachelor("Selma", "Hrenovica", dr, "0611996175021", dp, "shrenovica2", "pass");

            faks.RegistrujStudenta("Sanja", "Hrenovica", dr, "0611996175013", dp, 2, "Sarajevo", "shrenovica", "pass");
            Assert.AreEqual(2, faks.UkupnoOsoba());
        }
 public ActionResult Edit([Bind(Include = "Id,Digree,Decription")] Bachelor bachelor)
 {
     if (Session["UserId"] != null)
     {
         if (ModelState.IsValid)
         {
             db.Entry(bachelor).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(bachelor));
     }
     else
     {
         return(RedirectToAction("LoginMaster", "Admins"));
     }
 }
        public ActionResult Create([Bind(Include = "Id,Digree,Decription")] Bachelor bachelor)
        {
            if (Session["UserId"] != null)
            {
                if (ModelState.IsValid)
                {
                    db.Bachelors.Add(bachelor);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View(bachelor));
            }
            else
            {
                return(RedirectToAction("LoginMaster", "Admins"));
            }
        }
Exemple #19
0
        public void TestPolozeniPredmeti()
        {
            DateTime dr = DateTime.ParseExact("06.11.1996", "dd.MM.yyyy", CultureInfo.InvariantCulture);
            DateTime dt = DateTime.ParseExact("24.01.2013", "dd.MM.yyyy", CultureInfo.InvariantCulture);

            Bachelor bach = new Bachelor("Sanja", "Hrenovica", dr, "0611996175013", dt, "shrenovica", "pass");

            faks.RegistrujStudenta(bach);
            Predmeti p  = new Predmeti("Matematika", 20, 20, 100, 5, "matematika1", "prva godina");
            Predmeti p1 = new Predmeti("Matematika2", 20, 20, 100, 5, "matematika2", "prva godina");

            bach.DodajPredmet(p);
            bach.DodajPredmet(p1);
            istudentska = new MockStudentska(faks);
            List <Predmeti> testList = istudentska.polozeniPredmeti(bach);

            CollectionAssert.Contains(testList, p);
            CollectionAssert.Contains(testList, p1);
        }
 // GET: Bachelors/Edit/5
 public ActionResult Edit(int?id)
 {
     if (Session["UserId"] != null)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Bachelor bachelor = db.Bachelors.Find(id);
         if (bachelor == null)
         {
             return(HttpNotFound());
         }
         return(View(bachelor));
     }
     else
     {
         return(RedirectToAction("LoginMaster", "Admins"));
     }
 }
Exemple #21
0
 public List <Predmeti> polozeniPredmeti(Bachelor b)
 {
     return(sluzba.polozeniPredmeti(b));
 }
Exemple #22
0
 public Potvrda(Bachelor b, String s)
 {
     Student   = b;
     Obradjena = false;
     Svrha     = s;
 }