final
This commit is contained in:
parent
f8a4b504f0
commit
e444bf107a
@ -33,7 +33,6 @@ namespace Lab4
|
||||
if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface)
|
||||
{
|
||||
var plugin = (IPluginsConvention)Activator.CreateInstance(type)!;
|
||||
|
||||
plugins.Add(plugin.PluginName, plugin);
|
||||
}
|
||||
}
|
||||
@ -69,45 +68,9 @@ namespace Lab4
|
||||
};
|
||||
ControlsStripMenuItem.DropDownItems.Add(menuItem);
|
||||
}
|
||||
private void FormMain_KeyDown(object sender, KeyEventArgs e)
|
||||
private void ShowCatalog()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_selectedPlugin) ||
|
||||
!_plugins.ContainsKey(_selectedPlugin))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!e.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.I:
|
||||
ShowThesaurus();
|
||||
break;
|
||||
case Keys.A:
|
||||
AddNewElement();
|
||||
break;
|
||||
case Keys.U:
|
||||
UpdateElement();
|
||||
break;
|
||||
case Keys.D:
|
||||
DeleteElement();
|
||||
break;
|
||||
case Keys.S:
|
||||
CreateWordDoc();
|
||||
break;
|
||||
case Keys.T:
|
||||
CreatePdfDoc();
|
||||
break;
|
||||
case Keys.C:
|
||||
CreateExcelDoc();
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void ShowThesaurus()
|
||||
{
|
||||
_plugins[_selectedPlugin].GetThesaurus()?.Show();
|
||||
_plugins[_selectedPlugin].GetCatalog()?.Show();
|
||||
}
|
||||
private void AddNewElement()
|
||||
{
|
||||
@ -201,9 +164,7 @@ namespace Lab4
|
||||
saveFileDialog.Title = "Ñîõðàíèòü äèàãðàììó";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_plugins[_selectedPlugin].CreateExcelDocument(new
|
||||
PluginsConventionSaveDocument()
|
||||
{ FileName = saveFileDialog.FileName }))
|
||||
if (_plugins[_selectedPlugin].CreateExcelDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName }))
|
||||
{
|
||||
MessageBox.Show("Äîêóìåíò ñîõðàíåí", "Ñîçäàíèå" +
|
||||
" äîêóìåíòà", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@ -217,7 +178,7 @@ namespace Lab4
|
||||
}
|
||||
}
|
||||
private void ThesaurusToolStripMenuItem_Click(object sender,
|
||||
EventArgs e) => ShowThesaurus();
|
||||
EventArgs e) => ShowCatalog();
|
||||
private void AddElementToolStripMenuItem_Click(object sender,
|
||||
EventArgs e) => AddNewElement();
|
||||
private void UpdElementToolStripMenuItem_Click(object sender,
|
||||
|
@ -6,7 +6,7 @@
|
||||
UserControl GetControl { get; }
|
||||
PluginsConventionElement GetElement { get; }
|
||||
Form GetForm(PluginsConventionElement element);
|
||||
Form GetThesaurus();
|
||||
Form GetCatalog();
|
||||
bool DeleteElement(PluginsConventionElement element);
|
||||
void ReloadData();
|
||||
bool CreateWordDocument(PluginsConventionSaveDocument saveDocument);
|
||||
|
@ -26,16 +26,14 @@ namespace ShopProducts
|
||||
{
|
||||
private readonly ProductLogic _ProductLogic = new ProductLogic(new ProductStorage());
|
||||
private readonly ManufacturerLogic _ManufacturerLogic = new ManufacturerLogic(new ManufacturerStorage());
|
||||
/*private UserTreeView userTreeView1 = new UserTreeView();*/
|
||||
private ControlDataTableRow controlDataTableRow1 = new ControlDataTableRow();
|
||||
public string PluginName { get; set; } = "Лаба 4";
|
||||
public string PluginName { get; set; } = "Products App";
|
||||
|
||||
public UserControl GetControl
|
||||
{
|
||||
get
|
||||
{
|
||||
Load();
|
||||
/*return userTreeView1;*/
|
||||
return controlDataTableRow1;
|
||||
}
|
||||
}
|
||||
@ -44,7 +42,6 @@ namespace ShopProducts
|
||||
{
|
||||
get
|
||||
{
|
||||
/*var selectedProduct = userTreeView1.GetSelectedObject<ProductReportModel>();*/
|
||||
var selectedProduct = controlDataTableRow1.GetSelectedObject<ProductReportModel>();
|
||||
|
||||
int? id = null;
|
||||
@ -92,15 +89,6 @@ namespace ShopProducts
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
/*COP.PieChart pieChart1 = new COP.PieChart();
|
||||
string fileName = saveDocument.FileName;
|
||||
var dates = _ProductLogic.GetExcelInfo();
|
||||
var chartData = dates.Select(x => new DataItem { Name = x.Item1, Value = x.Item2 }).ToList();
|
||||
pieChart1.GenerateDocument(new ExcelChartInfo(fileName, "Сколько клиентов какого статуса совершали покупки",
|
||||
"Круговая диаграмма", COP.Enums.LegendPosition.Bottom, chartData));
|
||||
return true;*/
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -128,16 +116,6 @@ namespace ShopProducts
|
||||
}
|
||||
});
|
||||
|
||||
/*string fileName = saveDocument.FileName;
|
||||
List<string> textList = new List<string>();
|
||||
var list = _ProductLogic.Read(new ProductBindingModel { PurchaseSum = 0 });
|
||||
var rs = list.Select(item => string.Concat("ФИО: ", item.Name, " Отзывы: ", item.Reviews, '\n')).ToArray();
|
||||
if (list != null)
|
||||
{
|
||||
BigTextDocument.CreateDocument(new BigTextDocumentInfo
|
||||
(fileName, "Документ по клиентам, совершавшим покупки (ФИО клиента и его отзывы)", rs)
|
||||
);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -161,18 +139,6 @@ namespace ShopProducts
|
||||
};
|
||||
pdf.CreatePdf(config);
|
||||
|
||||
/*string fileName = saveDocument.FileName;
|
||||
KOP.PDFComponents.PdfTableComponent pdfTableComponent1 = new();
|
||||
var Products = _ProductLogic.Read(null);
|
||||
for (int i = 0; i < Products.Count; i++)
|
||||
{
|
||||
if (Products[i].PurchaseSum == null || Products[i].PurchaseSum == "") { Products[i].PurchaseSum = "нет"; }
|
||||
}
|
||||
pdfTableComponent1.CreateDocument(fileName, "Отчёт по всем клиентам",
|
||||
new List<double> { 2.0, 6.0, 4.0, 4.0 }, new List<double> { 5.0, 3.0 },
|
||||
new List<(string, string)> { ("Id", "Id"), ("ФИО", "Name"), ("Статус", "Manufacturer"), ("Сумма покупок", "PurchaseSum") },
|
||||
Products
|
||||
);*/
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -185,9 +151,6 @@ namespace ShopProducts
|
||||
|
||||
private void Load()
|
||||
{
|
||||
/*List<string> stringToHierachy = new List<string>() { "Manufacturer", "PurchaseSum", "Id", "Name" };
|
||||
userTreeView1.Hierarchy = stringToHierachy;*/
|
||||
|
||||
var tableConfig = new List<DataTableColumnConfig>
|
||||
{
|
||||
new DataTableColumnConfig
|
||||
@ -224,13 +187,6 @@ namespace ShopProducts
|
||||
{
|
||||
try
|
||||
{
|
||||
/*var list = _ProductLogic.Read(null);
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].PurchaseSum == null || list[i].PurchaseSum == "") { list[i].PurchaseSum = "нет"; }
|
||||
}
|
||||
userTreeView1.PopulateTree(list);*/
|
||||
|
||||
controlDataTableRow1.Clear();
|
||||
|
||||
var list = _ProductLogic.Read(null);
|
||||
@ -278,7 +234,7 @@ namespace ShopProducts
|
||||
return null;
|
||||
}
|
||||
|
||||
public Form GetThesaurus()
|
||||
public Form GetCatalog()
|
||||
{
|
||||
return new FormManufacturers(_ManufacturerLogic);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user