4 базовая
This commit is contained in:
parent
2f7b71f1f8
commit
391beb9c32
@ -43,7 +43,7 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ReportIceCreamComponentViewModel> GetProductComponent()
|
||||
public List<ReportIceCreamComponentViewModel> GetIceCreamComponent()
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
|
||||
@ -51,20 +51,20 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
|
||||
var list = new List<ReportIceCreamComponentViewModel>();
|
||||
|
||||
foreach (var component in components)
|
||||
foreach (var icecream in iceCreams)
|
||||
{
|
||||
var record = new ReportIceCreamComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
IceCreams = new List<(string, int)>(),
|
||||
IceCreamName = icecream.IceCreamName,
|
||||
Components = new List<(string, int)>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var product in iceCreams)
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (product.IceCreamComponents.ContainsKey(component.Id))
|
||||
if (icecream.IceCreamComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.IceCreams.Add(new(product.IceCreamName, product.IceCreamComponents[component.Id].Item2));
|
||||
record.TotalCount += product.IceCreamComponents[component.Id].Item2;
|
||||
record.Components.Add(new(component.ComponentName, icecream.IceCreamComponents[component.Id].Item2));
|
||||
record.TotalCount += icecream.IceCreamComponents[component.Id].Item2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,6 +87,7 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
Id = x.Id,
|
||||
DateCreate = x.DateCreate,
|
||||
IceCreamName = x.IceCreamName,
|
||||
OrderStatus = Convert.ToString(x.Status) ?? String.Empty,
|
||||
Sum = x.Sum
|
||||
})
|
||||
.ToList();
|
||||
@ -96,13 +97,13 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||
public void SaveIceCreamsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список изделий",
|
||||
IceCreams = _iceCreamStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
@ -110,13 +111,13 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveProductComponentToExcelFile(ReportBindingModel model)
|
||||
public void SaveIceCreamComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
ProductComponents = GetProductComponent()
|
||||
Title = "Список изделий",
|
||||
IceCreamComponents = GetIceCreamComponent()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -28,18 +28,18 @@ namespace IceCreamBusinessLogic.OfficePackage
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
foreach (var pc in info.ProductComponents)
|
||||
foreach (var pc in info.IceCreamComponents)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.IceCreamName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
|
||||
foreach (var (IceCream, Count) in pc.IceCreams)
|
||||
foreach (var (IceCream, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
|
@ -14,13 +14,15 @@ namespace IceCreamBusinessLogic.OfficePackage
|
||||
{
|
||||
CreatePdf(info);
|
||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
CreateParagraph(new PdfParagraph {
|
||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
@ -29,7 +31,7 @@ namespace IceCreamBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.IceCreamName, order.Sum.ToString() },
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.IceCreamName, Convert.ToString(order.OrderStatus), order.Sum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
|
@ -19,11 +19,14 @@ namespace IceCreamBusinessLogic.OfficePackage
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var component in info.Components)
|
||||
foreach (var iceCream in info.IceCreams)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(iceCream.IceCreamName, new WordTextProperties { Size = "24", Bold = true}),
|
||||
(" - цена " + iceCream.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -8,6 +8,6 @@ namespace IceCreamBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public List<ReportIceCreamComponentViewModel> ProductComponents { get; set; } = new();
|
||||
public List<ReportIceCreamComponentViewModel> IceCreamComponents { get; set; } = new();
|
||||
}
|
||||
}
|
@ -8,6 +8,6 @@ namespace IceCreamBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public List<ComponentViewModel> Components { get; set; } = new();
|
||||
public List<IceCreamViewModel> IceCreams { get; set; } = new();
|
||||
}
|
||||
}
|
249
IceCreamShop/IceCreamShop/FormMain.Designer.cs
generated
249
IceCreamShop/IceCreamShop/FormMain.Designer.cs
generated
@ -28,170 +28,173 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonUpdate = new Button();
|
||||
buttonSetToFinish = new Button();
|
||||
buttonSetToDone = new Button();
|
||||
buttonSetToWork = new Button();
|
||||
buttonCreateOrder = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
мороженоеToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
componentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
componentIceCreamsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||
this.buttonSetToFinish = new System.Windows.Forms.Button();
|
||||
this.buttonSetToDone = new System.Windows.Forms.Button();
|
||||
this.buttonSetToWork = new System.Windows.Forms.Button();
|
||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
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.iceCreamComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.iceCreamToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(878, 294);
|
||||
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(170, 37);
|
||||
buttonUpdate.TabIndex = 13;
|
||||
buttonUpdate.Text = "Обновить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(1003, 392);
|
||||
this.buttonUpdate.Name = "buttonUpdate";
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(194, 49);
|
||||
this.buttonUpdate.TabIndex = 13;
|
||||
this.buttonUpdate.Text = "Обновить";
|
||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
|
||||
//
|
||||
// buttonSetToFinish
|
||||
//
|
||||
buttonSetToFinish.Location = new Point(878, 225);
|
||||
buttonSetToFinish.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSetToFinish.Name = "buttonSetToFinish";
|
||||
buttonSetToFinish.Size = new Size(170, 37);
|
||||
buttonSetToFinish.TabIndex = 12;
|
||||
buttonSetToFinish.Text = "Заказ выдан";
|
||||
buttonSetToFinish.UseVisualStyleBackColor = true;
|
||||
buttonSetToFinish.Click += buttonSetToFinish_Click;
|
||||
this.buttonSetToFinish.Location = new System.Drawing.Point(1003, 300);
|
||||
this.buttonSetToFinish.Name = "buttonSetToFinish";
|
||||
this.buttonSetToFinish.Size = new System.Drawing.Size(194, 49);
|
||||
this.buttonSetToFinish.TabIndex = 12;
|
||||
this.buttonSetToFinish.Text = "Заказ выдан";
|
||||
this.buttonSetToFinish.UseVisualStyleBackColor = true;
|
||||
this.buttonSetToFinish.Click += new System.EventHandler(this.buttonSetToFinish_Click);
|
||||
//
|
||||
// buttonSetToDone
|
||||
//
|
||||
buttonSetToDone.Location = new Point(878, 160);
|
||||
buttonSetToDone.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSetToDone.Name = "buttonSetToDone";
|
||||
buttonSetToDone.Size = new Size(170, 37);
|
||||
buttonSetToDone.TabIndex = 11;
|
||||
buttonSetToDone.Text = "Заказ готов";
|
||||
buttonSetToDone.UseVisualStyleBackColor = true;
|
||||
buttonSetToDone.Click += buttonSetToDone_Click;
|
||||
this.buttonSetToDone.Location = new System.Drawing.Point(1003, 213);
|
||||
this.buttonSetToDone.Name = "buttonSetToDone";
|
||||
this.buttonSetToDone.Size = new System.Drawing.Size(194, 49);
|
||||
this.buttonSetToDone.TabIndex = 11;
|
||||
this.buttonSetToDone.Text = "Заказ готов";
|
||||
this.buttonSetToDone.UseVisualStyleBackColor = true;
|
||||
this.buttonSetToDone.Click += new System.EventHandler(this.buttonSetToDone_Click);
|
||||
//
|
||||
// buttonSetToWork
|
||||
//
|
||||
buttonSetToWork.Location = new Point(878, 93);
|
||||
buttonSetToWork.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSetToWork.Name = "buttonSetToWork";
|
||||
buttonSetToWork.Size = new Size(170, 37);
|
||||
buttonSetToWork.TabIndex = 10;
|
||||
buttonSetToWork.Text = "Отдать на выполнение";
|
||||
buttonSetToWork.UseVisualStyleBackColor = true;
|
||||
buttonSetToWork.Click += buttonSetToWork_Click;
|
||||
this.buttonSetToWork.Location = new System.Drawing.Point(1003, 124);
|
||||
this.buttonSetToWork.Name = "buttonSetToWork";
|
||||
this.buttonSetToWork.Size = new System.Drawing.Size(194, 49);
|
||||
this.buttonSetToWork.TabIndex = 10;
|
||||
this.buttonSetToWork.Text = "Отдать на выполнение";
|
||||
this.buttonSetToWork.UseVisualStyleBackColor = true;
|
||||
this.buttonSetToWork.Click += new System.EventHandler(this.buttonSetToWork_Click);
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
buttonCreateOrder.Location = new Point(878, 26);
|
||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(170, 37);
|
||||
buttonCreateOrder.TabIndex = 9;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(1003, 35);
|
||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
this.buttonCreateOrder.Size = new System.Drawing.Size(194, 49);
|
||||
this.buttonCreateOrder.TabIndex = 9;
|
||||
this.buttonCreateOrder.Text = "Создать заказ";
|
||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 26);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(848, 305);
|
||||
dataGridView.TabIndex = 8;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(14, 35);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(969, 407);
|
||||
this.dataGridView.TabIndex = 8;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip.Size = new Size(1072, 24);
|
||||
menuStrip.TabIndex = 7;
|
||||
menuStrip.Text = "Справочники";
|
||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.справочникиToolStripMenuItem,
|
||||
this.отчетыToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Padding = new System.Windows.Forms.Padding(6, 3, 0, 3);
|
||||
this.menuStrip.Size = new System.Drawing.Size(1225, 30);
|
||||
this.menuStrip.TabIndex = 7;
|
||||
this.menuStrip.Text = "Справочники";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, мороженоеToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.компонентыToolStripMenuItem,
|
||||
this.мороженоеToolStripMenuItem});
|
||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// компонентыToolStripMenuItem
|
||||
//
|
||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
компонентыToolStripMenuItem.Size = new Size(145, 22);
|
||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.компонентыToolStripMenuItem_Click);
|
||||
//
|
||||
// мороженоеToolStripMenuItem
|
||||
//
|
||||
мороженоеToolStripMenuItem.Name = "мороженоеToolStripMenuItem";
|
||||
мороженоеToolStripMenuItem.Size = new Size(145, 22);
|
||||
мороженоеToolStripMenuItem.Text = "Мороженое";
|
||||
мороженоеToolStripMenuItem.Click += мороженоеToolStripMenuItem_Click;
|
||||
this.мороженоеToolStripMenuItem.Name = "мороженоеToolStripMenuItem";
|
||||
this.мороженоеToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.мороженоеToolStripMenuItem.Text = "Мороженое";
|
||||
this.мороженоеToolStripMenuItem.Click += new System.EventHandler(this.мороженоеToolStripMenuItem_Click);
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, componentIceCreamsToolStripMenuItem, ordersToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.iceCreamComponentsToolStripMenuItem,
|
||||
this.iceCreamToolStripMenuItem,
|
||||
this.ordersToolStripMenuItem});
|
||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// componentsToolStripMenuItem
|
||||
// iceCreamComponentsToolStripMenuItem
|
||||
//
|
||||
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||
componentsToolStripMenuItem.Size = new Size(235, 22);
|
||||
componentsToolStripMenuItem.Text = "Список компонентов";
|
||||
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||
this.iceCreamComponentsToolStripMenuItem.Name = "iceCreamComponentsToolStripMenuItem";
|
||||
this.iceCreamComponentsToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
|
||||
this.iceCreamComponentsToolStripMenuItem.Text = "Список мороженых";
|
||||
this.iceCreamComponentsToolStripMenuItem.Click += new System.EventHandler(this.IceCreamsToolStripMenuItem_Click);
|
||||
//
|
||||
// componentIceCreamsToolStripMenuItem
|
||||
// iceCreamToolStripMenuItem
|
||||
//
|
||||
componentIceCreamsToolStripMenuItem.Name = "componentIceCreamsToolStripMenuItem";
|
||||
componentIceCreamsToolStripMenuItem.Size = new Size(235, 22);
|
||||
componentIceCreamsToolStripMenuItem.Text = "Компоненты по мороженым";
|
||||
componentIceCreamsToolStripMenuItem.Click += ComponentIceCreamsToolStripMenuItem_Click;
|
||||
this.iceCreamToolStripMenuItem.Name = "iceCreamToolStripMenuItem";
|
||||
this.iceCreamToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
|
||||
this.iceCreamToolStripMenuItem.Text = "Мороженые с компонентами";
|
||||
this.iceCreamToolStripMenuItem.Click += new System.EventHandler(this.IceCreamComponentsToolStripMenuItem_Click);
|
||||
//
|
||||
// ordersToolStripMenuItem
|
||||
//
|
||||
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||
ordersToolStripMenuItem.Size = new Size(235, 22);
|
||||
ordersToolStripMenuItem.Text = "Список заказов";
|
||||
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
|
||||
this.ordersToolStripMenuItem.Text = "Список заказов";
|
||||
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1072, 347);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonSetToFinish);
|
||||
Controls.Add(buttonSetToDone);
|
||||
Controls.Add(buttonSetToWork);
|
||||
Controls.Add(buttonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
Name = "FormMain";
|
||||
Text = "Магазин мороженого";
|
||||
Load += FormMain_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1225, 463);
|
||||
this.Controls.Add(this.buttonUpdate);
|
||||
this.Controls.Add(this.buttonSetToFinish);
|
||||
this.Controls.Add(this.buttonSetToDone);
|
||||
this.Controls.Add(this.buttonSetToWork);
|
||||
this.Controls.Add(this.buttonCreateOrder);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Магазин мороженого";
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -207,8 +210,8 @@
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem мороженоеToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem componentsToolStripMenuItem;
|
||||
private ToolStripMenuItem componentIceCreamsToolStripMenuItem;
|
||||
private ToolStripMenuItem iceCreamComponentsToolStripMenuItem;
|
||||
private ToolStripMenuItem iceCreamToolStripMenuItem;
|
||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -167,17 +167,17 @@ namespace IceCreamShopView
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void IceCreamsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
_reportLogic.SaveIceCreamsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void ComponentIceCreamsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void IceCreamComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportProductComponents));
|
||||
if (service is FormReportProductComponents form)
|
||||
|
142
IceCreamShop/IceCreamShop/FormReportOrders.Designer.cs
generated
142
IceCreamShop/IceCreamShop/FormReportOrders.Designer.cs
generated
@ -28,99 +28,103 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonToPdf = new Button();
|
||||
panel = new Panel();
|
||||
buttonMake = new Button();
|
||||
dateTimePickerTo = new DateTimePicker();
|
||||
labelTo = new Label();
|
||||
dateTimePickerFrom = new DateTimePicker();
|
||||
labelFrom = new Label();
|
||||
panel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
this.buttonToPdf = new System.Windows.Forms.Button();
|
||||
this.panel = new System.Windows.Forms.Panel();
|
||||
this.buttonMake = new System.Windows.Forms.Button();
|
||||
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
||||
this.labelTo = new System.Windows.Forms.Label();
|
||||
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
||||
this.labelFrom = new System.Windows.Forms.Label();
|
||||
this.panel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonToPdf
|
||||
//
|
||||
buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonToPdf.Location = new Point(819, 8);
|
||||
buttonToPdf.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonToPdf.Name = "buttonToPdf";
|
||||
buttonToPdf.Size = new Size(139, 27);
|
||||
buttonToPdf.TabIndex = 6;
|
||||
buttonToPdf.Text = "В Pdf";
|
||||
buttonToPdf.UseVisualStyleBackColor = true;
|
||||
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonToPdf.Location = new System.Drawing.Point(936, 11);
|
||||
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.buttonToPdf.Name = "buttonToPdf";
|
||||
this.buttonToPdf.Size = new System.Drawing.Size(159, 36);
|
||||
this.buttonToPdf.TabIndex = 6;
|
||||
this.buttonToPdf.Text = "В Pdf";
|
||||
this.buttonToPdf.UseVisualStyleBackColor = true;
|
||||
this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonMake);
|
||||
panel.Controls.Add(buttonToPdf);
|
||||
panel.Controls.Add(dateTimePickerTo);
|
||||
panel.Controls.Add(labelTo);
|
||||
panel.Controls.Add(dateTimePickerFrom);
|
||||
panel.Controls.Add(labelFrom);
|
||||
panel.Dock = DockStyle.Top;
|
||||
panel.Location = new Point(0, 0);
|
||||
panel.Margin = new Padding(4, 3, 4, 3);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(1006, 40);
|
||||
panel.TabIndex = 7;
|
||||
this.panel.Controls.Add(this.buttonMake);
|
||||
this.panel.Controls.Add(this.buttonToPdf);
|
||||
this.panel.Controls.Add(this.dateTimePickerTo);
|
||||
this.panel.Controls.Add(this.labelTo);
|
||||
this.panel.Controls.Add(this.dateTimePickerFrom);
|
||||
this.panel.Controls.Add(this.labelFrom);
|
||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.panel.Name = "panel";
|
||||
this.panel.Size = new System.Drawing.Size(1150, 53);
|
||||
this.panel.TabIndex = 7;
|
||||
//
|
||||
// buttonMake
|
||||
//
|
||||
buttonMake.Location = new Point(476, 8);
|
||||
buttonMake.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonMake.Name = "buttonMake";
|
||||
buttonMake.Size = new Size(139, 27);
|
||||
buttonMake.TabIndex = 4;
|
||||
buttonMake.Text = "Сформировать";
|
||||
buttonMake.UseVisualStyleBackColor = true;
|
||||
this.buttonMake.Location = new System.Drawing.Point(544, 11);
|
||||
this.buttonMake.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.buttonMake.Name = "buttonMake";
|
||||
this.buttonMake.Size = new System.Drawing.Size(159, 36);
|
||||
this.buttonMake.TabIndex = 4;
|
||||
this.buttonMake.Text = "Сформировать";
|
||||
this.buttonMake.UseVisualStyleBackColor = true;
|
||||
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||
//
|
||||
// dateTimePickerTo
|
||||
//
|
||||
dateTimePickerTo.Location = new Point(237, 7);
|
||||
dateTimePickerTo.Margin = new Padding(4, 3, 4, 3);
|
||||
dateTimePickerTo.Name = "dateTimePickerTo";
|
||||
dateTimePickerTo.Size = new Size(163, 23);
|
||||
dateTimePickerTo.TabIndex = 3;
|
||||
this.dateTimePickerTo.Location = new System.Drawing.Point(271, 9);
|
||||
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||
this.dateTimePickerTo.Size = new System.Drawing.Size(186, 27);
|
||||
this.dateTimePickerTo.TabIndex = 3;
|
||||
//
|
||||
// labelTo
|
||||
//
|
||||
labelTo.AutoSize = true;
|
||||
labelTo.Location = new Point(208, 10);
|
||||
labelTo.Margin = new Padding(4, 0, 4, 0);
|
||||
labelTo.Name = "labelTo";
|
||||
labelTo.Size = new Size(21, 15);
|
||||
labelTo.TabIndex = 2;
|
||||
labelTo.Text = "по";
|
||||
this.labelTo.AutoSize = true;
|
||||
this.labelTo.Location = new System.Drawing.Point(238, 13);
|
||||
this.labelTo.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.labelTo.Name = "labelTo";
|
||||
this.labelTo.Size = new System.Drawing.Size(27, 20);
|
||||
this.labelTo.TabIndex = 2;
|
||||
this.labelTo.Text = "по";
|
||||
//
|
||||
// dateTimePickerFrom
|
||||
//
|
||||
dateTimePickerFrom.Location = new Point(37, 7);
|
||||
dateTimePickerFrom.Margin = new Padding(4, 3, 4, 3);
|
||||
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||
dateTimePickerFrom.Size = new Size(163, 23);
|
||||
dateTimePickerFrom.TabIndex = 1;
|
||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(42, 9);
|
||||
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(186, 27);
|
||||
this.dateTimePickerFrom.TabIndex = 1;
|
||||
//
|
||||
// labelFrom
|
||||
//
|
||||
labelFrom.AutoSize = true;
|
||||
labelFrom.Location = new Point(14, 10);
|
||||
labelFrom.Margin = new Padding(4, 0, 4, 0);
|
||||
labelFrom.Name = "labelFrom";
|
||||
labelFrom.Size = new Size(15, 15);
|
||||
labelFrom.TabIndex = 0;
|
||||
labelFrom.Text = "С";
|
||||
this.labelFrom.AutoSize = true;
|
||||
this.labelFrom.Location = new System.Drawing.Point(16, 13);
|
||||
this.labelFrom.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.labelFrom.Name = "labelFrom";
|
||||
this.labelFrom.Size = new System.Drawing.Size(18, 20);
|
||||
this.labelFrom.TabIndex = 0;
|
||||
this.labelFrom.Text = "С";
|
||||
//
|
||||
// FormReportOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1006, 450);
|
||||
Controls.Add(panel);
|
||||
Name = "FormReportOrders";
|
||||
Text = "Заказы";
|
||||
panel.ResumeLayout(false);
|
||||
panel.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1150, 600);
|
||||
this.Controls.Add(this.panel);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormReportOrders";
|
||||
this.Text = "Заказы";
|
||||
this.panel.ResumeLayout(false);
|
||||
this.panel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -29,14 +29,14 @@ namespace IceCreamShopView
|
||||
{
|
||||
try
|
||||
{
|
||||
var dict = _logic.GetProductComponent();
|
||||
var dict = _logic.GetIceCreamComponent();
|
||||
if (dict != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
||||
foreach (var listElem in elem.IceCreams)
|
||||
dataGridView.Rows.Add(new object[] { elem.IceCreamName, "", "" });
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace IceCreamShopView
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.SaveProductComponentToExcelFile(new ReportBindingModel
|
||||
_logic.SaveIceCreamComponentToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
|
@ -26,4 +26,10 @@
|
||||
<ProjectReference Include="..\IceCreamShopListImplement\IceCreamShopListImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ReportOrders.rdlc">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IIceCreamLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>IceCreamShopContracts.BusinessLogicsContracts.IIceCreamLogic, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IOrderLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>IceCreamShopContracts.BusinessLogicsContracts.IOrderLogic, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IComponentStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>IceCreamShopContracts.StoragesContracts.IComponentStorage, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IIceCreamStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>IceCreamShopContracts.StoragesContracts.IIceCreamStorage, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IOrderStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>IceCreamShopContracts.StoragesContracts.IOrderStorage, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -2,18 +2,18 @@
|
||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||
<AutoRefresh>0</AutoRefresh>
|
||||
<DataSources>
|
||||
<DataSource Name="AbstractShopContractsViewModels">
|
||||
<DataSource Name="IceCreamShopContractsViewModels">
|
||||
<ConnectionProperties>
|
||||
<DataProvider>System.Data.DataSet</DataProvider>
|
||||
<ConnectString>/* Local Connection */</ConnectString>
|
||||
</ConnectionProperties>
|
||||
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
|
||||
</DataSource>
|
||||
</DataSources>
|
||||
<DataSets>
|
||||
<DataSet Name="DataSetOrders">
|
||||
<Query>
|
||||
<DataSourceName>AbstractShopContractsViewModels</DataSourceName>
|
||||
<DataSourceName>IceCreamShopContractsViewModels</DataSourceName>
|
||||
<CommandText>/* Local Query */</CommandText>
|
||||
</Query>
|
||||
<Fields>
|
||||
@ -25,19 +25,23 @@
|
||||
<DataField>DateCreate</DataField>
|
||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="ProductName">
|
||||
<DataField>ProductName</DataField>
|
||||
<Field Name="IceCreamName">
|
||||
<DataField>IceCreamName</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="Sum">
|
||||
<DataField>Sum</DataField>
|
||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="OrderStatus">
|
||||
<DataField>OrderStatus</DataField>
|
||||
<rd:TypeName>IceCreamShopDataModels.OrderStatus</rd:TypeName>
|
||||
</Field>
|
||||
</Fields>
|
||||
<rd:DataSetInfo>
|
||||
<rd:DataSetName>AbstractShopContracts.ViewModels</rd:DataSetName>
|
||||
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
||||
<rd:ObjectDataSourceType>AbstractShopContracts.ViewModels.ReportOrdersViewModel, AbstractShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||
<rd:DataSetName>IceCreamShopContracts.ViewModels</rd:DataSetName>
|
||||
<rd:TableName>ReportOrderViewModel</rd:TableName>
|
||||
<rd:ObjectDataSourceType>IceCreamShopContracts.ViewModels.ReportOrderViewModel, IceCreamShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||
</rd:DataSetInfo>
|
||||
</DataSet>
|
||||
</DataSets>
|
||||
@ -127,6 +131,9 @@
|
||||
<TablixColumn>
|
||||
<Width>2.5cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>2.5cm</Width>
|
||||
</TablixColumn>
|
||||
</TablixColumns>
|
||||
<TablixRows>
|
||||
<TablixRow>
|
||||
@ -228,6 +235,38 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox2">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Статус Заказа</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
<Style>Solid</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox7">
|
||||
@ -336,13 +375,44 @@
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!ProductName.Value</Value>
|
||||
<Value>=Fields!IceCreamName.Value</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>IceCreamName</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
<Style>Solid</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="OrderStatus">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!OrderStatus.Value</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>OrderStatus</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
@ -397,6 +467,7 @@
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
</TablixMembers>
|
||||
</TablixColumnHierarchy>
|
||||
<TablixRowHierarchy>
|
||||
@ -413,7 +484,7 @@
|
||||
<Top>2.48391cm</Top>
|
||||
<Left>0.55245cm</Left>
|
||||
<Height>1.2cm</Height>
|
||||
<Width>16.44755cm</Width>
|
||||
<Width>18.94755cm</Width>
|
||||
<ZIndex>2</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
@ -513,7 +584,7 @@
|
||||
</ReportParameters>
|
||||
<ReportParametersLayout>
|
||||
<GridLayoutDefinition>
|
||||
<NumberOfColumns>4</NumberOfColumns>
|
||||
<NumberOfColumns>5</NumberOfColumns>
|
||||
<NumberOfRows>2</NumberOfRows>
|
||||
<CellDefinitions>
|
||||
<CellDefinition>
|
||||
@ -525,5 +596,5 @@
|
||||
</GridLayoutDefinition>
|
||||
</ReportParametersLayout>
|
||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
||||
<rd:ReportID>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
|
||||
</Report>
|
@ -14,7 +14,7 @@ namespace IceCreamShopContracts.BusinessLogicsContracts
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<ReportIceCreamComponentViewModel> GetProductComponent();
|
||||
List<ReportIceCreamComponentViewModel> GetIceCreamComponent();
|
||||
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
@ -27,13 +27,13 @@ namespace IceCreamShopContracts.BusinessLogicsContracts
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||
void SaveIceCreamsToWordFile(ReportBindingModel model);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveProductComponentToExcelFile(ReportBindingModel model);
|
||||
void SaveIceCreamComponentToExcelFile(ReportBindingModel model);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение заказов в файл-Pdf
|
||||
|
@ -8,10 +8,10 @@ namespace IceCreamShopContracts.ViewModels
|
||||
{
|
||||
public class ReportIceCreamComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string IceCreamName { get; set; } = string.Empty;
|
||||
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
public List<(string IceCream, int Count)> IceCreams { get; set; } = new();
|
||||
public List<(string IceCream, int Count)> Components { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace IceCreamShopContracts.ViewModels
|
||||
public DateTime DateCreate { get; set; }
|
||||
|
||||
public string IceCreamName { get; set; } = string.Empty;
|
||||
public string OrderStatus { get; set; } = string.Empty ;
|
||||
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using IceCreamShopContracts.ViewModels;
|
||||
using IceCreamShopContracts.BindingModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using IceCreamShopDatabaseImplement.Models;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace IceCreamShopDatabaseImplement.Implements
|
||||
{
|
||||
@ -53,14 +54,29 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
public IceCreamViewModel? Insert(IceCreamBindingModel model)
|
||||
{
|
||||
using var context = new IceCreamShopDatabase();
|
||||
var newIceCream = IceCream.Create(context, model);
|
||||
if (newIceCream == null)
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
{
|
||||
return null;
|
||||
try
|
||||
{
|
||||
var newIceCream = IceCream.Create(context, model);
|
||||
if (newIceCream == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
context.IceCreams.Add(newIceCream);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return newIceCream.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
context.IceCreams.Add(newIceCream);
|
||||
context.SaveChanges();
|
||||
return newIceCream.GetViewModel;
|
||||
}
|
||||
|
||||
public IceCreamViewModel? Update(IceCreamBindingModel model)
|
||||
|
@ -3,6 +3,7 @@ using IceCreamShopContracts.SearchModels;
|
||||
using IceCreamShopContracts.StoragesContracts;
|
||||
using IceCreamShopContracts.ViewModels;
|
||||
using IceCreamShopDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace IceCreamShopDatabaseImplement.Implements
|
||||
{
|
||||
@ -33,19 +34,20 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
}
|
||||
|
||||
using var context = new IceCreamShopDatabase();
|
||||
|
||||
return context.Orders.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (model is null) return new();
|
||||
using var context = new IceCreamShopDatabase();
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
return context.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).
|
||||
Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
using var context = new IceCreamShopDatabase();
|
||||
|
||||
return context.Orders.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
@ -70,7 +72,7 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
|
||||
return newOrder.GetViewModel;
|
||||
return context.Orders.FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -87,7 +89,7 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
|
||||
return order.GetViewModel;
|
||||
return context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
171
IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230313191542_NewMigration.Designer.cs
generated
Normal file
171
IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230313191542_NewMigration.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using IceCreamShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IceCreamShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(IceCreamShopDatabase))]
|
||||
[Migration("20230313191542_NewMigration")]
|
||||
partial class NewMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("IceCreamName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("IceCreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IceCreamId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("IceCreamId");
|
||||
|
||||
b.ToTable("IceCreamComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("IceCreamId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IceCreamId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b =>
|
||||
{
|
||||
b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("IceCreamComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("IceCreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("IceCream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("IceCreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("IceCream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("IceCreamComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IceCreamShopDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class NewMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -108,10 +108,6 @@ namespace IceCreamShopDatabaseImplement.Migrations
|
||||
b.Property<int>("IceCreamId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IceCreamName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -120,7 +116,7 @@ namespace IceCreamShopDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
b.HasIndex("IceCreamId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
@ -144,6 +140,17 @@ namespace IceCreamShopDatabaseImplement.Migrations
|
||||
b.Navigation("IceCream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("IceCreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("IceCream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("IceCreamComponents");
|
||||
|
@ -20,7 +20,7 @@ namespace IceCreamShopDatabaseImplement.Models
|
||||
[ForeignKey("ComponentId")]
|
||||
public virtual List<IceCreamComponent> IceCreamComponents { get; set; } = new();
|
||||
|
||||
public static Component? Create(ComponentBindingModel model)
|
||||
public static Component? Create(ComponentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -33,16 +33,8 @@ namespace IceCreamShopDatabaseImplement.Models
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
public static Component Create(ComponentViewModel model)
|
||||
{
|
||||
return new Component
|
||||
{
|
||||
Id = model.Id,
|
||||
ComponentName = model.ComponentName,
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
public void Update(ComponentBindingModel model)
|
||||
|
||||
public void Update(ComponentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace IceCreamShopDatabaseImplement.Models
|
||||
[ForeignKey("IceCreamId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
public static IceCream Create(IceCreamShopDatabase context, IceCreamBindingModel model)
|
||||
public static IceCream? Create(IceCreamShopDatabase context, IceCreamBindingModel model)
|
||||
{
|
||||
return new IceCream()
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ namespace IceCreamShopDatabaseImplement.Models
|
||||
return;
|
||||
}
|
||||
Status = model.Status;
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
|
@ -26,20 +26,19 @@ namespace IceCreamShopFileImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return source.Orders
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
return GetViewModel(source.Orders.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)));
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
@ -69,7 +68,7 @@ namespace IceCreamShopFileImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
source.SaveOrders();
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
@ -80,7 +79,18 @@ namespace IceCreamShopFileImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
source.SaveOrders();
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
|
||||
private OrderViewModel GetViewModel(Order order)
|
||||
{
|
||||
var viewModel = order.GetViewModel;
|
||||
var icecream = source.IceCreams.FirstOrDefault(x => x.Id == order.IceCreamId);
|
||||
if (icecream != null)
|
||||
{
|
||||
viewModel.IceCreamName = icecream.IceCreamName;
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ namespace IceCreamShopFileImplement.Models
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int IceCreamId { get; private set; }
|
||||
public string IceCreamName { get; private set; } = string.Empty;
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
@ -37,7 +36,6 @@ namespace IceCreamShopFileImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
IceCreamId = model.IceCreamId,
|
||||
IceCreamName = model.IceCreamName,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -55,7 +53,6 @@ namespace IceCreamShopFileImplement.Models
|
||||
{
|
||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||
IceCreamId = Convert.ToInt32(element.Element("IceCreamId")!.Value),
|
||||
IceCreamName = element.Element("IceCreamName")!.Value,
|
||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
||||
@ -69,20 +66,13 @@ namespace IceCreamShopFileImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
Id = model.Id;
|
||||
IceCreamId = model.IceCreamId;
|
||||
IceCreamName = model.IceCreamName;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
IceCreamId = IceCreamId,
|
||||
IceCreamName = IceCreamName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
@ -93,7 +83,6 @@ namespace IceCreamShopFileImplement.Models
|
||||
"Order",
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("IceCreamId", IceCreamId.ToString()),
|
||||
new XElement("IceCreamName", IceCreamName),
|
||||
new XElement("Count", Count.ToString()),
|
||||
new XElement("Sum", Sum.ToString()),
|
||||
new XElement("Status", Status.ToString()),
|
||||
|
@ -27,7 +27,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
{
|
||||
var element = _source.Orders[i];
|
||||
_source.Orders.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
return GetViewModel(element);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -39,7 +39,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -51,8 +51,8 @@ namespace IceCreamShopListImplement.Implements
|
||||
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
result.Add(order.GetViewModel);
|
||||
if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)
|
||||
result.Add(GetViewModel(order));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -62,7 +62,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
var result = new List<OrderViewModel>();
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
result.Add(GetViewModel(order));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -83,7 +83,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
return null;
|
||||
}
|
||||
_source.Orders.Add(newOrder);
|
||||
return newOrder.GetViewModel;
|
||||
return GetViewModel(newOrder);
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -93,10 +93,24 @@ namespace IceCreamShopListImplement.Implements
|
||||
if (order.Id == model.Id)
|
||||
{
|
||||
order.Update(model);
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private OrderViewModel GetViewModel(Order order)
|
||||
{
|
||||
var viewModel = order.GetViewModel;
|
||||
foreach (var icecream in _source.iceCreams)
|
||||
{
|
||||
if (icecream.Id == order.IceCreamId)
|
||||
{
|
||||
viewModel.IceCreamName = icecream.IceCreamName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ namespace IceCreamShopListImplement.Models
|
||||
|
||||
public int IceCreamId { get; private set; }
|
||||
|
||||
public string IceCreamName { get; private set; } = string.Empty;
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
@ -37,7 +35,6 @@ namespace IceCreamShopListImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
IceCreamId = model.IceCreamId,
|
||||
IceCreamName = model.IceCreamName,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -49,13 +46,7 @@ namespace IceCreamShopListImplement.Models
|
||||
public void Update(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null) return;
|
||||
Id = model.Id;
|
||||
IceCreamId = model.IceCreamId;
|
||||
IceCreamName = model.IceCreamName;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
|
||||
@ -63,7 +54,6 @@ namespace IceCreamShopListImplement.Models
|
||||
{
|
||||
Id = Id,
|
||||
IceCreamId = IceCreamId,
|
||||
IceCreamName = IceCreamName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
|
Loading…
Reference in New Issue
Block a user