Add new order + fix
This commit is contained in:
parent
8e73008033
commit
6dca3efbb7
110
SushiBar/SushiBar/FormMain.Designer.cs
generated
110
SushiBar/SushiBar/FormMain.Designer.cs
generated
@ -33,19 +33,18 @@
|
|||||||
this.directoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.directoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.sushiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.sushiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.storesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.listComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.listComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.componentsOnSushiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentsOnSushiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.listOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.orderListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonSubmit = new System.Windows.Forms.Button();
|
this.buttonSubmit = new System.Windows.Forms.Button();
|
||||||
this.buttonReady = new System.Windows.Forms.Button();
|
this.buttonReady = new System.Windows.Forms.Button();
|
||||||
this.buttonIssue = new System.Windows.Forms.Button();
|
this.buttonIssue = new System.Windows.Forms.Button();
|
||||||
this.buttonReload = new System.Windows.Forms.Button();
|
this.buttonReload = new System.Windows.Forms.Button();
|
||||||
this.buttonReplenishment = new System.Windows.Forms.Button();
|
this.buttonSell = new System.Windows.Forms.Button();
|
||||||
this.ButtonSell = new System.Windows.Forms.Button();
|
this.buttonSupply = new System.Windows.Forms.Button();
|
||||||
this.buttonReplenisment = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSelll = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -75,7 +74,7 @@
|
|||||||
this.directoryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.directoryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.componentsToolStripMenuItem,
|
this.componentsToolStripMenuItem,
|
||||||
this.sushiToolStripMenuItem,
|
this.sushiToolStripMenuItem,
|
||||||
this.storeToolStripMenuItem});
|
this.storesToolStripMenuItem});
|
||||||
this.directoryToolStripMenuItem.Name = "directoryToolStripMenuItem";
|
this.directoryToolStripMenuItem.Name = "directoryToolStripMenuItem";
|
||||||
this.directoryToolStripMenuItem.Size = new System.Drawing.Size(67, 20);
|
this.directoryToolStripMenuItem.Size = new System.Drawing.Size(67, 20);
|
||||||
this.directoryToolStripMenuItem.Text = "Directory";
|
this.directoryToolStripMenuItem.Text = "Directory";
|
||||||
@ -83,17 +82,55 @@
|
|||||||
// componentsToolStripMenuItem
|
// componentsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||||
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
|
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.componentsToolStripMenuItem.Text = "Components";
|
this.componentsToolStripMenuItem.Text = "Components";
|
||||||
this.componentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
this.componentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// sushiToolStripMenuItem
|
// sushiToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
|
this.sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
|
||||||
this.sushiToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
|
this.sushiToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.sushiToolStripMenuItem.Text = "Sushi";
|
this.sushiToolStripMenuItem.Text = "Sushi";
|
||||||
this.sushiToolStripMenuItem.Click += new System.EventHandler(this.SushiToolStripMenuItem_Click);
|
this.sushiToolStripMenuItem.Click += new System.EventHandler(this.SushiToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// storesToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.storesToolStripMenuItem.Name = "storesToolStripMenuItem";
|
||||||
|
this.storesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.storesToolStripMenuItem.Text = "Stores";
|
||||||
|
this.storesToolStripMenuItem.Click += new System.EventHandler(this.StoreToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// reportsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.listComponentsToolStripMenuItem,
|
||||||
|
this.componentsOnSushiToolStripMenuItem,
|
||||||
|
this.orderListToolStripMenuItem});
|
||||||
|
this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
||||||
|
this.reportsToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
|
||||||
|
this.reportsToolStripMenuItem.Text = "Reports";
|
||||||
|
//
|
||||||
|
// listComponentsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.listComponentsToolStripMenuItem.Name = "listComponentsToolStripMenuItem";
|
||||||
|
this.listComponentsToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
||||||
|
this.listComponentsToolStripMenuItem.Text = "List components";
|
||||||
|
this.listComponentsToolStripMenuItem.Click += new System.EventHandler(this.ListComponentsToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// componentsOnSushiToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.componentsOnSushiToolStripMenuItem.Name = "componentsOnSushiToolStripMenuItem";
|
||||||
|
this.componentsOnSushiToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
||||||
|
this.componentsOnSushiToolStripMenuItem.Text = "Components on sushi";
|
||||||
|
this.componentsOnSushiToolStripMenuItem.Click += new System.EventHandler(this.ComponentsOnSushiToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// orderListToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.orderListToolStripMenuItem.Name = "orderListToolStripMenuItem";
|
||||||
|
this.orderListToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
||||||
|
this.orderListToolStripMenuItem.Text = "Order list";
|
||||||
|
this.orderListToolStripMenuItem.Click += new System.EventHandler(this.ListOrdersToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(814, 27);
|
this.buttonCreateOrder.Location = new System.Drawing.Point(814, 27);
|
||||||
@ -144,47 +181,33 @@
|
|||||||
this.buttonReload.UseVisualStyleBackColor = true;
|
this.buttonReload.UseVisualStyleBackColor = true;
|
||||||
this.buttonReload.Click += new System.EventHandler(this.ButtonReload_Click);
|
this.buttonReload.Click += new System.EventHandler(this.ButtonReload_Click);
|
||||||
//
|
//
|
||||||
// buttonReplenishment
|
// buttonSell
|
||||||
//
|
//
|
||||||
this.buttonReplenishment.Location = new System.Drawing.Point(0, 0);
|
this.buttonSell.Location = new System.Drawing.Point(814, 415);
|
||||||
this.buttonReplenishment.Name = "buttonReplenishment";
|
this.buttonSell.Name = "buttonSell";
|
||||||
this.buttonReplenishment.Size = new System.Drawing.Size(75, 23);
|
this.buttonSell.Size = new System.Drawing.Size(111, 23);
|
||||||
this.buttonReplenishment.TabIndex = 0;
|
this.buttonSell.TabIndex = 7;
|
||||||
|
this.buttonSell.Text = "Sell";
|
||||||
|
this.buttonSell.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSell.Click += new System.EventHandler(this.ButtonSell_Click);
|
||||||
//
|
//
|
||||||
// ButtonSell
|
// buttonSupply
|
||||||
//
|
//
|
||||||
this.ButtonSell.Location = new System.Drawing.Point(0, 0);
|
this.buttonSupply.Location = new System.Drawing.Point(814, 386);
|
||||||
this.ButtonSell.Name = "ButtonSell";
|
this.buttonSupply.Name = "buttonSupply";
|
||||||
this.ButtonSell.Size = new System.Drawing.Size(75, 23);
|
this.buttonSupply.Size = new System.Drawing.Size(111, 23);
|
||||||
this.ButtonSell.TabIndex = 0;
|
this.buttonSupply.TabIndex = 8;
|
||||||
//
|
this.buttonSupply.Text = "Supply";
|
||||||
// buttonReplenisment
|
this.buttonSupply.UseVisualStyleBackColor = true;
|
||||||
//
|
this.buttonSupply.Click += new System.EventHandler(this.ButtonReplenishment_Click);
|
||||||
this.buttonReplenisment.Location = new System.Drawing.Point(814, 415);
|
|
||||||
this.buttonReplenisment.Name = "buttonReplenisment";
|
|
||||||
this.buttonReplenisment.Size = new System.Drawing.Size(111, 23);
|
|
||||||
this.buttonReplenisment.TabIndex = 7;
|
|
||||||
this.buttonReplenisment.Text = "Replenishment";
|
|
||||||
this.buttonReplenisment.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonReplenisment.Click += new System.EventHandler(this.ButtonReplenishment_Click);
|
|
||||||
//
|
|
||||||
// buttonSelll
|
|
||||||
//
|
|
||||||
this.buttonSelll.Location = new System.Drawing.Point(814, 386);
|
|
||||||
this.buttonSelll.Name = "buttonSelll";
|
|
||||||
this.buttonSelll.Size = new System.Drawing.Size(111, 23);
|
|
||||||
this.buttonSelll.TabIndex = 8;
|
|
||||||
this.buttonSelll.Text = "Sell";
|
|
||||||
this.buttonSelll.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSelll.Click += new System.EventHandler(this.ButtonSell_Click);
|
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(937, 450);
|
this.ClientSize = new System.Drawing.Size(937, 450);
|
||||||
this.Controls.Add(this.buttonSelll);
|
this.Controls.Add(this.buttonSupply);
|
||||||
this.Controls.Add(this.buttonReplenisment);
|
this.Controls.Add(this.buttonSell);
|
||||||
this.Controls.Add(this.buttonReload);
|
this.Controls.Add(this.buttonReload);
|
||||||
this.Controls.Add(this.buttonIssue);
|
this.Controls.Add(this.buttonIssue);
|
||||||
this.Controls.Add(this.buttonReady);
|
this.Controls.Add(this.buttonReady);
|
||||||
@ -216,5 +239,12 @@
|
|||||||
private Button buttonReload;
|
private Button buttonReload;
|
||||||
private ToolStripMenuItem componentsToolStripMenuItem;
|
private ToolStripMenuItem componentsToolStripMenuItem;
|
||||||
private ToolStripMenuItem sushiToolStripMenuItem;
|
private ToolStripMenuItem sushiToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem storesToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem reportsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem listComponentsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem componentsOnSushiToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem orderListToolStripMenuItem;
|
||||||
|
private Button buttonSell;
|
||||||
|
private Button buttonSupply;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -177,14 +177,12 @@ namespace SushiBar
|
|||||||
private void ListComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ListComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() != DialogResult.OK) return;
|
||||||
|
_reportLogic.SaveStoresToWordFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
_reportLogic.SaveSushiToWordFile(new ReportBindingModel
|
FileName = dialog.FileName
|
||||||
{
|
});
|
||||||
FileName = dialog.FileName
|
MessageBox.Show("Complete", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
});
|
|
||||||
MessageBox.Show("Complete", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComponentsOnSushiToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ComponentsOnSushiToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -13,6 +13,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
private readonly IComponentStorage _componentStorage;
|
private readonly IComponentStorage _componentStorage;
|
||||||
private readonly ISushiStorage _sushiStorage;
|
private readonly ISushiStorage _sushiStorage;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
private readonly IStoreStorage _storeStorage;
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
private readonly AbstractSaveToExcel _saveToExcel;
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
private readonly AbstractSaveToWord _saveToWord;
|
||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
private readonly AbstractSaveToPdf _saveToPdf;
|
||||||
@ -22,7 +23,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
IOrderStorage orderStorage,
|
IOrderStorage orderStorage,
|
||||||
AbstractSaveToExcel saveToExcel,
|
AbstractSaveToExcel saveToExcel,
|
||||||
AbstractSaveToWord saveToWord,
|
AbstractSaveToWord saveToWord,
|
||||||
AbstractSaveToPdf saveToPdf)
|
AbstractSaveToPdf saveToPdf, IStoreStorage storeStorage)
|
||||||
{
|
{
|
||||||
_sushiStorage = sushiStorage;
|
_sushiStorage = sushiStorage;
|
||||||
_componentStorage = componentStorage;
|
_componentStorage = componentStorage;
|
||||||
@ -30,6 +31,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
_saveToWord = saveToWord;
|
_saveToWord = saveToWord;
|
||||||
_saveToPdf = saveToPdf;
|
_saveToPdf = saveToPdf;
|
||||||
|
_storeStorage = storeStorage;
|
||||||
}
|
}
|
||||||
public List<ReportSushiComponentViewModel> GetSushi()
|
public List<ReportSushiComponentViewModel> GetSushi()
|
||||||
{
|
{
|
||||||
@ -71,6 +73,16 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveStoresToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Stores list",
|
||||||
|
Stores = _storeStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
public void SaveSushiToWordFile(ReportBindingModel model)
|
public void SaveSushiToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
|
@ -1,45 +1,32 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
|
using DocumentFormat.OpenXml.Drawing;
|
||||||
|
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage
|
namespace SushiBarBusinessLogic.OfficePackage;
|
||||||
|
|
||||||
|
public abstract class AbstractSaveToWord
|
||||||
{
|
{
|
||||||
public abstract class AbstractSaveToWord
|
public void CreateDoc(WordInfo info)
|
||||||
{
|
{
|
||||||
public void CreateDoc(WordInfo info)
|
CreateWord(info);
|
||||||
{
|
|
||||||
CreateWord(info);
|
var rows = info.Stores
|
||||||
CreateParagraph(new WordParagraph
|
.Select(store => CreateRow(
|
||||||
{
|
new List<TableCell?>()
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
|
||||||
(info.Title, new WordTextProperties { Bold = true, Size = "24", })
|
|
||||||
},
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
{
|
||||||
Size = "24",
|
CreateCell(new WordCell { Text = store.StoreName }),
|
||||||
JustificationType = WordJustificationType.Center
|
CreateCell(new WordCell { Text = store.StoreAddress }),
|
||||||
}
|
CreateCell(new WordCell { Text = store.OpeningDate.ToShortDateString() })
|
||||||
});
|
})).ToList();
|
||||||
foreach (var sushi in info.Sushi)
|
|
||||||
{
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
|
||||||
(sushi.SushiName, new WordTextProperties { Bold = true, Size = "24" }),
|
|
||||||
($" {sushi.Price}", new WordTextProperties { Size = "24", JustificationType = WordJustificationType.Right }) },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Both
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
SaveWord(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void CreateWord(WordInfo info);
|
CreateTable(rows);
|
||||||
|
SaveWord(info);
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
|
||||||
|
|
||||||
protected abstract void SaveWord(WordInfo info);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
protected abstract void CreateWord(WordInfo info);
|
||||||
|
protected abstract void CreateParagraph(WordParagraph? paragraph);
|
||||||
|
protected abstract void SaveWord(WordInfo info);
|
||||||
|
protected abstract void CreateTable(List<TableRow?>? rows);
|
||||||
|
protected abstract TableRow? CreateRow(List<TableCell?>? cells);
|
||||||
|
protected abstract TableCell? CreateCell(WordCell? cell);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
||||||
|
|
||||||
|
public class WordCell
|
||||||
|
{
|
||||||
|
public int Width { get; set; }
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
}
|
@ -7,5 +7,6 @@ namespace SushiBarBusinessLogic.OfficePackage.HelpersModels
|
|||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<SushiViewModel> Sushi { get; set; } = new();
|
public List<SushiViewModel> Sushi { get; set; } = new();
|
||||||
|
public List<StoreViewModel> Stores { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using static System.Net.Mime.MediaTypeNames;
|
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
using DocumentFormat.OpenXml;
|
using DocumentFormat.OpenXml;
|
||||||
using Document = DocumentFormat.OpenXml.Wordprocessing.Document;
|
using Document = DocumentFormat.OpenXml.Wordprocessing.Document;
|
||||||
|
using TableCell = DocumentFormat.OpenXml.Drawing.TableCell;
|
||||||
|
using TableRow = DocumentFormat.OpenXml.Drawing.TableRow;
|
||||||
using Text = DocumentFormat.OpenXml.Wordprocessing.Text;
|
using Text = DocumentFormat.OpenXml.Wordprocessing.Text;
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||||
@ -72,7 +72,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|||||||
mainPart.Document = new Document();
|
mainPart.Document = new Document();
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
}
|
}
|
||||||
protected override void CreateParagraph(WordParagraph paragraph)
|
protected override void CreateParagraph(WordParagraph? paragraph)
|
||||||
{
|
{
|
||||||
if (_docBody == null || paragraph == null)
|
if (_docBody == null || paragraph == null)
|
||||||
{
|
{
|
||||||
@ -111,5 +111,46 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|||||||
_wordDocument.Close();
|
_wordDocument.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void CreateTable(List<TableRow?>? rows)
|
||||||
|
{
|
||||||
|
if (_docBody == null || rows == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var table = new Table();
|
||||||
|
var tblProp = new TableProperties(
|
||||||
|
new TableBorders(
|
||||||
|
new TopBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new BottomBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new LeftBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new RightBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new InsideHorizontalBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new InsideVerticalBorder { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
table.AppendChild(tblProp);
|
||||||
|
table.Append(rows);
|
||||||
|
_docBody.AppendChild(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TableRow? CreateRow(List<TableCell?>? cells)
|
||||||
|
{
|
||||||
|
if (cells == null) return null;
|
||||||
|
var row = new TableRow();
|
||||||
|
row.Append(cells);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TableCell? CreateCell(WordCell? cell)
|
||||||
|
{
|
||||||
|
if (cell == null) return null;
|
||||||
|
var createCell = new TableCell(new Paragraph(
|
||||||
|
new Run(
|
||||||
|
new Text(cell.Text))));
|
||||||
|
createCell.Append(
|
||||||
|
new TableCellProperties(
|
||||||
|
new TableCellWidth { Width = cell.Width.ToString() }));
|
||||||
|
return createCell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ namespace SushiBarContracts.BusinessLogicsContracts
|
|||||||
void SaveSushiToWordFile(ReportBindingModel model);
|
void SaveSushiToWordFile(ReportBindingModel model);
|
||||||
void SaveProductComponentToExcelFile(ReportBindingModel model);
|
void SaveProductComponentToExcelFile(ReportBindingModel model);
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||||
|
public void SaveStoresToWordFile(ReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user