diff --git a/LawFirm/LawFirm/FormMain.Designer.cs b/LawFirm/LawFirm/FormMain.Designer.cs index 3c8895e..1f1e25f 100644 --- a/LawFirm/LawFirm/FormMain.Designer.cs +++ b/LawFirm/LawFirm/FormMain.Designer.cs @@ -33,7 +33,7 @@ this.бланкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.документыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.списокБланковToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.списокДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.бланкиПоДокументамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dataGridView = new System.Windows.Forms.DataGridView(); @@ -84,18 +84,19 @@ // отчетыToolStripMenuItem // this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.списокБланковToolStripMenuItem, + this.списокДокументовToolStripMenuItem, this.бланкиПоДокументамToolStripMenuItem, this.списокЗаказовToolStripMenuItem}); this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24); this.отчетыToolStripMenuItem.Text = "Отчеты"; // - // списокБланковToolStripMenuItem + // списокДокументовToolStripMenuItem // - this.списокБланковToolStripMenuItem.Name = "списокБланковToolStripMenuItem"; - this.списокБланковToolStripMenuItem.Size = new System.Drawing.Size(252, 26); - this.списокБланковToolStripMenuItem.Text = "Список бланков"; + this.списокДокументовToolStripMenuItem.Name = "списокДокументовToolStripMenuItem"; + this.списокДокументовToolStripMenuItem.Size = new System.Drawing.Size(252, 26); + this.списокДокументовToolStripMenuItem.Text = "Список документов"; + this.списокДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокДокументовToolStripMenuItem_Click); // // бланкиПоДокументамToolStripMenuItem // @@ -208,7 +209,7 @@ private Button buttonSetToFinish; private Button buttonUpdate; private ToolStripMenuItem отчетыToolStripMenuItem; - private ToolStripMenuItem списокБланковToolStripMenuItem; + private ToolStripMenuItem списокДокументовToolStripMenuItem; private ToolStripMenuItem бланкиПоДокументамToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem; } diff --git a/LawFirm/LawFirm/FormMain.cs b/LawFirm/LawFirm/FormMain.cs index 7455cdc..e2cf85a 100644 --- a/LawFirm/LawFirm/FormMain.cs +++ b/LawFirm/LawFirm/FormMain.cs @@ -1,4 +1,5 @@ using LawFirm; +using LawFirmBusinessLogic.BusinessLogics; using LawFirmContracts.BindingModels; using LawFirmContracts.BusinessLogicContracts; using LawFirmDataModels.Enums; @@ -20,11 +21,13 @@ namespace LawFirmView { private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic) + private readonly IReportLogic _reportLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportLogic; } private void FormMain_Load(object sender, EventArgs e) @@ -87,6 +90,20 @@ namespace LawFirmView } } + private void списокДокументовToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveDocumentsToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + } + private void buttonCreateOrder_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); @@ -181,7 +198,5 @@ namespace LawFirmView { LoadData(); } - - } } diff --git a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs index 702c5e6..1e80bc2 100644 --- a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ReportLogic.cs @@ -74,13 +74,13 @@ namespace LawFirmBusinessLogic.BusinessLogics .ToList(); } /// Сохранение компонент в файл-Word - public void SaveComponentsToWordFile(ReportBindingModel model) + public void SaveDocumentsToWordFile(ReportBindingModel model) { _saveToWord.CreateDoc(new WordInfo { FileName = model.FileName, - Title = "Список бланков", - Blanks = _blankStorage.GetFullList() + Title = "Список документов", + Documents = _documentStorage.GetFullList() }); } /// Сохранение компонент с указаеним продуктов в файл-Excel diff --git a/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs index e2faa19..7c5a587 100644 --- a/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/LawFirm/LawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -22,11 +22,14 @@ namespace LawFirmBusinessLogic.OfficePackage JustificationType = WordJustificationType.Center } }); - foreach (var component in info.Blanks) + foreach (var document in info.Documents) { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> {(component.BlankName, new WordTextProperties { Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> + {(document.DocumentName + " - ", new WordTextProperties { Size = "24", Bold = true}), + (document.Price.ToString(), new WordTextProperties { Size = "24", })}, + TextProperties = new WordTextProperties { Size = "24", diff --git a/LawFirm/LawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/LawFirm/LawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index 0d6bc60..1f73a5c 100644 --- a/LawFirm/LawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/LawFirm/LawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -11,6 +11,6 @@ namespace LawFirmBusinessLogic.OfficePackage.HelperModels { public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; - public List Blanks { get; set; } = new(); + public List Documents { get; set; } = new(); } } diff --git a/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs b/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs index f150ca4..08a1594 100644 --- a/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs +++ b/LawFirm/LawFirmContracts/BusinessLogicContracts/IReportLogic.cs @@ -15,7 +15,7 @@ namespace LawFirmContracts.BusinessLogicContracts /// Получение списка заказов за определенный период List GetOrders(ReportBindingModel model); /// Сохранение компонент в файл-Word - void SaveComponentsToWordFile(ReportBindingModel model); + void SaveDocumentsToWordFile(ReportBindingModel model); /// Сохранение компонент с указаеним продуктов в файл-Excel void SaveProductComponentToExcelFile(ReportBindingModel model); /// Сохранение заказов в файл-Pdf