доработки по формам
This commit is contained in:
parent
8bd5ec7e01
commit
47d1f3762b
@ -43,6 +43,7 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
1
ExamTimetable/ExamTimetable/FormExam.Designer.cs
generated
1
ExamTimetable/ExamTimetable/FormExam.Designer.cs
generated
@ -49,6 +49,7 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
|
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using ExamTimetable_Database;
|
using ExamTimetable_Database;
|
||||||
using ExamTimetable_Forms;
|
using ExamTimetable_Forms;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ExamTimetable
|
namespace ExamTimetable
|
||||||
{
|
{
|
||||||
@ -61,9 +62,40 @@ namespace ExamTimetable
|
|||||||
var service = Program.ServiceProvider?.GetService(typeof(Abstractions));
|
var service = Program.ServiceProvider?.GetService(typeof(Abstractions));
|
||||||
if (service is Abstractions bd)
|
if (service is Abstractions bd)
|
||||||
{
|
{
|
||||||
// Замените "GetCars" на метод вашего класса, который выполняет запрос к сущности
|
/*var exams = bd.GetExams();
|
||||||
|
int id = exams.Last().exam_id;
|
||||||
|
var exam = exams.Last();*/
|
||||||
|
string test = "test";
|
||||||
|
var faculties = bd.GetFaculties();
|
||||||
|
int id = faculties.Last().faculty_id;
|
||||||
|
var faculty = faculties.Last();
|
||||||
|
|
||||||
DateTime startTime = DateTime.Now;
|
DateTime startTime = DateTime.Now;
|
||||||
var result = bd.GetExams(); // Выполняем запрос к сущности
|
/*Exam updatedExam = new Exam
|
||||||
|
{
|
||||||
|
exam_id = id,
|
||||||
|
exam_date = exam.exam_date,
|
||||||
|
exam_place = exam.exam_place,
|
||||||
|
exam_subject = test,
|
||||||
|
com_id = exam.com_id,
|
||||||
|
exam_time = exam.exam_time
|
||||||
|
};*/
|
||||||
|
Faculty updatedFaculty = new Faculty
|
||||||
|
{
|
||||||
|
faculty_id = id,
|
||||||
|
faculty_name = test,
|
||||||
|
uni_id = faculty.uni_id
|
||||||
|
};
|
||||||
|
//var result = bd.GetExams(); // Âûïîëíÿåì çàïðîñ ê ñóùíîñòè
|
||||||
|
//var result = bd.GetExamById(id);
|
||||||
|
//bd.AddExam(exam);
|
||||||
|
//bd.UpdateExam(updatedExam);
|
||||||
|
//bd.DeleteExam(id);
|
||||||
|
//var result = bd.GetFaculties();
|
||||||
|
//var result = bd.GetFacultyById(id);
|
||||||
|
//bd.AddFaculty(faculty);
|
||||||
|
bd.UpdateFaculty(updatedFaculty);
|
||||||
|
//bd.DeleteFaculty(id);
|
||||||
DateTime endTime = DateTime.Now;
|
DateTime endTime = DateTime.Now;
|
||||||
|
|
||||||
// Âûâîäèì âðåìÿ âûïîëíåíèÿ çàïðîñà â êîíñîëü
|
// Âûâîäèì âðåìÿ âûïîëíåíèÿ çàïðîñà â êîíñîëü
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
@ -128,7 +128,10 @@ namespace ExamTimetable_Database
|
|||||||
{
|
{
|
||||||
using var conn = GetConnection();
|
using var conn = GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE faculty SET faculty_name = {faculty.faculty_name}, uni_id = {faculty.uni_id} WHERE faculty_id = {faculty.faculty_id}", conn);
|
using var cmd = new NpgsqlCommand($"UPDATE faculty SET faculty_name = @faculty_name, uni_id = @uni_id WHERE faculty_id = @faculty_id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@faculty_id", faculty.faculty_id);
|
||||||
|
cmd.Parameters.AddWithValue("@faculty_name", faculty.faculty_name);
|
||||||
|
cmd.Parameters.AddWithValue("@uni_id", faculty.uni_id);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
public override void DeleteFaculty(int id)
|
public override void DeleteFaculty(int id)
|
||||||
@ -315,7 +318,14 @@ namespace ExamTimetable_Database
|
|||||||
{
|
{
|
||||||
using var conn = GetConnection();
|
using var conn = GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE exam SET exam_date = {exam.exam_date}, exam_place = {exam.exam_place}, exam_subject = {exam.exam_subject}, com_id = {exam.com_id}, exam_time= {exam.exam_time} WHERE exam_id = {exam.exam_id}", conn);
|
//using var cmd = new NpgsqlCommand($"UPDATE exam SET exam_date = {exam.exam_date}, exam_place = {exam.exam_place}, exam_subject = {exam.exam_subject}, com_id = {exam.com_id}, exam_time= {exam.exam_time} WHERE exam_id = {exam.exam_id}", conn);
|
||||||
|
using var cmd = new NpgsqlCommand($"UPDATE exam SET exam_date = @exam_date, exam_place = @exam_place, exam_subject = @exam_subject, com_id = @com_id, exam_time= @exam_time WHERE exam_id = @exam_id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@exam_id", exam.exam_id);
|
||||||
|
cmd.Parameters.AddWithValue("@exam_date", exam.exam_date);
|
||||||
|
cmd.Parameters.AddWithValue("@exam_place", exam.exam_place);
|
||||||
|
cmd.Parameters.AddWithValue("@exam_subject", exam.exam_subject);
|
||||||
|
cmd.Parameters.AddWithValue("@com_id", exam.com_id);
|
||||||
|
cmd.Parameters.AddWithValue("@exam_time", exam.exam_time);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
public override void DeleteExam(int id)
|
public override void DeleteExam(int id)
|
||||||
|
Loading…
Reference in New Issue
Block a user