From 902061fd686f28133f28c64adfc0ae2548319734 Mon Sep 17 00:00:00 2001 From: AnnaLioness Date: Thu, 28 Mar 2024 00:00:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=89=D1=91=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExamTimetable_Database/Implementation.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ExamTimetable/ExamTimetable_Database/Implementation.cs b/ExamTimetable/ExamTimetable_Database/Implementation.cs index 809dadf..0ca8053 100644 --- a/ExamTimetable/ExamTimetable_Database/Implementation.cs +++ b/ExamTimetable/ExamTimetable_Database/Implementation.cs @@ -19,8 +19,7 @@ namespace ExamTimetable_Database { using var conn = GetConnection(); 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); - cmd.Parameters.AddWithValue("@univer_id", university.univer_id); + 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_name", university.univer_name); cmd.Parameters.AddWithValue("@univer_adress", university.univer_adress); cmd.Parameters.AddWithValue("@phone_number", university.phone_number); @@ -85,8 +84,7 @@ namespace ExamTimetable_Database { using var conn = GetConnection(); conn.Open(); - using var cmd = new NpgsqlCommand($"INSERT INTO faculty (faculty_id, faculty_name, uni_id) VALUES (@faculty_id, @faculty_name, @uni_id)", conn); - cmd.Parameters.AddWithValue("@faculty_id", faculty.faculty_id); + using var cmd = new NpgsqlCommand($"INSERT INTO faculty (faculty_name, uni_id) VALUES (@faculty_name, @uni_id)", conn); cmd.Parameters.AddWithValue("@faculty_name", faculty.faculty_name); cmd.Parameters.AddWithValue("@uni_id", faculty.uni_id); cmd.ExecuteNonQuery(); @@ -145,8 +143,7 @@ namespace ExamTimetable_Database { using var conn = GetConnection(); conn.Open(); - using var cmd = new NpgsqlCommand($"INSERT INTO specialization (spec_id, spec_name, fuc_id) VALUES (@spec_id, @spec_name, @fuc_id)", conn); - cmd.Parameters.AddWithValue("@spec_id", specialization.spec_id); + using var cmd = new NpgsqlCommand($"INSERT INTO specialization (spec_name, fuc_id) VALUES (@spec_name, @fuc_id)", conn); cmd.Parameters.AddWithValue("@spec_name", specialization.spec_name); cmd.Parameters.AddWithValue("@fuc_id", specialization.fuc_id); cmd.ExecuteNonQuery(); @@ -205,8 +202,7 @@ namespace ExamTimetable_Database { using var conn = GetConnection(); conn.Open(); - using var cmd = new NpgsqlCommand($"INSERT INTO comission (comm_id, teaching_stuff, fu_id) VALUES (@comm_id, @teaching_stuff, @fu_id)", conn); - cmd.Parameters.AddWithValue("@comm_id", comission.comm_id); + using var cmd = new NpgsqlCommand($"INSERT INTO comission (teaching_stuff, fu_id) VALUES (@teaching_stuff, @fu_id)", conn); cmd.Parameters.AddWithValue("@teaching_stuff", comission.teaching_stuff); cmd.Parameters.AddWithValue("@fu_id", comission.fu_id); cmd.ExecuteNonQuery(); @@ -265,8 +261,7 @@ namespace ExamTimetable_Database { using var conn = GetConnection(); 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); - cmd.Parameters.AddWithValue("@exam_id", exam.exam_id); + 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_date", exam.exam_date); cmd.Parameters.AddWithValue("@exam_place", exam.exam_place); cmd.Parameters.AddWithValue("@exam_subject", exam.exam_subject);