From a38c5d258be9281ea9a30a6a93092309bfdb2d39 Mon Sep 17 00:00:00 2001 From: AnnaLioness Date: Mon, 22 Apr 2024 15:18:04 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ExamTimetable/ExamTimetable/FormFaculty.cs | 26 +- .../ExamTimetable/FormUniversity.Designer.cs | 286 +++++++++--------- 2 files changed, 157 insertions(+), 155 deletions(-) diff --git a/ExamTimetable/ExamTimetable/FormFaculty.cs b/ExamTimetable/ExamTimetable/FormFaculty.cs index 241d889..84111f2 100644 --- a/ExamTimetable/ExamTimetable/FormFaculty.cs +++ b/ExamTimetable/ExamTimetable/FormFaculty.cs @@ -35,8 +35,19 @@ namespace ExamTimetable_Forms dataGridView.Columns.Add("Univer", "Университет"); } - // Заполняем dataGridView данными из списка моделей автомобилей - foreach (Faculty faculty in faculties) + // Загружаем список в комбо-бокс + comboBoxUni.DataSource = bd.GetUniversities() + .Select(x => new helpCombobox() + { + Text = bd.GetUniversityById(x.univer_id).univer_name, + Id = x.univer_id + }) + .ToList(); + comboBoxUni.DisplayMember = "Text"; + comboBoxUni.ValueMember = "Id"; + + // Заполняем dataGridView данными из списка моделей автомобилей + foreach (Faculty faculty in faculties) { dataGridView.Rows.Add(faculty.faculty_id, faculty.faculty_name, bd.GetUniversityById(faculty.uni_id).univer_name); } @@ -107,17 +118,6 @@ namespace ExamTimetable_Forms // Получаем значение из выбранной строки string selectedUni = row.Cells["Univer"].Value.ToString(); - // Загружаем список в комбо-бокс - comboBoxUni.DataSource = bd.GetUniversities() - .Select(x => new helpCombobox() - { - Text = bd.GetUniversityById(x.univer_id).univer_name, - Id = x.univer_id - }) - .ToList(); - comboBoxUni.DisplayMember = "Text"; - comboBoxUni.ValueMember = "Id"; - // Выбираем универ, который соответствует выбранному значению в строке comboBoxUni.SelectedItem = selectedUni; } diff --git a/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs b/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs index 208bc3d..5c709b2 100644 --- a/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs +++ b/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs @@ -28,148 +28,150 @@ /// private void InitializeComponent() { - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.textBoxName = new System.Windows.Forms.TextBox(); - this.textBoxAddress = new System.Windows.Forms.TextBox(); - this.textBoxPhone = new System.Windows.Forms.TextBox(); - this.textBoxEmail = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.buttonCreate = new System.Windows.Forms.Button(); - this.buttonUpdate = new System.Windows.Forms.Button(); - this.buttonDelete = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); - // - // dataGridView - // - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Location = new System.Drawing.Point(12, 12); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(496, 390); - this.dataGridView.TabIndex = 0; - this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick); - // - // textBoxName - // - this.textBoxName.Location = new System.Drawing.Point(617, 26); - this.textBoxName.Name = "textBoxName"; - this.textBoxName.Size = new System.Drawing.Size(177, 23); - this.textBoxName.TabIndex = 1; - // - // textBoxAddress - // - this.textBoxAddress.Location = new System.Drawing.Point(617, 64); - this.textBoxAddress.Name = "textBoxAddress"; - this.textBoxAddress.Size = new System.Drawing.Size(177, 23); - this.textBoxAddress.TabIndex = 2; - // - // textBoxPhone - // - this.textBoxPhone.Location = new System.Drawing.Point(617, 104); - this.textBoxPhone.Name = "textBoxPhone"; - this.textBoxPhone.Size = new System.Drawing.Size(177, 23); - this.textBoxPhone.TabIndex = 3; - // - // textBoxEmail - // - this.textBoxEmail.Location = new System.Drawing.Point(617, 144); - this.textBoxEmail.Name = "textBoxEmail"; - this.textBoxEmail.Size = new System.Drawing.Size(177, 23); - this.textBoxEmail.TabIndex = 4; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(545, 29); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(62, 15); - this.label1.TabIndex = 5; - this.label1.Text = "Название:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(555, 67); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(43, 15); - this.label2.TabIndex = 6; - this.label2.Text = "Адрес:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(545, 107); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(58, 15); - this.label3.TabIndex = 7; - this.label3.Text = "Телефон:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(555, 152); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(39, 15); - this.label4.TabIndex = 8; - this.label4.Text = "Email:"; - // - // buttonCreate - // - this.buttonCreate.Location = new System.Drawing.Point(719, 185); - this.buttonCreate.Name = "buttonCreate"; - this.buttonCreate.Size = new System.Drawing.Size(75, 23); - this.buttonCreate.TabIndex = 9; - this.buttonCreate.Text = "Создать"; - this.buttonCreate.UseVisualStyleBackColor = true; - this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click); - // - // buttonUpdate - // - this.buttonUpdate.Location = new System.Drawing.Point(719, 223); - this.buttonUpdate.Name = "buttonUpdate"; - this.buttonUpdate.Size = new System.Drawing.Size(75, 23); - this.buttonUpdate.TabIndex = 10; - this.buttonUpdate.Text = "Изменить"; - this.buttonUpdate.UseVisualStyleBackColor = true; - this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click); - // - // buttonDelete - // - this.buttonDelete.Location = new System.Drawing.Point(719, 263); - this.buttonDelete.Name = "buttonDelete"; - this.buttonDelete.Size = new System.Drawing.Size(75, 23); - this.buttonDelete.TabIndex = 11; - this.buttonDelete.Text = "Удалить"; - this.buttonDelete.UseVisualStyleBackColor = true; - this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click); - // - // FormUniversity - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(806, 414); - this.Controls.Add(this.buttonDelete); - this.Controls.Add(this.buttonUpdate); - this.Controls.Add(this.buttonCreate); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBoxEmail); - this.Controls.Add(this.textBoxPhone); - this.Controls.Add(this.textBoxAddress); - this.Controls.Add(this.textBoxName); - this.Controls.Add(this.dataGridView); - this.Name = "FormUniversity"; - this.Text = "FormUniversity"; - this.Load += new System.EventHandler(this.FormUniversity_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxAddress = new System.Windows.Forms.TextBox(); + this.textBoxPhone = new System.Windows.Forms.TextBox(); + this.textBoxEmail = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.buttonCreate = new System.Windows.Forms.Button(); + this.buttonUpdate = new System.Windows.Forms.Button(); + this.buttonDelete = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.AllowUserToAddRows = false; + this.dataGridView.AllowUserToDeleteRows = false; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(12, 12); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(496, 390); + this.dataGridView.TabIndex = 0; + this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick); + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(617, 26); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(177, 23); + this.textBoxName.TabIndex = 1; + // + // textBoxAddress + // + this.textBoxAddress.Location = new System.Drawing.Point(617, 64); + this.textBoxAddress.Name = "textBoxAddress"; + this.textBoxAddress.Size = new System.Drawing.Size(177, 23); + this.textBoxAddress.TabIndex = 2; + // + // textBoxPhone + // + this.textBoxPhone.Location = new System.Drawing.Point(617, 104); + this.textBoxPhone.Name = "textBoxPhone"; + this.textBoxPhone.Size = new System.Drawing.Size(177, 23); + this.textBoxPhone.TabIndex = 3; + // + // textBoxEmail + // + this.textBoxEmail.Location = new System.Drawing.Point(617, 144); + this.textBoxEmail.Name = "textBoxEmail"; + this.textBoxEmail.Size = new System.Drawing.Size(177, 23); + this.textBoxEmail.TabIndex = 4; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(545, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(62, 15); + this.label1.TabIndex = 5; + this.label1.Text = "Название:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(555, 67); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(43, 15); + this.label2.TabIndex = 6; + this.label2.Text = "Адрес:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(545, 107); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(58, 15); + this.label3.TabIndex = 7; + this.label3.Text = "Телефон:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(555, 152); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(39, 15); + this.label4.TabIndex = 8; + this.label4.Text = "Email:"; + // + // buttonCreate + // + this.buttonCreate.Location = new System.Drawing.Point(719, 185); + this.buttonCreate.Name = "buttonCreate"; + this.buttonCreate.Size = new System.Drawing.Size(75, 23); + this.buttonCreate.TabIndex = 9; + this.buttonCreate.Text = "Создать"; + this.buttonCreate.UseVisualStyleBackColor = true; + this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click); + // + // buttonUpdate + // + this.buttonUpdate.Location = new System.Drawing.Point(719, 223); + this.buttonUpdate.Name = "buttonUpdate"; + this.buttonUpdate.Size = new System.Drawing.Size(75, 23); + this.buttonUpdate.TabIndex = 10; + this.buttonUpdate.Text = "Изменить"; + this.buttonUpdate.UseVisualStyleBackColor = true; + this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click); + // + // buttonDelete + // + this.buttonDelete.Location = new System.Drawing.Point(719, 263); + this.buttonDelete.Name = "buttonDelete"; + this.buttonDelete.Size = new System.Drawing.Size(75, 23); + this.buttonDelete.TabIndex = 11; + this.buttonDelete.Text = "Удалить"; + this.buttonDelete.UseVisualStyleBackColor = true; + this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click); + // + // FormUniversity + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(806, 414); + this.Controls.Add(this.buttonDelete); + this.Controls.Add(this.buttonUpdate); + this.Controls.Add(this.buttonCreate); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBoxEmail); + this.Controls.Add(this.textBoxPhone); + this.Controls.Add(this.textBoxAddress); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.dataGridView); + this.Name = "FormUniversity"; + this.Text = "FormUniversity"; + this.Load += new System.EventHandler(this.FormUniversity_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); }