diff --git a/StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs b/StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs index 18f6847..0880485 100644 --- a/StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs +++ b/StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs @@ -30,13 +30,20 @@ { menuStrip1 = new MenuStrip(); справочникиToolStripMenuItem = new ToolStripMenuItem(); - buttonRefresh = new Button(); - dataGridView = new DataGridView(); факультетыToolStripMenuItem = new ToolStripMenuItem(); направленияToolStripMenuItem = new ToolStripMenuItem(); студентыToolStripMenuItem = new ToolStripMenuItem(); + buttonAdd = new Button(); + groupBox1 = new GroupBox(); + labelAdd = new Label(); + labelGet = new Label(); + buttonGet = new Button(); + labelUpdate = new Label(); + buttonUpdate = new Button(); + labelDelete = new Label(); + buttonDelete = new Button(); menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + groupBox1.SuspendLayout(); SuspendLayout(); // // menuStrip1 @@ -45,7 +52,8 @@ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Size = new Size(1088, 28); + menuStrip1.Padding = new Padding(5, 2, 0, 2); + menuStrip1.Size = new Size(411, 24); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // @@ -53,66 +61,138 @@ // справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { факультетыToolStripMenuItem, направленияToolStripMenuItem, студентыToolStripMenuItem }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; - справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Size = new Size(94, 20); справочникиToolStripMenuItem.Text = "Справочники"; // - // buttonRefresh - // - buttonRefresh.Location = new Point(882, 49); - buttonRefresh.Margin = new Padding(3, 4, 3, 4); - buttonRefresh.Name = "buttonRefresh"; - buttonRefresh.Size = new Size(181, 43); - buttonRefresh.TabIndex = 10; - buttonRefresh.Text = "Обновить список"; - buttonRefresh.UseVisualStyleBackColor = true; - // - // dataGridView - // - dataGridView.BackgroundColor = Color.White; - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(12, 32); - dataGridView.Margin = new Padding(3, 4, 3, 4); - dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 25; - dataGridView.Size = new Size(845, 548); - dataGridView.TabIndex = 7; - // // факультетыToolStripMenuItem // факультетыToolStripMenuItem.Name = "факультетыToolStripMenuItem"; - факультетыToolStripMenuItem.Size = new Size(224, 26); + факультетыToolStripMenuItem.Size = new Size(148, 22); факультетыToolStripMenuItem.Text = "Факультеты"; факультетыToolStripMenuItem.Click += факультетыToolStripMenuItem_Click; // // направленияToolStripMenuItem // направленияToolStripMenuItem.Name = "направленияToolStripMenuItem"; - направленияToolStripMenuItem.Size = new Size(224, 26); + направленияToolStripMenuItem.Size = new Size(148, 22); направленияToolStripMenuItem.Text = "Направления"; направленияToolStripMenuItem.Click += направленияToolStripMenuItem_Click; // // студентыToolStripMenuItem // студентыToolStripMenuItem.Name = "студентыToolStripMenuItem"; - студентыToolStripMenuItem.Size = new Size(224, 26); + студентыToolStripMenuItem.Size = new Size(148, 22); студентыToolStripMenuItem.Text = "Студенты"; студентыToolStripMenuItem.Click += студентыToolStripMenuItem_Click; // + // buttonAdd + // + buttonAdd.Location = new Point(17, 32); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(171, 39); + buttonAdd.TabIndex = 3; + buttonAdd.Text = "Добавить 1000 строк"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // groupBox1 + // + groupBox1.Controls.Add(labelDelete); + groupBox1.Controls.Add(buttonDelete); + groupBox1.Controls.Add(labelUpdate); + groupBox1.Controls.Add(buttonUpdate); + groupBox1.Controls.Add(labelGet); + groupBox1.Controls.Add(buttonGet); + groupBox1.Controls.Add(labelAdd); + groupBox1.Controls.Add(buttonAdd); + groupBox1.Location = new Point(12, 37); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(382, 275); + groupBox1.TabIndex = 4; + groupBox1.TabStop = false; + groupBox1.Text = "Тесты:"; + // + // labelAdd + // + labelAdd.AutoSize = true; + labelAdd.Location = new Point(314, 44); + labelAdd.Name = "labelAdd"; + labelAdd.Size = new Size(31, 15); + labelAdd.TabIndex = 4; + labelAdd.Text = "0 мс"; + // + // labelGet + // + labelGet.AutoSize = true; + labelGet.Location = new Point(314, 106); + labelGet.Name = "labelGet"; + labelGet.Size = new Size(31, 15); + labelGet.TabIndex = 6; + labelGet.Text = "0 мс"; + // + // buttonGet + // + buttonGet.Location = new Point(17, 94); + buttonGet.Name = "buttonGet"; + buttonGet.Size = new Size(171, 39); + buttonGet.TabIndex = 5; + buttonGet.Text = "Получение 1000 строк"; + buttonGet.UseVisualStyleBackColor = true; + buttonGet.Click += buttonGet_Click; + // + // labelUpdate + // + labelUpdate.AutoSize = true; + labelUpdate.Location = new Point(314, 171); + labelUpdate.Name = "labelUpdate"; + labelUpdate.Size = new Size(31, 15); + labelUpdate.TabIndex = 8; + labelUpdate.Text = "0 мс"; + // + // buttonUpdate + // + buttonUpdate.Location = new Point(17, 159); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(171, 39); + buttonUpdate.TabIndex = 7; + buttonUpdate.Text = "Обновление 1000 строк"; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += buttonUpdate_Click; + // + // labelDelete + // + labelDelete.AutoSize = true; + labelDelete.Location = new Point(314, 235); + labelDelete.Name = "labelDelete"; + labelDelete.Size = new Size(31, 15); + labelDelete.TabIndex = 10; + labelDelete.Text = "0 мс"; + // + // buttonDelete + // + buttonDelete.Location = new Point(17, 223); + buttonDelete.Name = "buttonDelete"; + buttonDelete.Size = new Size(171, 39); + buttonDelete.TabIndex = 9; + buttonDelete.Text = "Удаление 1000 строк"; + buttonDelete.UseVisualStyleBackColor = true; + buttonDelete.Click += buttonDelete_Click; + // // FormMain // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1088, 587); - Controls.Add(buttonRefresh); - Controls.Add(dataGridView); + ClientSize = new Size(411, 325); + Controls.Add(groupBox1); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; + Margin = new Padding(3, 2, 3, 2); Name = "FormMain"; Text = "Списки студентов на зачисление"; menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -121,10 +201,17 @@ private MenuStrip menuStrip1; private ToolStripMenuItem справочникиToolStripMenuItem; - private Button buttonRefresh; - private DataGridView dataGridView; private ToolStripMenuItem факультетыToolStripMenuItem; private ToolStripMenuItem направленияToolStripMenuItem; private ToolStripMenuItem студентыToolStripMenuItem; + private Button buttonAdd; + private GroupBox groupBox1; + private Label labelAdd; + private Label labelDelete; + private Button buttonDelete; + private Label labelUpdate; + private Button buttonUpdate; + private Label labelGet; + private Button buttonGet; } } \ No newline at end of file diff --git a/StudentEnrollment/StudentEnrollmentView/FormMain.cs b/StudentEnrollment/StudentEnrollmentView/FormMain.cs index 2203380..824b0eb 100644 --- a/StudentEnrollment/StudentEnrollmentView/FormMain.cs +++ b/StudentEnrollment/StudentEnrollmentView/FormMain.cs @@ -1,4 +1,7 @@ -namespace StudentEnrollmentView +using StudentEnrollmentContracts.BindingModels; +using StudentEnrollmentContracts.BusinessLogicContracts; + +namespace StudentEnrollmentView { public partial class FormMain : Form { @@ -36,5 +39,71 @@ Form.ShowDialog(); } } + + private void buttonAdd_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(IFacultyLogic)); + if (service is IFacultyLogic logic) + { + DateTime startTime = DateTime.Now; + for (int i = 0; i < 1000; i++) + { + logic.Create(new FacultyBindingModel + { + FacultyName = "факультет " + i, + }); + } + DateTime endTime = DateTime.Now; + labelAdd.Text = $"{(endTime - startTime).TotalMilliseconds} мс"; + } + } + private void buttonGet_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(IFacultyLogic)); + if (service is IFacultyLogic logic) + { + DateTime startTime = DateTime.Now; + logic.ReadList(null); + DateTime endTime = DateTime.Now; + labelGet.Text = $"{(endTime - startTime).TotalMilliseconds} мс"; + } + } + + private void buttonUpdate_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(IFacultyLogic)); + if (service is IFacultyLogic logic) + { + DateTime startTime = DateTime.Now; + for (int i = 0; i < 1000; i++) + { + logic.Update(new FacultyBindingModel + { + Id = i, + FacultyName = "новый факультет " + i, + }); + } + DateTime endTime = DateTime.Now; + labelUpdate.Text = $"{(endTime - startTime).TotalMilliseconds} мс"; + } + } + + private void buttonDelete_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(IFacultyLogic)); + if (service is IFacultyLogic logic) + { + DateTime startTime = DateTime.Now; + for (int i = 0; i < 1000; i++) + { + logic.Delete(new FacultyBindingModel + { + Id = i, + }); + } + DateTime endTime = DateTime.Now; + labelDelete.Text = $"{(endTime - startTime).TotalMilliseconds} мс"; + } + } } }