From a0ea4e27b1b6c8d22abca24e3704b76479fbca78 Mon Sep 17 00:00:00 2001 From: goldfest Date: Sat, 4 May 2024 01:50:16 +0400 Subject: [PATCH] =?UTF-8?q?1000=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9=20=D1=82=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Transportlog/FormMain.Designer.cs | 102 +++++++++++------- Transportlog/Transportlog/FormMain.cs | 31 +++++- 2 files changed, 89 insertions(+), 44 deletions(-) diff --git a/Transportlog/Transportlog/FormMain.Designer.cs b/Transportlog/Transportlog/FormMain.Designer.cs index e1b50b2..a9b1cfb 100644 --- a/Transportlog/Transportlog/FormMain.Designer.cs +++ b/Transportlog/Transportlog/FormMain.Designer.cs @@ -38,19 +38,21 @@ rentalToolStripMenuItem = new ToolStripMenuItem(); cargotransportToolStripMenuItem = new ToolStripMenuItem(); cargoordersToolStripMenuItem = new ToolStripMenuItem(); - buttonTest = new Button(); - textBoxTest = new TextBox(); + buttonTest1 = new Button(); + textBoxTest1 = new TextBox(); + textBoxTest2 = new TextBox(); + buttonTest2 = new Button(); menuStrip1.SuspendLayout(); SuspendLayout(); // // menuStrip1 // + menuStrip1.BackColor = SystemColors.ActiveCaption; menuStrip1.ImageScalingSize = new Size(20, 20); menuStrip1.Items.AddRange(new ToolStripItem[] { tablesToolStripMenuItem }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(7, 3, 0, 3); - menuStrip1.Size = new Size(497, 30); + menuStrip1.Size = new Size(570, 24); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // @@ -58,98 +60,118 @@ // tablesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { cargoToolStripMenuItem, transportToolStripMenuItem, carModelToolStripMenuItem, branchToolStripMenuItem, clientToolStripMenuItem, rentalToolStripMenuItem, cargotransportToolStripMenuItem, cargoordersToolStripMenuItem }); tablesToolStripMenuItem.Name = "tablesToolStripMenuItem"; - tablesToolStripMenuItem.Size = new Size(63, 24); + tablesToolStripMenuItem.Size = new Size(50, 20); tablesToolStripMenuItem.Text = "tables"; // // cargoToolStripMenuItem // cargoToolStripMenuItem.Name = "cargoToolStripMenuItem"; - cargoToolStripMenuItem.Size = new Size(224, 26); + cargoToolStripMenuItem.Size = new Size(157, 22); cargoToolStripMenuItem.Text = "cargo"; cargoToolStripMenuItem.Click += cargoToolStripMenuItem_Click; // // transportToolStripMenuItem // transportToolStripMenuItem.Name = "transportToolStripMenuItem"; - transportToolStripMenuItem.Size = new Size(224, 26); + transportToolStripMenuItem.Size = new Size(157, 22); transportToolStripMenuItem.Text = "transport"; transportToolStripMenuItem.Click += transportToolStripMenuItem_Click; // // carModelToolStripMenuItem // carModelToolStripMenuItem.Name = "carModelToolStripMenuItem"; - carModelToolStripMenuItem.Size = new Size(224, 26); + carModelToolStripMenuItem.Size = new Size(157, 22); carModelToolStripMenuItem.Text = "warehouse"; carModelToolStripMenuItem.Click += warehouseToolStripMenuItem_Click; // // branchToolStripMenuItem // branchToolStripMenuItem.Name = "branchToolStripMenuItem"; - branchToolStripMenuItem.Size = new Size(224, 26); + branchToolStripMenuItem.Size = new Size(157, 22); branchToolStripMenuItem.Text = "driver"; branchToolStripMenuItem.Click += driverToolStripMenuItem_Click; // // clientToolStripMenuItem // clientToolStripMenuItem.Name = "clientToolStripMenuItem"; - clientToolStripMenuItem.Size = new Size(224, 26); + clientToolStripMenuItem.Size = new Size(157, 22); clientToolStripMenuItem.Text = "routes"; clientToolStripMenuItem.Click += routesToolStripMenuItem_Click; // // rentalToolStripMenuItem // rentalToolStripMenuItem.Name = "rentalToolStripMenuItem"; - rentalToolStripMenuItem.Size = new Size(224, 26); + rentalToolStripMenuItem.Size = new Size(157, 22); rentalToolStripMenuItem.Text = "orders"; rentalToolStripMenuItem.Click += ordersToolStripMenuItem_Click; // // cargotransportToolStripMenuItem // cargotransportToolStripMenuItem.Name = "cargotransportToolStripMenuItem"; - cargotransportToolStripMenuItem.Size = new Size(224, 26); + cargotransportToolStripMenuItem.Size = new Size(157, 22); cargotransportToolStripMenuItem.Text = "cargo_transport"; cargotransportToolStripMenuItem.Click += cargo_transportToolStripMenuItem_Click; // // cargoordersToolStripMenuItem // cargoordersToolStripMenuItem.Name = "cargoordersToolStripMenuItem"; - cargoordersToolStripMenuItem.Size = new Size(224, 26); + cargoordersToolStripMenuItem.Size = new Size(157, 22); cargoordersToolStripMenuItem.Text = "cargo_orders"; cargoordersToolStripMenuItem.Click += cargo_ordersToolStripMenuItem_Click; // - // buttonTest + // buttonTest1 // - buttonTest.BackColor = SystemColors.Highlight; - buttonTest.Font = new Font("Showcard Gothic", 19.8000011F, FontStyle.Regular, GraphicsUnit.Point); - buttonTest.ForeColor = SystemColors.ActiveCaption; - buttonTest.Location = new Point(151, 96); - buttonTest.Margin = new Padding(3, 4, 3, 4); - buttonTest.Name = "buttonTest"; - buttonTest.Size = new Size(204, 114); - buttonTest.TabIndex = 1; - buttonTest.Text = "Тест"; - buttonTest.UseVisualStyleBackColor = false; - buttonTest.Click += buttonTest_Click; + buttonTest1.BackColor = SystemColors.Highlight; + buttonTest1.Font = new Font("Microsoft Sans Serif", 19.8000011F, FontStyle.Regular, GraphicsUnit.Point); + buttonTest1.ForeColor = SystemColors.ActiveCaption; + buttonTest1.Location = new Point(12, 73); + buttonTest1.Name = "buttonTest1"; + buttonTest1.Size = new Size(232, 86); + buttonTest1.TabIndex = 1; + buttonTest1.Text = "Тест"; + buttonTest1.UseVisualStyleBackColor = false; + buttonTest1.Click += buttonTest1_Click; // - // textBoxTest + // textBoxTest1 // - textBoxTest.Location = new Point(111, 36); - textBoxTest.Margin = new Padding(3, 4, 3, 4); - textBoxTest.Multiline = true; - textBoxTest.Name = "textBoxTest"; - textBoxTest.Size = new Size(286, 52); - textBoxTest.TabIndex = 2; + textBoxTest1.Location = new Point(12, 27); + textBoxTest1.Multiline = true; + textBoxTest1.Name = "textBoxTest1"; + textBoxTest1.Size = new Size(232, 40); + textBoxTest1.TabIndex = 2; + // + // textBoxTest2 + // + textBoxTest2.Location = new Point(326, 27); + textBoxTest2.Multiline = true; + textBoxTest2.Name = "textBoxTest2"; + textBoxTest2.Size = new Size(232, 40); + textBoxTest2.TabIndex = 3; + // + // buttonTest2 + // + buttonTest2.BackColor = SystemColors.Highlight; + buttonTest2.Font = new Font("Microsoft Sans Serif", 19.8000011F, FontStyle.Regular, GraphicsUnit.Point); + buttonTest2.ForeColor = SystemColors.ActiveCaption; + buttonTest2.Location = new Point(326, 73); + buttonTest2.Name = "buttonTest2"; + buttonTest2.Size = new Size(232, 86); + buttonTest2.TabIndex = 4; + buttonTest2.Text = "Тест"; + buttonTest2.UseVisualStyleBackColor = false; + buttonTest2.Click += buttonTest2_Click; // // FormMain // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(497, 223); - Controls.Add(textBoxTest); - Controls.Add(buttonTest); + ClientSize = new Size(570, 167); + Controls.Add(buttonTest2); + Controls.Add(textBoxTest2); + Controls.Add(textBoxTest1); + Controls.Add(buttonTest1); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; - Margin = new Padding(3, 4, 3, 4); Name = "FormMain"; Text = "FormMain"; menuStrip1.ResumeLayout(false); @@ -167,10 +189,12 @@ private ToolStripMenuItem branchToolStripMenuItem; private ToolStripMenuItem clientToolStripMenuItem; private ToolStripMenuItem rentalToolStripMenuItem; - private Button buttonTest; - private TextBox textBoxTest; + private Button buttonTest1; + private TextBox textBoxTest1; private ToolStripMenuItem transportToolStripMenuItem; private ToolStripMenuItem cargotransportToolStripMenuItem; private ToolStripMenuItem cargoordersToolStripMenuItem; + private TextBox textBoxTest2; + private Button buttonTest2; } } \ No newline at end of file diff --git a/Transportlog/Transportlog/FormMain.cs b/Transportlog/Transportlog/FormMain.cs index d51e403..04d0a66 100644 --- a/Transportlog/Transportlog/FormMain.cs +++ b/Transportlog/Transportlog/FormMain.cs @@ -82,19 +82,40 @@ namespace Forms } } - - private void buttonTest_Click(object sender, EventArgs e) + private void buttonTest1_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(Abstractions)); if (service is Abstractions bd) { - var cars = bd.GetCargos(); - int id = cars.Last().id; + var cargos = bd.GetCargos(); + int id = cargos.Last().id; DateTime startTime = DateTime.Now; bd.DeleteCargo(id); DateTime endTime = DateTime.Now; - textBoxTest.Text = $"Время выполнения запроса: {(endTime - startTime).TotalMilliseconds} миллисекунд"; + textBoxTest1.Text = $"Время выполнения запроса: {(endTime - startTime).TotalMilliseconds} миллисекунд"; + } + } + private void buttonTest2_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(Abstractions)); + if (service is Abstractions bd) + { + DateTime startTime = DateTime.Now; + for (int i = 0; i < 1000; i++) + { + Cargo cargo = new Cargo + { + Name = "Груз " + i, + Description = "Описание груза " + i, + Weight = i * 10, + Type = "Тип груза " + i + }; + bd.AddCargo(cargo); + } + DateTime endTime = DateTime.Now; + + textBoxTest2.Text = $"Добавление 1000 строк выполнено за {(endTime - startTime).TotalMilliseconds} миллисекунд"; } } }