Compare commits

..

8 Commits

190 changed files with 151134 additions and 959 deletions

View File

@ -14,6 +14,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreDatabaseImplement", "ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj", "{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreDatabaseImplement", "ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj", "{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreREST", "ComputerHardwareStoreREST\ComputerHardwareStoreREST.csproj", "{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreREST", "ComputerHardwareStoreREST\ComputerHardwareStoreREST.csproj", "{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}"
ProjectSection(ProjectDependencies) = postProject
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD} = {D32DEB60-AF40-46AF-8914-DC6A19BD66CD}
EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VendorClient", "VendorClient\VendorClient.csproj", "{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VendorClient", "VendorClient\VendorClient.csproj", "{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}"
EndProject EndProject

View File

@ -0,0 +1,20 @@
using ComputerHardwareContracts.BindingModels;
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
public class MessageInfoLogic : IMessageInfoLogic
{
public bool Create(MessageInfoBindingModel model)
{
throw new NotImplementedException();
}
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
{
throw new NotImplementedException();
}
}
}

View File

@ -76,7 +76,7 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
throw new ArgumentNullException(nameof(element)); throw new ArgumentNullException(nameof(element));
} }
model.OrderProduct = element.OrderProduct; model.OrderProducts = element.OrderProducts;
model.DateCreate = element.DateCreate; model.DateCreate = element.DateCreate;
model.Status = element.Status; model.Status = element.Status;

View File

@ -7,6 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,62 @@
using ComputerHardwareStoreContracts.BindingModels;
using Microsoft.Extensions.Logging;
namespace ComputerHardwareStoreBusinessLogic.MailWorker
{
public abstract class AbstractMailWorker
{
protected string _mailLogin = string.Empty;
protected string _mailPassword = string.Empty;
protected string _smtpClientHost = string.Empty;
protected int _smtpClientPort;
protected string _popHost = string.Empty;
protected int _popPort;
private readonly ILogger _logger;
public AbstractMailWorker(ILogger<AbstractMailWorker> logger)
{
_logger = logger;
}
public void MailConfig(MailConfigBindingModel config)
{
_mailLogin = config.MailLogin;
_mailPassword = config.MailPassword;
_smtpClientHost = config.SmtpClientHost;
_smtpClientPort = config.SmtpClientPort;
_popHost = config.PopHost;
_popPort = config.PopPort;
_logger.LogDebug("Config: {login}, {password}, {clientHost}, {clientPort}, {popHost}, {popPort}",
_mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
}
public async void MailSendAsync(MailSendInfoBindingModel info)
{
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
{
return;
}
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
{
return;
}
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
{
return;
}
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject);
await SendMailAsync(info);
}
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
}
}

View File

@ -0,0 +1,41 @@
using ComputerHardwareStoreContracts.BindingModels;
using Microsoft.Extensions.Logging;
using System.Net;
using System.Net.Mail;
using System.Text;
namespace ComputerHardwareStoreBusinessLogic.MailWorker
{
public class MailKitWorker : AbstractMailWorker
{
public MailKitWorker(ILogger<MailKitWorker> logger) : base(logger) { }
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
{
using var objMailMessage = new MailMessage();
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
try
{
objMailMessage.From = new MailAddress(_mailLogin);
objMailMessage.To.Add(new MailAddress(info.MailAddress));
objMailMessage.Subject = info.Subject;
objMailMessage.Body = info.Text;
objMailMessage.SubjectEncoding = Encoding.UTF8;
objMailMessage.BodyEncoding = Encoding.UTF8;
MemoryStream ms = new(info.File);
objMailMessage.Attachments.Add(new Attachment(ms, "report.pdf", "application/pdf"));
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.EnableSsl = true;
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
await Task.Run(() => objSmtpClient.Send(objMailMessage));
}
catch (Exception)
{
throw;
}
}
}
}

View File

@ -0,0 +1,112 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcel
{
public void CreateReportProduct(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
uint rowIndex = 2;
foreach (var pb in info.ProductBuilds)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = pb.ProductName,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var Build in pb.Builds)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = Build.Item1,
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = Build.Item2.ToString(),
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
rowIndex++;
}
SaveExcel(info);
}
public void CreateReportBuild(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
uint rowIndex = 2;
foreach (var bp in info.BuildProducts)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = bp.BuildName,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var Product in bp.Products)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = Product.Item1,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = Product.Item2.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
rowIndex++;
}
SaveExcel(info);
}
protected abstract void CreateExcel(ExcelInfo info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
protected abstract void MergeCells(ExcelMergeParameters excelParams);
protected abstract void SaveExcel(ExcelInfo info);
}
}

View File

@ -0,0 +1,125 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateProductBuildReport(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<WordRow> rows = new List<WordRow>();
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)> {
("Сборки", new WordTextProperties { Size = "24", Bold = true }),
("Товары", new WordTextProperties { Size = "24", Bold = true }),
("Стоимость", new WordTextProperties { Size = "24", Bold = true })
}
});
var reportRecords = info.ProductBuilds;
foreach (var reportRecord in reportRecords)
{
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)>
{
(reportRecord.ProductName, new WordTextProperties { Size = "24" }),
("", new WordTextProperties { }),
("", new WordTextProperties { })
}
});
for (int i = 0; i < reportRecord.Builds.Count; i++)
{
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)>
{
("", new WordTextProperties { }),
(reportRecord.Builds[i].Build, new WordTextProperties { Size = "24" }),
(reportRecord.Builds[i].Price.ToString(), new WordTextProperties { Size = "24" })
}
});
}
}
CreateTable(rows);
SaveWord(info);
}
public void CreateBuildProductReport(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
List<WordRow> rows = new List<WordRow>();
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)> {
("Товары", new WordTextProperties { Size = "24", Bold = true }),
("Сборки", new WordTextProperties { Size = "24", Bold = true }),
("Стоимость", new WordTextProperties { Size = "24", Bold = true })
}
});
var reportRecords = info.BuildProducts;
foreach (var reportRecord in reportRecords)
{
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)>
{
(reportRecord.BuildName, new WordTextProperties { Size = "24" }),
("", new WordTextProperties { }),
("", new WordTextProperties { })
}
});
for (int i = 0; i < reportRecord.Products.Count; i++)
{
rows.Add(new WordRow
{
Rows = new List<(string, WordTextProperties)>
{
("", new WordTextProperties { }),
(reportRecord.Products[i].Product, new WordTextProperties { Size = "24" }),
(reportRecord.Products[i].Price.ToString(), new WordTextProperties { Size = "24" })
}
});
}
}
CreateTable(rows);
SaveWord(info);
}
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateTable(List<WordRow> rows);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
}
}

View File

@ -0,0 +1,9 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums
{
public enum ExcelStyleInfoType
{
Title,
Text,
TextWithBroder
}
}

View File

@ -0,0 +1,8 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums
{
public enum WordJustificationType
{
Center,
Both
}
}

View File

@ -0,0 +1,13 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class ExcelCellParameters
{
public string ColumnName { get; set; } = string.Empty;
public uint RowIndex { get; set; }
public string Text { get; set; } = string.Empty;
public string CellReference => $"{ColumnName}{RowIndex}";
public ExcelStyleInfoType StyleInfo { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class ExcelInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ReportBuildProductViewModel> BuildProducts { get; set; } = new();
public List<ReportProductBuildViewModel> ProductBuilds {get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class ExcelMergeParameters
{
public string CellFromName { get; set; } = string.Empty;
public string CellToName { get; set; } = string.Empty;
public string Merge => $"{CellFromName}:{CellToName}";
}
}

View File

@ -0,0 +1,12 @@
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class WordInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ReportBuildProductViewModel> BuildProducts { get; set; } = new();
public List<ReportProductBuildViewModel> ProductBuilds { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class WordParagraph
{
public List<(string, WordTextProperties)> Texts { get; set; } = new();
public WordTextProperties? TextProperties { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class WordRow
{
public List<(string, WordTextProperties)> Rows { get; set; } = new();
}
}

View File

@ -0,0 +1,11 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class WordTextProperties
{
public string Size { get; set; } = string.Empty;
public bool Bold { get; set; }
public WordJustificationType JustificationType { get; set; }
}
}

View File

@ -0,0 +1,329 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2013.Excel;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.Implements
{
public class SaveToExcel : AbstractSaveToExcel
{
private SpreadsheetDocument? _spreadsheetDocument;
private SharedStringTablePart? _shareStringPart;
private Worksheet? _worksheet;
private static void CreateStyles(WorkbookPart workbookpart)
{
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
sp.Stylesheet = new Stylesheet();
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
var fontUsual = new Font();
fontUsual.Append(new FontSize() { Val = 12D });
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Theme = 1U });
fontUsual.Append(new FontName() { Val = "Times New Roman" });
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
var fontTitle = new Font();
fontTitle.Append(new Bold());
fontTitle.Append(new FontSize() { Val = 14D });
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Theme = 1U });
fontTitle.Append(new FontName() { Val = "Times New Roman" });
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
fonts.Append(fontUsual);
fonts.Append(fontTitle);
var fills = new Fills() { Count = 2U };
var fill1 = new Fill();
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
var fill2 = new Fill();
fill2.Append(new PatternFill()
{
PatternType = PatternValues.Gray125
});
fills.Append(fill1);
fills.Append(fill2);
var borders = new Borders() { Count = 2U };
var borderNoBorder = new Border();
borderNoBorder.Append(new LeftBorder());
borderNoBorder.Append(new RightBorder());
borderNoBorder.Append(new TopBorder());
borderNoBorder.Append(new BottomBorder());
borderNoBorder.Append(new DiagonalBorder());
var borderThin = new Border();
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var rightBorder = new RightBorder()
{
Style = BorderStyleValues.Thin
};
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
var bottomBorder = new BottomBorder()
{
Style = BorderStyleValues.Thin
};
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
borderThin.Append(leftBorder);
borderThin.Append(rightBorder);
borderThin.Append(topBorder);
borderThin.Append(bottomBorder);
borderThin.Append(new DiagonalBorder());
borders.Append(borderNoBorder);
borders.Append(borderThin);
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
var cellFormatStyle = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 0U
};
cellStyleFormats.Append(cellFormatStyle);
var cellFormats = new CellFormats() { Count = 3U };
var cellFormatFont = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
ApplyFont = true
};
var cellFormatFontAndBorder = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 1U,
FormatId = 0U,
ApplyFont = true,
ApplyBorder = true
};
var cellFormatTitle = new CellFormat()
{
NumberFormatId = 0U,
FontId = 1U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
Alignment = new Alignment()
{
Vertical = VerticalAlignmentValues.Center,
WrapText = true,
Horizontal = HorizontalAlignmentValues.Center
},
ApplyFont = true
};
cellFormats.Append(cellFormatFont);
cellFormats.Append(cellFormatFontAndBorder);
cellFormats.Append(cellFormatTitle);
var cellStyles = new CellStyles() { Count = 1U };
cellStyles.Append(new CellStyle()
{
Name = "Normal",
FormatId = 0U,
BuiltinId = 0U
});
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
{ Count = 0U };
var tableStyles = new TableStyles()
{
Count = 0U,
DefaultTableStyle = "TableStyleMedium2",
DefaultPivotStyle = "PivotStyleLight16"
};
var stylesheetExtensionList = new StylesheetExtensionList();
var stylesheetExtension1 = new StylesheetExtension()
{
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
};
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
stylesheetExtension1.Append(new SlicerStyles()
{
DefaultSlicerStyle = "SlicerStyleLight1"
});
var stylesheetExtension2 = new StylesheetExtension()
{
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
};
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
stylesheetExtension2.Append(new TimelineStyles()
{
DefaultTimelineStyle = "TimeSlicerStyleLight1"
});
stylesheetExtensionList.Append(stylesheetExtension1);
stylesheetExtensionList.Append(stylesheetExtension2);
sp.Stylesheet.Append(fonts);
sp.Stylesheet.Append(fills);
sp.Stylesheet.Append(borders);
sp.Stylesheet.Append(cellStyleFormats);
sp.Stylesheet.Append(cellFormats);
sp.Stylesheet.Append(cellStyles);
sp.Stylesheet.Append(differentialFormats);
sp.Stylesheet.Append(tableStyles);
sp.Stylesheet.Append(stylesheetExtensionList);
}
/// <summary>
/// Получение номера стиля из типа
/// </summary>
/// <param name="styleInfo"></param>
/// <returns></returns>
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
{
return styleInfo switch
{
ExcelStyleInfoType.Title => 2U,
ExcelStyleInfoType.TextWithBroder => 1U,
ExcelStyleInfoType.Text => 0U,
_ => 0U,
};
}
protected override void CreateExcel(ExcelInfo info)
{
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
// Создаем книгу (в ней хранятся листы)
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
CreateStyles(workbookpart);
// Получаем/создаем хранилище текстов для книги
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
?
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
:
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
// Создаем SharedStringTable, если его нет
if (_shareStringPart.SharedStringTable == null)
{
_shareStringPart.SharedStringTable = new SharedStringTable();
}
// Создаем лист в книгу
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData());
// Добавляем лист в книгу
var sheets =
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
var sheet = new Sheet()
{
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
SheetId = 1,
Name = "Лист"
};
sheets.Append(sheet);
_worksheet = worksheetPart.Worksheet;
}
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
{
if (_worksheet == null || _shareStringPart == null)
{
return;
}
var sheetData = _worksheet.GetFirstChild<SheetData>();
if (sheetData == null)
{
return;
}
// Ищем строку, либо добавляем ее
Row row;
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
{
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
}
else
{
row = new Row() { RowIndex = excelParams.RowIndex };
sheetData.Append(row);
}
// Ищем нужную ячейку
Cell cell;
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
{
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
}
else
{
// Все ячейки должны быть последовательно друг за другом расположены
// нужно определить, после какой вставлять
Cell? refCell = null;
foreach (Cell rowCell in row.Elements<Cell>())
{
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
{
refCell = rowCell;
break;
}
}
var newCell = new Cell()
{
CellReference =
excelParams.CellReference
};
row.InsertBefore(newCell, refCell);
cell = newCell;
}
// вставляем новый текст
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
_shareStringPart.SharedStringTable.Save();
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
}
protected override void MergeCells(ExcelMergeParameters excelParams)
{
if (_worksheet == null)
{
return;
}
MergeCells mergeCells;
if (_worksheet.Elements<MergeCells>().Any())
{
mergeCells = _worksheet.Elements<MergeCells>().First();
}
else
{
mergeCells = new MergeCells();
if (_worksheet.Elements<CustomSheetView>().Any())
{
_worksheet.InsertAfter(mergeCells,
_worksheet.Elements<CustomSheetView>().First());
}
else
{
_worksheet.InsertAfter(mergeCells,
_worksheet.Elements<SheetData>().First());
}
}
var mergeCell = new MergeCell()
{
Reference = new StringValue(excelParams.Merge)
};
mergeCells.Append(mergeCell);
}
protected override void SaveExcel(ExcelInfo info)
{
if (_spreadsheetDocument == null)
{
return;
}
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
_spreadsheetDocument.Close();
}
}
}

View File

@ -0,0 +1,175 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.Implements
{
public class SaveToWord : AbstractSaveToWord
{
private WordprocessingDocument? _wordDocument;
private Body? _docBody;
private static JustificationValues GetJustificationValues(WordJustificationType type)
{
return type switch
{
WordJustificationType.Both => JustificationValues.Both,
WordJustificationType.Center => JustificationValues.Center,
_ => JustificationValues.Left,
};
}
private static SectionProperties CreateSectionProperties()
{
var properties = new SectionProperties();
var pageSize = new PageSize
{
Orient = PageOrientationValues.Portrait
};
properties.AppendChild(pageSize);
return properties;
}
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
{
if (paragraphProperties == null)
{
return null;
}
var properties = new ParagraphProperties();
properties.AppendChild(new Justification()
{
Val = GetJustificationValues(paragraphProperties.JustificationType)
});
properties.AppendChild(new SpacingBetweenLines
{
LineRule = LineSpacingRuleValues.Auto
});
properties.AppendChild(new Indentation());
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
if (!string.IsNullOrEmpty(paragraphProperties.Size))
{
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size });
}
properties.AppendChild(paragraphMarkRunProperties);
return properties;
}
protected override void CreateWord(WordInfo info)
{
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
mainPart.Document = new Document();
_docBody = mainPart.Document.AppendChild(new Body());
}
protected override void CreateTable(List<WordRow> data)
{
if (_docBody == null || data == null)
{
return;
}
Table table = new Table();
var tableProp = new TableProperties();
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
tableProp.AppendChild(new TableBorders(
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
));
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
table.AppendChild(tableProp);
TableGrid tableGrid = new TableGrid();
for (int j = 0; j < data[0].Rows.Count; ++j)
{
tableGrid.AppendChild(new GridColumn() { Width = "1600" });
}
table.AppendChild(tableGrid);
for (int i = 0; i < data.Count; ++i)
{
TableRow docRow = new TableRow();
for (int j = 0; j < data[i].Rows.Count; ++j)
{
var docParagraph = new Paragraph();
var docRun = new Run();
var runProperties = new RunProperties();
docParagraph.AppendChild(CreateParagraphProperties(data[i].Rows[j].Item2));
runProperties.AppendChild(new RunFonts() { Ascii = "Times New Roman", ComplexScript = "Times New Roman", HighAnsi = "Times New Roman" });
runProperties.AppendChild(new FontSize { Val = data[i].Rows[j].Item2.Size == null ? data[i].Rows[j].Item2.Size : "24" });
if (data[i].Rows[j].Item2.Bold)
runProperties.AppendChild(new Bold());
docRun.AppendChild(runProperties);
docRun.AppendChild(new Text { Text = data[i].Rows[j].Item1.ToString(), Space = SpaceProcessingModeValues.Preserve });
docParagraph.AppendChild(docRun);
TableCell docCell = new TableCell();
docCell.AppendChild(docParagraph);
docRow.AppendChild(docCell);
}
table.AppendChild(docRow);
}
_docBody.AppendChild(table);
}
protected override void CreateParagraph(WordParagraph paragraph)
{
if (_docBody == null || paragraph == null)
{
return;
}
var docParagraph = new Paragraph();
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
foreach (var run in paragraph.Texts)
{
var docRun = new Run();
var properties = new RunProperties();
properties.AppendChild(new FontSize { Val = run.Item2.Size });
if (run.Item2.Bold)
{
properties.AppendChild(new Bold());
}
docRun.AppendChild(properties);
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
docParagraph.AppendChild(docRun);
}
_docBody.AppendChild(docParagraph);
}
protected override void SaveWord(WordInfo info)
{
if (_docBody == null || _wordDocument == null)
{
return;
}
_docBody.AppendChild(CreateSectionProperties());
_wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Close();
}
}
}

View File

@ -0,0 +1,17 @@
namespace ComputerHardwareStoreContracts.BindingModels
{
public class MailConfigBindingModel
{
public string MailLogin { get; set; } = string.Empty;
public string MailPassword { get; set; } = string.Empty;
// адрес отправки
public string SmtpClientHost { get; set; } = string.Empty;
public int SmtpClientPort { get; set; }
// адрес получения
public string PopHost { get; set; } = string.Empty;
public int PopPort { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace ComputerHardwareStoreContracts.BindingModels
{
public class MailSendInfoBindingModel
{
public string MailAddress { get; set; } = string.Empty;
public string Subject { get; set; } = string.Empty;
public string Text { get; set; } = string.Empty;
public byte[] File { get; set; } = Array.Empty<byte>();
}
}

View File

@ -0,0 +1,14 @@
using ComputerHardwareStoreDataModels.Models;
namespace ComputerHardwareContracts.BindingModels
{
public class MessageInfoBindingModel : IMessageInfoModel
{
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }
public string SenderName { get; set; } = string.Empty;
public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty;
public DateTime DateDelivery { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace ComputerHardwareStoreContracts.BindingModels
{
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using ComputerHardwareContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface IMessageInfoLogic
{
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
bool Create(MessageInfoBindingModel model);
}
}

View File

@ -0,0 +1,41 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface IReportLogic
{
/// <summary>
/// Получение списка товаров по сборкам
/// </summary>
/// <returns></returns>
List<ReportProductBuildViewModel> GetProductBuild();
/// <summary>
/// Получение списка сборок по товарам
/// </summary>
/// <returns></returns>
List<ReportBuildProductViewModel> GetBuildProduct();
/// <summary>
/// Получение списка покупок за период с комплектующими и комментариями
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
//List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
/// <summary>
/// Получение списка комплектующих с покупками и заказами за период
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
//List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
/// <summary>
/// Сохранение списка в файл-Word
/// </summary>
/// <param name="model"></param>
void SaveListToWordFile(ReportBindingModel model);
/// <summary>
/// Сохранение списка в файл-Excel
/// </summary>
/// <param name="model"></param>
void SaveListToExcelFile(ReportBindingModel model);
}
}

View File

@ -6,6 +6,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="4.0.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ComputerHardwareStoreDataModels\ComputerHardwareStoreDataModels.csproj" /> <ProjectReference Include="..\ComputerHardwareStoreDataModels\ComputerHardwareStoreDataModels.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,8 @@
namespace ComputerHardwareStoreContracts.SearchModels
{
public class MessageInfoSearchModel
{
public int? ClientId { get; set; }
public string? MessageId { get; set; }
}
}

View File

@ -4,5 +4,6 @@
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? Login { get; set; } public string? Login { get; set; }
public string? Password { get; set; }
} }
} }

View File

@ -0,0 +1,14 @@
using ComputerHardwareContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.StorageContracts
{
public interface IMessageInfoStorage
{
List<MessageInfoViewModel> GetFullList();
List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model);
MessageInfoViewModel? GetElement(MessageInfoSearchModel model);
MessageInfoViewModel? Insert(MessageInfoBindingModel model);
}
}

View File

@ -0,0 +1,9 @@
namespace ComputerHardwareStoreContracts.ViewModels.HelperModels
{
public class ComponentSelectionViewModel
{
public int Id { get; set; }
public bool IsSelected { get; set; }
public int Quantity { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using ComputerHardwareStoreDataModels.Models;
using System.ComponentModel;
namespace ComputerHardwareStoreContracts.ViewModels
{
public class MessageInfoViewModel : IMessageInfoModel
{
public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; }
[DisplayName("Отправитель")]
public string SenderName { get; set; } = string.Empty;
[DisplayName("Дата письма")]
public DateTime DateDelivery { get; set; }
[DisplayName("Заголовок")]
public string Subject { get; set; } = string.Empty;
[DisplayName("Текст")]
public string Body { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,8 @@
namespace ComputerHardwareStoreContracts.ViewModels
{
public class ReportBuildProductViewModel
{
public string BuildName { get; set; } = string.Empty;
public List<(string Product, int Price)> Products { get; set; } = new();
}
}

View File

@ -0,0 +1,8 @@
namespace ComputerHardwareStoreContracts.ViewModels
{
public class ReportProductBuildViewModel
{
public string ProductName { get; set;} = string.Empty;
public List<(string Build, int Price)> Builds { get; set; } = new();
}
}

View File

@ -0,0 +1,13 @@
namespace ComputerHardwareStoreContracts.ViewModels
{
public class ReportPurchaseViewModel
{
public int Id { get; set; }
public List<(string Build, int count, List<(string Component, int count)>)> Builds { get; set; } = new();
public int TotalCount { get; set; }
public double TotalCost { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace ComputerHardwareStoreDataModels.Models
{
public interface IMessageInfoModel
{
string MessageId { get; }
int? ClientId { get; }
string SenderName { get; }
DateTime DateDelivery { get; }
string Subject { get; }
string Body { get; }
}
}

View File

@ -7,11 +7,9 @@ namespace ComputerHardwareStoreDatabaseImplement
{ {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
optionsBuilder.UseNpgsql("Host=192.168.1.61:5432;Database=computerhardwarestore;Username=compstore;Password=compstore"); //optionsBuilder.UseNpgsql("Host=192.168.1.61:5432;Database=computerhardwarestore;Username=compstore;Password=compstore");
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=ComputerHardwareStore;Username=postgres;Password=postgres");
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
} }
public virtual DbSet<Component> Components { set; get; } public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Product> Products { set; get; } public virtual DbSet<Product> Products { set; get; }

View File

@ -24,7 +24,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
} }
using var context = new ComputerHardwareStoreDBContext(); using var context = new ComputerHardwareStoreDBContext();
return context.Components return context.Components
.Where(c => c.Name.Contains(model.Name)) .Where(c => c.Name.Contains(model.Name) ||
(c.StoreKeeper.Id == model.StoreKeeperId))
.Select(c => c.GetViewModel) .Select(c => c.GetViewModel)
.ToList(); .ToList();
} }

View File

@ -30,6 +30,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
.Include(p => p.Products) .Include(p => p.Products)
.ThenInclude(p => p.Product) .ThenInclude(p => p.Product)
.Where(p => .Where(p =>
(model.VendorId.HasValue && model.VendorId == p.VendorId) ||
(model.Id.HasValue && p.Id == model.Id) || (model.Id.HasValue && p.Id == model.Id) ||
((model.DateFrom.HasValue && model.DateTo.HasValue) && ((model.DateFrom.HasValue && model.DateTo.HasValue) &&
((model.DateFrom <= p.DateCreate && p.DateCreate <= model.DateTo) || ((model.DateFrom <= p.DateCreate && p.DateCreate <= model.DateTo) ||

View File

@ -1,547 +0,0 @@
// <auto-generated />
using System;
using ComputerHardwareStoreDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ComputerHardwareStoreDatabaseImplement.Migrations
{
[DbContext(typeof(ComputerHardwareStoreDBContext))]
[Migration("20240501130816_fix")]
partial class fix
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<int>("VendorId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("VendorId");
b.ToTable("Builds");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("BuildId")
.HasColumnType("integer");
b.Property<int>("ComponentId")
.HasColumnType("integer");
b.Property<int>("Count")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("BuildId");
b.HasIndex("ComponentId");
b.ToTable("BuildComponents");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("BuildId")
.HasColumnType("integer");
b.Property<DateTime>("Date")
.HasColumnType("timestamp without time zone");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("BuildId");
b.ToTable("Comments");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("Cost")
.HasColumnType("double precision");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StoreKeeperId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StoreKeeperId");
b.ToTable("Components");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateImplement")
.HasColumnType("timestamp without time zone");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("ProductId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderProducts");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<int?>("StoreKeeperId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StoreKeeperId");
b.ToTable("Products");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId")
.HasColumnType("integer");
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("ProductId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ProductId");
b.ToTable("ProductComponents");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("Cost")
.HasColumnType("double precision");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateImplement")
.HasColumnType("timestamp without time zone");
b.Property<int>("VendorId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("VendorId");
b.ToTable("Purchases");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("BuildId")
.HasColumnType("integer");
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("PurchaseId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("BuildId");
b.HasIndex("PurchaseId");
b.ToTable("PurchaseBuilds");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("ProductId")
.HasColumnType("integer");
b.Property<int>("PurchaseId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("PurchaseId");
b.ToTable("PurchaseProducts");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("StoreKeepers");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Vendors");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
.WithMany("Builds")
.HasForeignKey("VendorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Vendor");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
.WithMany("Components")
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
.WithMany()
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
b.Navigation("Component");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
.WithMany()
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
.WithMany("Components")
.HasForeignKey("StoreKeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StoreKeeperЗЛ");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
.WithMany("Products")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Product");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
.WithMany("Products")
.HasForeignKey("StoreKeeperId");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
.WithMany("ProductComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
.WithMany("Components")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Product");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
.WithMany("Purchases")
.HasForeignKey("VendorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
.WithMany()
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Builds")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
b.Navigation("Purchase");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
{
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Products")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Purchase");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
{
b.Navigation("Components");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
{
b.Navigation("ProductComponents");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
{
b.Navigation("Components");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
{
b.Navigation("Builds");
b.Navigation("Products");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
{
b.Navigation("Components");
b.Navigation("Products");
});
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
{
b.Navigation("Builds");
b.Navigation("Purchases");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,80 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ComputerHardwareStoreDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class fix : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Products_ProductId",
table: "Orders");
migrationBuilder.DropIndex(
name: "IX_Orders_ProductId",
table: "Orders");
migrationBuilder.DropColumn(
name: "Count",
table: "Orders");
migrationBuilder.DropColumn(
name: "ProductId",
table: "Orders");
migrationBuilder.CreateIndex(
name: "IX_Comments_BuildId",
table: "Comments",
column: "BuildId");
migrationBuilder.AddForeignKey(
name: "FK_Comments_Builds_BuildId",
table: "Comments",
column: "BuildId",
principalTable: "Builds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Comments_Builds_BuildId",
table: "Comments");
migrationBuilder.DropIndex(
name: "IX_Comments_BuildId",
table: "Comments");
migrationBuilder.AddColumn<int>(
name: "Count",
table: "Orders",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ProductId",
table: "Orders",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Orders_ProductId",
table: "Orders",
column: "ProductId");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Products_ProductId",
table: "Orders",
column: "ProductId",
principalTable: "Products",
principalColumn: "Id");
}
}
}

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ComputerHardwareStoreDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class cs2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Count",
table: "Orders",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ProductId",
table: "Orders",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Orders_ProductId",
table: "Orders",
column: "ProductId");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Products_ProductId",
table: "Orders",
column: "ProductId",
principalTable: "Products",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Products_ProductId",
table: "Orders");
migrationBuilder.DropIndex(
name: "IX_Orders_ProductId",
table: "Orders");
migrationBuilder.DropColumn(
name: "Count",
table: "Orders");
migrationBuilder.DropColumn(
name: "ProductId",
table: "Orders");
}
}
}

View File

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace ComputerHardwareStoreDatabaseImplement.Migrations namespace ComputerHardwareStoreDatabaseImplement.Migrations
{ {
[DbContext(typeof(ComputerHardwareStoreDBContext))] [DbContext(typeof(ComputerHardwareStoreDBContext))]
[Migration("20240501142223_cs2")] [Migration("20240528172646_create")]
partial class cs2 partial class create
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -0,0 +1,432 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ComputerHardwareStoreDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class create : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StoreKeepers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Login = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StoreKeepers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Vendors",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Login = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vendors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Components",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Cost = table.Column<double>(type: "double precision", nullable: false),
StoreKeeperId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Components", x => x.Id);
table.ForeignKey(
name: "FK_Components_StoreKeepers_StoreKeeperId",
column: x => x.StoreKeeperId,
principalTable: "StoreKeepers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false),
StoreKeeperId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.Id);
table.ForeignKey(
name: "FK_Products_StoreKeepers_StoreKeeperId",
column: x => x.StoreKeeperId,
principalTable: "StoreKeepers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Builds",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false),
VendorId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Builds", x => x.Id);
table.ForeignKey(
name: "FK_Builds_Vendors_VendorId",
column: x => x.VendorId,
principalTable: "Vendors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Purchases",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
VendorId = table.Column<int>(type: "integer", nullable: false),
Cost = table.Column<double>(type: "double precision", nullable: false),
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Purchases", x => x.Id);
table.ForeignKey(
name: "FK_Purchases_Vendors_VendorId",
column: x => x.VendorId,
principalTable: "Vendors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Count = table.Column<int>(type: "integer", nullable: false),
Sum = table.Column<double>(type: "double precision", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
ProductId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.Id);
table.ForeignKey(
name: "FK_Orders_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ProductComponents",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProductId = table.Column<int>(type: "integer", nullable: false),
ComponentId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductComponents", x => x.Id);
table.ForeignKey(
name: "FK_ProductComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProductComponents_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BuildComponents",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
BuildId = table.Column<int>(type: "integer", nullable: false),
ComponentId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildComponents", x => x.Id);
table.ForeignKey(
name: "FK_BuildComponents_Builds_BuildId",
column: x => x.BuildId,
principalTable: "Builds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BuildComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Comments",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Date = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Text = table.Column<string>(type: "text", nullable: false),
BuildId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Comments", x => x.Id);
table.ForeignKey(
name: "FK_Comments_Builds_BuildId",
column: x => x.BuildId,
principalTable: "Builds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PurchaseBuilds",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PurchaseId = table.Column<int>(type: "integer", nullable: false),
BuildId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PurchaseBuilds", x => x.Id);
table.ForeignKey(
name: "FK_PurchaseBuilds_Builds_BuildId",
column: x => x.BuildId,
principalTable: "Builds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PurchaseBuilds_Purchases_PurchaseId",
column: x => x.PurchaseId,
principalTable: "Purchases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PurchaseProducts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PurchaseId = table.Column<int>(type: "integer", nullable: false),
ProductId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PurchaseProducts", x => x.Id);
table.ForeignKey(
name: "FK_PurchaseProducts_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PurchaseProducts_Purchases_PurchaseId",
column: x => x.PurchaseId,
principalTable: "Purchases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderProducts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrderId = table.Column<int>(type: "integer", nullable: false),
ProductId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderProducts", x => x.Id);
table.ForeignKey(
name: "FK_OrderProducts_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderProducts_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BuildComponents_BuildId",
table: "BuildComponents",
column: "BuildId");
migrationBuilder.CreateIndex(
name: "IX_BuildComponents_ComponentId",
table: "BuildComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_Builds_VendorId",
table: "Builds",
column: "VendorId");
migrationBuilder.CreateIndex(
name: "IX_Comments_BuildId",
table: "Comments",
column: "BuildId");
migrationBuilder.CreateIndex(
name: "IX_Components_StoreKeeperId",
table: "Components",
column: "StoreKeeperId");
migrationBuilder.CreateIndex(
name: "IX_OrderProducts_OrderId",
table: "OrderProducts",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderProducts_ProductId",
table: "OrderProducts",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ProductId",
table: "Orders",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_ProductComponents_ComponentId",
table: "ProductComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_ProductComponents_ProductId",
table: "ProductComponents",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_Products_StoreKeeperId",
table: "Products",
column: "StoreKeeperId");
migrationBuilder.CreateIndex(
name: "IX_PurchaseBuilds_BuildId",
table: "PurchaseBuilds",
column: "BuildId");
migrationBuilder.CreateIndex(
name: "IX_PurchaseBuilds_PurchaseId",
table: "PurchaseBuilds",
column: "PurchaseId");
migrationBuilder.CreateIndex(
name: "IX_PurchaseProducts_ProductId",
table: "PurchaseProducts",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_PurchaseProducts_PurchaseId",
table: "PurchaseProducts",
column: "PurchaseId");
migrationBuilder.CreateIndex(
name: "IX_Purchases_VendorId",
table: "Purchases",
column: "VendorId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BuildComponents");
migrationBuilder.DropTable(
name: "Comments");
migrationBuilder.DropTable(
name: "OrderProducts");
migrationBuilder.DropTable(
name: "ProductComponents");
migrationBuilder.DropTable(
name: "PurchaseBuilds");
migrationBuilder.DropTable(
name: "PurchaseProducts");
migrationBuilder.DropTable(
name: "Orders");
migrationBuilder.DropTable(
name: "Components");
migrationBuilder.DropTable(
name: "Builds");
migrationBuilder.DropTable(
name: "Purchases");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Vendors");
migrationBuilder.DropTable(
name: "StoreKeepers");
}
}
}

View File

@ -15,11 +15,13 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.OpenApi" Version="1.6.14" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ComputerHardwareStoreBusinessLogic\ComputerHardwareStoreBusinessLogic.csproj" />
<ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" /> <ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,87 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.StorageContracts;
using Microsoft.AspNetCore.Mvc;
namespace ComputerHardwareStoreREST.Controllers
{
[ApiController]
[Route("[controller]")]
public class ProductController : Controller
{
private readonly ILogger<ProductController> _logger;
private readonly IProductStorage _storage;
public ProductController(ILogger<ProductController> logger, IProductStorage storage)
{
_logger = logger;
_storage = storage;
}
[HttpPost("get/filter")]
public IActionResult GetByFilter([FromBody] ProductSearchModel model)
{
try
{
var result = _storage.GetFilteredList(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpPost("get")]
public IActionResult GetById([FromBody] ProductSearchModel model)
{
try
{
var result = _storage.GetElement(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpPost("create")]
public IActionResult Create([FromBody] ProductBindingModel model)
{
try
{
var result = _storage.Insert(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpPut("update")]
public IActionResult Update([FromBody] ProductBindingModel model)
{
try
{
var result = _storage.Update(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpPost("delete")]
public IActionResult Delete([FromBody] ProductBindingModel model)
{
try
{
var result = _storage.Delete(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}

View File

@ -7,19 +7,19 @@ namespace ComputerHardwareStoreREST.Controllers
{ {
[ApiController] [ApiController]
[Route("[controller]")] [Route("[controller]")]
public class ProductController : Controller public class ComponentController : Controller
{ {
private readonly ILogger<ProductController> _logger; private readonly ILogger<ComponentController> _logger;
private readonly IProductStorage _storage; private readonly IComponentStorage _storage;
public ProductController(ILogger<ProductController> logger, IProductStorage storage) public ComponentController(ILogger<ComponentController> logger, IComponentStorage storage)
{ {
_logger = logger; _logger = logger;
_storage = storage; _storage = storage;
} }
[HttpPost("get/filter")] [HttpPost("get/filter")]
public IActionResult GetByFilter([FromBody] ProductSearchModel model) public IActionResult GetByFilter([FromBody] ComponentSearchModel model)
{ {
try try
{ {
@ -32,7 +32,7 @@ namespace ComputerHardwareStoreREST.Controllers
} }
} }
[HttpPost("get")] [HttpPost("get")]
public IActionResult GetById([FromBody] ProductSearchModel model) public IActionResult GetById([FromBody] ComponentSearchModel model)
{ {
try try
{ {
@ -45,7 +45,7 @@ namespace ComputerHardwareStoreREST.Controllers
} }
} }
[HttpPost("create")] [HttpPost("create")]
public IActionResult Create([FromBody] ProductBindingModel model) public IActionResult Create([FromBody] ComponentBindingModel model)
{ {
try try
{ {
@ -58,7 +58,7 @@ namespace ComputerHardwareStoreREST.Controllers
} }
} }
[HttpPut("update")] [HttpPut("update")]
public IActionResult Update([FromBody] ProductBindingModel model) public IActionResult Update([FromBody] ComponentBindingModel model)
{ {
try try
{ {
@ -71,7 +71,7 @@ namespace ComputerHardwareStoreREST.Controllers
} }
} }
[HttpPost("delete")] [HttpPost("delete")]
public IActionResult Delete([FromBody] ProductBindingModel model) public IActionResult Delete([FromBody] ComponentBindingModel model)
{ {
try try
{ {

View File

@ -2,87 +2,82 @@
using ComputerHardwareStoreContracts.BindingModels; using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels; using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.StorageContracts; using ComputerHardwareStoreContracts.StorageContracts;
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreREST.Controllers namespace ComputerHardwareStoreREST.Controllers
{ {
[Route("api/[controller]/[action]")]
[ApiController] [ApiController]
[Route("[controller]")] public class StoreKeeperController : Controller
public class StoreKeepersController : Controller
{ {
private readonly ILogger<StoreKeepersController> _logger; private readonly ILogger _logger;
private readonly IStoreKeeperStorage _storage; private readonly IStoreKeeperLogic _logic;
private readonly IMessageInfoLogic _mailLogic;
public StoreKeepersController(ILogger<StoreKeepersController> logger, IStoreKeeperStorage storage) public StoreKeeperController(IStoreKeeperLogic logic, IMessageInfoLogic mailLogic, ILogger<StoreKeeperController> logger)
{ {
_logger = logger; _logger = logger;
_storage = storage; _logic = logic;
_mailLogic = mailLogic;
} }
[HttpGet]
[HttpPost("get/filter")] public StoreKeeperViewModel? Login(string login, string password)
public IActionResult GetByFilter([FromBody] StoreKeeperSearchModel model)
{ {
try try
{ {
var result = _storage.GetFilteredList(model); return _logic.ReadElement(new StoreKeeperSearchModel
return Ok(result); {
Login = login,
Password = password
});
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка входа в систему");
throw;
} }
} }
[HttpPost("get")] [HttpPost]
public IActionResult GetById([FromBody] StoreKeeperSearchModel model) public void Register(StoreKeeperBindingModel model)
{ {
try try
{ {
var result = _storage.GetElement(model); _logic.Create(model);
return Ok(result);
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка регистрации");
throw;
} }
} }
[HttpPost("create")] [HttpPost]
public IActionResult Create([FromBody] StoreKeeperBindingModel model) public void UpdateData(StoreKeeperBindingModel model)
{ {
try try
{ {
var result = _storage.Insert(model); _logic.Update(model);
return Ok(result);
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка обновления данных");
throw;
} }
} }
[HttpPut("update")] [HttpGet]
public IActionResult Update([FromBody] StoreKeeperBindingModel model) public List<MessageInfoViewModel>? GetMessages(int clientId)
{ {
try try
{ {
var result = _storage.Update(model); return _mailLogic.ReadList(new MessageInfoSearchModel
return Ok(result); {
ClientId = clientId
});
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка получения писем клиента");
} throw;
} }
[HttpPost("delete")]
public IActionResult Delete([FromBody] StoreKeeperBindingModel model)
{
try
{
var result = _storage.Delete(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
} }
} }
} }

View File

@ -1,86 +1,81 @@
using ComputerHardwareStoreContracts.BindingModels; using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.SearchModels; using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.StorageContracts; using ComputerHardwareStoreContracts.ViewModels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace ComputerHardwareStoreREST.Controllers namespace ComputerHardwareStoreREST.Controllers
{ {
[Route("api/[controller]/[action]")]
[ApiController] [ApiController]
[Route("[controller]")]
public class VendorController : Controller public class VendorController : Controller
{ {
private readonly ILogger<VendorController> _logger; private readonly ILogger _logger;
private readonly IVendorStorage _storage; private readonly IVendorLogic _logic;
private readonly IMessageInfoLogic _mailLogic;
public VendorController(ILogger<VendorController> logger, IVendorStorage storage) public VendorController(IVendorLogic logic, IMessageInfoLogic mailLogic, ILogger<VendorController> logger)
{ {
_logger = logger; _logger = logger;
_storage = storage; _logic = logic;
_mailLogic = mailLogic;
} }
[HttpGet]
[HttpPost("get/filter")] public VendorViewModel? Login(string login, string password)
public IActionResult GetByFilter([FromBody] VendorSearchModel model)
{ {
try try
{ {
var result = _storage.GetFilteredList(model); return _logic.ReadElement(new VendorSearchModel
return Ok(result); {
Login = login,
Password = password
});
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка входа в систему");
throw;
} }
} }
[HttpPost("get")] [HttpPost]
public IActionResult GetById([FromBody] VendorSearchModel model) public void Register(VendorBindingModel model)
{ {
try try
{ {
var result = _storage.GetElement(model); _logic.Create(model);
return Ok(result);
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка регистрации");
throw;
} }
} }
[HttpPost("create")] [HttpPost]
public IActionResult Create([FromBody] VendorBindingModel model) public void UpdateData(VendorBindingModel model)
{ {
try try
{ {
var result = _storage.Insert(model); _logic.Update(model);
return Ok(result);
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка обновления данных");
throw;
} }
} }
[HttpPut("update")] [HttpGet]
public IActionResult Update([FromBody] VendorBindingModel model) public List<MessageInfoViewModel>? GetMessages(int clientId)
{ {
try try
{ {
var result = _storage.Update(model); return _mailLogic.ReadList(new MessageInfoSearchModel
return Ok(result); {
ClientId = clientId
});
} }
catch (Exception ex) catch (Exception ex)
{ {
return BadRequest(ex.Message); _logger.LogError(ex, "Ошибка получения писем клиента");
} throw;
}
[HttpPost("delete")]
public IActionResult Delete([FromBody] VendorBindingModel model)
{
try
{
var result = _storage.Delete(model);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
} }
} }
} }

View File

@ -1,39 +1,58 @@
using ComputerHardwareStoreContracts.StorageContracts; using ComputerHardwareStoreBusinessLogic.BusinessLogic;
using ComputerHardwareStoreDatabaseImplement; using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.StorageContracts;
using ComputerHardwareStoreDatabaseImplement.Implements; using ComputerHardwareStoreDatabaseImplement.Implements;
using ComputerHardwareStoreREST; using ComputerHardwareStoreREST;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// получаем строку подключения из файла конфигурации // получаем строку подключения из файла конфигурации
//DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection"); //DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddSingleton<IComponentStorage, ComponentStorage >(); builder.Services.AddTransient<IVendorStorage, VendorStorage>();
builder.Services.AddSingleton<IStoreKeeperStorage, StoreKeeperStorage>(); builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
builder.Services.AddSingleton<IProductStorage, ProductStorage>(); builder.Services.AddTransient<IBuildStorage, BuildStorage>();
builder.Services.AddSingleton<IOrderStorage, OrderStorage>(); builder.Services.AddTransient<ICommentStorage, CommentStorage>();
builder.Services.AddSingleton<IBuildStorage, BuildStorage>(); builder.Services.AddTransient<IProductStorage, ProductStorage>();
builder.Services.AddSingleton<ICommentStorage, CommentStorage>(); builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
builder.Services.AddSingleton<IPurchaseStorage, PurchaseStorage>(); builder.Services.AddTransient<IStoreKeeperStorage, StoreKeeperStorage>();
builder.Services.AddSingleton<IVendorStorage, VendorStorage>();
builder.Services.AddTransient<IVendorLogic, VendorLogic>();
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
builder.Services.AddTransient<IBuildLogic, BuildLogic>();
builder.Services.AddTransient<ICommentLogic, CommentLogic>();
//builder.Services.AddTransient<IProductLogic, ProductLogic>();
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
builder.Services.AddTransient<IStoreKeeperLogic, StoreKeeperLogic>();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build(); var app = builder.Build();
var mailSender = app.Services.GetService<AbstractMailWorker>();
mailSender?.MailConfig(new MailConfigBindingModel
{
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
});
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AbstractShopRestApi v1"));
} }
app.UseHttpsRedirection();
app.UseAuthorization(); app.UseAuthorization();
app.MapControllers(); app.MapControllers();

View File

@ -2,11 +2,13 @@
"profiles": { "profiles": {
"ComputerHardwareStoreREST": { "ComputerHardwareStoreREST": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"applicationUrl": "https://localhost:63872;http://localhost:63873" "applicationUrl": "https://localhost:8080;http://localhost:8081"
} }
} }
} }

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,16 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"SmtpClientHost": "smtp.gmail.com",
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "coursework@gmail.com",
"MailPassword": "123"
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="d:/temp/HardwareShopRestApi.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />
</layout>
</appender>
<root>
<level value="TRACE" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@ -0,0 +1,65 @@
using ComputerHardwareStoreContracts.ViewModels;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
namespace StoreKeeperClient
{
public static class APIClient
{
private static readonly HttpClient _client = new();
public static StoreKeeperViewModel? Client { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{
var response = _client.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<T>(result);
}
else
{
throw new Exception(result);
}
}
public static void PostRequest<T>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _client.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode)
{
throw new Exception(result);
}
}
public static R? PostRequestWithResult<T, R>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _client.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<R>(result);
}
else
{
return default;
}
}
}
}

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Diagnostics; using System.Diagnostics;
using StoreKeeperClient.Models; using StoreKeeperClient.Models;
using ComputerHardwareStoreContracts.BindingModels;
namespace StoreKeeperClient.Controllers namespace StoreKeeperClient.Controllers
{ {
@ -17,13 +18,46 @@ namespace StoreKeeperClient.Controllers
[HttpGet] [HttpGet]
public IActionResult Index() public IActionResult Index()
{ {
return View(); if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/main/getpurchases?clientId={APIClient.Client.Id}"));
} }
[HttpGet] [HttpGet]
public IActionResult Privacy() public IActionResult Privacy()
{ {
return View(); if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Client);
}
[HttpPost]
public void Privacy(string login, string password, string fio)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/updatedata", new StoreKeeperBindingModel
{
Id = APIClient.Client.Id,
Name = fio,
Login = login,
Password = password
});
APIClient.Client.Name = fio;
APIClient.Client.Login = login;
APIClient.Client.Password = password;
Response.Redirect("Index");
} }
[HttpGet] [HttpGet]
@ -35,105 +69,179 @@ namespace StoreKeeperClient.Controllers
[HttpGet] [HttpGet]
public IActionResult Register() public IActionResult Register()
{ {
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult AddBuildToPurchase() public IActionResult AddBuildToPurchase()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Builds() public IActionResult Builds()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<BuildViewModel>()); return View(new List<BuildViewModel>());
} }
[HttpGet] [HttpGet]
public IActionResult BuildCreate() public IActionResult BuildCreate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult BuildDelete() public IActionResult BuildDelete()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult BuildUpdate() public IActionResult BuildUpdate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult CommentCreate() public IActionResult CommentCreate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult CommentDelete() public IActionResult CommentDelete()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult CommentUpdate() public IActionResult CommentUpdate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Comments() public IActionResult Comments()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<CommentViewModel>()); return View(new List<CommentViewModel>());
} }
[HttpGet] [HttpGet]
public IActionResult ProductsList() public IActionResult ProductsList()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<BuildViewModel>()); return View(new List<BuildViewModel>());
} }
[HttpGet] [HttpGet]
public IActionResult PurchaseCreate() public IActionResult PurchaseCreate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult PurchaseDelete() public IActionResult PurchaseDelete()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Purchases() public IActionResult Purchases()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<PurchaseViewModel>()); return View(new List<PurchaseViewModel>());
} }
[HttpGet] [HttpGet]
public IActionResult PurchaseUpdate() public IActionResult PurchaseUpdate()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Report() public IActionResult Report()
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<PurchaseViewModel>()); return View(new List<PurchaseViewModel>());
} }
[HttpPost] [HttpPost]
public void Report(string password) public void Report(string password)
{ {
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
Response.Redirect("ReportOnly"); Response.Redirect("ReportOnly");
} }
public IActionResult Mails()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {

View File

@ -0,0 +1,387 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
using ComputerHardwareStoreContracts.ViewModels.HelperModels;
using ComputerHardwareStoreDataModels.Models;
using Microsoft.AspNetCore.Mvc;
namespace StoreKeeperClient.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class StoreKeeperController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IStoreKeeperLogic _storeKeeperLogic;
private readonly IComponentLogic _componentLogic;
private readonly IBuildLogic _buildLogic;
private readonly IProductLogic _productLogic;
public StoreKeeperController(ILogger<HomeController> logger, IComponentLogic componentLogic, IBuildLogic buildLogic, IProductLogic productLogic, IStoreKeeperLogic storeKeeperLogic)
{
_logger = logger;
_componentLogic = componentLogic;
_buildLogic = buildLogic;
_productLogic = productLogic;
_storeKeeperLogic = storeKeeperLogic;
}
[HttpPost]
public void CreateComponent(string name, double price)
{
if (string.IsNullOrEmpty(name))
{
throw new Exception("Enter name");
}
_componentLogic.Create(
new ComponentBindingModel
{
Name = name,
Cost = price,
StoreKeeper = APIClient.Client!
}
);
Response.Redirect("Components");
}
[HttpGet]
public IActionResult UpdateComponent()
{
ViewBag.Components = _componentLogic.ReadList(
new ComponentSearchModel
{
StoreKeeperId = APIClient.Client.Id
}
);
return View();
}
[HttpPost]
public void UpdateComponent(int component, double price, string name)
{
if (component == 0)
{
throw new Exception("Chose component");
}
if (string.IsNullOrEmpty(name))
{
throw new Exception("Enter name");
}
_componentLogic.Update(
new ComponentBindingModel
{
Id = component,
Name = name,
Cost = price,
StoreKeeper = APIClient.Client!
}
);
Response.Redirect("Components");
}
[HttpGet]
public IActionResult ComponentToBuild()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Assemblies = _buildLogic.ReadList(null);
ViewBag.Components = _componentLogic.ReadList(
new ComponentSearchModel
{
StoreKeeperId = APIClient.Client!.Id
}
);
return View();
}
[HttpPost]
public void ComponentToBuild(int buildId, int componentId, int count)
{
if (buildId == 0)
{
throw new Exception("chose build");
}
if (componentId == 0)
{
throw new Exception("chose component");
}
if (count <= 0)
{
throw new Exception("chose count");
}
BuildViewModel build = _buildLogic.ReadElement(new BuildSearchModel { Id = buildId })!;
ComponentViewModel component = _componentLogic.ReadElement(new ComponentSearchModel { Id = componentId })!;
if (build.BuildComponents.ContainsKey(componentId))
build.BuildComponents[componentId] = (component, build.BuildComponents[componentId].Item2 + count);
else
build.BuildComponents.Add(componentId, (component, count));
build.Price += component.Cost * count;
_buildLogic.Update(
new BuildBindingModel
{
Id = buildId,
Vendor = build.Vendor,
Name = build.Name,
Price = build.Price,
BuildComponents = build.BuildComponents
});
Response.Redirect("Components");
}
[HttpGet]
public IActionResult RemoveComponentFromBuild()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Assemblies = _buildLogic.ReadList(null);
ViewBag.Components = _componentLogic.ReadList(
new ComponentSearchModel
{
StoreKeeperId = APIClient.Client!.Id
}
);
return View();
}
[HttpPost]
public void RemoveComponentFromBuild(int buildId, int componentId, int count)
{
if (buildId == 0)
{
throw new Exception("chose build");
}
if (componentId == 0)
{
throw new Exception("chose component");
}
if (count <= 0)
{
throw new Exception("chose count");
}
BuildViewModel build = _buildLogic.ReadElement(new BuildSearchModel { Id = buildId })!;
ComponentViewModel component = _componentLogic.ReadElement(new ComponentSearchModel { Id = componentId })!;
if (build.BuildComponents.ContainsKey(componentId))
{
if (build.BuildComponents[componentId].Item2 < count)
throw new Exception("ther is not enough components in build");
if (build.BuildComponents[componentId].Item2 == count)
build.BuildComponents.Remove(componentId);
else
build.BuildComponents[componentId] = (component, build.BuildComponents[componentId].Item2 - count);
}
else
throw new Exception("there is no that component in build");
build.Price -= component.Cost * count;
_buildLogic.Update(
new BuildBindingModel
{
Id = buildId,
Vendor = build.Vendor,
Name = build.Name,
Price = build.Price,
BuildComponents = build.BuildComponents
});
Response.Redirect("Components");
}
[HttpGet]
public IActionResult DeleteComponent()
{
ViewBag.Components = _componentLogic.ReadList(
new ComponentSearchModel
{
StoreKeeperId = APIClient.Client.Id
}
);
return View();
}
[HttpPost]
public void DeleteComponent(int component)
{
if (component == 0)
{
throw new Exception("Chose component");
}
_componentLogic.Delete(
new ComponentBindingModel { Id = component }
);
Response.Redirect("Components");
}
// товары
[HttpGet]
public IActionResult CreateProduct()
{
return View(_componentLogic.ReadList(null));
}
[HttpPost]
public void CreateProduct(double price, string name, List<ComponentSelectionViewModel> components)
{
var selectedComponents = components.Where(g => g.IsSelected && g.Quantity > 0).ToList();
List<ComponentViewModel> componentsViewModels = _componentLogic.ReadList(null)!;
Dictionary<int, (IComponentModel, int)> productComponents = new Dictionary<int, (IComponentModel, int)>();
price = 0;
foreach (var component in selectedComponents)
{
productComponents.Add(component.Id, (
componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!,
component.Quantity
));
price += component.Quantity * componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!.Cost;
}
_productLogic.Create(
new ProductBindingModel
{
Name = name,
Price = price,
StoreKeeper = APIClient.Client!,
ProductComponents = productComponents,
}
);
Response.Redirect("Products");
}
[HttpGet]
public IActionResult UpdateProduct(int productId)
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Components = APIClient.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?clientId={APIClient.Client.Id}");
return View(productId);
}
[HttpPost]
public void UpdateProduct(double price, string name, List<ComponentSelectionViewModel> components, int product)
{
if (product == 0)
{
throw new Exception("chose product");
}
var selectedComponents = components.Where(g => g.IsSelected && g.Quantity > 0).ToList();
List<ComponentViewModel> componentsViewModels = _componentLogic.ReadList(null)!;
Dictionary<int, (IComponentModel, int)> productComponents = new Dictionary<int, (IComponentModel, int)>();
price = 0;
// добавляем в
foreach (var component in selectedComponents)
{
productComponents.Add(component.Id, (
componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!,
component.Quantity
));
price += component.Quantity * componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!.Cost;
}
_productLogic.Update(
new ProductBindingModel
{
Id = product,
StoreKeeper = APIClient.Client,
Price = price,
Name = name,
ProductComponents = productComponents
});
Response.Redirect("Products");
}
[HttpGet]
public IActionResult DeleteProduct()
{
var products = _productLogic.ReadList(
new ProductSearchModel
{
StoreKeeperId = APIClient.Client!.Id
}
);
ViewBag.Products = products;
return View();
}
[HttpPost]
public void DeleteProduct(int product)
{
_productLogic.Delete(
new ProductBindingModel { Id = product }
);
Response.Redirect("Products");
}
// заказы
//[HttpGet]
//public IActionResult CreateOrder()
//{
// ViewBag.Products = _productLogic.ReadList(
// new ProductSearchModel
// {
// StoreKeeperId = APIClient.Client!.Id
// }
// );
// return View();
//}
//[HttpPost]
//public void CreateOrder(DateTime date, string address, int product)
//{
// _orderForProductsLogic.Create(
// new OrderForProductsBindingModel
// {
// OrderDate = date,
// DeliveryAddres = address,
// ProductId = product,
// }
// );
// Response.Redirect("Orders");
//}
//[HttpGet]
//public IActionResult UpdateOrder()
//{
// ViewBag.Products = _productLogic.ReadList(
// new ProductSearchModel
// {
// StoreKeeperId = APIClient.Client!.Id
// }
// );
// ViewBag.OrdersForProducts = _orderForProductsLogic.ReadList(
// new OrderForProductsSearchModel
// {
// StoreKeeperId = APIClient.Client!.Id
// }
// );
// return View();
//}
//[HttpPost]
//public void UpdateOrder(DateTime date, string address, int product, int order)
//{
// _orderForProductsLogic.Update(
// new OrderForProductsBindingModel
// {
// Id = order,
// OrderDate = date,
// DeliveryAddres = address,
// ProductId = product
// }
// );
// Response.Redirect("Orders");
//}
//[HttpGet]
//public IActionResult DeleteOrder()
//{
// ViewBag.OrdersForProducts = _orderForProductsLogic.ReadList(
// new OrderForProductsSearchModel
// {
// StoreKeeperId = APIClient.Client!.Id
// }
// );
// return View();
//}
//[HttpPost]
//public void DeleteOrder(int order)
//{
// _orderForProductsLogic.Delete(
// new OrderForProductsBindingModel
// {
// Id = order,
// }
// );
// Response.Redirect("Orders");
//}
}
}

View File

@ -1,43 +1,19 @@
using ComputerHardwareStoreContracts.BusinessLogicsContracts; using StoreKeeperClient;
using ComputerHardwareStoreContracts.StorageContracts;
using ComputerHardwareStoreDatabaseImplement.Implements;
using ComputerHardwareStoreBusinessLogic.BusinessLogic;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews(); builder.Services.AddControllersWithViews();
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Services.AddTransient<IVendorStorage, VendorStorage>();
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
builder.Services.AddTransient<IBuildStorage, BuildStorage>();
builder.Services.AddTransient<ICommentStorage, CommentStorage>();
builder.Services.AddTransient<IProductStorage, ProductStorage>();
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
builder.Services.AddTransient<IStoreKeeperStorage, StoreKeeperStorage>();
builder.Services.AddTransient<IVendorLogic, VendorLogic>();
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
builder.Services.AddTransient<IBuildLogic, BuildLogic>();
builder.Services.AddTransient<ICommentLogic, CommentLogic>();
builder.Services.AddTransient<IProductLogic, ProductLogic>();
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
builder.Services.AddTransient<IStoreKeeperLogic, StoreKeeperLogic>();
var app = builder.Build(); var app = builder.Build();
APIClient.Connect(builder.Configuration);
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseSwagger(); app.UseExceptionHandler("/Home/Error");
app.UseSwaggerUI(); app.UseHsts();
} }
app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
app.UseAuthorization(); app.UseAuthorization();

View File

@ -13,7 +13,6 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5062", "applicationUrl": "http://localhost:5062",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
@ -23,7 +22,6 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7291;http://localhost:5062", "applicationUrl": "https://localhost:7291;http://localhost:5062",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
@ -32,7 +30,6 @@
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

View File

@ -7,6 +7,53 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Controllers\StoreKeeperController.cs" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-grid.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-grid.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-grid.rtl.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-grid.rtl.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-reboot.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-reboot.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-reboot.rtl.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-reboot.rtl.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-utilities.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-utilities.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-utilities.rtl.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-utilities.rtl.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.rtl.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.rtl.min.css.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.bundle.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.bundle.js.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.bundle.min.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.bundle.min.js.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.esm.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.esm.js.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.esm.min.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.esm.min.js.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.js.map" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js" />
<None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js.map" />
<None Include="wwwroot\lib\bootstrap\LICENSE" />
<None Include="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js" />
<None Include="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js" />
<None Include="wwwroot\lib\jquery-validation\dist\additional-methods.js" />
<None Include="wwwroot\lib\jquery-validation\dist\additional-methods.min.js" />
<None Include="wwwroot\lib\jquery-validation\dist\jquery.validate.js" />
<None Include="wwwroot\lib\jquery-validation\dist\jquery.validate.min.js" />
<None Include="wwwroot\lib\jquery-validation\LICENSE.md" />
<None Include="wwwroot\lib\jquery\dist\jquery.js" />
<None Include="wwwroot\lib\jquery\dist\jquery.min.js" />
<None Include="wwwroot\lib\jquery\dist\jquery.min.map" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup> </ItemGroup>

View File

@ -44,10 +44,10 @@
@Html.DisplayFor(modelItem => component.Id) @Html.DisplayFor(modelItem => component.Id)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => component.ComponentName) @Html.DisplayFor(modelItem => component.Name)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => component.ComponentPrice) @Html.DisplayFor(modelItem => component.Cost)
</td> </td>
</tr> </tr>
} }

View File

@ -1,7 +1,64 @@
@{ @using ComputerHardwareStoreContracts.ViewModels
@model List<OrderViewModel>
@{
ViewData["Title"] = "Home Page"; ViewData["Title"] = "Home Page";
} }
<div class="text-center"> <div class="text-center">
<img src="./Images/Logo.jpg" alt="logo" /> <h1 class="display-4">Заказы</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-action="Create">Создать заказ</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Изделие
</th>
<th>
Дата создания
</th>
<th>
Количество
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCreate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sum)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
</tr>
}
</tbody>
</table>
}
</div> </div>

View File

@ -0,0 +1,48 @@
@using ComputerHardwareStoreContracts.ViewModels
@model List<MessageInfoViewModel>
@{
ViewData["Title"] = "Mails";
}
<div class="text-center">
<h1 class="display-4">Заказы</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Дата письма
</th>
<th>
Заголовок
</th>
<th>
Текст
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.DateDelivery)
</td>
<td>
@Html.DisplayFor(modelItem => item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => item.Body)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,5 +1,5 @@
@using ComputerHardwareStoreContracts.ViewModels @using ComputerHardwareStoreContracts.ViewModels
@model List<OrderForProductsViewModel> @model List<OrderViewModel>
@{ @{
ViewData["Title"] = "Orders"; ViewData["Title"] = "Orders";
} }
@ -46,7 +46,7 @@
@Html.DisplayFor(modelItem => order.DateCreate) @Html.DisplayFor(modelItem => order.DateCreate)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => order.DateImplemet) @Html.DisplayFor(modelItem => order.DateImplement)
</td> </td>
</tr> </tr>
} }

View File

@ -0,0 +1,57 @@
@using ComputerHardwareStoreContracts.ViewModels
@model List<PurchaseViewModel>
@{
ViewData["Title"] = "Purchases";
}
<div class="text-center">
<h1 class="display-4">Покупки товаров и сборок</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Надо войти!</h3>
return;
}
<p>
<a class="text-decoration-none me-3 text-black h5" asp-action="CreatePurchase">Создать покупку</a>
<a class="text-decoration-none me-3 text-black h5" asp-action="UpdatePurchase">Изменить покупку</a>
<a class="text-decoration-none text-black h5" asp-action="DeletePurchase">Удалить покупку</a>
</p>
<table class="PurchaseTable">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата создания
</th>
<th>
Дата выполнения
</th>
</tr>
</thead>
<tbody>
<tbody>
@foreach (var purchase in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => purchase.Id)
</td>
<td>
@Html.DisplayFor(modelItem => purchase.DateCreate)
</td>
<td>
@Html.DisplayFor(modelItem => purchase.DateImplement)
</td>
</tr>
}
</tbody>
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,25 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - ComputerStoreWorkerApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/ComputerStoreWorkerApp.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">ComputerStoreWorkerApp</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Components">Комплектующие</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Products">Товары</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Orders">Заказы на товары</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="BuildByProductsReport">Список сборок по товарам</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ComponentsByPurchasesAndOrdersReport">Отчёт по комплектующим за период</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - ComputerStoreWorkerApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,48 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View File

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -0,0 +1,3 @@
@using StoreKeeperClient
@using StoreKeeperClient.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

View File

@ -5,5 +5,6 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
"IPAddress": "http://localhost:8081/"
} }

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2011-2021 Twitter, Inc.
Copyright (c) 2011-2021 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,427 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,424 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More