ещё правки

This commit is contained in:
AnnaLioness 2024-03-28 00:00:05 +04:00
parent b7b255ea9e
commit 902061fd68

View File

@ -19,8 +19,7 @@ namespace ExamTimetable_Database
{ {
using var conn = GetConnection(); using var conn = GetConnection();
conn.Open(); conn.Open();
using var cmd = new NpgsqlCommand($"INSERT INTO university (univer_id, univer_name, univer_adress, phone_number, email_addr) VALUES (@univer_id, @univer_name ,@univer_adress, @phone_number, @email_addr)", conn); using var cmd = new NpgsqlCommand($"INSERT INTO university (univer_name, univer_adress, phone_number, email_addr) VALUES (@univer_name ,@univer_adress, @phone_number, @email_addr)", conn);
cmd.Parameters.AddWithValue("@univer_id", university.univer_id);
cmd.Parameters.AddWithValue("@univer_name", university.univer_name); cmd.Parameters.AddWithValue("@univer_name", university.univer_name);
cmd.Parameters.AddWithValue("@univer_adress", university.univer_adress); cmd.Parameters.AddWithValue("@univer_adress", university.univer_adress);
cmd.Parameters.AddWithValue("@phone_number", university.phone_number); cmd.Parameters.AddWithValue("@phone_number", university.phone_number);
@ -85,8 +84,7 @@ namespace ExamTimetable_Database
{ {
using var conn = GetConnection(); using var conn = GetConnection();
conn.Open(); conn.Open();
using var cmd = new NpgsqlCommand($"INSERT INTO faculty (faculty_id, faculty_name, uni_id) VALUES (@faculty_id, @faculty_name, @uni_id)", conn); using var cmd = new NpgsqlCommand($"INSERT INTO faculty (faculty_name, uni_id) VALUES (@faculty_name, @uni_id)", conn);
cmd.Parameters.AddWithValue("@faculty_id", faculty.faculty_id);
cmd.Parameters.AddWithValue("@faculty_name", faculty.faculty_name); cmd.Parameters.AddWithValue("@faculty_name", faculty.faculty_name);
cmd.Parameters.AddWithValue("@uni_id", faculty.uni_id); cmd.Parameters.AddWithValue("@uni_id", faculty.uni_id);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -145,8 +143,7 @@ namespace ExamTimetable_Database
{ {
using var conn = GetConnection(); using var conn = GetConnection();
conn.Open(); conn.Open();
using var cmd = new NpgsqlCommand($"INSERT INTO specialization (spec_id, spec_name, fuc_id) VALUES (@spec_id, @spec_name, @fuc_id)", conn); using var cmd = new NpgsqlCommand($"INSERT INTO specialization (spec_name, fuc_id) VALUES (@spec_name, @fuc_id)", conn);
cmd.Parameters.AddWithValue("@spec_id", specialization.spec_id);
cmd.Parameters.AddWithValue("@spec_name", specialization.spec_name); cmd.Parameters.AddWithValue("@spec_name", specialization.spec_name);
cmd.Parameters.AddWithValue("@fuc_id", specialization.fuc_id); cmd.Parameters.AddWithValue("@fuc_id", specialization.fuc_id);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -205,8 +202,7 @@ namespace ExamTimetable_Database
{ {
using var conn = GetConnection(); using var conn = GetConnection();
conn.Open(); conn.Open();
using var cmd = new NpgsqlCommand($"INSERT INTO comission (comm_id, teaching_stuff, fu_id) VALUES (@comm_id, @teaching_stuff, @fu_id)", conn); using var cmd = new NpgsqlCommand($"INSERT INTO comission (teaching_stuff, fu_id) VALUES (@teaching_stuff, @fu_id)", conn);
cmd.Parameters.AddWithValue("@comm_id", comission.comm_id);
cmd.Parameters.AddWithValue("@teaching_stuff", comission.teaching_stuff); cmd.Parameters.AddWithValue("@teaching_stuff", comission.teaching_stuff);
cmd.Parameters.AddWithValue("@fu_id", comission.fu_id); cmd.Parameters.AddWithValue("@fu_id", comission.fu_id);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -265,8 +261,7 @@ namespace ExamTimetable_Database
{ {
using var conn = GetConnection(); using var conn = GetConnection();
conn.Open(); conn.Open();
using var cmd = new NpgsqlCommand($"INSERT INTO exam (exam_id, exam_date, exam_place, exam_subject, com_id, exam_time) VALUES (@exam_id, @exam_date, @exam_place, @exam_subject, @com_id, @exam_time)", conn); using var cmd = new NpgsqlCommand($"INSERT INTO exam (exam_date, exam_place, exam_subject, com_id, exam_time) VALUES (@exam_date, @exam_place, @exam_subject, @com_id, @exam_time)", conn);
cmd.Parameters.AddWithValue("@exam_id", exam.exam_id);
cmd.Parameters.AddWithValue("@exam_date", exam.exam_date); cmd.Parameters.AddWithValue("@exam_date", exam.exam_date);
cmd.Parameters.AddWithValue("@exam_place", exam.exam_place); cmd.Parameters.AddWithValue("@exam_place", exam.exam_place);
cmd.Parameters.AddWithValue("@exam_subject", exam.exam_subject); cmd.Parameters.AddWithValue("@exam_subject", exam.exam_subject);