лр3 похоже готова
This commit is contained in:
parent
d25940be9c
commit
e37edd505a
3
COP/VisualCompLib/MyDropDownList.Designer.cs
generated
3
COP/VisualCompLib/MyDropDownList.Designer.cs
generated
@ -46,7 +46,8 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
AutoSize = true;
|
||||||
|
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
Controls.Add(dropDownList);
|
Controls.Add(dropDownList);
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "MyDropDownList";
|
Name = "MyDropDownList";
|
||||||
|
6
COP/WinForms/FormClient.Designer.cs
generated
6
COP/WinForms/FormClient.Designer.cs
generated
@ -1,4 +1,6 @@
|
|||||||
namespace WinForms
|
using ControlsLibraryNet60.Input;
|
||||||
|
|
||||||
|
namespace WinForms
|
||||||
{
|
{
|
||||||
partial class FormClient
|
partial class FormClient
|
||||||
{
|
{
|
||||||
@ -124,6 +126,7 @@
|
|||||||
//
|
//
|
||||||
// controlInputNullableInt1
|
// controlInputNullableInt1
|
||||||
//
|
//
|
||||||
|
controlInputNullableInt1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
controlInputNullableInt1.Location = new Point(14, 240);
|
controlInputNullableInt1.Location = new Point(14, 240);
|
||||||
controlInputNullableInt1.Margin = new Padding(5, 8, 5, 8);
|
controlInputNullableInt1.Margin = new Padding(5, 8, 5, 8);
|
||||||
controlInputNullableInt1.Name = "controlInputNullableInt1";
|
controlInputNullableInt1.Name = "controlInputNullableInt1";
|
||||||
@ -133,6 +136,7 @@
|
|||||||
//
|
//
|
||||||
// myDropDownList1
|
// myDropDownList1
|
||||||
//
|
//
|
||||||
|
myDropDownList1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
myDropDownList1.Location = new Point(12, 105);
|
myDropDownList1.Location = new Point(12, 105);
|
||||||
myDropDownList1.Margin = new Padding(3, 4, 3, 4);
|
myDropDownList1.Margin = new Padding(3, 4, 3, 4);
|
||||||
myDropDownList1.Name = "myDropDownList1";
|
myDropDownList1.Name = "myDropDownList1";
|
||||||
|
4
COP/WinForms/FormMain.Designer.cs
generated
4
COP/WinForms/FormMain.Designer.cs
generated
@ -39,6 +39,8 @@
|
|||||||
статусыToolStripMenuItem = new ToolStripMenuItem();
|
статусыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
myTreeView1 = new VisableComponents.MyTreeView();
|
myTreeView1 = new VisableComponents.MyTreeView();
|
||||||
wordText1 = new VisualCompLib.Components.WordText(components);
|
wordText1 = new VisualCompLib.Components.WordText(components);
|
||||||
|
excelChart1 = new UnvisableComponents.ExcelChart(components);
|
||||||
|
componentDocumentWithTableMultiHeaderPdf1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf(components);
|
||||||
contextMenuStrip1.SuspendLayout();
|
contextMenuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -140,5 +142,7 @@
|
|||||||
private ToolStripMenuItem статусыToolStripMenuItem;
|
private ToolStripMenuItem статусыToolStripMenuItem;
|
||||||
private VisableComponents.MyTreeView myTreeView1;
|
private VisableComponents.MyTreeView myTreeView1;
|
||||||
private VisualCompLib.Components.WordText wordText1;
|
private VisualCompLib.Components.WordText wordText1;
|
||||||
|
private UnvisableComponents.ExcelChart excelChart1;
|
||||||
|
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf componentDocumentWithTableMultiHeaderPdf1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,8 @@ using ClientsContracts.BusinessLogicContracts;
|
|||||||
using ClientsContracts.ViewModels;
|
using ClientsContracts.ViewModels;
|
||||||
using ClientsContracts.BindingModels;
|
using ClientsContracts.BindingModels;
|
||||||
using ControlsLibraryNet60.Data;
|
using ControlsLibraryNet60.Data;
|
||||||
|
using ComponentsLibraryNet60.Models;
|
||||||
|
using UnvisableComponents;
|
||||||
using Unity;
|
using Unity;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
@ -107,7 +109,7 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
if(item.Amount != null)
|
if (item.Amount != null)
|
||||||
{
|
{
|
||||||
string clients = string.Concat("ФИО: ", item.Name, " Отзывы: ", item.Reviews);
|
string clients = string.Concat("ФИО: ", item.Name, " Отзывы: ", item.Reviews);
|
||||||
textList.Add(clients);
|
textList.Add(clients);
|
||||||
@ -118,6 +120,74 @@ namespace WinForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createExcel()
|
||||||
|
{
|
||||||
|
string fileName = "";
|
||||||
|
using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
|
||||||
|
{
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
fileName = dialog.FileName.ToString();
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var statuses = _statusLogic.Read(null);
|
||||||
|
var clients = _clientLogic.Read(null);
|
||||||
|
List<(string, int)> dates = new List<(string, int)>();
|
||||||
|
for (int i = 0; i < statuses.Count; i++)
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
for(int j = 0; j < clients.Count; j++)
|
||||||
|
{
|
||||||
|
if (clients[j].Status == statuses[i].Name && clients[j].Amount != null) counter++;
|
||||||
|
}
|
||||||
|
dates.Add((statuses[i].Name, counter));
|
||||||
|
}
|
||||||
|
excelChart1.Load(new ChartInfo
|
||||||
|
{
|
||||||
|
Path = fileName,
|
||||||
|
Title = "Сколько клиентов какого статуса совершали покупки",
|
||||||
|
DiagrammTitle = "Круговая диаграмма",
|
||||||
|
Dates = dates,
|
||||||
|
DirLegend = DirectionLegend.Right
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreatePdf()
|
||||||
|
{
|
||||||
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
|
string fileName = "";
|
||||||
|
using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" })
|
||||||
|
{
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
fileName = dialog.FileName.ToString();
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var clients = _clientLogic.Read(null);
|
||||||
|
for (int i = 0; i < clients.Count; i++)
|
||||||
|
{
|
||||||
|
if (clients[i].Amount == null) { clients[i].Amount = 0; }
|
||||||
|
}
|
||||||
|
componentDocumentWithTableMultiHeaderPdf1.CreateDoc(new ComponentDocumentWithTableHeaderDataConfig<ClientViewModel>
|
||||||
|
{
|
||||||
|
FilePath = fileName,
|
||||||
|
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")
|
||||||
|
},
|
||||||
|
Data = clients
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void статусыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void статусыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var form = Program.Container.Resolve<FormStatus>();
|
var form = Program.Container.Resolve<FormStatus>();
|
||||||
@ -126,12 +196,12 @@ namespace WinForms
|
|||||||
|
|
||||||
private void сохранитьВПдфToolStripMenuItem_Click(object sender, EventArgs e)
|
private void сохранитьВПдфToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
CreatePdf();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void сохранитьВЭксельToolStripMenuItem_Click(object sender, EventArgs e)
|
private void сохранитьВЭксельToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
createExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void сохранитьВВордToolStripMenuItem_Click(object sender, EventArgs e)
|
private void сохранитьВВордToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -123,4 +123,10 @@
|
|||||||
<metadata name="wordText1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="wordText1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>202, 17</value>
|
<value>202, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="excelChart1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>327, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="componentDocumentWithTableMultiHeaderPdf1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>460, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user