diff --git a/BeautySalon/BeautySalon/FormCheques.Designer.cs b/BeautySalon/BeautySalon/FormCheques.Designer.cs index 1486d3c..b46497a 100644 --- a/BeautySalon/BeautySalon/FormCheques.Designer.cs +++ b/BeautySalon/BeautySalon/FormCheques.Designer.cs @@ -32,12 +32,15 @@ dataGridView = new DataGridView(); buttonUpdate = new Button(); buttonCreate = new Button(); + numericUpDownSize = new NumericUpDown(); + buttonGenerated = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit(); SuspendLayout(); // // buttonDelete // - buttonDelete.Location = new Point(928, 352); + buttonDelete.Location = new Point(928, 228); buttonDelete.Name = "buttonDelete"; buttonDelete.Size = new Size(147, 56); buttonDelete.TabIndex = 13; @@ -56,12 +59,12 @@ dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 51; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(880, 450); + dataGridView.Size = new Size(880, 516); dataGridView.TabIndex = 10; // // buttonUpdate // - buttonUpdate.Location = new Point(928, 190); + buttonUpdate.Location = new Point(928, 135); buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Size = new Size(147, 56); buttonUpdate.TabIndex = 15; @@ -79,11 +82,31 @@ buttonCreate.UseVisualStyleBackColor = true; buttonCreate.Click += buttonCreate_Click; // + // numericUpDownSize + // + numericUpDownSize.Location = new Point(928, 363); + numericUpDownSize.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + numericUpDownSize.Name = "numericUpDownSize"; + numericUpDownSize.Size = new Size(147, 27); + numericUpDownSize.TabIndex = 17; + // + // buttonGenerated + // + buttonGenerated.Location = new Point(928, 424); + buttonGenerated.Name = "buttonGenerated"; + buttonGenerated.Size = new Size(147, 56); + buttonGenerated.TabIndex = 16; + buttonGenerated.Text = "Сгенерировать записи"; + buttonGenerated.UseVisualStyleBackColor = true; + buttonGenerated.Click += buttonGenerated_Click; + // // FormCheques // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1120, 450); + ClientSize = new Size(1120, 516); + Controls.Add(numericUpDownSize); + Controls.Add(buttonGenerated); Controls.Add(buttonUpdate); Controls.Add(buttonCreate); Controls.Add(buttonDelete); @@ -92,6 +115,7 @@ Text = "Чеки"; Load += FormCheques_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit(); ResumeLayout(false); } @@ -101,5 +125,7 @@ private DataGridView dataGridView; private Button buttonUpdate; private Button buttonCreate; + private NumericUpDown numericUpDownSize; + private Button buttonGenerated; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormCheques.cs b/BeautySalon/BeautySalon/FormCheques.cs index 42a74cb..34414b9 100644 --- a/BeautySalon/BeautySalon/FormCheques.cs +++ b/BeautySalon/BeautySalon/FormCheques.cs @@ -1,6 +1,7 @@ using BeautySalonDBModels; using BeautySalonDBModels.Implements; using BeautySalonDBModels.Models; +using System.Diagnostics; namespace BeautySalon { @@ -98,5 +99,40 @@ namespace BeautySalon } } } + + private void buttonGenerated_Click(object sender, EventArgs e) + { + try + { + int size = (int)numericUpDownSize.Value; + int[] array = new int[size]; + + Stopwatch sw = new Stopwatch(); + sw.Start(); + for (int i = 0; i < array.Length; i++) + { + chequeStorage.Add(new Cheque + { + MasterId = 33, + ServiceId = 40, + ClientId = i % 2 + 2, + Price = i * 10, + DateReception = DateTime.Now, + }); + } + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Generate receptions", nano, sec); + form.ShowDialog(); + + LoadData(); + } + catch (Exception) + { + + throw; + } + } } } diff --git a/BeautySalon/BeautySalon/FormClient.cs b/BeautySalon/BeautySalon/FormClient.cs index 04578ca..a5d7c30 100644 --- a/BeautySalon/BeautySalon/FormClient.cs +++ b/BeautySalon/BeautySalon/FormClient.cs @@ -1,5 +1,6 @@ using BeautySalonDBModels; using BeautySalonDBModels.Models; +using System.Diagnostics; namespace BeautySalon { @@ -32,7 +33,15 @@ namespace BeautySalon FIO = textBoxFIO.Text, Age = (int)numericUpDownAge.Value, }; + Stopwatch sw = new Stopwatch(); + sw.Start(); clientStorage.Update(newClient); + sw.Stop(); + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + long sec = sw.ElapsedMilliseconds; + FormTimeOperation form = new FormTimeOperation("Update", nano, sec); + form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) { DialogResult = DialogResult.OK; Close(); } } else { @@ -41,7 +50,15 @@ namespace BeautySalon FIO = textBoxFIO.Text, Age = (int)numericUpDownAge.Value, }; + Stopwatch sw = new Stopwatch(); + sw.Start(); clientStorage.Add(newClient); + sw.Stop(); + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + long sec = sw.ElapsedMilliseconds; + FormTimeOperation form = new FormTimeOperation("Insert", nano, sec); + form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) { DialogResult = DialogResult.OK; Close(); } } DialogResult = DialogResult.OK; Close(); diff --git a/BeautySalon/BeautySalon/FormClients.Designer.cs b/BeautySalon/BeautySalon/FormClients.Designer.cs index 0e5688e..21608b0 100644 --- a/BeautySalon/BeautySalon/FormClients.Designer.cs +++ b/BeautySalon/BeautySalon/FormClients.Designer.cs @@ -32,12 +32,15 @@ buttonUpdate = new Button(); buttonCreate = new Button(); dataGridView = new DataGridView(); + numericUpDownSize = new NumericUpDown(); + buttonGenerated = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit(); SuspendLayout(); // // buttonDelete // - buttonDelete.Location = new Point(480, 356); + buttonDelete.Location = new Point(748, 227); buttonDelete.Name = "buttonDelete"; buttonDelete.Size = new Size(147, 56); buttonDelete.TabIndex = 7; @@ -47,7 +50,7 @@ // // buttonUpdate // - buttonUpdate.Location = new Point(480, 186); + buttonUpdate.Location = new Point(748, 131); buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Size = new Size(147, 56); buttonUpdate.TabIndex = 6; @@ -57,7 +60,7 @@ // // buttonCreate // - buttonCreate.Location = new Point(480, 25); + buttonCreate.Location = new Point(748, 33); buttonCreate.Name = "buttonCreate"; buttonCreate.Size = new Size(147, 56); buttonCreate.TabIndex = 5; @@ -76,14 +79,34 @@ dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 51; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(417, 450); + dataGridView.Size = new Size(688, 514); dataGridView.TabIndex = 4; // + // numericUpDownSize + // + numericUpDownSize.Location = new Point(748, 376); + numericUpDownSize.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + numericUpDownSize.Name = "numericUpDownSize"; + numericUpDownSize.Size = new Size(147, 27); + numericUpDownSize.TabIndex = 15; + // + // buttonGenerated + // + buttonGenerated.Location = new Point(748, 437); + buttonGenerated.Name = "buttonGenerated"; + buttonGenerated.Size = new Size(147, 56); + buttonGenerated.TabIndex = 14; + buttonGenerated.Text = "Сгенерировать записи"; + buttonGenerated.UseVisualStyleBackColor = true; + buttonGenerated.Click += buttonGenerated_Click; + // // FormClients // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(683, 450); + ClientSize = new Size(952, 514); + Controls.Add(numericUpDownSize); + Controls.Add(buttonGenerated); Controls.Add(buttonDelete); Controls.Add(buttonUpdate); Controls.Add(buttonCreate); @@ -92,6 +115,7 @@ Text = "Клиенты"; Load += FormClients_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit(); ResumeLayout(false); } @@ -101,5 +125,7 @@ private Button buttonUpdate; private Button buttonCreate; private DataGridView dataGridView; + private NumericUpDown numericUpDownSize; + private Button buttonGenerated; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormClients.cs b/BeautySalon/BeautySalon/FormClients.cs index 3053bb2..ede40e8 100644 --- a/BeautySalon/BeautySalon/FormClients.cs +++ b/BeautySalon/BeautySalon/FormClients.cs @@ -1,5 +1,7 @@ using BeautySalonDBModels; using BeautySalonDBModels.Models; +using System.Diagnostics; +using System.Net; namespace BeautySalon { @@ -22,7 +24,15 @@ namespace BeautySalon private void LoadData() { + Stopwatch sw = new Stopwatch(); + sw.Start(); var list = clientStorage.GetObjects(); + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("LoadData", nano, sec); + form.ShowDialog(); + if (list != null) { dataGridView.DataSource = list; @@ -70,10 +80,51 @@ namespace BeautySalon if(dataGridView.SelectedRows.Count == 1) { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ClientId"].Value); + + Stopwatch sw = new Stopwatch(); + sw.Start(); clientStorage.Remove(id); + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Delete", nano, sec); + form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) { DialogResult = DialogResult.OK; Close(); } + LoadData(); } } + + private void buttonGenerated_Click(object sender, EventArgs e) + { + try + { + int size = (int)numericUpDownSize.Value; + int[] array = new int[size]; + Stopwatch sw = new Stopwatch(); + sw.Start(); + for (int i = 0; i < array.Length; i++) + { + clientStorage.Add(new Client + { + FIO = i.ToString(), + Age = i, + }); + } + LoadData(); + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Generate and loadData", nano, sec); + form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) { DialogResult = DialogResult.OK; Close(); } + } + catch (Exception) + { + + throw; + } + } } } diff --git a/BeautySalon/BeautySalon/FormMain.Designer.cs b/BeautySalon/BeautySalon/FormMain.Designer.cs index e2c4ea2..4eee240 100644 --- a/BeautySalon/BeautySalon/FormMain.Designer.cs +++ b/BeautySalon/BeautySalon/FormMain.Designer.cs @@ -72,8 +72,8 @@ // добавитьToolStripMenuItem1 // добавитьToolStripMenuItem1.Name = "добавитьToolStripMenuItem1"; - добавитьToolStripMenuItem1.Size = new Size(83, 24); - добавитьToolStripMenuItem1.Text = "Клиенты"; + добавитьToolStripMenuItem1.Size = new Size(169, 24); + добавитьToolStripMenuItem1.Text = "Регистрация клиента"; добавитьToolStripMenuItem1.Click += добавитьToolStripMenuItem1_Click; // // создатьПриемToolStripMenuItem @@ -84,8 +84,8 @@ // посмотретьЧекиToolStripMenuItem // посмотретьЧекиToolStripMenuItem.Name = "посмотретьЧекиToolStripMenuItem"; - посмотретьЧекиToolStripMenuItem.Size = new Size(57, 24); - посмотретьЧекиToolStripMenuItem.Text = "Чеки"; + посмотретьЧекиToolStripMenuItem.Size = new Size(172, 24); + посмотретьЧекиToolStripMenuItem.Text = "Запись на процедуру"; посмотретьЧекиToolStripMenuItem.Click += посмотретьЧекиToolStripMenuItem_Click; // // FormMain diff --git a/BeautySalon/BeautySalon/FormMasters.Designer.cs b/BeautySalon/BeautySalon/FormMasters.Designer.cs index 61b6519..64518ce 100644 --- a/BeautySalon/BeautySalon/FormMasters.Designer.cs +++ b/BeautySalon/BeautySalon/FormMasters.Designer.cs @@ -32,7 +32,10 @@ buttonDelete = new Button(); buttonUpdate = new Button(); buttonCreate = new Button(); + numericUpDownSize = new NumericUpDown(); + buttonGenerated = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit(); SuspendLayout(); // // dataGridView @@ -51,7 +54,7 @@ // // buttonDelete // - buttonDelete.Location = new Point(604, 361); + buttonDelete.Location = new Point(604, 215); buttonDelete.Name = "buttonDelete"; buttonDelete.Size = new Size(147, 56); buttonDelete.TabIndex = 6; @@ -61,7 +64,7 @@ // // buttonUpdate // - buttonUpdate.Location = new Point(604, 191); + buttonUpdate.Location = new Point(604, 122); buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Size = new Size(147, 56); buttonUpdate.TabIndex = 5; @@ -79,11 +82,31 @@ buttonCreate.UseVisualStyleBackColor = true; buttonCreate.Click += buttonCreate_Click; // + // numericUpDownSize + // + numericUpDownSize.Location = new Point(604, 310); + numericUpDownSize.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + numericUpDownSize.Name = "numericUpDownSize"; + numericUpDownSize.Size = new Size(147, 27); + numericUpDownSize.TabIndex = 13; + // + // buttonGenerated + // + buttonGenerated.Location = new Point(604, 371); + buttonGenerated.Name = "buttonGenerated"; + buttonGenerated.Size = new Size(147, 56); + buttonGenerated.TabIndex = 12; + buttonGenerated.Text = "Сгенерировать записи"; + buttonGenerated.UseVisualStyleBackColor = true; + buttonGenerated.Click += buttonGenerated_Click; + // // FormMasters // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); + Controls.Add(numericUpDownSize); + Controls.Add(buttonGenerated); Controls.Add(buttonDelete); Controls.Add(buttonUpdate); Controls.Add(buttonCreate); @@ -92,6 +115,7 @@ Text = "Мастера"; Load += FormMasters_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit(); ResumeLayout(false); } @@ -101,5 +125,7 @@ private Button buttonDelete; private Button buttonUpdate; private Button buttonCreate; + private NumericUpDown numericUpDownSize; + private Button buttonGenerated; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormMasters.cs b/BeautySalon/BeautySalon/FormMasters.cs index d433d70..2e2e3dd 100644 --- a/BeautySalon/BeautySalon/FormMasters.cs +++ b/BeautySalon/BeautySalon/FormMasters.cs @@ -1,6 +1,7 @@ using BeautySalonDBModels; using BeautySalonDBModels.Implements; using BeautySalonDBModels.Models; +using System.Diagnostics; namespace BeautySalon { @@ -86,5 +87,35 @@ namespace BeautySalon { LoadData(); } + + private void buttonGenerated_Click(object sender, EventArgs e) + { + try + { + int size = (int)numericUpDownSize.Value; + int[] array = new int[size]; + Stopwatch sw = new Stopwatch(); + sw.Start(); + for (int i = 0; i < array.Length; i++) + { + masterDb.Add(new Master + { + FIO = i.ToString(), + SpecialisationId = 15, + }); + } + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Generate masters", nano, sec); + form.ShowDialog(); + LoadData(); + } + catch (Exception) + { + + throw; + } + } } } diff --git a/BeautySalon/BeautySalon/FormServices.Designer.cs b/BeautySalon/BeautySalon/FormServices.Designer.cs index e4aa452..900022d 100644 --- a/BeautySalon/BeautySalon/FormServices.Designer.cs +++ b/BeautySalon/BeautySalon/FormServices.Designer.cs @@ -32,7 +32,10 @@ buttonDelete = new Button(); buttonUpdate = new Button(); buttonCreate = new Button(); + numericUpDownSize = new NumericUpDown(); + buttonGenerated = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit(); SuspendLayout(); // // dataGridView @@ -51,7 +54,7 @@ // // buttonDelete // - buttonDelete.Location = new Point(553, 365); + buttonDelete.Location = new Point(553, 224); buttonDelete.Name = "buttonDelete"; buttonDelete.Size = new Size(147, 56); buttonDelete.TabIndex = 9; @@ -61,7 +64,7 @@ // // buttonUpdate // - buttonUpdate.Location = new Point(553, 195); + buttonUpdate.Location = new Point(553, 127); buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Size = new Size(147, 56); buttonUpdate.TabIndex = 8; @@ -79,11 +82,31 @@ buttonCreate.UseVisualStyleBackColor = true; buttonCreate.Click += buttonCreate_Click; // + // numericUpDownSize + // + numericUpDownSize.Location = new Point(553, 311); + numericUpDownSize.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + numericUpDownSize.Name = "numericUpDownSize"; + numericUpDownSize.Size = new Size(147, 27); + numericUpDownSize.TabIndex = 11; + // + // buttonGenerated + // + buttonGenerated.Location = new Point(553, 372); + buttonGenerated.Name = "buttonGenerated"; + buttonGenerated.Size = new Size(147, 56); + buttonGenerated.TabIndex = 10; + buttonGenerated.Text = "Сгенерировать записи"; + buttonGenerated.UseVisualStyleBackColor = true; + buttonGenerated.Click += buttonGenerated_Click; + // // FormServices // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(752, 450); + Controls.Add(numericUpDownSize); + Controls.Add(buttonGenerated); Controls.Add(buttonDelete); Controls.Add(buttonUpdate); Controls.Add(buttonCreate); @@ -92,6 +115,7 @@ Text = "Услуги"; Load += FormServices_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit(); ResumeLayout(false); } @@ -101,5 +125,7 @@ private Button buttonDelete; private Button buttonUpdate; private Button buttonCreate; + private NumericUpDown numericUpDownSize; + private Button buttonGenerated; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormServices.cs b/BeautySalon/BeautySalon/FormServices.cs index c241036..cbaf5a4 100644 --- a/BeautySalon/BeautySalon/FormServices.cs +++ b/BeautySalon/BeautySalon/FormServices.cs @@ -1,6 +1,7 @@ using BeautySalonDBModels.Models; using BeautySalonDBModels; using BeautySalonDBModels.Implements; +using System.Diagnostics; namespace BeautySalon { @@ -85,5 +86,38 @@ namespace BeautySalon { LoadData(); } + + private void buttonGenerated_Click(object sender, EventArgs e) + { + try + { + int size = (int)numericUpDownSize.Value; + int[] array = new int[size]; + + Stopwatch sw = Stopwatch.StartNew(); + sw.Start(); + for (int i = 0; i < array.Length; i++) + { + serviceStorage.Add(new Service + { + ServiceName = i.ToString(), + SpecialisationId = 14, + Price = i * 10 + }) ; + } + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Generate services", nano, sec); + form.ShowDialog(); + + LoadData(); + } + catch (Exception) + { + + throw; + } + } } } diff --git a/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs index 9cbde97..d685be4 100644 --- a/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs +++ b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs @@ -32,7 +32,10 @@ buttonCreate = new Button(); buttonDelete = new Button(); buttonUpdate = new Button(); + buttonGenerated = new Button(); + numericUpDownSize = new NumericUpDown(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit(); SuspendLayout(); // // dataGridView @@ -46,7 +49,7 @@ dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 51; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(417, 450); + dataGridView.Size = new Size(417, 466); dataGridView.TabIndex = 0; // // buttonCreate @@ -61,7 +64,7 @@ // // buttonDelete // - buttonDelete.Location = new Point(476, 362); + buttonDelete.Location = new Point(476, 212); buttonDelete.Name = "buttonDelete"; buttonDelete.Size = new Size(147, 56); buttonDelete.TabIndex = 3; @@ -71,7 +74,7 @@ // // buttonUpdate // - buttonUpdate.Location = new Point(476, 192); + buttonUpdate.Location = new Point(476, 121); buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Size = new Size(147, 56); buttonUpdate.TabIndex = 2; @@ -79,11 +82,31 @@ buttonUpdate.UseVisualStyleBackColor = true; buttonUpdate.Click += buttonUpdate_Click; // + // buttonGenerated + // + buttonGenerated.Location = new Point(476, 382); + buttonGenerated.Name = "buttonGenerated"; + buttonGenerated.Size = new Size(147, 56); + buttonGenerated.TabIndex = 4; + buttonGenerated.Text = "Сгенерировать записи"; + buttonGenerated.UseVisualStyleBackColor = true; + buttonGenerated.Click += buttonGenerated_Click; + // + // numericUpDownSize + // + numericUpDownSize.Location = new Point(476, 321); + numericUpDownSize.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + numericUpDownSize.Name = "numericUpDownSize"; + numericUpDownSize.Size = new Size(147, 27); + numericUpDownSize.TabIndex = 5; + // // FormSpecialisations // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(678, 450); + ClientSize = new Size(678, 466); + Controls.Add(numericUpDownSize); + Controls.Add(buttonGenerated); Controls.Add(buttonDelete); Controls.Add(buttonUpdate); Controls.Add(buttonCreate); @@ -92,6 +115,7 @@ Text = "Специализации"; Load += FormSpecialisations_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit(); ResumeLayout(false); } @@ -101,5 +125,7 @@ private Button buttonCreate; private Button buttonDelete; private Button buttonUpdate; + private Button buttonGenerated; + private NumericUpDown numericUpDownSize; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormSpecialisations.cs b/BeautySalon/BeautySalon/FormSpecialisations.cs index b1c51f1..e5010e6 100644 --- a/BeautySalon/BeautySalon/FormSpecialisations.cs +++ b/BeautySalon/BeautySalon/FormSpecialisations.cs @@ -1,11 +1,11 @@ using BeautySalonDBModels; using BeautySalonDBModels.Models; +using System.Diagnostics; namespace BeautySalon { public partial class FormSpecialisations : Form { - private int? _id; public int Id { @@ -72,5 +72,36 @@ namespace BeautySalon LoadData(); } } + + private void buttonGenerated_Click(object sender, EventArgs e) + { + try + { + int size = (int)numericUpDownSize.Value; + int[] array = new int[size]; + + Stopwatch sw = Stopwatch.StartNew(); + sw.Start(); + for(int i = 0; i < array.Length; i++) + { + specialisationDB.Add(new Specialisation + { + Name = i.ToString(), + }); + } + sw.Stop(); + long sec = sw.ElapsedMilliseconds; + long nano = sw.ElapsedTicks * 1000000000L / Stopwatch.Frequency; + FormTimeOperation form = new FormTimeOperation("Generate specialisations", nano, sec); + form.ShowDialog(); + + LoadData(); + } + catch (Exception) + { + + throw; + } + } } } diff --git a/BeautySalon/BeautySalon/FormTimeOperation.Designer.cs b/BeautySalon/BeautySalon/FormTimeOperation.Designer.cs new file mode 100644 index 0000000..604066d --- /dev/null +++ b/BeautySalon/BeautySalon/FormTimeOperation.Designer.cs @@ -0,0 +1,58 @@ +namespace BeautySalon +{ + partial class FormTimeOperation + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelTimeOperation = new Label(); + SuspendLayout(); + // + // labelTimeOperation + // + labelTimeOperation.AutoSize = true; + labelTimeOperation.Location = new Point(14, 9); + labelTimeOperation.Name = "labelTimeOperation"; + labelTimeOperation.Size = new Size(28, 20); + labelTimeOperation.TabIndex = 1; + labelTimeOperation.Text = "0,0"; + // + // FormTimeOperation + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(562, 178); + Controls.Add(labelTimeOperation); + Name = "FormTimeOperation"; + Text = "Время выполнения"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private Label labelTimeOperation; + } +} \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormTimeOperation.cs b/BeautySalon/BeautySalon/FormTimeOperation.cs new file mode 100644 index 0000000..e48bc7a --- /dev/null +++ b/BeautySalon/BeautySalon/FormTimeOperation.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BeautySalon +{ + public partial class FormTimeOperation : Form + { + public FormTimeOperation(string operation, long nano, long sec) + { + InitializeComponent(); + labelTimeOperation.Text = $"Время выполнения операции {operation} \nсоставило '{nano}'\nнаносекунд\nи '{sec}' милисекунд"; + } + } +} diff --git a/BeautySalon/BeautySalon/FormTimeOperation.resx b/BeautySalon/BeautySalon/FormTimeOperation.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/BeautySalon/BeautySalon/FormTimeOperation.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BeautySalon/BeautySalon/Program.cs b/BeautySalon/BeautySalon/Program.cs index c7690a8..cc695be 100644 --- a/BeautySalon/BeautySalon/Program.cs +++ b/BeautySalon/BeautySalon/Program.cs @@ -63,6 +63,8 @@ namespace BeautySalon services.AddTransient(); services.AddTransient(); + + services.AddTransient(); } } } \ No newline at end of file