diff --git a/RenovationWork/FormMain.Designer.cs b/RenovationWork/FormMain.Designer.cs index 7e46eda..49541cb 100644 --- a/RenovationWork/FormMain.Designer.cs +++ b/RenovationWork/FormMain.Designer.cs @@ -22,150 +22,236 @@ #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() - { - menuStrip = new MenuStrip(); - refbooksToolStripMenuItem = new ToolStripMenuItem(); - componentsToolStripMenuItem = new ToolStripMenuItem(); - JobTypeToolStripMenuItem = new ToolStripMenuItem(); - dataGridView = new DataGridView(); - buttonCreateOrder = new Button(); - buttonTakeOrderInWork = new Button(); - buttonOrderReady = new Button(); - buttonIssuedOrder = new Button(); - buttonRef = new Button(); - menuStrip.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - SuspendLayout(); - // - // menuStrip - // - menuStrip.Items.AddRange(new ToolStripItem[] { refbooksToolStripMenuItem }); - menuStrip.Location = new Point(0, 0); - menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(984, 24); - menuStrip.TabIndex = 0; - menuStrip.Text = "menuStrip1"; - // - // refbooksToolStripMenuItem - // - refbooksToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, JobTypeToolStripMenuItem }); - refbooksToolStripMenuItem.Name = "refbooksToolStripMenuItem"; - refbooksToolStripMenuItem.Size = new Size(94, 20); - refbooksToolStripMenuItem.Text = "Справочники"; - // - // componentsToolStripMenuItem - // - componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; - componentsToolStripMenuItem.Size = new Size(145, 22); - componentsToolStripMenuItem.Text = "Компоненты"; - componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click; - // - // JobTypeToolStripMenuItem - // - JobTypeToolStripMenuItem.Name = "JobTypeToolStripMenuItem"; - JobTypeToolStripMenuItem.Size = new Size(145, 22); - JobTypeToolStripMenuItem.Text = "Вид работы"; - JobTypeToolStripMenuItem.Click += JobTypeToolStripMenuItem_Click; - // - // dataGridView - // - dataGridView.BackgroundColor = SystemColors.ControlLightLight; - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(12, 27); - dataGridView.Name = "dataGridView"; - dataGridView.RowTemplate.Height = 25; - dataGridView.Size = new Size(797, 341); - dataGridView.TabIndex = 1; - // - // buttonCreateOrder - // - buttonCreateOrder.Location = new Point(815, 42); - buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(157, 23); - buttonCreateOrder.TabIndex = 2; - buttonCreateOrder.Text = "Создать заказ"; - buttonCreateOrder.UseVisualStyleBackColor = true; - buttonCreateOrder.Click += buttonCreateOrder_Click; - // - // buttonTakeOrderInWork - // - buttonTakeOrderInWork.Location = new Point(815, 71); - buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - buttonTakeOrderInWork.Size = new Size(157, 23); - buttonTakeOrderInWork.TabIndex = 3; - buttonTakeOrderInWork.Text = "Отладить на выполнение"; - buttonTakeOrderInWork.UseVisualStyleBackColor = true; - buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; - // - // buttonOrderReady - // - buttonOrderReady.Location = new Point(815, 100); - buttonOrderReady.Name = "buttonOrderReady"; - buttonOrderReady.Size = new Size(157, 23); - buttonOrderReady.TabIndex = 4; - buttonOrderReady.Text = "Заказ готов"; - buttonOrderReady.UseVisualStyleBackColor = true; - buttonOrderReady.Click += buttonOrderReady_Click; - // - // buttonIssuedOrder - // - buttonIssuedOrder.Location = new Point(815, 129); - buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(157, 23); - buttonIssuedOrder.TabIndex = 5; - buttonIssuedOrder.Text = "Заказ выдан"; - buttonIssuedOrder.UseVisualStyleBackColor = true; - buttonIssuedOrder.Click += buttonIssuedOrder_Click; - // - // buttonRef - // - buttonRef.Location = new Point(815, 158); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(157, 23); - buttonRef.TabIndex = 6; - buttonRef.Text = "Обновить список"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += buttonRef_Click; - // - // FormMain - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(984, 370); - Controls.Add(buttonRef); - Controls.Add(buttonIssuedOrder); - Controls.Add(buttonOrderReady); - Controls.Add(buttonTakeOrderInWork); - Controls.Add(buttonCreateOrder); - Controls.Add(dataGridView); - Controls.Add(menuStrip); - MainMenuStrip = menuStrip; - Name = "FormMain"; - Text = "Ремонтные работы"; - Load += FormMain_Load; - menuStrip.ResumeLayout(false); - menuStrip.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - ResumeLayout(false); - PerformLayout(); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + menuStrip = new MenuStrip(); + refbooksToolStripMenuItem = new ToolStripMenuItem(); + componentsToolStripMenuItem = new ToolStripMenuItem(); + JobTypeToolStripMenuItem = new ToolStripMenuItem(); + ClientsToolStripMenuItem = new ToolStripMenuItem(); + ImplementersToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + listComponentsToolStripMenuItem = new ToolStripMenuItem(); + componentRepairsПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); + OrdersToolStripMenuItem = new ToolStripMenuItem(); + StartWorkingToolStripMenuItem = new ToolStripMenuItem(); + mailToolStripMenuItem = new ToolStripMenuItem(); + createBackUpToolStripMenuItem = new ToolStripMenuItem(); + dataGridView = new DataGridView(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonOrderReady = new Button(); + buttonIssuedOrder = new Button(); + buttonRef = new Button(); + menuStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { refbooksToolStripMenuItem, отчетыToolStripMenuItem, StartWorkingToolStripMenuItem, mailToolStripMenuItem, createBackUpToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(1236, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip1"; + // + // refbooksToolStripMenuItem + // + refbooksToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, JobTypeToolStripMenuItem, ClientsToolStripMenuItem, ImplementersToolStripMenuItem }); + refbooksToolStripMenuItem.Name = "refbooksToolStripMenuItem"; + refbooksToolStripMenuItem.Size = new Size(94, 20); + refbooksToolStripMenuItem.Text = "Справочники"; + // + // componentsToolStripMenuItem + // + componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; + componentsToolStripMenuItem.Size = new Size(149, 22); + componentsToolStripMenuItem.Text = "Компоненты"; + componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click; + // + // JobTypeToolStripMenuItem + // + JobTypeToolStripMenuItem.Name = "JobTypeToolStripMenuItem"; + JobTypeToolStripMenuItem.Size = new Size(149, 22); + JobTypeToolStripMenuItem.Text = "Вид работы"; + JobTypeToolStripMenuItem.Click += JobTypeToolStripMenuItem_Click; + // + // ClientsToolStripMenuItem + // + ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem"; + ClientsToolStripMenuItem.Size = new Size(149, 22); + ClientsToolStripMenuItem.Text = "Клиенты"; + ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; + // + // ImplementersToolStripMenuItem + // + ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem"; + ImplementersToolStripMenuItem.Size = new Size(149, 22); + ImplementersToolStripMenuItem.Text = "Исполнители"; + ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { listComponentsToolStripMenuItem, componentRepairsПоИзделиямToolStripMenuItem, OrdersToolStripMenuItem }); + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(60, 20); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // listComponentsToolStripMenuItem + // + listComponentsToolStripMenuItem.Name = "listComponentsToolStripMenuItem"; + listComponentsToolStripMenuItem.Size = new Size(218, 22); + listComponentsToolStripMenuItem.Text = "Список изделий"; + listComponentsToolStripMenuItem.Click += listComponentsToolStripMenuItem_Click; + // + // componentRepairsПоИзделиямToolStripMenuItem + // + componentRepairsПоИзделиямToolStripMenuItem.Name = "componentRepairsПоИзделиямToolStripMenuItem"; + componentRepairsПоИзделиямToolStripMenuItem.Size = new Size(218, 22); + componentRepairsПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям"; + componentRepairsПоИзделиямToolStripMenuItem.Click += componentRepairsПоИзделиямToolStripMenuItem_Click; + // + // OrdersToolStripMenuItem + // + OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem"; + OrdersToolStripMenuItem.Size = new Size(218, 22); + OrdersToolStripMenuItem.Text = "Список заказов"; + OrdersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click; + // + // StartWorkingToolStripMenuItem + // + StartWorkingToolStripMenuItem.Name = "StartWorkingToolStripMenuItem"; + StartWorkingToolStripMenuItem.Size = new Size(92, 20); + StartWorkingToolStripMenuItem.Text = "Запуск работ"; + StartWorkingToolStripMenuItem.Click += StartWorkingToolStripMenuItem_Click_1; + // + // mailToolStripMenuItem + // + mailToolStripMenuItem.Name = "mailToolStripMenuItem"; + mailToolStripMenuItem.Size = new Size(62, 20); + mailToolStripMenuItem.Text = "Письма"; + mailToolStripMenuItem.Click += mailToolStripMenuItem_Click; + // + // createBackUpToolStripMenuItem + // + createBackUpToolStripMenuItem.Name = "createBackUpToolStripMenuItem"; + createBackUpToolStripMenuItem.Size = new Size(97, 20); + createBackUpToolStripMenuItem.Text = "Создать бекап"; + createBackUpToolStripMenuItem.Click += createBackUpToolStripMenuItem_Click; + // + // dataGridView + // + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(12, 27); + dataGridView.Name = "dataGridView"; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(1049, 341); + dataGridView.TabIndex = 1; + // + // buttonCreateOrder + // + buttonCreateOrder.ImageAlign = ContentAlignment.MiddleRight; + buttonCreateOrder.Location = new Point(1067, 42); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(157, 23); + buttonCreateOrder.TabIndex = 2; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += buttonCreateOrder_Click; + // + // buttonTakeOrderInWork + // + buttonTakeOrderInWork.ImageAlign = ContentAlignment.MiddleRight; + buttonTakeOrderInWork.Location = new Point(1067, 71); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(157, 23); + buttonTakeOrderInWork.TabIndex = 3; + buttonTakeOrderInWork.Text = "Отладить на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; + // + // buttonOrderReady + // + buttonOrderReady.ImageAlign = ContentAlignment.MiddleRight; + buttonOrderReady.Location = new Point(1067, 100); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(157, 23); + buttonOrderReady.TabIndex = 4; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += buttonOrderReady_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.ImageAlign = ContentAlignment.MiddleRight; + buttonIssuedOrder.Location = new Point(1067, 129); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(157, 23); + buttonIssuedOrder.TabIndex = 5; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += buttonIssuedOrder_Click; + // + // buttonRef + // + buttonRef.ImageAlign = ContentAlignment.MiddleRight; + buttonRef.Location = new Point(1067, 158); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(157, 23); + buttonRef.TabIndex = 6; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // FormMain + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1236, 370); + Controls.Add(buttonRef); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonOrderReady); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormMain"; + Text = "Ремонтные работы"; + Load += FormMain_Load; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } #endregion - private MenuStrip menuStrip; - private ToolStripMenuItem refbooksToolStripMenuItem; - private ToolStripMenuItem componentsToolStripMenuItem; - private ToolStripMenuItem JobTypeToolStripMenuItem; - private DataGridView dataGridView; - private Button buttonCreateOrder; - private Button buttonTakeOrderInWork; - private Button buttonOrderReady; - private Button buttonIssuedOrder; - private Button buttonRef; - } + private MenuStrip menuStrip; + private ToolStripMenuItem refbooksToolStripMenuItem; + private ToolStripMenuItem componentsToolStripMenuItem; + private ToolStripMenuItem JobTypeToolStripMenuItem; + private DataGridView dataGridView; + private Button buttonCreateOrder; + private Button buttonTakeOrderInWork; + private Button buttonOrderReady; + private Button buttonIssuedOrder; + private Button buttonRef; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem listComponentsToolStripMenuItem; + private ToolStripMenuItem componentRepairsПоИзделиямToolStripMenuItem; + private ToolStripMenuItem OrdersToolStripMenuItem; + private ToolStripMenuItem ClientsToolStripMenuItem; + private ToolStripMenuItem ImplementersToolStripMenuItem; + private ToolStripMenuItem StartWorkingToolStripMenuItem; + private ToolStripMenuItem mailToolStripMenuItem; + private ToolStripMenuItem createBackUpToolStripMenuItem; + } } \ No newline at end of file diff --git a/RenovationWork/FormMain.cs b/RenovationWork/FormMain.cs index d143cbe..c2db2d1 100644 --- a/RenovationWork/FormMain.cs +++ b/RenovationWork/FormMain.cs @@ -150,10 +150,84 @@ namespace RenovationWorkView } } - private void buttonRef_Click(object sender, EventArgs e) - { - LoadData(); - } - } -} + private void buttonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + private void listComponentsToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveRepairsToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } + + private void componentRepairsПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); + } + + private void OrdersToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); + } + + private void ClientsToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); + } + + private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); + } + + private void StartWorkingToolStripMenuItem_Click_1(object sender, EventArgs e) + { + _workProcess.DoWork(DependencyManager.Instance.Resolve(), _orderLogic); + MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void mailToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); + } + + private void createBackUpToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (_backUpLogic != null) + { + var fbd = new FolderBrowserDialog(); + if (fbd.ShowDialog() == DialogResult.OK) + { + _backUpLogic.CreateBackUp(new BackUpSaveBinidngModel + { + FolderName = fbd.SelectedPath + }); + MessageBox.Show("Бекап создан", "Сообщение", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка создания бэкапа", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } +} diff --git a/RenovationWork/Program.cs b/RenovationWork/Program.cs index 419c2af..e844572 100644 --- a/RenovationWork/Program.cs +++ b/RenovationWork/Program.cs @@ -30,19 +30,37 @@ namespace RenovationWorkView option.SetMinimumLevel(LogLevel.Information); option.AddNLog("nlog.config"); }); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - } - } + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(true); + + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + private static void MailCheck(object obj) => DependencyManager.Instance.Resolve()?.MailCheck(); + } } \ No newline at end of file diff --git a/RenovationWorkListImplement/DataListSingleton.cs b/RenovationWorkListImplement/DataListSingleton.cs index c1e46cf..3716305 100644 --- a/RenovationWorkListImplement/DataListSingleton.cs +++ b/RenovationWorkListImplement/DataListSingleton.cs @@ -13,12 +13,18 @@ namespace RenovationWorkListImplement public List Components { get; set; } public List Orders { get; set; } public List Repairs { get; set; } - private DataListSingleton() + public List Clients { get; set; } + public List Implementers { get; set; } + public List Messages { get; set; } + private DataListSingleton() { Components = new List(); Orders = new List(); Repairs = new List(); - } + Clients = new List(); + Implementers = new List(); + Messages = new List(); + } public static DataListSingleton GetInstance() { if (_instance == null)