From 66df1c294ab8548d3477ba06100061714e10c3eb Mon Sep 17 00:00:00 2001 From: Ismailov_Rovshan Date: Thu, 16 Nov 2023 02:01:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=80=D0=BE=D0=B4=D0=B5=20=D1=82=D0=B5?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82=D0=BE=D1=87=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=B2=D1=81=D1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinForms/WinForms/FormMain.Designer.cs | 33 ++++++++++++++------------ WinForms/WinForms/FormMain.cs | 33 +++++++++++++------------- WinForms/WinForms/WinForms.csproj | 4 ++-- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/WinForms/WinForms/FormMain.Designer.cs b/WinForms/WinForms/FormMain.Designer.cs index cac361d..4ddf6a3 100644 --- a/WinForms/WinForms/FormMain.Designer.cs +++ b/WinForms/WinForms/FormMain.Designer.cs @@ -40,9 +40,9 @@ namespace WinForms this.сохранитьВПдфToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.статусыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.wordText1 = new VisualCompLib.Components.WordText(this.components); - this.excelChart1 = new Lab2.ChartComponent(this.components); + this.excelChart1 = new UnvisableComponents.ExcelChart(this.components); this.componentDocumentWithTableMultiHeaderPdf1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf(this.components); - this.myTreeView1 = new kop.components.TreeClassView(); + this.myTreeView1 = new VisableComponents.MyTreeView(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -58,7 +58,7 @@ namespace WinForms this.сохранитьВПдфToolStripMenuItem, this.статусыToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(267, 172); + this.contextMenuStrip1.Size = new System.Drawing.Size(255, 200); // // добавитьToolStripMenuItem // @@ -89,23 +89,23 @@ namespace WinForms this.сохранитьВВордToolStripMenuItem.Name = "сохранитьВВордToolStripMenuItem"; this.сохранитьВВордToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.сохранитьВВордToolStripMenuItem.Size = new System.Drawing.Size(266, 24); - this.сохранитьВВордToolStripMenuItem.Text = "Сохранить в Ворд"; + this.сохранитьВВордToolStripMenuItem.Text = "Сохранить в Word"; this.сохранитьВВордToolStripMenuItem.Click += new System.EventHandler(this.сохранитьВВордToolStripMenuItem_Click); // // сохранитьВЭксельToolStripMenuItem // this.сохранитьВЭксельToolStripMenuItem.Name = "сохранитьВЭксельToolStripMenuItem"; this.сохранитьВЭксельToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); - this.сохранитьВЭксельToolStripMenuItem.Size = new System.Drawing.Size(266, 24); - this.сохранитьВЭксельToolStripMenuItem.Text = "Сохранить в Эксель"; + this.сохранитьВЭксельToolStripMenuItem.Size = new System.Drawing.Size(254, 24); + this.сохранитьВЭксельToolStripMenuItem.Text = "Сохранить в Exel"; this.сохранитьВЭксельToolStripMenuItem.Click += new System.EventHandler(this.сохранитьВЭксельToolStripMenuItem_Click); // // сохранитьВПдфToolStripMenuItem // this.сохранитьВПдфToolStripMenuItem.Name = "сохранитьВПдфToolStripMenuItem"; this.сохранитьВПдфToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); - this.сохранитьВПдфToolStripMenuItem.Size = new System.Drawing.Size(266, 24); - this.сохранитьВПдфToolStripMenuItem.Text = "Сохранить в пдф"; + this.сохранитьВПдфToolStripMenuItem.Size = new System.Drawing.Size(254, 24); + this.сохранитьВПдфToolStripMenuItem.Text = "Сохранить в PDF"; this.сохранитьВПдфToolStripMenuItem.Click += new System.EventHandler(this.сохранитьВПдфToolStripMenuItem_Click); // // статусыToolStripMenuItem @@ -118,9 +118,13 @@ namespace WinForms // // myTreeView1 // - this.myTreeView1.Location = new System.Drawing.Point(12, 12); + this.myTreeView1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.myTreeView1.BackColor = System.Drawing.SystemColors.ControlDark; + this.myTreeView1.Location = new System.Drawing.Point(12, 13); + this.myTreeView1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.myTreeView1.MinimumSize = new System.Drawing.Size(200, 200); this.myTreeView1.Name = "myTreeView1"; - this.myTreeView1.Size = new System.Drawing.Size(658, 374); + this.myTreeView1.Size = new System.Drawing.Size(658, 372); this.myTreeView1.TabIndex = 1; // // FormMain @@ -130,7 +134,7 @@ namespace WinForms this.ClientSize = new System.Drawing.Size(682, 398); this.Controls.Add(this.myTreeView1); this.Name = "FormMain"; - this.Text = "Учет клиентов"; + this.Text = "Заказы"; this.Load += new System.EventHandler(this.FormMain_Load); this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); @@ -149,11 +153,10 @@ namespace WinForms private ToolStripMenuItem статусыToolStripMenuItem; private VisualCompLib.Components.WordText wordText1; - - //private TreeClassView myTreeView1; - private Lab2.ChartComponent excelChart1; + private UnvisableComponents.ExcelChart excelChart1; + //private Lab2.ChartComponent excelChart1; private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf componentDocumentWithTableMultiHeaderPdf1; - private kop.components.TreeClassView myTreeView1; + private VisableComponents.MyTreeView myTreeView1; } } \ No newline at end of file diff --git a/WinForms/WinForms/FormMain.cs b/WinForms/WinForms/FormMain.cs index 51825a7..3772434 100644 --- a/WinForms/WinForms/FormMain.cs +++ b/WinForms/WinForms/FormMain.cs @@ -1,6 +1,5 @@ using ComponentsLibraryNet60.DocumentWithTable; using ComponentsLibraryNet60.Models; -using Lab2; using OrdersContracts.BindingModels; using OrdersContracts.BusinessLogicContracts; using OrdersContracts.ViewModels; @@ -13,6 +12,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using UnvisableComponents; using VisualComponentsLib.Components; namespace WinForms @@ -27,7 +27,7 @@ namespace WinForms _statusLogic = statusLogic; InitializeComponent(); List stringToHierachy = new List() { "Status", "Amount", "Id", "Name" }; - myTreeView1.setHierarchy(stringToHierachy); + myTreeView1.addToHierarchy(stringToHierachy); ContextMenuStrip = contextMenuStrip1; } private void FormMain_Load(object sender, EventArgs e) @@ -42,9 +42,9 @@ namespace WinForms var list = _orderLogic.Read(null); for (int i = 0; i < list.Count; i++) { - if (list[i].Amount == null || list[i].Amount == "") { list[i].Amount = "нет"; } + if (list[i].Amount == null || list[i].Amount == "") { list[i].Amount = "Заказы, оплаченные скидками"; } } - myTreeView1.setData(list); + myTreeView1.LoadTree(list); } catch (Exception ex) { @@ -60,8 +60,6 @@ namespace WinForms { LoadData(); } - - } private void UpdateElement() @@ -69,7 +67,7 @@ namespace WinForms var service = Program.ServiceProvider?.GetService(typeof(FormOrder)); if (!(service is FormOrder form)) return; - var selectedOrder = myTreeView1.GetSelectedClass(); + var selectedOrder = myTreeView1.GetNode(typeof(OrderBindingModel)); if (selectedOrder != null) { form.Id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id); @@ -88,7 +86,7 @@ namespace WinForms { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - var selectedOrder = myTreeView1.GetSelectedClass(); + var selectedOrder = myTreeView1.GetNode(typeof(OrderBindingModel)); int id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id); try { @@ -120,14 +118,14 @@ namespace WinForms { foreach (var item in list) { - if (item.Amount != null && item.Amount != "") + if (item.Amount == null || item.Amount == "") { - string orders = string.Concat("ФИО: ", item.Name, " Отзывы: ", item.Info); + string orders = string.Concat("ФИО: ", item.Name, " Описание: ", item.Info); textList.Add(orders); } } string[] textArray = textList.ToArray(); - wordText1.CreateWordText(new(fileName, "Документ по клиентам, совершавшим покупки (ФИО клиента и его отзывы)", textArray)); + wordText1.CreateWordText(new(fileName, "Заказы, которые были оплачены скидками", textArray)); } } @@ -158,9 +156,10 @@ namespace WinForms excelChart1.Load(new ChartInfo { Path = fileName, - Title = "Сколько клиентов какого статуса совершали покупки", + Title = "Статусы заказов", DiagrammTitle = "Круговая диаграмма", - Data = dates, + Dates = dates, + DirLegend = DirectionLegend.Right }); } @@ -180,19 +179,19 @@ namespace WinForms var orders = _orderLogic.Read(null); for (int i = 0; i < orders.Count; i++) { - if (orders[i].Amount == null || orders[i].Amount == "") { orders[i].Amount = "нет"; } + if (orders[i].Amount == null || orders[i].Amount == "") { orders[i].Amount = "нет2"; } } componentDocumentWithTableMultiHeaderPdf1.CreateDoc(new ComponentDocumentWithTableHeaderDataConfig { FilePath = fileName, - Header = "Отчет по клиентам", + Header = "Отчет по заказам", ColumnsRowsWidth = new List<(int, int)> { (5, 5), (10, 5), (15, 0), (15, 0) }, Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)> { (0, 0, "Id", "Id"), (1, 0, "ФИО", "Name"), (2, 0, "Статус", "Status"), - (3, 0, "Сумма покупок", "Amount") + (3, 0, "Сумма заказа", "Amount") }, Data = orders }); @@ -235,4 +234,4 @@ namespace WinForms AddNewElement(); } } -} +} \ No newline at end of file diff --git a/WinForms/WinForms/WinForms.csproj b/WinForms/WinForms/WinForms.csproj index e6e224f..b7e53b0 100644 --- a/WinForms/WinForms/WinForms.csproj +++ b/WinForms/WinForms/WinForms.csproj @@ -15,8 +15,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +