PIbd22_Kamcharova_K.A_hard_lab1

This commit is contained in:
mayday 2024-06-22 16:29:31 +04:00
parent febd548e04
commit 9bec306e6a
4 changed files with 350 additions and 166 deletions

View File

@ -32,6 +32,15 @@
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();
@ -44,16 +53,16 @@
//
// menuStrip
//
menuStrip.Items.AddRange(new ToolStripItem[] { refbooksToolStripMenuItem });
menuStrip.Items.AddRange(new ToolStripItem[] { refbooksToolStripMenuItem, отчетыToolStripMenuItem, StartWorkingToolStripMenuItem, mailToolStripMenuItem, createBackUpToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(984, 24);
menuStrip.Size = new Size(1236, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1";
//
// refbooksToolStripMenuItem
//
refbooksToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, JobTypeToolStripMenuItem });
refbooksToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, JobTypeToolStripMenuItem, ClientsToolStripMenuItem, ImplementersToolStripMenuItem });
refbooksToolStripMenuItem.Name = "refbooksToolStripMenuItem";
refbooksToolStripMenuItem.Size = new Size(94, 20);
refbooksToolStripMenuItem.Text = "Справочники";
@ -61,17 +70,80 @@
// componentsToolStripMenuItem
//
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
componentsToolStripMenuItem.Size = new Size(145, 22);
componentsToolStripMenuItem.Size = new Size(149, 22);
componentsToolStripMenuItem.Text = "Компоненты";
componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click;
//
// JobTypeToolStripMenuItem
//
JobTypeToolStripMenuItem.Name = "JobTypeToolStripMenuItem";
JobTypeToolStripMenuItem.Size = new Size(145, 22);
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;
@ -79,12 +151,13 @@
dataGridView.Location = new Point(12, 27);
dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(797, 341);
dataGridView.Size = new Size(1049, 341);
dataGridView.TabIndex = 1;
//
// buttonCreateOrder
//
buttonCreateOrder.Location = new Point(815, 42);
buttonCreateOrder.ImageAlign = ContentAlignment.MiddleRight;
buttonCreateOrder.Location = new Point(1067, 42);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(157, 23);
buttonCreateOrder.TabIndex = 2;
@ -94,7 +167,8 @@
//
// buttonTakeOrderInWork
//
buttonTakeOrderInWork.Location = new Point(815, 71);
buttonTakeOrderInWork.ImageAlign = ContentAlignment.MiddleRight;
buttonTakeOrderInWork.Location = new Point(1067, 71);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(157, 23);
buttonTakeOrderInWork.TabIndex = 3;
@ -104,7 +178,8 @@
//
// buttonOrderReady
//
buttonOrderReady.Location = new Point(815, 100);
buttonOrderReady.ImageAlign = ContentAlignment.MiddleRight;
buttonOrderReady.Location = new Point(1067, 100);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(157, 23);
buttonOrderReady.TabIndex = 4;
@ -114,7 +189,8 @@
//
// buttonIssuedOrder
//
buttonIssuedOrder.Location = new Point(815, 129);
buttonIssuedOrder.ImageAlign = ContentAlignment.MiddleRight;
buttonIssuedOrder.Location = new Point(1067, 129);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(157, 23);
buttonIssuedOrder.TabIndex = 5;
@ -124,7 +200,8 @@
//
// buttonRef
//
buttonRef.Location = new Point(815, 158);
buttonRef.ImageAlign = ContentAlignment.MiddleRight;
buttonRef.Location = new Point(1067, 158);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(157, 23);
buttonRef.TabIndex = 6;
@ -136,7 +213,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(984, 370);
ClientSize = new Size(1236, 370);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonOrderReady);
@ -167,5 +244,14 @@
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;
}
}

View File

@ -154,6 +154,80 @@ namespace RenovationWorkView
{
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<FormReportRepairComponents>();
form.ShowDialog();
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
form.ShowDialog();
}
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormClients>();
form.ShowDialog();
}
private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormImplementers>();
form.ShowDialog();
}
private void StartWorkingToolStripMenuItem_Click_1(object sender, EventArgs e)
{
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void mailToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormMail>();
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);
}
}
}
}

View File

@ -30,19 +30,37 @@ namespace RenovationWorkView
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IRepairStorage, RepairStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IRepairLogic, RepairLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormRepair>();
services.AddTransient<FormRepairComponent>();
services.AddTransient<FormRepairs>();
}
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<IRepairLogic, RepairLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<FormMain>();
DependencyManager.Instance.RegisterType<FormComponent>();
DependencyManager.Instance.RegisterType<FormComponents>();
DependencyManager.Instance.RegisterType<FormCreateOrder>();
DependencyManager.Instance.RegisterType<FormRepair>();
DependencyManager.Instance.RegisterType<FormRepairComponent>();
DependencyManager.Instance.RegisterType<FormRepairs>();
DependencyManager.Instance.RegisterType<FormReportOrders>();
DependencyManager.Instance.RegisterType<FormReportRepairComponents>();
DependencyManager.Instance.RegisterType<FormClients>();
DependencyManager.Instance.RegisterType<FormImplementers>();
DependencyManager.Instance.RegisterType<FormImplementer>();
DependencyManager.Instance.RegisterType<FormMail>();
}
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
}
}

View File

@ -13,11 +13,17 @@ namespace RenovationWorkListImplement
public List<Component> Components { get; set; }
public List<Order> Orders { get; set; }
public List<Repair> Repairs { get; set; }
public List<Client> Clients { get; set; }
public List<Implementer> Implementers { get; set; }
public List<MessageInfo> Messages { get; set; }
private DataListSingleton()
{
Components = new List<Component>();
Orders = new List<Order>();
Repairs = new List<Repair>();
Clients = new List<Client>();
Implementers = new List<Implementer>();
Messages = new List<MessageInfo>();
}
public static DataListSingleton GetInstance()
{