Compare commits

...

9 Commits

Author SHA1 Message Date
bekodeg
7f1d42b0a6 добавил отчёт в пдф 2024-05-29 16:45:44 +04:00
bekodeg
1314116c20 незнаю 2024-05-29 16:11:57 +04:00
bekodeg
320dc8439c + 2024-05-29 16:11:45 +04:00
bekodeg
735283b20c исправил текст в домене 2024-05-29 16:05:56 +04:00
8aefc24b6a слишком синее неб0.. 2024-05-29 15:47:18 +04:00
598049b063 уладили конфликты 2024-05-29 15:43:40 +04:00
ddf2ad1002 сайты работают 2024-05-29 10:28:14 +04:00
0837497835 бд на компе; рест работает, клиентов надо настроить 2024-05-28 22:41:22 +04:00
0b911e13f9 настраиваю веб 2024-05-28 20:21:49 +04:00
158 changed files with 149961 additions and 848 deletions

View File

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

View File

@ -0,0 +1,156 @@
using ComputerHardwareContracts.OfficePackage.HelperModels;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml.EMMA;
using MigraDoc.Rendering;
namespace ComputerHardwareContracts.OfficePackage
{
public abstract class AbstractSaveToPdf
{
public void GetPurchaseReportFile(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title,
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"за период с {info.DateFrom.ToShortDateString()} " +
$"по {info.DateTo.ToShortDateString()}",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "3cm", "4cm", "3cm", "4cm", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Покупка", "Дата покупки", "Цена", "Комментарии", "Комплектующие" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var record in info.ReportPurchases)
{
List<string> comments = record.Comments;
List<string> components = record.Components;
int recordHeight = Math.Max(comments.Count + 1, components.Count + 1);
for (int i = 0; i < recordHeight; i++)
{
List<string> cellsData = new() { "", "", "", "", "" };
if (i == 0)
{
cellsData[0] = record.Id.ToString();
cellsData[1] = record.PurchaseDate.ToShortDateString();
cellsData[2] = record.PurchaseSum.ToString("0.00") + " р.";
CreateRow(new PdfRowParameters
{
Texts = cellsData,
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
continue;
}
int k = i - 1;
if (k < comments.Count)
{
cellsData[3] = comments[k];
}
if (k < components.Count)
{
cellsData[4] = components[k];
}
CreateRow(new PdfRowParameters
{
Texts = cellsData,
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
}
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.ReportPurchases.Sum(x => x.PurchaseSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left });
SavePdf(info);
}
public void CreateComponentsReport(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "5cm", "5cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Комплектующее", "Товар/Сборка", "Количество" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var record in info.ReportComponents)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { record.ComponentName, "", "" },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
foreach (var goodOrBuild in record.GoodOrBuilds)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "", goodOrBuild.Item1, goodOrBuild.Item2.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Итого", "", record.TotalCount.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
SavePdf(info);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreatePdf(PdfInfo info);
/// <summary>
/// Создание параграфа с текстом
/// </summary>
/// <param name="title"></param>
/// <param name="style"></param>
protected abstract void CreateParagraph(PdfParagraph paragraph);
/// <summary>
/// Создание таблицы
/// </summary>
/// <param name="title"></param>
/// <param name="style"></param>
protected abstract void CreateTable(List<string> columns);
/// <summary>
/// Создание и заполнение строки
/// </summary>
/// <param name="rowParameters"></param>
protected abstract void CreateRow(PdfRowParameters rowParameters);
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="info"></param>
protected abstract void SavePdf(PdfInfo info);
}
}

View File

@ -0,0 +1,11 @@
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums
{
public enum PdfParagraphAlignmentType
{
Center,
Left,
Rigth
}
}

View File

@ -0,0 +1,19 @@
using ComputerHardwareContracts.ViewModels;
namespace ComputerHardwareContracts.OfficePackage.HelperModels
{
public class PdfInfo
{
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<ReportComponentsViewModel> ReportComponents { get; set; } = new();
public List<ReportPurchaseViewModel> ReportPurchases { get; set; } = new();
}
}

View File

@ -0,0 +1,13 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class PdfParagraph
{
public string Text { get; set; } = string.Empty;
public string Style { get; set; } = string.Empty;
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels
{
public class PdfRowParameters
{
public List<string> Texts { get; set; } = new();
public string Style { get; set; } = string.Empty;
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
}

View File

@ -0,0 +1,117 @@
using ComputerHardwareContracts.OfficePackage;
using ComputerHardwareContracts.OfficePackage.HelperModels;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperEnums;
using ComputerHardwareStoreBusinessLogic.OfficePackage.HelperModels;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
namespace ComputerHardwareStoreBusinessLogic.OfficePackage.Implements
{
public class SaveToPdf : AbstractSaveToPdf
{
private Document? _document;
private Section? _section;
private Table? _table;
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
{
return type switch
{
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
_ => ParagraphAlignment.Justify,
};
}
/// <summary>
/// Создание стилей для документа
/// </summary>
/// <param name="document"></param>
private static void DefineStyles(Document document)
{
var style = document.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Font.Size = 14;
style = document.Styles.AddStyle("NormalTitle", "Normal");
style.Font.Bold = true;
}
protected override void CreatePdf(PdfInfo info)
{
_document = new Document();
DefineStyles(_document);
_section = _document.AddSection();
}
protected override void CreateParagraph(PdfParagraph pdfParagraph)
{
if (_section == null)
{
return;
}
var paragraph = _section.AddParagraph(pdfParagraph.Text);
paragraph.Format.SpaceAfter = "1cm";
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
paragraph.Style = pdfParagraph.Style;
}
protected override void CreateTable(List<string> columns)
{
if (_document == null)
{
return;
}
_table = _document.LastSection.AddTable();
foreach (var elem in columns)
{
_table.AddColumn(elem);
}
}
protected override void CreateRow(PdfRowParameters rowParameters)
{
if (_table == null)
{
return;
}
var row = _table.AddRow();
for (int i = 0; i < rowParameters.Texts.Count; ++i)
{
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
if (!string.IsNullOrEmpty(rowParameters.Style))
{
row.Cells[i].Style = rowParameters.Style;
}
Unit borderWidth = 0.5;
row.Cells[i].Borders.Left.Width = borderWidth;
row.Cells[i].Borders.Right.Width = borderWidth;
row.Cells[i].Borders.Top.Width = borderWidth;
row.Cells[i].Borders.Bottom.Width = borderWidth;
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
}
}
protected override void SavePdf(PdfInfo info)
{
var renderer = new PdfDocumentRenderer(true)
{
Document = _document
};
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
renderer.RenderDocument();
renderer.PdfDocument.Save(info.FileName);
}
}
}

View File

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

View File

@ -0,0 +1,11 @@
namespace ComputerHardwareContracts.ViewModels
{
public class ReportComponentsViewModel
{
public string ComponentName { get; set; } = string.Empty;
public int TotalCount { get; set; }
public List<Tuple<string, int>> GoodOrBuilds { get; set; } = new();
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
{
{
"Logging": {
"LogLevel": {
"Default": "Information",

View File

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

View File

@ -5,12 +5,10 @@ using System.Text;
namespace StoreKeeperClient
{
public class APIClient
public static class APIClient
{
private static readonly HttpClient _client = new();
public static StoreKeeperViewModel? StoreKeeper { get; set; } = null;
public static StoreKeeperViewModel? Client { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);

View File

@ -2,10 +2,11 @@
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using StoreKeeperClient.Models;
using ComputerHardwareStoreContracts.BindingModels;
namespace StoreKeeperClient.Controllers
{
public class HomeController : Controller
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
@ -17,16 +18,49 @@ namespace StoreKeeperClient.Controllers
[HttpGet]
public IActionResult Index()
{
return View();
}
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/main/getpurchases?clientId={APIClient.Client.Id}"));
}
[HttpGet]
public IActionResult Privacy()
{
return View();
}
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Client);
}
[HttpGet]
[HttpPost]
public void Privacy(string login, string password, string fio)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/updatedata", new StoreKeeperBindingModel
{
Id = APIClient.Client.Id,
Name = fio,
Login = login,
Password = password
});
APIClient.Client.Name = fio;
APIClient.Client.Login = login;
APIClient.Client.Password = password;
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Enter()
{
return View();
@ -35,108 +69,173 @@ namespace StoreKeeperClient.Controllers
[HttpGet]
public IActionResult Register()
{
return View();
}
[HttpGet]
public IActionResult AddBuildToPurchase()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult Builds()
{
return View(new List<BuildViewModel>());
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<BuildViewModel>());
}
[HttpGet]
public IActionResult BuildCreate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult BuildDelete()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult BuildUpdate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult CommentCreate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult CommentDelete()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult CommentUpdate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult Comments()
{
return View(new List<CommentViewModel>());
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<CommentViewModel>());
}
[HttpGet]
public IActionResult ProductsList()
{
return View(new List<BuildViewModel>());
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<BuildViewModel>());
}
[HttpGet]
public IActionResult PurchaseCreate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult PurchaseDelete()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult Purchases()
{
return View(new List<PurchaseViewModel>());
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<PurchaseViewModel>());
}
[HttpGet]
public IActionResult PurchaseUpdate()
{
return View();
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View();
}
[HttpGet]
public IActionResult Report()
{
return View(new List<PurchaseViewModel>());
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
return View(new List<PurchaseViewModel>());
}
[HttpPost]
public void Report(string password)
{
Response.Redirect("ReportOnly");
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
Response.Redirect("ReportOnly");
}
public IActionResult Mails()
{
if (APIClient.StoreKeeper == null)
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

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

View File

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

View File

@ -1,5 +1,2 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<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

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

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

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,12 @@
Copyright (c) .NET Foundation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
these files except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

View File

@ -0,0 +1,432 @@
// Unobtrusive validation support library for jQuery and jQuery Validate
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// @version v3.2.11
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports
module.exports = factory(require('jquery-validation'));
} else {
// Browser global
jQuery.validator.unobtrusive = factory(jQuery);
}
}(function ($) {
var $jQval = $.validator,
adapters,
data_validation = "unobtrusiveValidation";
function setValidationValues(options, ruleName, value) {
options.rules[ruleName] = value;
if (options.message) {
options.messages[ruleName] = options.message;
}
}
function splitAndTrim(value) {
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
}
function escapeAttributeValue(value) {
// As mentioned on http://api.jquery.com/category/selectors/
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
}
function getModelPrefix(fieldName) {
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
}
function appendModelPrefix(value, prefix) {
if (value.indexOf("*.") === 0) {
value = value.replace("*.", prefix);
}
return value;
}
function onError(error, inputElement) { // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
if (replace) {
container.empty();
error.removeClass("input-validation-error").appendTo(container);
}
else {
error.hide();
}
}
function onErrors(event, validator) { // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
if (list && list.length && validator.errorList.length) {
list.empty();
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
$.each(validator.errorList, function () {
$("<li />").html(this.message).appendTo(list);
});
}
}
function onSuccess(error) { // 'this' is the form element
var container = error.data("unobtrusiveContainer");
if (container) {
var replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
if (replace) {
container.empty();
}
}
}
function onReset(event) { // 'this' is the form element
var $form = $(this),
key = '__jquery_unobtrusive_validation_form_reset';
if ($form.data(key)) {
return;
}
// Set a flag that indicates we're currently resetting the form.
$form.data(key, true);
try {
$form.data("validator").resetForm();
} finally {
$form.removeData(key);
}
$form.find(".validation-summary-errors")
.addClass("validation-summary-valid")
.removeClass("validation-summary-errors");
$form.find(".field-validation-error")
.addClass("field-validation-valid")
.removeClass("field-validation-error")
.removeData("unobtrusiveContainer")
.find(">*") // If we were using valmsg-replace, get the underlying error
.removeData("unobtrusiveContainer");
}
function validationInfo(form) {
var $form = $(form),
result = $form.data(data_validation),
onResetProxy = $.proxy(onReset, form),
defaultOptions = $jQval.unobtrusive.options || {},
execInContext = function (name, args) {
var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args);
};
if (!result) {
result = {
options: { // options structure passed to jQuery Validate's validate() method
errorClass: defaultOptions.errorClass || "input-validation-error",
errorElement: defaultOptions.errorElement || "span",
errorPlacement: function () {
onError.apply(form, arguments);
execInContext("errorPlacement", arguments);
},
invalidHandler: function () {
onErrors.apply(form, arguments);
execInContext("invalidHandler", arguments);
},
messages: {},
rules: {},
success: function () {
onSuccess.apply(form, arguments);
execInContext("success", arguments);
}
},
attachValidation: function () {
$form
.off("reset." + data_validation, onResetProxy)
.on("reset." + data_validation, onResetProxy)
.validate(this.options);
},
validate: function () { // a validation function that is called by unobtrusive Ajax
$form.validate();
return $form.valid();
}
};
$form.data(data_validation, result);
}
return result;
}
$jQval.unobtrusive = {
adapters: [],
parseElement: function (element, skipAttach) {
/// <summary>
/// Parses a single HTML element for unobtrusive validation attributes.
/// </summary>
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
/// validation to the form. If parsing just this single element, you should specify true.
/// If parsing several elements, you should specify false, and manually attach the validation
/// to the form when you are finished. The default is false.</param>
var $element = $(element),
form = $element.parents("form")[0],
valInfo, rules, messages;
if (!form) { // Cannot do client-side validation without a form
return;
}
valInfo = validationInfo(form);
valInfo.options.rules[element.name] = rules = {};
valInfo.options.messages[element.name] = messages = {};
$.each(this.adapters, function () {
var prefix = "data-val-" + this.name,
message = $element.attr(prefix),
paramValues = {};
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
prefix += "-";
$.each(this.params, function () {
paramValues[this] = $element.attr(prefix + this);
});
this.adapt({
element: element,
form: form,
message: message,
params: paramValues,
rules: rules,
messages: messages
});
}
});
$.extend(rules, { "__dummy__": true });
if (!skipAttach) {
valInfo.attachValidation();
}
},
parse: function (selector) {
/// <summary>
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
/// attribute values.
/// </summary>
/// <param name="selector" type="String">Any valid jQuery selector.</param>
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
// element with data-val=true
var $selector = $(selector),
$forms = $selector.parents()
.addBack()
.filter("form")
.add($selector.find("form"))
.has("[data-val=true]");
$selector.find("[data-val=true]").each(function () {
$jQval.unobtrusive.parseElement(this, true);
});
$forms.each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
}
});
}
};
adapters = $jQval.unobtrusive.adapters;
adapters.add = function (adapterName, params, fn) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
/// mmmm is the parameter name).</param>
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
/// attributes into jQuery Validate rules and/or messages.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
if (!fn) { // Called with no params, just a function
fn = params;
params = [];
}
this.push({ name: adapterName, params: params, adapt: fn });
return this;
};
adapters.addBool = function (adapterName, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has no parameter values.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, function (options) {
setValidationValues(options, ruleName || adapterName, true);
});
};
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a minimum value.</param>
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
/// have a maximum value.</param>
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
/// have both a minimum and maximum value.</param>
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the minimum value. The default is "min".</param>
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
/// contains the maximum value. The default is "max".</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
var min = options.params.min,
max = options.params.max;
if (min && max) {
setValidationValues(options, minMaxRuleName, [min, max]);
}
else if (min) {
setValidationValues(options, minRuleName, min);
}
else if (max) {
setValidationValues(options, maxRuleName, max);
}
});
};
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
/// the jQuery Validate validation rule has a single value.</summary>
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
/// The default is "val".</param>
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
/// of adapterName will be used instead.</param>
/// <returns type="jQuery.validator.unobtrusive.adapters" />
return this.add(adapterName, [attribute || "val"], function (options) {
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
});
};
$jQval.addMethod("__dummy__", function (value, element, params) {
return true;
});
$jQval.addMethod("regex", function (value, element, params) {
var match;
if (this.optional(element)) {
return true;
}
match = new RegExp(params).exec(value);
return (match && (match.index === 0) && (match[0].length === value.length));
});
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
var match;
if (nonalphamin) {
match = value.match(/\W/g);
match = match && match.length >= nonalphamin;
}
return match;
});
if ($jQval.methods.extension) {
adapters.addSingleVal("accept", "mimtype");
adapters.addSingleVal("extension", "extension");
} else {
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
// validating the extension, and ignore mime-type validations as they are not supported.
adapters.addSingleVal("extension", "extension", "accept");
}
adapters.addSingleVal("regex", "pattern");
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
adapters.add("equalto", ["other"], function (options) {
var prefix = getModelPrefix(options.element.name),
other = options.params.other,
fullOtherName = appendModelPrefix(other, prefix),
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
setValidationValues(options, "equalTo", element);
});
adapters.add("required", function (options) {
// jQuery Validate equates "required" with "mandatory" for checkbox elements
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
setValidationValues(options, "required", true);
}
});
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
var value = {
url: options.params.url,
type: options.params.type || "GET",
data: {}
},
prefix = getModelPrefix(options.element.name);
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
var paramName = appendModelPrefix(fieldName, prefix);
value.data[paramName] = function () {
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
// For checkboxes and radio buttons, only pick up values from checked fields.
if (field.is(":checkbox")) {
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
}
else if (field.is(":radio")) {
return field.filter(":checked").val() || '';
}
return field.val();
};
});
setValidationValues(options, "remote", value);
});
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
if (options.params.min) {
setValidationValues(options, "minlength", options.params.min);
}
if (options.params.nonalphamin) {
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
}
if (options.params.regex) {
setValidationValues(options, "regex", options.params.regex);
}
});
adapters.add("fileextensions", ["extensions"], function (options) {
setValidationValues(options, "extension", options.params.extensions);
});
$(function () {
$jQval.unobtrusive.parse(document);
});
return $jQval.unobtrusive;
}));

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
=====================
Copyright Jörn Zaefferer
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 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

View File

@ -0,0 +1,36 @@
Copyright JS Foundation and other contributors, https://js.foundation/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery
The following license applies to all parts of this software except as
documented below:
====
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.
====
All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.

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

View File

@ -1,23 +1,26 @@
using VendorClient;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddControllersWithViews();
var app = builder.Build();
APIClient.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllers();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

View File

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

View File

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

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - AutomobilePlantClientApp</title>
<title>@ViewData["Title"] - Тыж Программист</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
<script src="~/lib/jquery/dist/jquery.min.js"></script>

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