From 324a62181506af6471b1948f2ed36ee0d00f392d Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Tue, 9 May 2023 15:00:49 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DBMSContext.cs | 12 + .../TransportCompamyMongoDBImplementer.csproj | 9 + TransportCompany/TransportCompany.sln | 8 +- TransportCompany/TransportCompany/App.config | 2 +- .../TransportCompany/FormTrucking.Designer.cs | 515 +++++++++--------- .../TransportCompany/FormTrucking.cs | 336 +++++++----- .../TransportCompany/TransportCompany.csproj | 1 + .../BusinessLogic/ClientLogic.cs | 1 + .../ElegevContext.cs | 1 + 9 files changed, 482 insertions(+), 403 deletions(-) create mode 100644 TransportCompany/TransportCompamyMongoDBImplementer/DBMSContext.cs create mode 100644 TransportCompany/TransportCompamyMongoDBImplementer/TransportCompamyMongoDBImplementer.csproj diff --git a/TransportCompany/TransportCompamyMongoDBImplementer/DBMSContext.cs b/TransportCompany/TransportCompamyMongoDBImplementer/DBMSContext.cs new file mode 100644 index 0000000..9f8c15c --- /dev/null +++ b/TransportCompany/TransportCompamyMongoDBImplementer/DBMSContext.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TransportCompamyMongoDBImplementer +{ + public class DBMSContext + { + } +} diff --git a/TransportCompany/TransportCompamyMongoDBImplementer/TransportCompamyMongoDBImplementer.csproj b/TransportCompany/TransportCompamyMongoDBImplementer/TransportCompamyMongoDBImplementer.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/TransportCompany/TransportCompamyMongoDBImplementer/TransportCompamyMongoDBImplementer.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/TransportCompany/TransportCompany.sln b/TransportCompany/TransportCompany.sln index 209a19b..d09fee8 100644 --- a/TransportCompany/TransportCompany.sln +++ b/TransportCompany/TransportCompany.sln @@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyContracts", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyBusinessLogic", "TransportCompanyBusinessLogic\TransportCompanyBusinessLogic.csproj", "{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyDatabaseImplements", "TransportCompanyDatabaseImplements\TransportCompanyDatabaseImplements.csproj", "{E421890B-5501-4A4D-931A-1B8139FDDB24}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyDatabaseImplements", "TransportCompanyDatabaseImplements\TransportCompanyDatabaseImplements.csproj", "{E421890B-5501-4A4D-931A-1B8139FDDB24}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompamyMongoDBImplementer", "TransportCompamyMongoDBImplementer\TransportCompamyMongoDBImplementer.csproj", "{5315CD03-FC5D-4ECB-9973-38989C1B02EE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,6 +41,10 @@ Global {E421890B-5501-4A4D-931A-1B8139FDDB24}.Debug|Any CPU.Build.0 = Debug|Any CPU {E421890B-5501-4A4D-931A-1B8139FDDB24}.Release|Any CPU.ActiveCfg = Release|Any CPU {E421890B-5501-4A4D-931A-1B8139FDDB24}.Release|Any CPU.Build.0 = Release|Any CPU + {5315CD03-FC5D-4ECB-9973-38989C1B02EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5315CD03-FC5D-4ECB-9973-38989C1B02EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5315CD03-FC5D-4ECB-9973-38989C1B02EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5315CD03-FC5D-4ECB-9973-38989C1B02EE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/TransportCompany/TransportCompany/App.config b/TransportCompany/TransportCompany/App.config index 3cd7446..9277687 100644 --- a/TransportCompany/TransportCompany/App.config +++ b/TransportCompany/TransportCompany/App.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/TransportCompany/TransportCompany/FormTrucking.Designer.cs b/TransportCompany/TransportCompany/FormTrucking.Designer.cs index 35a895b..754373a 100644 --- a/TransportCompany/TransportCompany/FormTrucking.Designer.cs +++ b/TransportCompany/TransportCompany/FormTrucking.Designer.cs @@ -1,261 +1,270 @@ namespace TransportCompany { - partial class FormTrucking - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; + partial class FormTrucking + { + /// + /// 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); - } + /// + /// 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 + #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() - { - dataGridView = new DataGridView(); - buttonCreateTrucking = new Button(); - menuStrip = new MenuStrip(); - toolStripMenuItem = new ToolStripMenuItem(); - transportToolStripMenuItem = new ToolStripMenuItem(); - typeTransportationToolStripMenuItem = new ToolStripMenuItem(); - cargoToolStripMenuItem = new ToolStripMenuItem(); - clientToolStripMenuItem = new ToolStripMenuItem(); - rndGenerationToolStripMenuItem = new ToolStripMenuItem(); - generationClientsToolStripMenuItem = new ToolStripMenuItem(); - generationTruckingsToolStripMenuItem = new ToolStripMenuItem(); - testTimeGetDataToolStripMenuItem = new ToolStripMenuItem(); - buttonUpdate = new Button(); - comboBoxEmails = new ComboBox(); - label1 = new Label(); - checkBoxSorted = new CheckBox(); - checkBoxForFilterMode = new CheckBox(); - testComplexQueriesToolStripMenuItem = new ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - menuStrip.SuspendLayout(); - SuspendLayout(); - // - // dataGridView - // - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(11, 67); - dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(937, 417); - dataGridView.TabIndex = 0; - // - // buttonCreateTrucking - // - buttonCreateTrucking.Location = new Point(1014, 67); - buttonCreateTrucking.Name = "buttonCreateTrucking"; - buttonCreateTrucking.Size = new Size(235, 29); - buttonCreateTrucking.TabIndex = 1; - buttonCreateTrucking.Text = "Создать перевозку"; - buttonCreateTrucking.UseVisualStyleBackColor = true; - buttonCreateTrucking.Click += ButtonCreateTrucking_Click; - // - // menuStrip - // - menuStrip.ImageScalingSize = new Size(20, 20); - menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, rndGenerationToolStripMenuItem, testTimeGetDataToolStripMenuItem, testComplexQueriesToolStripMenuItem }); - menuStrip.Location = new Point(0, 0); - menuStrip.Name = "menuStrip"; - menuStrip.Padding = new Padding(6, 3, 0, 3); - menuStrip.Size = new Size(1297, 30); - menuStrip.TabIndex = 6; - menuStrip.Text = "menuStrip1"; - // - // toolStripMenuItem - // - toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { transportToolStripMenuItem, typeTransportationToolStripMenuItem, cargoToolStripMenuItem, clientToolStripMenuItem }); - toolStripMenuItem.Name = "toolStripMenuItem"; - toolStripMenuItem.Size = new Size(117, 24); - toolStripMenuItem.Text = "Справочники"; - // - // transportToolStripMenuItem - // - transportToolStripMenuItem.Name = "transportToolStripMenuItem"; - transportToolStripMenuItem.Size = new Size(245, 26); - transportToolStripMenuItem.Text = "Транспорт"; - transportToolStripMenuItem.Click += TransportToolStripMenuItem_Click; - // - // typeTransportationToolStripMenuItem - // - typeTransportationToolStripMenuItem.Name = "typeTransportationToolStripMenuItem"; - typeTransportationToolStripMenuItem.Size = new Size(245, 26); - typeTransportationToolStripMenuItem.Text = "Тип транспортировки"; - typeTransportationToolStripMenuItem.Click += TypeTransportationToolStripMenuItem_Click; - // - // cargoToolStripMenuItem - // - cargoToolStripMenuItem.Name = "cargoToolStripMenuItem"; - cargoToolStripMenuItem.Size = new Size(245, 26); - cargoToolStripMenuItem.Text = "Груз"; - cargoToolStripMenuItem.Click += CargoToolStripMenuItem_Click; - // - // clientToolStripMenuItem - // - clientToolStripMenuItem.Name = "clientToolStripMenuItem"; - clientToolStripMenuItem.Size = new Size(245, 26); - clientToolStripMenuItem.Text = "Клиенты"; - clientToolStripMenuItem.Click += ClientToolStripMenuItem_Click; - // - // rndGenerationToolStripMenuItem - // - rndGenerationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { generationClientsToolStripMenuItem, generationTruckingsToolStripMenuItem }); - rndGenerationToolStripMenuItem.Name = "rndGenerationToolStripMenuItem"; - rndGenerationToolStripMenuItem.Size = new Size(179, 24); - rndGenerationToolStripMenuItem.Text = "Рандомная генерация"; - // - // generationClientsToolStripMenuItem - // - generationClientsToolStripMenuItem.Name = "generationClientsToolStripMenuItem"; - generationClientsToolStripMenuItem.Size = new Size(245, 26); - generationClientsToolStripMenuItem.Text = "Генерация клиентов"; - generationClientsToolStripMenuItem.Click += GenerationClientsToolStripMenuItem_Click; - // - // generationTruckingsToolStripMenuItem - // - generationTruckingsToolStripMenuItem.Name = "generationTruckingsToolStripMenuItem"; - generationTruckingsToolStripMenuItem.Size = new Size(245, 26); - generationTruckingsToolStripMenuItem.Text = "Генерация перевозок"; - generationTruckingsToolStripMenuItem.Click += GenerationTruckingsToolStripMenuItem_Click; - // - // testTimeGetDataToolStripMenuItem - // - testTimeGetDataToolStripMenuItem.Name = "testTimeGetDataToolStripMenuItem"; - testTimeGetDataToolStripMenuItem.Size = new Size(227, 24); - testTimeGetDataToolStripMenuItem.Text = "Тест скорости чтения данных"; - testTimeGetDataToolStripMenuItem.Click += TestTimeGetDataToolStripMenuItem_Click; - // - // buttonUpdate - // - buttonUpdate.Location = new Point(1014, 138); - buttonUpdate.Name = "buttonUpdate"; - buttonUpdate.Size = new Size(235, 29); - buttonUpdate.TabIndex = 7; - buttonUpdate.Text = "Обновить"; - buttonUpdate.UseVisualStyleBackColor = true; - buttonUpdate.Click += ButtonUpdate_Click; - // - // comboBoxEmails - // - comboBoxEmails.FormattingEnabled = true; - comboBoxEmails.Location = new Point(142, 33); - comboBoxEmails.Name = "comboBoxEmails"; - comboBoxEmails.Size = new Size(208, 28); - comboBoxEmails.TabIndex = 8; - comboBoxEmails.SelectedIndexChanged += ComboBoxEmails_SelectedIndexChanged; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(12, 36); - label1.Name = "label1"; - label1.Size = new Size(124, 20); - label1.TabIndex = 9; - label1.Text = "Выберите почту:"; - // - // checkBoxSorted - // - checkBoxSorted.AutoSize = true; - checkBoxSorted.Location = new Point(632, 35); - checkBoxSorted.Name = "checkBoxSorted"; - checkBoxSorted.Size = new Size(316, 24); - checkBoxSorted.TabIndex = 10; - checkBoxSorted.Text = "Сортировать по возрастанию стоимости"; - checkBoxSorted.UseVisualStyleBackColor = true; - checkBoxSorted.CheckedChanged += CheckBoxSorted_CheckedChanged; - // - // checkBoxForFilterMode - // - checkBoxForFilterMode.AutoSize = true; - checkBoxForFilterMode.Location = new Point(370, 35); - checkBoxForFilterMode.Name = "checkBoxForFilterMode"; - checkBoxForFilterMode.Size = new Size(212, 24); - checkBoxForFilterMode.TabIndex = 11; - checkBoxForFilterMode.Text = "Включить режим фильтра"; - checkBoxForFilterMode.UseVisualStyleBackColor = true; - // - // testComplexQueriesToolStripMenuItem - // - testComplexQueriesToolStripMenuItem.Name = "testComplexQueriesToolStripMenuItem"; - testComplexQueriesToolStripMenuItem.Size = new Size(188, 24); - testComplexQueriesToolStripMenuItem.Text = "Тест сложных запросов"; - testComplexQueriesToolStripMenuItem.Click += TestComplexQueriesToolStripMenuItem_Click; - // - // FormTrucking - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1297, 496); - Controls.Add(checkBoxForFilterMode); - Controls.Add(checkBoxSorted); - Controls.Add(label1); - Controls.Add(comboBoxEmails); - Controls.Add(buttonUpdate); - Controls.Add(buttonCreateTrucking); - Controls.Add(dataGridView); - Controls.Add(menuStrip); - MainMenuStrip = menuStrip; - Name = "FormTrucking"; - Text = "Перевозки"; - Load += FormMain_Load; - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - menuStrip.ResumeLayout(false); - menuStrip.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + buttonCreateTrucking = new Button(); + menuStrip = new MenuStrip(); + toolStripMenuItem = new ToolStripMenuItem(); + transportToolStripMenuItem = new ToolStripMenuItem(); + typeTransportationToolStripMenuItem = new ToolStripMenuItem(); + cargoToolStripMenuItem = new ToolStripMenuItem(); + clientToolStripMenuItem = new ToolStripMenuItem(); + rndGenerationToolStripMenuItem = new ToolStripMenuItem(); + generationClientsToolStripMenuItem = new ToolStripMenuItem(); + generationTruckingsToolStripMenuItem = new ToolStripMenuItem(); + testTimeGetDataToolStripMenuItem = new ToolStripMenuItem(); + testComplexQueriesToolStripMenuItem = new ToolStripMenuItem(); + buttonUpdate = new Button(); + comboBoxEmails = new ComboBox(); + label1 = new Label(); + checkBoxSorted = new CheckBox(); + checkBoxForFilterMode = new CheckBox(); + createJsonFilesToolStripMenuItem = new ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(11, 67); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(937, 417); + dataGridView.TabIndex = 0; + // + // buttonCreateTrucking + // + buttonCreateTrucking.Location = new Point(1014, 67); + buttonCreateTrucking.Name = "buttonCreateTrucking"; + buttonCreateTrucking.Size = new Size(235, 29); + buttonCreateTrucking.TabIndex = 1; + buttonCreateTrucking.Text = "Создать перевозку"; + buttonCreateTrucking.UseVisualStyleBackColor = true; + buttonCreateTrucking.Click += ButtonCreateTrucking_Click; + // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, rndGenerationToolStripMenuItem, testTimeGetDataToolStripMenuItem, testComplexQueriesToolStripMenuItem, createJsonFilesToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Padding = new Padding(6, 3, 0, 3); + menuStrip.Size = new Size(1297, 30); + menuStrip.TabIndex = 6; + menuStrip.Text = "menuStrip1"; + // + // toolStripMenuItem + // + toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { transportToolStripMenuItem, typeTransportationToolStripMenuItem, cargoToolStripMenuItem, clientToolStripMenuItem }); + toolStripMenuItem.Name = "toolStripMenuItem"; + toolStripMenuItem.Size = new Size(117, 24); + toolStripMenuItem.Text = "Справочники"; + // + // transportToolStripMenuItem + // + transportToolStripMenuItem.Name = "transportToolStripMenuItem"; + transportToolStripMenuItem.Size = new Size(245, 26); + transportToolStripMenuItem.Text = "Транспорт"; + transportToolStripMenuItem.Click += TransportToolStripMenuItem_Click; + // + // typeTransportationToolStripMenuItem + // + typeTransportationToolStripMenuItem.Name = "typeTransportationToolStripMenuItem"; + typeTransportationToolStripMenuItem.Size = new Size(245, 26); + typeTransportationToolStripMenuItem.Text = "Тип транспортировки"; + typeTransportationToolStripMenuItem.Click += TypeTransportationToolStripMenuItem_Click; + // + // cargoToolStripMenuItem + // + cargoToolStripMenuItem.Name = "cargoToolStripMenuItem"; + cargoToolStripMenuItem.Size = new Size(245, 26); + cargoToolStripMenuItem.Text = "Груз"; + cargoToolStripMenuItem.Click += CargoToolStripMenuItem_Click; + // + // clientToolStripMenuItem + // + clientToolStripMenuItem.Name = "clientToolStripMenuItem"; + clientToolStripMenuItem.Size = new Size(245, 26); + clientToolStripMenuItem.Text = "Клиенты"; + clientToolStripMenuItem.Click += ClientToolStripMenuItem_Click; + // + // rndGenerationToolStripMenuItem + // + rndGenerationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { generationClientsToolStripMenuItem, generationTruckingsToolStripMenuItem }); + rndGenerationToolStripMenuItem.Name = "rndGenerationToolStripMenuItem"; + rndGenerationToolStripMenuItem.Size = new Size(179, 24); + rndGenerationToolStripMenuItem.Text = "Рандомная генерация"; + // + // generationClientsToolStripMenuItem + // + generationClientsToolStripMenuItem.Name = "generationClientsToolStripMenuItem"; + generationClientsToolStripMenuItem.Size = new Size(245, 26); + generationClientsToolStripMenuItem.Text = "Генерация клиентов"; + generationClientsToolStripMenuItem.Click += GenerationClientsToolStripMenuItem_Click; + // + // generationTruckingsToolStripMenuItem + // + generationTruckingsToolStripMenuItem.Name = "generationTruckingsToolStripMenuItem"; + generationTruckingsToolStripMenuItem.Size = new Size(245, 26); + generationTruckingsToolStripMenuItem.Text = "Генерация перевозок"; + generationTruckingsToolStripMenuItem.Click += GenerationTruckingsToolStripMenuItem_Click; + // + // testTimeGetDataToolStripMenuItem + // + testTimeGetDataToolStripMenuItem.Name = "testTimeGetDataToolStripMenuItem"; + testTimeGetDataToolStripMenuItem.Size = new Size(227, 24); + testTimeGetDataToolStripMenuItem.Text = "Тест скорости чтения данных"; + testTimeGetDataToolStripMenuItem.Click += TestTimeGetDataToolStripMenuItem_Click; + // + // testComplexQueriesToolStripMenuItem + // + testComplexQueriesToolStripMenuItem.Name = "testComplexQueriesToolStripMenuItem"; + testComplexQueriesToolStripMenuItem.Size = new Size(188, 24); + testComplexQueriesToolStripMenuItem.Text = "Тест сложных запросов"; + testComplexQueriesToolStripMenuItem.Click += TestComplexQueriesToolStripMenuItem_Click; + // + // buttonUpdate + // + buttonUpdate.Location = new Point(1014, 138); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(235, 29); + buttonUpdate.TabIndex = 7; + buttonUpdate.Text = "Обновить"; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // comboBoxEmails + // + comboBoxEmails.FormattingEnabled = true; + comboBoxEmails.Location = new Point(142, 33); + comboBoxEmails.Name = "comboBoxEmails"; + comboBoxEmails.Size = new Size(208, 28); + comboBoxEmails.TabIndex = 8; + comboBoxEmails.SelectedIndexChanged += ComboBoxEmails_SelectedIndexChanged; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 36); + label1.Name = "label1"; + label1.Size = new Size(124, 20); + label1.TabIndex = 9; + label1.Text = "Выберите почту:"; + // + // checkBoxSorted + // + checkBoxSorted.AutoSize = true; + checkBoxSorted.Location = new Point(632, 35); + checkBoxSorted.Name = "checkBoxSorted"; + checkBoxSorted.Size = new Size(316, 24); + checkBoxSorted.TabIndex = 10; + checkBoxSorted.Text = "Сортировать по возрастанию стоимости"; + checkBoxSorted.UseVisualStyleBackColor = true; + checkBoxSorted.CheckedChanged += CheckBoxSorted_CheckedChanged; + // + // checkBoxForFilterMode + // + checkBoxForFilterMode.AutoSize = true; + checkBoxForFilterMode.Location = new Point(370, 35); + checkBoxForFilterMode.Name = "checkBoxForFilterMode"; + checkBoxForFilterMode.Size = new Size(212, 24); + checkBoxForFilterMode.TabIndex = 11; + checkBoxForFilterMode.Text = "Включить режим фильтра"; + checkBoxForFilterMode.UseVisualStyleBackColor = true; + // + // createJsonFilesToolStripMenuItem + // + createJsonFilesToolStripMenuItem.Name = "createJsonFilesToolStripMenuItem"; + createJsonFilesToolStripMenuItem.Size = new Size(209, 24); + createJsonFilesToolStripMenuItem.Text = "Сформировать json файлы"; + createJsonFilesToolStripMenuItem.Click += CreateJsonFilesToolStripMenuItem_Click; + // + // FormTrucking + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1297, 496); + Controls.Add(checkBoxForFilterMode); + Controls.Add(checkBoxSorted); + Controls.Add(label1); + Controls.Add(comboBoxEmails); + Controls.Add(buttonUpdate); + Controls.Add(buttonCreateTrucking); + Controls.Add(dataGridView); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormTrucking"; + Text = "Перевозки"; + Load += FormMain_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } - #endregion + #endregion - private DataGridView dataGridView; - private Button buttonCreateTrucking; - private Button buttonTakeOrderInWork; - private Button buttonOrderReady; - private Button buttonIssuedOrder; - private Button buttonRef; - private MenuStrip menuStrip; - private ToolStripMenuItem toolStripMenuItem; - private ToolStripMenuItem transportToolStripMenuItem; - private ToolStripMenuItem workPieceToolStripMenuItem; - private ToolStripMenuItem typeTransportationToolStripMenuItem; - private ToolStripMenuItem cargoToolStripMenuItem; - private ToolStripMenuItem clientToolStripMenuItem; - private ToolStripMenuItem shopToolStripMenuItem; - private ToolStripMenuItem addManufactureToolStripMenuItem; - private Button buttonSellManufacture; - private ToolStripMenuItem reportToolStripMenuItem; - private ToolStripMenuItem groupedOrdersReportToolStripMenuItem; - private ToolStripMenuItem ordersReportToolStripMenuItem; - private ToolStripMenuItem manufactureWorkPiecesReportToolStripMenuItem; - private ToolStripMenuItem shopsReportToolStripMenuItem; - private ToolStripMenuItem rndGenerationToolStripMenuItem; - private ToolStripMenuItem generationClientsToolStripMenuItem; - private ToolStripMenuItem generationTruckingsToolStripMenuItem; - private Button buttonUpdate; - private ComboBox comboBoxEmails; - private Label label1; - private CheckBox checkBoxSorted; - private CheckBox checkBoxForFilterMode; - private ToolStripMenuItem testTimeGetDataToolStripMenuItem; - private ToolStripMenuItem testComplexQueriesToolStripMenuItem; - } + private DataGridView dataGridView; + private Button buttonCreateTrucking; + private Button buttonTakeOrderInWork; + private Button buttonOrderReady; + private Button buttonIssuedOrder; + private Button buttonRef; + private MenuStrip menuStrip; + private ToolStripMenuItem toolStripMenuItem; + private ToolStripMenuItem transportToolStripMenuItem; + private ToolStripMenuItem workPieceToolStripMenuItem; + private ToolStripMenuItem typeTransportationToolStripMenuItem; + private ToolStripMenuItem cargoToolStripMenuItem; + private ToolStripMenuItem clientToolStripMenuItem; + private ToolStripMenuItem shopToolStripMenuItem; + private ToolStripMenuItem addManufactureToolStripMenuItem; + private Button buttonSellManufacture; + private ToolStripMenuItem reportToolStripMenuItem; + private ToolStripMenuItem groupedOrdersReportToolStripMenuItem; + private ToolStripMenuItem ordersReportToolStripMenuItem; + private ToolStripMenuItem manufactureWorkPiecesReportToolStripMenuItem; + private ToolStripMenuItem shopsReportToolStripMenuItem; + private ToolStripMenuItem rndGenerationToolStripMenuItem; + private ToolStripMenuItem generationClientsToolStripMenuItem; + private ToolStripMenuItem generationTruckingsToolStripMenuItem; + private Button buttonUpdate; + private ComboBox comboBoxEmails; + private Label label1; + private CheckBox checkBoxSorted; + private CheckBox checkBoxForFilterMode; + private ToolStripMenuItem testTimeGetDataToolStripMenuItem; + private ToolStripMenuItem testComplexQueriesToolStripMenuItem; + private ToolStripMenuItem createJsonFilesToolStripMenuItem; + } } \ No newline at end of file diff --git a/TransportCompany/TransportCompany/FormTrucking.cs b/TransportCompany/TransportCompany/FormTrucking.cs index e0855fc..1fc5af2 100644 --- a/TransportCompany/TransportCompany/FormTrucking.cs +++ b/TransportCompany/TransportCompany/FormTrucking.cs @@ -1,6 +1,8 @@ using Microsoft.Extensions.Logging; using System.ComponentModel; using System.Reflection; +using System.Text; +using System.Text.Json; using System.Windows.Forms; using TransportCompanyContracts.BusinessLogicsContracts; using TransportCompanyContracts.SearchModels; @@ -8,184 +10,222 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace TransportCompany { - public partial class FormTrucking : Form - { - private readonly ILogger _logger; + public partial class FormTrucking : Form + { + private readonly ILogger _logger; - private readonly ITruckingLogic _truckingLogic; + private readonly ITruckingLogic _truckingLogic; - private readonly IClientLogic _clientLogic; + private readonly IClientLogic _clientLogic; - public FormTrucking(ILogger logger, ITruckingLogic truckingLogic, IClientLogic clientLogic) - { - InitializeComponent(); + private readonly ICargoLogic _cargoLogic; - _logger = logger; - _truckingLogic = truckingLogic; - _clientLogic = clientLogic; - } + private readonly ITransportLogic _transportLogic; - private void FormMain_Load(object sender, EventArgs e) - { - LoadData(); - } + private readonly ITransportationLogic _transportationLogic; - private void LoadData() - { - _logger.LogInformation(" "); + public FormTrucking(ILogger logger, ITruckingLogic truckingLogic, IClientLogic clientLogic, + ICargoLogic cargoLogic, ITransportLogic transportLogic, ITransportationLogic transportationLogic) + { + InitializeComponent(); - try - { - var list = _truckingLogic.ReadList(null); + _logger = logger; + _truckingLogic = truckingLogic; + _clientLogic = clientLogic; + _cargoLogic = cargoLogic; + _transportLogic = transportLogic; + _transportationLogic = transportationLogic; + } - var listClients = _clientLogic.ReadList(null); + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["ClientId"].Visible = false; - dataGridView.Columns["CargoId"].Visible = false; - dataGridView.Columns["TransportId"].Visible = false; - dataGridView.Columns["TransportationId"].Visible = false; - } + private void LoadData() + { + _logger.LogInformation(" "); - if (listClients != null) - { - comboBoxEmails.DisplayMember = "Email"; - comboBoxEmails.ValueMember = "Id"; - comboBoxEmails.DataSource = listClients; - comboBoxEmails.SelectedItem = null; - } + try + { + var list = _truckingLogic.ReadList(null); - _logger.LogInformation(" "); - } - catch (Exception ex) - { - _logger.LogError(ex, " "); - MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + var listClients = _clientLogic.ReadList(null); - private void ButtonCreateTrucking_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormCreateTrucking)); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["ClientId"].Visible = false; + dataGridView.Columns["CargoId"].Visible = false; + dataGridView.Columns["TransportId"].Visible = false; + dataGridView.Columns["TransportationId"].Visible = false; + } - if (service is FormCreateTrucking form) - { - form.ShowDialog(); - LoadData(); - } - } + if (listClients != null) + { + comboBoxEmails.DisplayMember = "Email"; + comboBoxEmails.ValueMember = "Id"; + comboBoxEmails.DataSource = listClients; + comboBoxEmails.SelectedItem = null; + } - private void TransportToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormTransport)); + _logger.LogInformation(" "); + } + catch (Exception ex) + { + _logger.LogError(ex, " "); + MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } - if (service is FormTransport form) - { - form.ShowDialog(); - LoadData(); - } - } + private void ButtonCreateTrucking_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCreateTrucking)); - private void CargoToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormCargo)); + if (service is FormCreateTrucking form) + { + form.ShowDialog(); + LoadData(); + } + } - if (service is FormCargo form) - { - form.ShowDialog(); - LoadData(); - } - } + private void TransportToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormTransport)); - private void ClientToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormClients)); + if (service is FormTransport form) + { + form.ShowDialog(); + LoadData(); + } + } - if (service is FormClients form) - { - form.ShowDialog(); - LoadData(); - } - } + private void CargoToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCargo)); - private void TypeTransportationToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormTypeTransportation)); + if (service is FormCargo form) + { + form.ShowDialog(); + LoadData(); + } + } - if (service is FormTypeTransportation form) - { - form.ShowDialog(); - LoadData(); - } - } + private void ClientToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormClients)); - private void GenerationClientsToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormRandomCreateClient)); + if (service is FormClients form) + { + form.ShowDialog(); + LoadData(); + } + } - if (service is FormRandomCreateClient form) - { - form.ShowDialog(); - LoadData(); - } - } + private void TypeTransportationToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormTypeTransportation)); - private void GenerationTruckingsToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormRandomCreateTrucking)); + if (service is FormTypeTransportation form) + { + form.ShowDialog(); + LoadData(); + } + } - if (service is FormRandomCreateTrucking form) - { - form.ShowDialog(); - LoadData(); - } - } + private void GenerationClientsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormRandomCreateClient)); - private void ButtonUpdate_Click(object sender, EventArgs e) - { - LoadData(); - } + if (service is FormRandomCreateClient form) + { + form.ShowDialog(); + LoadData(); + } + } - private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e) - { - if (!checkBoxForFilterMode.Checked) - { - //dataGridView.DataSource = _truckingLogic.ReadList(null); - LoadData(); - } - else - { - dataGridView.DataSource = _truckingLogic.ReadList(null).Where(x => x.ClientId == comboBoxEmails.SelectedIndex).ToList(); - } - } + private void GenerationTruckingsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormRandomCreateTrucking)); - private void CheckBoxSorted_CheckedChanged(object sender, EventArgs e) - { - dataGridView.DataSource = _truckingLogic.ReadList(null).OrderByDescending(x => x.Price).ToList(); - } + if (service is FormRandomCreateTrucking form) + { + form.ShowDialog(); + LoadData(); + } + } - private void TestTimeGetDataToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormTimeCheck)); + private void ButtonUpdate_Click(object sender, EventArgs e) + { + LoadData(); + } - if (service is FormTimeCheck form) - { - form.ShowDialog(); - LoadData(); - } - } + private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e) + { + if (!checkBoxForFilterMode.Checked) + { + //dataGridView.DataSource = _truckingLogic.ReadList(null); + LoadData(); + } + else + { + dataGridView.DataSource = _truckingLogic.ReadList(null).Where(x => x.ClientId == comboBoxEmails.SelectedIndex).ToList(); + } + } - private void TestComplexQueriesToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormCheckTimeJoin)); + private void CheckBoxSorted_CheckedChanged(object sender, EventArgs e) + { + dataGridView.DataSource = _truckingLogic.ReadList(null).OrderByDescending(x => x.Price).ToList(); + } - if (service is FormCheckTimeJoin form) - { - form.ShowDialog(); - LoadData(); - } - } - } + private void TestTimeGetDataToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormTimeCheck)); + + if (service is FormTimeCheck form) + { + form.ShowDialog(); + LoadData(); + } + } + + private void TestComplexQueriesToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCheckTimeJoin)); + + if (service is FormCheckTimeJoin form) + { + form.ShowDialog(); + LoadData(); + } + } + + private void CreateJsonFilesToolStripMenuItem_Click(object sender, EventArgs e) + { + var listTrucking = _truckingLogic.ReadList(null); + var listClients = _clientLogic.ReadList(null); + var listCargos = _cargoLogic.ReadList(null); + var listTransport = _transportLogic.ReadList(null); + var listTransportation = _transportationLogic.ReadList(null); + + string jsonList = JsonSerializer.Serialize(listClients).ToString(); + + string path = @"C:\Users\Programmist73\Desktop\JSON\"; // + + string realPath; + + for(int i = 0; i < listClients.Count; i++) + { + realPath = path + "json" + i.ToString() + ".json"; + + File.Create(realPath).Close(); + + StreamWriter writetext = new StreamWriter(realPath); + + writetext.WriteLine("{\n\t" + "\"client\" : " + "{\n\t" + "\t\"Name\" : " + "\"" + listClients[i].Name + "\"" + "\n\t}\n}"); + + writetext.Close(); + } + } + } } \ No newline at end of file diff --git a/TransportCompany/TransportCompany/TransportCompany.csproj b/TransportCompany/TransportCompany/TransportCompany.csproj index 9d2c9db..e77bdc8 100644 --- a/TransportCompany/TransportCompany/TransportCompany.csproj +++ b/TransportCompany/TransportCompany/TransportCompany.csproj @@ -22,6 +22,7 @@ + diff --git a/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/ClientLogic.cs b/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/ClientLogic.cs index 5255dbc..a1a4da4 100644 --- a/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/ClientLogic.cs +++ b/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/ClientLogic.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using TransportCompanyContracts.BindingModels; using TransportCompanyContracts.BusinessLogicsContracts; diff --git a/TransportCompany/TransportCompanyDatabaseImplements/ElegevContext.cs b/TransportCompany/TransportCompanyDatabaseImplements/ElegevContext.cs index e1cfe71..f051f23 100644 --- a/TransportCompany/TransportCompanyDatabaseImplements/ElegevContext.cs +++ b/TransportCompany/TransportCompanyDatabaseImplements/ElegevContext.cs @@ -154,6 +154,7 @@ public partial class ElegevContext : DbContext .HasMaxLength(255) .HasColumnName("transportation_type"); }); + modelBuilder.HasSequence("seq_cargo"); modelBuilder.HasSequence("seq_client"); modelBuilder.HasSequence("seq_trucking");