¯\_( ͡° ͜ʖ ͡°)_/¯
This commit is contained in:
parent
c210524830
commit
b364827c33
@ -26,21 +26,56 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "2cm", "6cm", "4cm", "6cm" });
|
||||
//ТУТ КОСТЫЛЬ КАК взять номер заказа, в info его нема
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Text = new List<string> {$"Заказ номер: Костыль " },
|
||||
Style = "NormalTittle",
|
||||
alignmentType = PdfParagraphAlignmentType.Center,
|
||||
});
|
||||
int StringsEnum = 0;
|
||||
|
||||
CreateRow(new PdfRowParameters {
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Text = new List<string> { "Номер", "Товар", "Цена", "Статья затрат" },
|
||||
Style = "NormalTittle",
|
||||
alignmentType = PdfParagraphAlignmentType.Center,
|
||||
});
|
||||
|
||||
foreach (var products in info.Products) {
|
||||
CreateRow(new PdfRowParameters {
|
||||
foreach (var products in info.Products)
|
||||
{
|
||||
if (products.ID == 1 && StringsEnum != 0)
|
||||
{
|
||||
// Криво считает сумму
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.Products.Sum(x => x.Price)}\t",
|
||||
Style = "Normal",
|
||||
alignmentType = PdfParagraphAlignmentType.Right
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "2cm", "6cm", "4cm", "6cm" });
|
||||
//ТУТ КОСТЫЛЬ КАК взять номер заказа, в info его нема
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Text = new List<string> { $"Заказ номер: Костыль " },
|
||||
Style = "NormalTittle",
|
||||
alignmentType = PdfParagraphAlignmentType.Center,
|
||||
});
|
||||
}
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Text = new List<string> { products.ID.ToString(), products.ProductName.ToString(), products.Price.ToString(),
|
||||
products.CostItemName.ToString()},
|
||||
Style = "Normal",
|
||||
alignmentType = PdfParagraphAlignmentType.Left,
|
||||
|
||||
});
|
||||
StringsEnum++;
|
||||
|
||||
}
|
||||
// Криво считает сумму
|
||||
CreateParagraph(new PdfParagraph {
|
||||
Text = $"Итого: {info.Products.Sum(x => x.Price)}\t",
|
||||
Style = "Normal",
|
||||
|
@ -6,13 +6,13 @@ namespace ElectronicsShopDataBaseImplement
|
||||
{
|
||||
public class Database : DbContext
|
||||
{
|
||||
//DESKTOP-E2VPEN3
|
||||
//WIN-S7AOPVO8GAA
|
||||
//WIN-4HUIDGH3G02
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder
|
||||
optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false) {
|
||||
optionsBuilder.UseSqlServer(@"Data Source=WIN-4HUIDGH3G02\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=WIN-S7AOPVO8GAA\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
288
ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727090854_Init.Designer.cs
generated
Normal file
288
ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727090854_Init.Designer.cs
generated
Normal file
@ -0,0 +1,288 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ElectronicsShopDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20240727090854_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("CostNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("EmployeeID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EmployeeID");
|
||||
|
||||
b.ToTable("CostItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<string>("EmployeeFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Employees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("ClientID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ClientID");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OrderID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProductID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderID");
|
||||
|
||||
b.HasIndex("ProductID");
|
||||
|
||||
b.ToTable("OrderProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("ClientID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DatePaymeant")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("OrderID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PayOption")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("PaymentID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("SumPayment")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("PaymentID");
|
||||
|
||||
b.ToTable("Paymeants");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("CostItemID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CostItemID");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
||||
{
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
||||
.WithMany()
|
||||
.HasForeignKey("EmployeeID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Employee");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("OrderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("_order");
|
||||
|
||||
b.Navigation("_product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
||||
{
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
|
||||
.WithMany("Payments")
|
||||
.HasForeignKey("PaymentID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
||||
.WithMany()
|
||||
.HasForeignKey("CostItemID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CostItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Payments");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,215 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Employees",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Employees", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Clients_ClientID",
|
||||
column: x => x.ClientID,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CostItems",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false),
|
||||
CostNum = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CostItems", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_CostItems_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Paymeants",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OrderID = table.Column<int>(type: "int", nullable: false),
|
||||
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||
SumPayment = table.Column<double>(type: "float", nullable: false),
|
||||
PayOption = table.Column<int>(type: "int", nullable: false),
|
||||
DatePaymeant = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
PaymentID = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Paymeants", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Paymeants_Orders_PaymentID",
|
||||
column: x => x.PaymentID,
|
||||
principalTable: "Orders",
|
||||
principalColumn: "ID");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false),
|
||||
CostItemID = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Products", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Products_CostItems_CostItemID",
|
||||
column: x => x.CostItemID,
|
||||
principalTable: "CostItems",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OrderProducts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OrderID = table.Column<int>(type: "int", nullable: false),
|
||||
ProductID = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", 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_CostItems_EmployeeID",
|
||||
table: "CostItems",
|
||||
column: "EmployeeID");
|
||||
|
||||
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_ClientID",
|
||||
table: "Orders",
|
||||
column: "ClientID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Paymeants_PaymentID",
|
||||
table: "Paymeants",
|
||||
column: "PaymentID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_CostItemID",
|
||||
table: "Products",
|
||||
column: "CostItemID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "OrderProducts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Paymeants");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CostItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Employees");
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user