예제 #1
0
        public void SetThesis()
        {
            //populate thesis model
            currentThesisValues = new ThesisModel(
                thesisView.EmailAdres,
                thesisView.ThesisDateCreation,
                thesisView.StudentIndexNumber,
                thesisView.StudentName,
                thesisView.StudentLastName,
                thesisView.StudentSpecialization,
                thesisView.Degree,
                thesisView.TypeOfLearning,
                thesisView.TopicOfThesisPolish,
                thesisView.TopicOfThesisEnglish,
                thesisView.TeacherAdvisorName,
                thesisView.FieldOfStudy);

            InitThesisDatabase();
        }
예제 #2
0
        public void AddThesis(ThesisModel thesisToAdd)
        {
            DbConnect();
            string        initQuery     = "INSERT INTO Thesis ('emailAdres', 'studentIndexNumber', 'studentName', 'studentLastName', 'degree', 'studentSpecialization', 'fieldOfStudy', 'teacherAdvisorName', 'thesisDateCreation', 'topicOfThesisEnglish', 'topicOfThesisPolish', 'typeOfLearning') VALUES (@emailAdres, @studentIndexNumber, @studentName, @studentLastName, @degree, @studentSpecialization, @fieldOfStudy, @teacherAdvisorName, @thesisDateCreation, @topicOfThesisEnglish, @topicOfThesisPolish, @typeOfLearning)";
            SQLiteCommand thesisCommand = new SQLiteCommand(initQuery, dbConnection);

            thesisCommand.Parameters.AddWithValue("@emailAdres", thesisToAdd.EmailAdres);
            thesisCommand.Parameters.AddWithValue("@studentIndexNumber", thesisToAdd.StudentIndexNumber);
            thesisCommand.Parameters.AddWithValue("@studentName", thesisToAdd.StudentName);
            thesisCommand.Parameters.AddWithValue("@studentLastName", thesisToAdd.StudentLastName);
            thesisCommand.Parameters.AddWithValue("@degree", thesisToAdd.Degree);
            thesisCommand.Parameters.AddWithValue("@studentSpecialization", thesisToAdd.StudentSpecialization);
            thesisCommand.Parameters.AddWithValue("@fieldOfStudy", thesisToAdd.FieldOfStudy);
            thesisCommand.Parameters.AddWithValue("@teacherAdvisorName", thesisToAdd.TeacherAdvisorName);
            thesisCommand.Parameters.AddWithValue("@thesisDateCreation", thesisToAdd.ThesisDateCreation);
            thesisCommand.Parameters.AddWithValue("@topicOfThesisEnglish", thesisToAdd.TopicOfThesisEnglish);
            thesisCommand.Parameters.AddWithValue("@topicOfThesisPolish", thesisToAdd.TopicOfThesisPolish);
            thesisCommand.Parameters.AddWithValue("@typeOfLearning", thesisToAdd.TypeOfLearning);

            thesisCommand.ExecuteNonQuery();
            Console.WriteLine("Add thesis was called in DbHandler");
            DbDisconnect();
        }