fix merge conflicts

This commit is contained in:
ShabOl 2024-06-21 18:35:50 +04:00
commit f8c72b171c
149 changed files with 79867 additions and 39 deletions

View File

@ -15,11 +15,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoWorkshopListImplement",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoWorkshopFileImplement", "AutoWorkshopFileImplement\AutoWorkshopFileImplement.csproj", "{862B0F3D-1B88-45B8-9526-AD21A6D6FA81}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoWorkshopDatabaseImplement", "AutoWorkshopDatabaseImplement\AutoWorkshopDatabaseImplement.csproj", "{751668F7-01A3-43F0-BDD8-ABB3A8F5A955}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoWorkshopDatabaseImplement", "AutoWorkshopDatabaseImplement\AutoWorkshopDatabaseImplement.csproj", "{751668F7-01A3-43F0-BDD8-ABB3A8F5A955}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoWorkshopRestApi", "AutoWorkshopRestApi\AutoWorkshopRestApi.csproj", "{15C54F32-1549-4887-BE08-DC6845B0D7ED}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoWorkshopRestApi", "AutoWorkshopRestApi\AutoWorkshopRestApi.csproj", "{15C54F32-1549-4887-BE08-DC6845B0D7ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoWorkshopClientApp", "AutoWorkshopClientApp\AutoWorkshopClientApp.csproj", "{EAE83B19-8CE1-4589-907A-DB9C8313FA06}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoWorkshopClientApp", "AutoWorkshopClientApp\AutoWorkshopClientApp.csproj", "{EAE83B19-8CE1-4589-907A-DB9C8313FA06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoWorkshopShopApp", "AutoWorkshopShopApp\AutoWorkshopShopApp.csproj", "{5934B924-59F1-42B6-9116-33F4947525CC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -63,6 +65,10 @@ Global
{EAE83B19-8CE1-4589-907A-DB9C8313FA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAE83B19-8CE1-4589-907A-DB9C8313FA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAE83B19-8CE1-4589-907A-DB9C8313FA06}.Release|Any CPU.Build.0 = Release|Any CPU
{5934B924-59F1-42B6-9116-33F4947525CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5934B924-59F1-42B6-9116-33F4947525CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5934B924-59F1-42B6-9116-33F4947525CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5934B924-59F1-42B6-9116-33F4947525CC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -13,13 +13,14 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage;
private readonly IShopStorage _shopStorage;
static readonly object _locker = new object();
public OrderLogic(ILogger<RepairLogic> Logger, IOrderStorage OrderStorage)
public OrderLogic(ILogger<RepairLogic> Logger, IOrderStorage OrderStorage, IShopStorage ShopStorage)
{
_logger = Logger;
_orderStorage = OrderStorage;
_shopStorage = ShopStorage;
}
public List<OrderViewModel>? ReadList(OrderSearchModel? Model)
@ -113,6 +114,23 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
public bool DeliveryOrder(OrderBindingModel Model)
{
var Order = _orderStorage.GetElement(new OrderSearchModel
{
Id = Model.Id
});
if (Order is null)
throw new ArgumentNullException(nameof(Order));
if (!_shopStorage.RestockingShops(new SupplyBindingModel
{
RepairId = Order.RepairId,
Count = Order.Count
}))
{
throw new ArgumentException("Недостаточно места");
}
return ChangeOrderStatus(Model, OrderStatus.Delivered);
}

View File

@ -13,16 +13,18 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
private readonly IComponentStorage _componentStorage;
private readonly IRepairStorage _RepairStorage;
private readonly IOrderStorage _orderStorage;
private readonly IShopStorage _shopStorage;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(IRepairStorage RepairStorage, IComponentStorage ComponentStorage, IOrderStorage OrderStorage,
public ReportLogic(IRepairStorage RepairStorage, IComponentStorage ComponentStorage, IOrderStorage OrderStorage, IShopStorage ShopStorage,
AbstractSaveToExcel SaveToExcel, AbstractSaveToWord SaveToWord, AbstractSaveToPdf SaveToPdf)
{
_RepairStorage = RepairStorage;
_componentStorage = ComponentStorage;
_orderStorage = OrderStorage;
_shopStorage = ShopStorage;
_saveToExcel = SaveToExcel;
_saveToWord = SaveToWord;
@ -41,6 +43,26 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
.ToList();
}
public List<ReportShopsViewModel> GetShops()
{
return _shopStorage.GetFullList().Select(x => new ReportShopsViewModel
{
ShopName = x.ShopName,
Repairs = x.ShopRepairs.Select(x => (x.Value.Item1.RepairName, x.Value.Item2)).ToList(),
TotalCount = x.ShopRepairs.Select(x => x.Value.Item2).Sum()
}).ToList();
}
public List<ReportGroupedOrdersViewModel> GetGroupedOrders()
{
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupedOrdersViewModel
{
Date = x.Key,
OrdersCount = x.Count(),
OrdersSum = x.Select(y => y.Sum).Sum()
}).ToList();
}
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel Model)
{
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = Model.DateFrom, DateTo = Model.DateTo })
@ -57,7 +79,7 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
public void SaveRepairsToWordFile(ReportBindingModel Model)
{
_saveToWord.CreateDoc(new WordInfo
_saveToWord.CreateRepairsDoc(new WordRepairsInfo
{
FileName = Model.FileName,
Title = "Список ремонтов",
@ -67,7 +89,7 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
public void SaveRepairComponentToExcelFile(ReportBindingModel Model)
{
_saveToExcel.CreateReport(new ExcelInfo
_saveToExcel.CreateReport(new ExcelRepairsInfo
{
FileName = Model.FileName,
Title = "Список ремонтов",
@ -77,7 +99,7 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
public void SaveOrdersToPdfFile(ReportBindingModel Model)
{
_saveToPdf.CreateDoc(new PdfInfo
_saveToPdf.CreateDoc(new PdfOrdersInfo
{
FileName = Model.FileName,
Title = "Список заказов",
@ -86,5 +108,35 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
Orders = GetOrders(Model)
});
}
public void SaveShopsToWordFile(ReportBindingModel model)
{
_saveToWord.CreateShopsDoc(new WordShopsInfo
{
FileName = model.FileName,
Title = "Список магазинов",
Shops = _shopStorage.GetFullList()
});
}
public void SaveShopsToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateShopRepairsReport(new ExcelShopsInfo
{
FileName = model.FileName,
Title = "Загруженность магазинов",
ShopRepairs = GetShops()
});
}
public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
{
_saveToPdf.CreateGroupedOrdersDoc(new PdfGroupedOrdersInfo
{
FileName = model.FileName,
Title = "Список заказов, объединенных по датам",
GroupedOrders = GetGroupedOrders()
});
}
}
}

View File

@ -0,0 +1,194 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace AutoWorkshopBusinessLogic.BusinessLogics
{
public class ShopLogic : IShopLogic
{
private readonly ILogger _logger;
private readonly IShopStorage _shopStorage;
private readonly IRepairStorage _repairStorage;
public ShopLogic(ILogger<ShopLogic> Logger, IShopStorage ShopStorage, IRepairStorage RepairStorage)
{
_logger = Logger;
_shopStorage = ShopStorage;
_repairStorage = RepairStorage;
}
public List<ShopViewModel>? ReadList(ShopSearchModel? Model)
{
_logger.LogInformation("ReadList. ShopName:{ShopName}.Id:{ Id}", Model?.ShopName, Model?.Id);
var List = Model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(Model);
if (List == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", List.Count);
return List;
}
public ShopViewModel? ReadElement(ShopSearchModel Model)
{
if (Model == null)
throw new ArgumentNullException(nameof(Model));
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", Model.ShopName, Model.Id);
var Element = _shopStorage.GetElement(Model);
if (Element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", Element.Id);
return Element;
}
public bool Create(ShopBindingModel Model)
{
CheckModel(Model);
if (_shopStorage.Insert(Model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(ShopBindingModel Model)
{
CheckModel(Model);
if (_shopStorage.Update(Model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(ShopBindingModel Model)
{
CheckModel(Model, false);
_logger.LogInformation("Delete. Id:{Id}", Model.Id);
if (_shopStorage.Delete(Model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool MakeSupply(SupplyBindingModel Model)
{
if (Model == null)
throw new ArgumentNullException(nameof(Model));
if (Model.Count <= 0)
throw new ArgumentException("Количество ремонтов должно быть больше 0");
ShopViewModel? Shop = _shopStorage.GetElement(new ShopSearchModel
{
Id = Model.ShopId
});
if (Shop == null)
throw new ArgumentException("Магазина не существует");
int CurrentRepairsNum = Shop.ShopRepairs.Select(x => x.Value.Item2).Sum();
if (Model.Count > Shop.RepairsMaxCount - CurrentRepairsNum)
{
_logger.LogWarning("Попытка добавить в магазин число элементов, большее RepairsMaxCount");
return false;
}
if (Shop.ShopRepairs.ContainsKey(Model.RepairId))
{
var RepairsNum = Shop.ShopRepairs[Model.RepairId];
RepairsNum.Item2 += Model.Count;
Shop.ShopRepairs[Model.RepairId] = RepairsNum;
}
else
{
var Repair = _repairStorage.GetElement(new RepairSearchModel
{
Id = Model.RepairId
});
if (Repair == null)
throw new ArgumentException($"Поставка: Товар с id {Model.RepairId} не найден");
Shop.ShopRepairs.Add(Model.RepairId, (Repair, Model.Count));
}
_shopStorage.Update(new ShopBindingModel()
{
Id = Shop.Id,
ShopName = Shop.ShopName,
Address = Shop.Address,
OpeningDate = Shop.OpeningDate,
ShopRepairs = Shop.ShopRepairs,
RepairsMaxCount = Shop.RepairsMaxCount,
});
return true;
}
private void CheckModel(ShopBindingModel Model, bool WithParams=true)
{
if (Model == null)
throw new ArgumentNullException(nameof(Model));
if (!WithParams)
return;
if (string.IsNullOrEmpty(Model.Address))
throw new ArgumentException("Адрес магазина длжен быть заполнен", nameof(Model.Address));
if (string.IsNullOrEmpty(Model.ShopName))
throw new ArgumentException("Название магазина должно быть заполнено", nameof(Model.ShopName));
_logger.LogInformation("Shop. ShopName: {ShopName}. Address: {Address}. OpeningDate: {OpeningDate}. Id:{Id}",
Model.ShopName, Model.Address, Model.OpeningDate, Model.Id);
var Element = _shopStorage.GetElement(new ShopSearchModel
{
ShopName = Model.ShopName
});
if (Element != null && Element.Id != Model.Id)
{
throw new InvalidOperationException("Магазин с таким названием уже есть");
}
}
public bool MakeSell(SupplySearchModel Model)
{
if (!Model.RepairId.HasValue || !Model.Count.HasValue)
return false;
_logger.LogInformation("Поиск ремонтов во всех магазинах");
if (_shopStorage.Sell(Model))
{
_logger.LogInformation("Продажа выполнена успешно");
return true;
}
_logger.LogInformation("Продажа не выполнена");
return false;
}
}
}

View File

@ -5,7 +5,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcel
{
public void CreateReport(ExcelInfo Info)
public void CreateReport(ExcelRepairsInfo Info)
{
CreateExcel(Info);
@ -78,13 +78,88 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
SaveExcel(Info);
}
protected abstract void CreateExcel(ExcelInfo Info);
public void CreateShopRepairsReport(ExcelShopsInfo 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 ShopRep in Info.ShopRepairs)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = RowIndex,
Text = ShopRep.ShopName,
StyleInfo = ExcelStyleInfoType.Text
});
RowIndex++;
foreach (var (Repair, Count) in ShopRep.Repairs)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = RowIndex,
Text = Repair,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = RowIndex,
Text = Count.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
RowIndex++;
}
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = RowIndex,
Text = "Итого",
StyleInfo = ExcelStyleInfoType.Text
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = RowIndex,
Text = ShopRep.TotalCount.ToString(),
StyleInfo = ExcelStyleInfoType.Text
});
RowIndex++;
}
SaveExcel(Info);
}
protected abstract void CreateExcel(IDocumentInfo Info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters ExcelParams);
protected abstract void MergeCells(ExcelMergeParameters ExcelParams);
protected abstract void SaveExcel(ExcelInfo Info);
protected abstract void SaveExcel(IDocumentInfo Info);
}
}

View File

@ -5,7 +5,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToPdf
{
public void CreateDoc(PdfInfo Info)
public void CreateDoc(PdfOrdersInfo Info)
{
CreatePdf(Info);
CreateParagraph(new PdfParagraph { Text = Info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
@ -33,8 +33,35 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
SavePdf(Info);
}
protected abstract void CreatePdf(PdfInfo Info);
public void CreateGroupedOrdersDoc(PdfGroupedOrdersInfo Info)
{
CreatePdf(Info);
CreateParagraph(new PdfParagraph { Text = Info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "4cm", "3cm", "2cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Дата заказа", "Кол-во", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var groupedOrder in Info.GroupedOrders)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { groupedOrder.Date.ToShortDateString(), groupedOrder.OrdersCount.ToString(), groupedOrder.OrdersSum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph { Text = $"Итого: {Info.GroupedOrders.Sum(x => x.OrdersSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
SavePdf(Info);
}
protected abstract void CreatePdf(IDocumentInfo Info);
protected abstract void CreateParagraph(PdfParagraph Paragraph);
@ -42,6 +69,6 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
protected abstract void CreateRow(PdfRowParameters RowParameters);
protected abstract void SavePdf(PdfInfo Info);
protected abstract void SavePdf(IDocumentInfo Info);
}
}

View File

@ -5,7 +5,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateDoc(WordInfo Info)
public void CreateRepairsDoc(WordRepairsInfo Info)
{
CreateWord(Info);
@ -37,11 +37,57 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
SaveWord(Info);
}
protected abstract void CreateWord(WordInfo Info);
public void CreateShopsDoc(WordShopsInfo 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
}
});
CreateTable(new List<string> { "3000", "3000", "3000" });
CreateRow(new WordRowParameters
{
Texts = new List<string> { "Название", "Адрес", "Дата открытия" },
TextProperties = new WordTextProperties
{
Size = "24",
Bold = true,
JustificationType = WordJustificationType.Center
}
});
foreach (var Shop in Info.Shops)
{
CreateRow(new WordRowParameters
{
Texts = new List<string> { Shop.ShopName, Shop.Address, Shop.OpeningDate.ToString() },
TextProperties = new WordTextProperties
{
Size = "22",
JustificationType = WordJustificationType.Both
}
});
}
SaveWord(Info);
}
protected abstract void CreateWord(IDocumentInfo Info);
protected abstract void CreateParagraph(WordParagraph Paragraph);
protected abstract void SaveWord(WordInfo Info);
protected abstract void SaveWord(IDocumentInfo Info);
protected abstract void CreateTable(List<string> Colums);
protected abstract void CreateRow(WordRowParameters RowParameters);
}
}

View File

@ -2,7 +2,7 @@
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class ExcelInfo
public class ExcelRepairsInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;

View File

@ -0,0 +1,13 @@
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class ExcelShopsInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ReportShopsViewModel> ShopRepairs { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public interface IDocumentInfo
{
public string FileName { get; set; }
public string Title { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class PdfGroupedOrdersInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List<ReportGroupedOrdersViewModel> GroupedOrders { get; set; } = new();
}
}

View File

@ -2,7 +2,7 @@
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class PdfInfo
public class PdfOrdersInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;

View File

@ -2,7 +2,7 @@
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class WordInfo
public class WordRepairsInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;

View File

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

View File

@ -0,0 +1,13 @@
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopBusinessLogic.OfficePackage.HelperModels
{
public class WordShopsInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ShopViewModel> Shops { get; set; } = new();
}
}

View File

@ -139,7 +139,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
};
}
protected override void CreateExcel(ExcelInfo Info)
protected override void CreateExcel(IDocumentInfo Info)
{
_spreadsheetDocument = SpreadsheetDocument.Create(Info.FileName, SpreadsheetDocumentType.Workbook);
@ -269,7 +269,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
MergeCells.Append(MergeCell);
}
protected override void SaveExcel(ExcelInfo Info)
protected override void SaveExcel(IDocumentInfo Info)
{
if (_spreadsheetDocument == null)
return;

View File

@ -33,7 +33,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
Style.Font.Bold = true;
}
protected override void CreatePdf(PdfInfo Info)
protected override void CreatePdf(IDocumentInfo Info)
{
_document = new Document();
DefineStyles(_document);
@ -94,7 +94,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
}
}
protected override void SavePdf(PdfInfo Info)
protected override void SavePdf(IDocumentInfo Info)
{
var Renderer = new PdfDocumentRenderer(true)
{

View File

@ -64,7 +64,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
return Properties;
}
protected override void CreateWord(WordInfo Info)
protected override void CreateWord(IDocumentInfo Info)
{
_wordDocument = WordprocessingDocument.Create(Info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
@ -103,7 +103,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
_docBody.AppendChild(DocParagraph);
}
protected override void SaveWord(WordInfo Info)
protected override void SaveWord(IDocumentInfo Info)
{
if (_docBody == null || _wordDocument == null)
{
@ -114,5 +114,79 @@ namespace AutoWorkshopBusinessLogic.OfficePackage.Implements
_wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Close();
}
private Table? _lastTable;
protected override void CreateTable(List<string> Columns)
{
if (_docBody == null)
return;
_lastTable = 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 });
_lastTable.AppendChild(TableProp);
TableGrid TableGrid = new TableGrid();
foreach (var Column in Columns)
{
TableGrid.AppendChild(new GridColumn() { Width = Column });
}
_lastTable.AppendChild(TableGrid);
_docBody.AppendChild(_lastTable);
}
protected override void CreateRow(WordRowParameters RowParameters)
{
if (_docBody == null || _lastTable == null)
return;
TableRow DocRow = new TableRow();
foreach (var Column in RowParameters.Texts)
{
var DocParagraph = new Paragraph();
WordParagraph Paragraph = new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (Column, RowParameters.TextProperties) },
TextProperties = RowParameters.TextProperties
};
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);
}
TableCell docCell = new TableCell();
docCell.AppendChild(DocParagraph);
DocRow.AppendChild(docCell);
}
_lastTable.AppendChild(DocRow);
}
}
}

View File

@ -0,0 +1,19 @@
using AutoWorkshopDataModels.Models;
namespace AutoWorkshopContracts.BindingModels
{
public class ShopBindingModel : IShopModel
{
public int Id { get; set; }
public string ShopName { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public DateTime OpeningDate { get; set; } = DateTime.Now;
public Dictionary<int, (IRepairModel, int)> ShopRepairs { get; set; } = new();
public int RepairsMaxCount { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using AutoWorkshopDataModels.Models;
namespace AutoWorkshopContracts.BindingModels
{
public class SupplyBindingModel : ISupplyModel
{
public int ShopId { get; set; }
public int RepairId { get; set; }
public int Count { get; set; }
}
}

View File

@ -8,11 +8,21 @@ namespace AutoWorkshopContracts.BusinessLogicContracts
List<ReportRepairComponentViewModel> GetRepairComponents();
List<ReportOrdersViewModel> GetOrders(ReportBindingModel Model);
List<ReportShopsViewModel> GetShops();
List<ReportGroupedOrdersViewModel> GetGroupedOrders();
void SaveRepairsToWordFile(ReportBindingModel Model);
void SaveRepairComponentToExcelFile(ReportBindingModel Model);
void SaveOrdersToPdfFile(ReportBindingModel Model);
void SaveShopsToWordFile(ReportBindingModel Model);
void SaveShopsToExcelFile(ReportBindingModel Model);
void SaveGroupedOrdersToPdfFile(ReportBindingModel Model);
}
}

View File

@ -0,0 +1,23 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopContracts.BusinessLogicsContracts
{
public interface IShopLogic
{
List<ShopViewModel>? ReadList(ShopSearchModel? Model);
ShopViewModel? ReadElement(ShopSearchModel Model);
bool Create(ShopBindingModel Model);
bool Update(ShopBindingModel Model);
bool Delete(ShopBindingModel Model);
bool MakeSupply(SupplyBindingModel Model);
bool MakeSell(SupplySearchModel Model);
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopContracts.SearchModels
{
public class ShopSearchModel
{
public int? Id { get; set; }
public string? ShopName { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopContracts.SearchModels
{
public class SupplySearchModel
{
public int? RepairId { get; set; }
public int? Count { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopContracts.StoragesContracts
{
public interface IShopStorage
{
List<ShopViewModel> GetFullList();
List<ShopViewModel> GetFilteredList(ShopSearchModel Model);
ShopViewModel? GetElement(ShopSearchModel Model);
ShopViewModel? Insert(ShopBindingModel Model);
ShopViewModel? Update(ShopBindingModel Model);
ShopViewModel? Delete(ShopBindingModel Model);
bool Sell(SupplySearchModel Model);
bool RestockingShops(SupplyBindingModel Model);
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopContracts.ViewModels
{
public class RepairCount
{
public RepairViewModel Repair { get; set; } = new();
public int Count { get; set; } = new();
}
}

View File

@ -0,0 +1,11 @@
namespace AutoWorkshopContracts.ViewModels
{
public class ReportGroupedOrdersViewModel
{
public DateTime Date { get; set; } = DateTime.Now;
public int OrdersCount { get; set; }
public double OrdersSum { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace AutoWorkshopContracts.ViewModels
{
public class ReportShopsViewModel
{
public string ShopName { get; set; } = string.Empty;
public int TotalCount { get; set; }
public List<(string Repair, int Count)> Repairs { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopContracts.ViewModels
{
public class ShopRepairsViewModel
{
public ShopViewModel Shop { get; set; } = new();
public Dictionary<int, RepairCount> ShopRepairs { get; set; } = new();
}
}

View File

@ -0,0 +1,24 @@
using AutoWorkshopDataModels.Models;
using System.ComponentModel;
namespace AutoWorkshopContracts.ViewModels
{
public class ShopViewModel : IShopModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string ShopName { get; set; } = string.Empty;
[DisplayName("Адрес")]
public string Address { get; set; } = string.Empty;
[DisplayName("Дата открытия")]
public DateTime OpeningDate { get; set; }
public Dictionary<int, (IRepairModel, int)> ShopRepairs { get; set; } = new();
[DisplayName("Вместимость")]
public int RepairsMaxCount { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace AutoWorkshopDataModels.Models
{
public interface IShopModel : IId
{
string ShopName { get; }
string Address { get; }
DateTime OpeningDate { get; }
Dictionary<int, (IRepairModel, int)> ShopRepairs { get; }
int RepairsMaxCount { get; }
}
}

View File

@ -0,0 +1,11 @@
namespace AutoWorkshopDataModels.Models
{
public interface ISupplyModel
{
int ShopId { get; }
int RepairId { get; }
int Count { get; }
}
}

View File

@ -9,7 +9,7 @@ namespace AutoWorkshopDatabaseImplement
{
if (OptionsBuilder.IsConfigured == false)
{
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=AutoWorkshop;Username=postgres;Password=admin");
OptionsBuilder.UseNpgsql(@"Host=localhost;Port=5000;Database=AutoWorkshop_Hard;Username=postgres;Password=admin");
}
base.OnConfiguring(OptionsBuilder);
@ -26,6 +26,10 @@ namespace AutoWorkshopDatabaseImplement
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Shop> Shops { get; set; }
public virtual DbSet<ShopRepair> ShopRepairs { get; set; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }

View File

@ -0,0 +1,221 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace AutoWorkshopDatabaseImplement.Implements
{
public class ShopStorage : IShopStorage
{
public List<ShopViewModel> GetFullList()
{
using var Context = new AutoWorkshopDatabase();
return Context.Shops
.Include(x => x.Repairs)
.ThenInclude(x => x.Repair)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
public List<ShopViewModel> GetFilteredList(ShopSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ShopName))
return new();
using var Context = new AutoWorkshopDatabase();
return Context.Shops
.Include(x => x.Repairs)
.ThenInclude(x => x.Repair)
.Where(x => x.ShopName.Contains(Model.ShopName))
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
public ShopViewModel? GetElement(ShopSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ShopName) && !Model.Id.HasValue)
return new();
using var Context = new AutoWorkshopDatabase();
return Context.Shops
.Include(x => x.Repairs)
.ThenInclude(x => x.Repair)
.FirstOrDefault(x => (!string.IsNullOrEmpty(Model.ShopName) && x.ShopName == Model.ShopName) ||
(Model.Id.HasValue && x.Id == Model.Id))?
.GetViewModel;
}
public ShopViewModel? Insert(ShopBindingModel Model)
{
using var Context = new AutoWorkshopDatabase();
var NewShop = Shop.Create(Context, Model);
if (NewShop == null)
return null;
Context.Shops.Add(NewShop);
Context.SaveChanges();
return NewShop.GetViewModel;
}
public ShopViewModel? Update(ShopBindingModel Model)
{
using var Context = new AutoWorkshopDatabase();
using var Transaction = Context.Database.BeginTransaction();
try
{
var Shop = Context.Shops.FirstOrDefault(x => x.Id == Model.Id);
if (Shop == null)
return null;
Shop.Update(Model);
Context.SaveChanges();
Shop.UpdateRepairs(Context, Model);
Transaction.Commit();
return Shop.GetViewModel;
}
catch
{
Transaction.Rollback();
throw;
}
}
public ShopViewModel? Delete(ShopBindingModel Model)
{
using var Context = new AutoWorkshopDatabase();
var Shop = Context.Shops
.Include(x => x.Repairs)
.FirstOrDefault(x => x.Id == Model.Id);
if (Shop == null)
return null;
Context.Shops.Remove(Shop);
Context.SaveChanges();
return Shop.GetViewModel;
}
public bool Sell(SupplySearchModel Model)
{
using var Context = new AutoWorkshopDatabase();
var Transaction = Context.Database.BeginTransaction();
try
{
var ShopsWithDesiredRepair = Context.Shops
.Include(x => x.Repairs)
.ThenInclude(x => x.Repair)
.ToList()
.Where(x => x.ShopRepairs.ContainsKey(Model.RepairId.Value))
.OrderByDescending(x => x.ShopRepairs[Model.RepairId.Value].Item2)
.ToList();
foreach (var Shop in ShopsWithDesiredRepair)
{
int Slack = Model.Count.Value - Shop.ShopRepairs[Model.RepairId.Value].Item2;
if (Slack > 0)
{
Shop.ShopRepairs.Remove(Model.RepairId.Value);
Shop.RepairsDictionatyUpdate(Context);
Context.SaveChanges();
Model.Count = Slack;
}
else
{
if (Slack == 0)
{
Shop.ShopRepairs.Remove(Model.RepairId.Value);
}
else
{
var RepairAndCount = Shop.ShopRepairs[Model.RepairId.Value];
RepairAndCount.Item2 = -Slack;
Shop.ShopRepairs[Model.RepairId.Value] = RepairAndCount;
}
Shop.RepairsDictionatyUpdate(Context);
Transaction.Commit();
return true;
}
}
Transaction.Rollback();
return false;
}
catch
{
Transaction.Rollback();
throw;
}
}
public bool RestockingShops(SupplyBindingModel Model)
{
using var Context = new AutoWorkshopDatabase();
var Transaction = Context.Database.BeginTransaction();
var Shops = Context.Shops
.Include(x => x.Repairs)
.ThenInclude(x => x.Repair)
.ToList()
.Where(x => x.RepairsMaxCount > x.ShopRepairs
.Select(x => x.Value.Item2).Sum())
.ToList();
try
{
foreach (Shop Shop in Shops)
{
int FreeSpaceNum = Shop.RepairsMaxCount - Shop.ShopRepairs.Select(x => x.Value.Item2).Sum();
int Refill = Math.Min(FreeSpaceNum, Model.Count);
Model.Count -= Refill;
if (Shop.ShopRepairs.ContainsKey(Model.RepairId))
{
var RepairAndCount = Shop.ShopRepairs[Model.RepairId];
RepairAndCount.Item2 += Refill;
Shop.ShopRepairs[Model.RepairId] = RepairAndCount;
}
else
{
var Repair = Context.Repairs.First(x => x.Id == Model.RepairId);
Shop.ShopRepairs.Add(Model.RepairId, (Repair, Refill));
}
Shop.RepairsDictionatyUpdate(Context);
if (Model.Count == 0)
{
Transaction.Commit();
return true;
}
}
Transaction.Rollback();
return false;
}
catch
{
Transaction.Rollback();
throw;
}
}
}
}

View File

@ -12,8 +12,13 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AutoWorkshopDatabaseImplement.Migrations
{
[DbContext(typeof(AutoWorkshopDatabase))]
<<<<<<<< HEAD:AutoWorkshopDatabaseImplement/Migrations/20240416160914_Implementers.Designer.cs
[Migration("20240416160914_Implementers")]
partial class Implementers
========
[Migration("20240514192226_Lab5_Hard")]
partial class Lab5_Hard
>>>>>>>> Lab5_Hard:AutoWorkshopDatabaseImplement/Migrations/20240514192226_Lab5_Hard.Designer.cs
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -186,6 +191,59 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.ToTable("RepairComponents");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("OpeningDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("RepairsMaxCount")
.HasColumnType("integer");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.ShopRepair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("RepairId")
.HasColumnType("integer");
b.Property<int>("ShopId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RepairId");
b.HasIndex("ShopId");
b.ToTable("ShopRepairs");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
{
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", "Client")
@ -230,6 +288,25 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.Navigation("Repair");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.ShopRepair", b =>
{
b.HasOne("AutoWorkshopDatabaseImplement.Models.Repair", "Repair")
.WithMany("Shops")
.HasForeignKey("RepairId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AutoWorkshopDatabaseImplement.Models.Shop", "Shop")
.WithMany("Repairs")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Repair");
b.Navigation("Shop");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
@ -250,6 +327,13 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.Navigation("Components");
b.Navigation("Orders");
b.Navigation("Shops");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Repairs");
});
#pragma warning restore 612, 618
}

View File

@ -7,7 +7,11 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AutoWorkshopDatabaseImplement.Migrations
{
/// <inheritdoc />
<<<<<<<< HEAD:AutoWorkshopDatabaseImplement/Migrations/20240416160914_Implementers.cs
public partial class Implementers : Migration
========
public partial class Lab5_Hard : Migration
>>>>>>>> Lab5_Hard:AutoWorkshopDatabaseImplement/Migrations/20240514192226_Lab5_Hard.cs
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -71,6 +75,22 @@ namespace AutoWorkshopDatabaseImplement.Migrations
table.PrimaryKey("PK_Repairs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Shops",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShopName = table.Column<string>(type: "text", nullable: false),
Address = table.Column<string>(type: "text", nullable: false),
OpeningDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
RepairsMaxCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
@ -135,6 +155,33 @@ namespace AutoWorkshopDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ShopRepairs",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RepairId = table.Column<int>(type: "integer", nullable: false),
ShopId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ShopRepairs", x => x.Id);
table.ForeignKey(
name: "FK_ShopRepairs_Repairs_RepairId",
column: x => x.RepairId,
principalTable: "Repairs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShopRepairs_Shops_ShopId",
column: x => x.ShopId,
principalTable: "Shops",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
@ -159,6 +206,16 @@ namespace AutoWorkshopDatabaseImplement.Migrations
name: "IX_RepairComponents_RepairId",
table: "RepairComponents",
column: "RepairId");
migrationBuilder.CreateIndex(
name: "IX_ShopRepairs_RepairId",
table: "ShopRepairs",
column: "RepairId");
migrationBuilder.CreateIndex(
name: "IX_ShopRepairs_ShopId",
table: "ShopRepairs",
column: "ShopId");
}
/// <inheritdoc />
@ -170,6 +227,9 @@ namespace AutoWorkshopDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "RepairComponents");
migrationBuilder.DropTable(
name: "ShopRepairs");
migrationBuilder.DropTable(
name: "Clients");
@ -181,6 +241,9 @@ namespace AutoWorkshopDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "Repairs");
migrationBuilder.DropTable(
name: "Shops");
}
}
}

View File

@ -183,6 +183,59 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.ToTable("RepairComponents");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("OpeningDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("RepairsMaxCount")
.HasColumnType("integer");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.ShopRepair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("RepairId")
.HasColumnType("integer");
b.Property<int>("ShopId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RepairId");
b.HasIndex("ShopId");
b.ToTable("ShopRepairs");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
{
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", "Client")
@ -227,6 +280,25 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.Navigation("Repair");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.ShopRepair", b =>
{
b.HasOne("AutoWorkshopDatabaseImplement.Models.Repair", "Repair")
.WithMany("Shops")
.HasForeignKey("RepairId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AutoWorkshopDatabaseImplement.Models.Shop", "Shop")
.WithMany("Repairs")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Repair");
b.Navigation("Shop");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
@ -247,6 +319,13 @@ namespace AutoWorkshopDatabaseImplement.Migrations
b.Navigation("Components");
b.Navigation("Orders");
b.Navigation("Shops");
});
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Repairs");
});
#pragma warning restore 612, 618
}

View File

@ -38,7 +38,10 @@ namespace AutoWorkshopDatabaseImplement.Models
[ForeignKey("RepairId")]
public virtual List<Order> Orders { get; set; } = new();
[ForeignKey("RepairId")]
public virtual List<ShopRepair> Shops { get; set; } = new();
public static Repair Create(AutoWorkshopDatabase Context, RepairBindingModel Model)
{
return new Repair()

View File

@ -0,0 +1,131 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AutoWorkshopDatabaseImplement.Models
{
public class Shop : IShopModel
{
public int Id { get; set; }
[Required]
public string ShopName { get; set; } = string.Empty;
[Required]
public string Address { get; set; } = string.Empty;
[Required]
public DateTime OpeningDate { get; set; }
[Required]
public int RepairsMaxCount { get; set; }
[ForeignKey("ShopId")]
public List<ShopRepair> Repairs { get; set; } = new();
private Dictionary<int, (IRepairModel, int)>? _shopRepairs = null;
[NotMapped]
public Dictionary<int, (IRepairModel, int)> ShopRepairs
{
get
{
if (_shopRepairs == null)
{
if (_shopRepairs == null)
{
_shopRepairs = Repairs.ToDictionary(ShopRep => ShopRep.RepairId, ShopRep => (ShopRep.Repair as IRepairModel, ShopRep.Count));
}
return _shopRepairs;
}
return _shopRepairs;
}
}
public static Shop Create(AutoWorkshopDatabase Context, ShopBindingModel Model)
{
return new Shop()
{
Id = Model.Id,
ShopName = Model.ShopName,
Address = Model.Address,
OpeningDate = Model.OpeningDate,
Repairs = Model.ShopRepairs.Select(x => new ShopRepair
{
Repair = Context.Repairs.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList(),
RepairsMaxCount = Model.RepairsMaxCount
};
}
public void Update(ShopBindingModel Model)
{
ShopName = Model.ShopName;
Address = Model.Address;
OpeningDate = Model.OpeningDate;
RepairsMaxCount = Model.RepairsMaxCount;
}
public ShopViewModel GetViewModel => new()
{
Id = Id,
ShopName = ShopName,
Address = Address,
OpeningDate = OpeningDate,
ShopRepairs = ShopRepairs,
RepairsMaxCount = RepairsMaxCount
};
public void UpdateRepairs(AutoWorkshopDatabase Context, ShopBindingModel Model)
{
var ShopRepairs = Context.ShopRepairs
.Where(rec => rec.ShopId == Model.Id)
.ToList();
if (ShopRepairs != null && ShopRepairs.Count > 0)
{
Context.ShopRepairs.RemoveRange(ShopRepairs.Where(rec => !Model.ShopRepairs.ContainsKey(rec.RepairId)));
Context.SaveChanges();
ShopRepairs = Context.ShopRepairs.Where(rec => rec.ShopId == Model.Id).ToList();
foreach (var RepairToUpdate in ShopRepairs)
{
RepairToUpdate.Count = Model.ShopRepairs[RepairToUpdate.RepairId].Item2;
Model.ShopRepairs.Remove(RepairToUpdate.RepairId);
}
Context.SaveChanges();
}
var Shop = Context.Shops.First(x => x.Id == Id);
foreach (var ShopRepair in Model.ShopRepairs)
{
Context.ShopRepairs.Add(new ShopRepair
{
Shop = Shop,
Repair = Context.Repairs.First(x => x.Id == ShopRepair.Key),
Count = ShopRepair.Value.Item2
});
Context.SaveChanges();
}
_shopRepairs = null;
}
public void RepairsDictionatyUpdate(AutoWorkshopDatabase Context)
{
UpdateRepairs(Context, new ShopBindingModel
{
Id = Id,
ShopRepairs = ShopRepairs
});
}
}
}

View File

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace AutoWorkshopDatabaseImplement.Models
{
public class ShopRepair
{
public int Id { get; set; }
[Required]
public int RepairId { get; set; }
[Required]
public int ShopId { get; set; }
[Required]
public int Count { get; set; }
public virtual Shop Shop { get; set; } = new();
public virtual Repair Repair { get; set; } = new();
}
}

View File

@ -10,6 +10,7 @@ namespace AutoWorkshopFileImplement
private readonly string ComponentFileName = "Component.xml";
private readonly string OrderFileName = "Order.xml";
private readonly string RepairFileName = "Repair.xml";
private readonly string ShopFileName = "Shop.xml";
private readonly string ClientFileName = "Client.xml";
private readonly string ImplementerFileName = "Implementer.xml";
@ -18,6 +19,8 @@ namespace AutoWorkshopFileImplement
public List<Order> Orders { get; private set; }
public List<Repair> Repairs { get; private set; }
public List<Shop> Shops { get; private set; }
public List<Client> Clients { get; private set; }
@ -28,6 +31,7 @@ namespace AutoWorkshopFileImplement
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
Repairs = LoadData(RepairFileName, "Repair", x => Repair.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
}
@ -45,6 +49,7 @@ namespace AutoWorkshopFileImplement
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
public void SaveRepairs() => SaveData(Repairs, RepairFileName, "Repairs", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);

View File

@ -0,0 +1,168 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopFileImplement.Models;
namespace AutoWorkshopFileImplement.Implements
{
public class ShopStorage : IShopStorage
{
private readonly DataFileSingleton _source;
public ShopStorage()
{
_source = DataFileSingleton.GetInstance();
}
public List<ShopViewModel> GetFullList()
{
return _source.Shops.Select(x => x.GetViewModel).ToList();
}
public List<ShopViewModel> GetFilteredList(ShopSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ShopName))
return new();
return _source.Shops
.Where(x => x.ShopName
.Contains(Model.ShopName))
.Select(x => x.GetViewModel)
.ToList();
}
public ShopViewModel? GetElement(ShopSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ShopName) && !Model.Id.HasValue)
return null;
return _source.Shops.FirstOrDefault(x =>
(!string.IsNullOrEmpty(Model.ShopName) && x.ShopName == Model.ShopName) ||
(Model.Id.HasValue && x.Id == Model.Id))?
.GetViewModel;
}
public ShopViewModel? Insert(ShopBindingModel Model)
{
Model.Id = _source.Shops.Count > 0 ? _source.Shops.Max(x => x.Id) + 1 : 1;
var NewShop = Shop.Create(Model);
if (NewShop == null)
return null;
_source.Shops.Add(NewShop);
_source.SaveShops();
return NewShop.GetViewModel;
}
public ShopViewModel? Update(ShopBindingModel Model)
{
var Shop = _source.Shops.FirstOrDefault(x => x.Id == Model.Id);
if (Shop == null)
return null;
Shop.Update(Model);
_source.SaveShops();
return Shop.GetViewModel;
}
public ShopViewModel? Delete(ShopBindingModel Model)
{
var Shop = _source.Shops.FirstOrDefault(x => x.Id == Model.Id);
if (Shop == null)
return null;
_source.Shops.Remove(Shop);
_source.SaveShops();
return Shop.GetViewModel;
}
public bool Sell(SupplySearchModel Model)
{
if (Model == null || !Model.RepairId.HasValue || !Model.Count.HasValue)
return false;
int TotalRepairsNum = _source.Shops
.Select(x => x.Repairs.ContainsKey(Model.RepairId.Value) ? x.Repairs[Model.RepairId.Value] : 0)
.Sum();
if (TotalRepairsNum < Model.Count)
return false;
var ShopsWithDesiredRepair = _source.Shops
.Where(x => x.Repairs.ContainsKey(Model.RepairId.Value))
.OrderByDescending(x => x.Repairs[Model.RepairId.Value])
.ToList();
foreach (var Shop in ShopsWithDesiredRepair)
{
int Slack = Model.Count.Value - Shop.Repairs[Model.RepairId.Value];
if (Slack > 0)
{
Shop.Repairs.Remove(Model.RepairId.Value);
Shop.RepairsUpdate();
Model.Count = Slack;
}
else
{
if (Slack == 0)
Shop.Repairs.Remove(Model.RepairId.Value);
else
Shop.Repairs[Model.RepairId.Value] = -Slack;
Shop.RepairsUpdate();
_source.SaveShops();
return true;
}
}
_source.SaveShops();
return false;
}
public bool RestockingShops(SupplyBindingModel Model)
{
int TotalFreeSpaceNum = _source.Shops
.Select(x => x.RepairsMaxCount - x.ShopRepairs
.Select(y => y.Value.Item2)
.Sum())
.Sum();
if (TotalFreeSpaceNum < Model.Count)
return false;
foreach (Shop Shop in _source.Shops)
{
int FreeSpaceNum = Shop.RepairsMaxCount - Shop.ShopRepairs.Select(x => x.Value.Item2).Sum();
if (FreeSpaceNum <= 0)
continue;
FreeSpaceNum = Math.Min(FreeSpaceNum, Model.Count);
Model.Count -= FreeSpaceNum;
if (Shop.Repairs.ContainsKey(Model.RepairId))
Shop.Repairs[Model.RepairId] += FreeSpaceNum;
else
Shop.Repairs.Add(Model.RepairId, FreeSpaceNum);
Shop.RepairsUpdate();
if (Model.Count == 0)
{
_source.SaveShops();
return true;
}
}
return false;
}
}
}

View File

@ -0,0 +1,110 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopDataModels.Models;
using System.Xml.Linq;
namespace AutoWorkshopFileImplement.Models
{
public class Shop : IShopModel
{
public int Id { get; private set; }
public string ShopName { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime OpeningDate { get; private set; }
public Dictionary<int, int> Repairs { get; private set; } = new();
private Dictionary<int, (IRepairModel, int)>? _shopRepairs = null;
public Dictionary<int, (IRepairModel, int)> ShopRepairs
{
get
{
if (_shopRepairs == null)
{
var Source = DataFileSingleton.GetInstance();
_shopRepairs = Repairs.ToDictionary(x => x.Key, y => ((Source.Repairs.FirstOrDefault(z => z.Id == y.Key) as IRepairModel)!, y.Value));
}
return _shopRepairs;
}
}
public int RepairsMaxCount { get; private set; }
public static Shop? Create(ShopBindingModel? Model)
{
if (Model == null)
return null;
return new Shop()
{
Id = Model.Id,
ShopName = Model.ShopName,
Address = Model.Address,
OpeningDate = Model.OpeningDate,
Repairs = Model.ShopRepairs.ToDictionary(x => x.Key, x => x.Value.Item2),
RepairsMaxCount = Model.RepairsMaxCount
};
}
public static Shop? Create(XElement Element)
{
if (Element == null)
return null;
return new Shop()
{
Id = Convert.ToInt32(Element.Attribute("Id")!.Value),
ShopName = Element.Element("ShopName")!.Value,
Address = Element.Element("Address")!.Value,
OpeningDate = Convert.ToDateTime(Element.Element("OpeningDate")!.Value),
Repairs = Element.Element("ShopRepairs")!.Elements("ShopRepair")!.ToDictionary(x => Convert.ToInt32(x.Element("Key")?.Value),
x => Convert.ToInt32(x.Element("Value")?.Value)),
RepairsMaxCount = Convert.ToInt32(Element.Element("RepairsMaxCount")!.Value)
};
}
public void Update(ShopBindingModel? Model)
{
if (Model == null)
return;
ShopName = Model.ShopName;
Address = Model.Address;
OpeningDate = Model.OpeningDate;
RepairsMaxCount = Model.RepairsMaxCount;
Repairs = Model.ShopRepairs.ToDictionary(x => x.Key, x => x.Value.Item2);
_shopRepairs = null;
}
public ShopViewModel GetViewModel => new()
{
Id = Id,
ShopName = ShopName,
Address = Address,
OpeningDate = OpeningDate,
ShopRepairs = ShopRepairs,
RepairsMaxCount = RepairsMaxCount
};
public XElement GetXElement => new(
"Shop",
new XAttribute("Id", Id),
new XElement("ShopName", ShopName),
new XElement("Address", Address),
new XElement("OpeningDate", OpeningDate.ToString()),
new XElement("ShopRepairs", Repairs.Select(
x => new XElement("ShopRepair", new XElement("Key", x.Key), new XElement("Value", x.Value))).ToArray()),
new XElement("RepairsMaxCount", RepairsMaxCount.ToString())
);
public void RepairsUpdate()
{
_shopRepairs = null;
}
}
}

View File

@ -12,6 +12,9 @@ namespace AutoWorkshopListImplement
public List<Repair> Repairs { get; set; }
public List<Shop> Shops { get; set; }
public List<Client> Clients { get; set; }
public List<Implementer> Implementers { get; set; }
@ -21,6 +24,7 @@ namespace AutoWorkshopListImplement
Components = new List<Component>();
Orders = new List<Order>();
Repairs = new List<Repair>();
Shops = new List<Shop>();
Clients = new List<Client>();
Implementers = new List<Implementer>();
}

View File

@ -0,0 +1,122 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopListImplement.Models;
namespace AutoWorkshopListImplement.Implements
{
public class ShopStorage : IShopStorage
{
private readonly DataListSingleton _source;
public ShopStorage()
{
_source = DataListSingleton.GetInstance();
}
public List<ShopViewModel> GetFullList()
{
var Result = new List<ShopViewModel>();
foreach (var Shop in _source.Shops)
{
Result.Add(Shop.GetViewModel);
}
return Result;
}
public List<ShopViewModel> GetFilteredList(ShopSearchModel Model)
{
var Result = new List<ShopViewModel>();
if (string.IsNullOrEmpty(Model.ShopName))
return Result;
foreach (var Shop in _source.Shops)
{
if (Shop.ShopName.Contains(Model.ShopName))
Result.Add(Shop.GetViewModel);
}
return Result;
}
public ShopViewModel? GetElement(ShopSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ShopName) && !Model.Id.HasValue)
return null;
foreach (var Shop in _source.Shops)
{
if ((!string.IsNullOrEmpty(Model.ShopName) && Shop.ShopName == Model.ShopName) ||
(Model.Id.HasValue && Shop.Id == Model.Id))
{
return Shop.GetViewModel;
}
}
return null;
}
public ShopViewModel? Insert(ShopBindingModel Model)
{
Model.Id = 1;
foreach (var Shop in _source.Shops)
{
if (Model.Id <= Shop.Id)
Model.Id = Shop.Id + 1;
}
var NewShop = Shop.Create(Model);
if (NewShop is null)
return null;
_source.Shops.Add(NewShop);
return NewShop.GetViewModel;
}
public ShopViewModel? Update(ShopBindingModel Model)
{
foreach (var Shop in _source.Shops)
{
if (Shop.Id == Model.Id)
{
Shop.Update(Model);
return Shop.GetViewModel;
}
}
return null;
}
public ShopViewModel? Delete(ShopBindingModel Model)
{
for (int i = 0; i < _source.Shops.Count; ++i)
{
if (_source.Shops[i].Id == Model.Id)
{
var Shop = _source.Shops[i];
_source.Shops.RemoveAt(i);
return Shop.GetViewModel;
}
}
return null;
}
public bool Sell(SupplySearchModel Model)
{
throw new NotImplementedException();
}
public bool RestockingShops(SupplyBindingModel Model)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,57 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopDataModels.Models;
namespace AutoWorkshopListImplement.Models
{
public class Shop : IShopModel
{
public int Id { get; private set; }
public string ShopName { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime OpeningDate { get; private set; }
public Dictionary<int, (IRepairModel, int)> ShopRepairs { get; private set; } = new();
public int RepairsMaxCount { get; private set; }
public static Shop? Create(ShopBindingModel? Model)
{
if (Model is null)
return null;
return new Shop()
{
Id = Model.Id,
ShopName = Model.ShopName,
Address = Model.Address,
OpeningDate = Model.OpeningDate,
RepairsMaxCount = Model.RepairsMaxCount,
};
}
public void Update(ShopBindingModel? Model)
{
if (Model is null)
return;
ShopName = Model.ShopName;
Address = Model.Address;
OpeningDate = Model.OpeningDate;
RepairsMaxCount = Model.RepairsMaxCount;
}
public ShopViewModel GetViewModel => new()
{
Id = Id,
ShopName = ShopName,
Address = Address,
OpeningDate = OpeningDate,
ShopRepairs = ShopRepairs,
RepairsMaxCount = RepairsMaxCount,
};
}
}

View File

@ -0,0 +1,125 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace AutoWorkshopRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ShopController : Controller
{
private readonly ILogger _logger;
private readonly IShopLogic _shopLogic;
public ShopController(ILogger<ShopController> Logger, IShopLogic ShopLogic)
{
_logger = Logger;
_shopLogic = ShopLogic;
}
[HttpGet]
public List<ShopViewModel>? GetShopList()
{
try
{
return _shopLogic.ReadList(null);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка магазинов");
throw;
}
}
[HttpGet]
public ShopRepairsViewModel? GetShop(int ShopId)
{
try
{
var Shop = _shopLogic.ReadElement(new ShopSearchModel { Id = ShopId });
if (Shop == null)
return null;
return new ShopRepairsViewModel
{
Shop = Shop,
ShopRepairs = Shop.ShopRepairs.ToDictionary(x => x.Key, x => new RepairCount
{
Repair = new RepairViewModel()
{
Id = x.Value.Item1.Id,
RepairName = x.Value.Item1.RepairName,
RepairComponents = x.Value.Item1.RepairComponents,
Price = x.Value.Item1.Price,
},
Count = x.Value.Item2
})
};
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения магазина");
throw;
}
}
[HttpPost]
public void CreateShop(ShopBindingModel Model)
{
try
{
_shopLogic.Create(Model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания магазина");
throw;
}
}
[HttpPost]
public void UpdateShop(ShopBindingModel Model)
{
try
{
_shopLogic.Update(Model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка обновления магазина");
throw;
}
}
[HttpPost]
public void DeleteShop(ShopBindingModel Model)
{
try
{
_shopLogic.Delete(Model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка удаления магазина");
throw;
}
}
[HttpPost]
public void MakeSupply(SupplyBindingModel Model)
{
try
{
_shopLogic.MakeSupply(Model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания поставки в магазин");
throw;
}
}
}
}

View File

@ -15,11 +15,15 @@ Builder.Services.AddTransient<IOrderStorage, OrderStorage>();
Builder.Services.AddTransient<IRepairStorage, RepairStorage>();
Builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
Builder.Services.AddTransient<IShopStorage, ShopStorage>();
Builder.Services.AddTransient<IOrderLogic, OrderLogic>();
Builder.Services.AddTransient<IClientLogic, ClientLogic>();
Builder.Services.AddTransient<IRepairLogic, RepairLogic>();
Builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
Builder.Services.AddTransient<IShopLogic, ShopLogic>();
Builder.Services.AddControllers();
Builder.Services.AddEndpointsApiExplorer();

View File

@ -0,0 +1,60 @@
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
namespace AutoWorkshopShopApp
{
public class ApiClient
{
private static readonly HttpClient _client = new();
public static string? Password { get; set; }
public static bool IsAuthenticated { get; private set; } = false;
public static bool TryAuthenticate(string Password)
{
if (Password == ApiClient.Password)
{
IsAuthenticated = true;
}
return IsAuthenticated;
}
public static void Connect(IConfiguration Configuration)
{
Password = Configuration["Password"];
_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);
}
}
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AutoWorkshopContracts\AutoWorkshopContracts.csproj" />
<ProjectReference Include="..\AutoWorkshopDataModels\AutoWorkshopDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,175 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopShopApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
namespace AutoWorkshopShopApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> Logger)
{
_logger = Logger;
}
public IActionResult Index()
{
if (!ApiClient.IsAuthenticated)
{
return Redirect("~/Home/Enter");
}
return View(ApiClient.GetRequest<List<ShopViewModel>>("api/shop/getshoplist"));
}
[HttpGet]
public IActionResult Enter()
{
return View();
}
[HttpPost]
public void Enter(string Password)
{
if (string.IsNullOrEmpty(Password))
{
throw new Exception("Введите пароль");
}
if (!ApiClient.TryAuthenticate(Password))
{
throw new Exception("Неверный пароль");
}
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Create()
{
if (!ApiClient.IsAuthenticated)
{
return Redirect("~/Home/Enter");
}
return View("Shop");
}
[HttpPost]
public void Create(int Id, string ShopName, string Address, DateTime OpeningDate, int MaxCount)
{
if (!ApiClient.IsAuthenticated)
{
throw new Exception("Вход только авторизованным");
}
if (string.IsNullOrEmpty(ShopName) || string.IsNullOrEmpty(Address))
{
throw new Exception("Название или адрес не может быть пустым");
}
if (MaxCount <= 0)
{
throw new Exception("Вместимость магазина должна быть больше нуля");
}
ApiClient.PostRequest("api/shop/createshop", new ShopBindingModel
{
Id = Id,
ShopName = ShopName,
Address = Address,
OpeningDate = OpeningDate,
RepairsMaxCount = MaxCount
});
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Update(int Id)
{
if (!ApiClient.IsAuthenticated)
{
return Redirect("~/Home/Enter");
}
return View("Shop", ApiClient.GetRequest<ShopRepairsViewModel>($"api/shop/getshop?shopId={Id}"));
}
[HttpPost]
public void Update(int Id, string ShopName, string Address, DateTime OpeningDate, int MaxCount)
{
if (!ApiClient.IsAuthenticated)
{
throw new Exception("Вход только авторизованным");
}
if (string.IsNullOrEmpty(ShopName) || string.IsNullOrEmpty(Address))
{
throw new Exception("Название или адрес не может быть пустым");
}
if (MaxCount <= 0)
{
throw new Exception("Вместимость магазина должна быть больше нуля");
}
ApiClient.PostRequest("api/shop/updateshop", new ShopBindingModel
{
Id = Id,
ShopName = ShopName,
Address = Address,
OpeningDate = OpeningDate,
RepairsMaxCount = MaxCount
});
Response.Redirect("Index");
}
[HttpPost]
public void Delete(int Id)
{
if (!ApiClient.IsAuthenticated)
{
throw new Exception("Вход только авторизованным");
}
ApiClient.PostRequest("api/shop/deleteshop", new ShopBindingModel
{
Id = Id,
});
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Supply()
{
if (!ApiClient.IsAuthenticated)
{
return Redirect("~/Home/Enter");
}
ViewBag.Shops = ApiClient.GetRequest<List<ShopViewModel>>("api/shop/getshoplist");
ViewBag.Repairs = ApiClient.GetRequest<List<RepairViewModel>>("api/main/getrepairlist");
return View();
}
[HttpPost]
public void Supply(int Shop, int Repair, int Count)
{
if (!ApiClient.IsAuthenticated)
{
throw new Exception("Вход только авторизованным");
}
ApiClient.PostRequest("api/shop/makesupply", new SupplyBindingModel
{
ShopId = Shop,
RepairId = Repair,
Count = Count
});
Response.Redirect("Index");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@ -0,0 +1,9 @@
namespace AutoWorkshopShopApp.Models
{
public class ErrorViewModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

View File

@ -0,0 +1,30 @@
using AutoWorkshopShopApp;
var Builder = WebApplication.CreateBuilder(args);
// Add services to the container.
Builder.Services.AddControllersWithViews();
var App = Builder.Build();
ApiClient.Connect(Builder.Configuration);
// Configure the HTTP request pipeline.
if (!App.Environment.IsDevelopment())
{
App.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
App.UseHsts();
}
App.UseHttpsRedirection();
App.UseStaticFiles();
App.UseRouting();
App.UseAuthorization();
App.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
App.Run();

View File

@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:23243",
"sslPort": 44379
}
},
"profiles": {
"AutoWorkshopShopApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7068;http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,15 @@
@{
ViewData["Title"] = "Enter";
}
<div class="text-center">
<h2 class="display-4">Вход в систему</h2>
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Пароль</label>
<input class="form-control" type="password" name="password">
</div>
<input type="submit" value="Вход" class="btn btn-primary" />
</form>

View File

@ -0,0 +1,68 @@
@using AutoWorkshopContracts.ViewModels
@model List<ShopViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Магазины</h1>
</div>
<div class="text-center ">
<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.ShopName)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.Address)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.OpeningDate)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.RepairsMaxCount)
</td>
<td>
<a class="btn btn-primary" asp-action="Update" asp-route-Id="@(Item.Id)" role="button">Изменить</a>
</td>
</tr>
}
</tbody>
</table>
</div>

View File

@ -0,0 +1,75 @@
@using AutoWorkshopDataModels.Models;
@using AutoWorkshopContracts.ViewModels;
@model ShopRepairsViewModel
@{
ViewData["Title"] = "Shop";
}
<div class="text-center">
@{
if (Model == null)
{
<h2 class="display-4">Создание магазина</h2>
}
else
{
<h2 class="display-4">Изменение магазина</h2>
}
}
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Название</label>
<input type="text" class="form-control" name="shopname" id="shopname" value="@(Model==null ? "" : Model.Shop?.ShopName)" />
</div>
<div class="mb-3">
<label class="form-label">Адрес</label>
<input type="text" class="form-control" name="address" id="address" value="@(Model==null ? "" : Model.Shop?.Address)" />
</div>
<div class="mb-3">
<label for="startDate">Дата открытия</label>
<input class="form-control" type="date" name="openingdate" id="openingdate" value="@(Model==null ? "" : Model.Shop?.OpeningDate.ToString("yyyy-MM-dd"))" />
</div>
<div class="mb-3">
<label class="form-label">Вместимость</label>
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="maxcount" id="maxcount" value="@(Model==null ? "" : Model.Shop?.RepairsMaxCount)" />
</div>
<div class="mb-3 ">
<input class="btn btn-primary" type="submit" value="Сохранить">
@{
if (Model != null && Model.Shop != null)
{
<input class="btn btn-danger" asp-action="Delete" type="submit" value="Удалить" asp-route-Id="@(Model==null ? 0 : Model.Shop.Id.ToString())">
}
}
</div>
</form>
@{
if (Model != null && Model.Shop != null)
{
<div>
<h6>Содержимое магазина</h6>
</div>
<table class="table">
<thead>
<tr>
<th>Название</th>
<th>Количество</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.ShopRepairs)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Value.Repair.RepairName)</td>
<td>@Html.DisplayFor(modelItem => item.Value.Count)</td>
</tr>
}
</tbody>
</table>
}
}

View File

@ -0,0 +1,22 @@
@{
ViewData["Title"] = "Supply";
}
<div class="text-center">
<h2 class="display-4">Создание поставки</h2>
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Магазин</label>
<select class="form-select form-select-lg" id="shop" name="shop" asp-items="@(new SelectList(@ViewBag.Shops,"Id", "ShopName"))"></select>
</div>
<div class="mb-3">
<label class="form-label">Ремонт</label>
<select class="form-select form-select-lg" id="repair" name="repair" asp-items="@(new SelectList(@ViewBag.Repairs,"Id", "RepairName"))"></select>
</div>
<div class="mb-3">
<label class="form-label">Количество</label>
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="count" id="count">
</div>
<input class="btn btn-success" type="submit" value="Создать поставку">
<a class="btn btn-primary" href="./Index" role="button">Отмена</a>
</form>

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,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - AutoWorkshopShopApp</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="~/AutoWorkshopShopApp.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">AutoWorkshopShopsApi</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="Index">Главная</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Supply">Поставка</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 - AutoWorkshop - <a asp-area="" asp-controller="Home" asp-action="Index">Главная</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,49 @@
/* 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 AutoWorkshopShopApp
@using AutoWorkshopShopApp.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

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

View File

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

View File

@ -0,0 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"IPAddress": "http://localhost:5224/",
"Password": "admin"
}

View File

@ -0,0 +1,18 @@
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,4 @@
// 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.
// Write your JavaScript code.

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 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

File diff suppressed because it is too large Load Diff

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