была ошибка с бд, все пофиксил, можно сдавать

This commit is contained in:
Алексей Крюков 2024-04-22 08:50:09 +04:00
parent abe16f404d
commit f9ea8d3810
13 changed files with 128 additions and 23 deletions

View File

@ -21,7 +21,7 @@ namespace TypographyContracts.ViewModels
[DisplayName("ФИО Клиента")]
public string ClientFIO { get; set; } = string.Empty;
public int? ImplementerId { get; set; }
[DisplayName("Implementer's FIO")]
[DisplayName("ФИО работника")]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }

View File

@ -2,7 +2,6 @@ using Microsoft.OpenApi.Models;
using TypographyBusinessLogic.BusinessLogics;
using TypographyContracts.BusinessLogicsContracts;
using TypographyContracts.StoragesContracts;
using TypographyDatabaseImplement.Implements;
using TypographyDatabaseImplements.Implements;
var builder = WebApplication.CreateBuilder(args);

View File

@ -3,9 +3,8 @@ using TypographyContracts.SearchModels;
using TypographyContracts.StoragesContracts;
using TypographyContracts.ViewModels;
using TypographyDatabaseImplement.Models;
using TypographyDatabaseImplements;
namespace TypographyDatabaseImplement.Implements
namespace TypographyDatabaseImplements.Implements
{
public class ComponentStorage : IComponentStorage
{

View File

@ -4,9 +4,8 @@ using TypographyContracts.StoragesContracts;
using TypographyContracts.ViewModels;
using TypographyDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using TypographyDatabaseImplements;
namespace TypographyDatabaseImplement.Implements
namespace TypographyDatabaseImplements.Implements
{
public class OrderStorage : IOrderStorage
{

View File

@ -4,10 +4,9 @@ using TypographyContracts.StoragesContracts;
using TypographyContracts.ViewModels;
using TypographyDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using TypographyDatabaseImplements;
using TypographyDatabaseImplements.Models;
namespace TypographyDatabaseImplement.Implements
namespace TypographyDatabaseImplements.Implements
{
public class PrintedStorage : IPrintedStorage
{

View File

@ -12,7 +12,7 @@ using TypographyDatabaseImplements;
namespace TypographyDatabaseImplements.Migrations
{
[DbContext(typeof(TypographyDatabase))]
[Migration("20240407171630_InitialCreate")]
[Migration("20240422043507_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -65,6 +65,9 @@ namespace TypographyDatabaseImplements.Migrations
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("PrintedId")
.HasColumnType("int");
@ -78,6 +81,8 @@ namespace TypographyDatabaseImplements.Migrations
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("PrintedId");
b.ToTable("Orders");
@ -108,6 +113,33 @@ namespace TypographyDatabaseImplements.Migrations
b.ToTable("Clients");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Printed", b =>
{
b.Property<int>("Id")
@ -162,6 +194,10 @@ namespace TypographyDatabaseImplements.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TypographyDatabaseImplements.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("TypographyDatabaseImplements.Models.Printed", "Printed")
.WithMany("Orders")
.HasForeignKey("PrintedId")
@ -170,6 +206,8 @@ namespace TypographyDatabaseImplements.Migrations
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Printed");
});
@ -202,6 +240,11 @@ namespace TypographyDatabaseImplements.Migrations
b.Navigation("Orders");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Printed", b =>
{
b.Navigation("Components");

View File

@ -40,6 +40,22 @@ namespace TypographyDatabaseImplements.Migrations
table.PrimaryKey("PK_Components", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Implementers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
WorkExperience = table.Column<int>(type: "int", nullable: false),
Qualification = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Implementers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Printeds",
columns: table => new
@ -62,6 +78,7 @@ namespace TypographyDatabaseImplements.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
PrintedId = table.Column<int>(type: "int", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: false),
ImplementerId = table.Column<int>(type: "int", nullable: true),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
@ -77,6 +94,11 @@ namespace TypographyDatabaseImplements.Migrations
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
column: x => x.ImplementerId,
principalTable: "Implementers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Orders_Printeds_PrintedId",
column: x => x.PrintedId,
@ -117,6 +139,11 @@ namespace TypographyDatabaseImplements.Migrations
table: "Orders",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ImplementerId",
table: "Orders",
column: "ImplementerId");
migrationBuilder.CreateIndex(
name: "IX_Orders_PrintedId",
table: "Orders",
@ -145,6 +172,9 @@ namespace TypographyDatabaseImplements.Migrations
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Implementers");
migrationBuilder.DropTable(
name: "Components");

View File

@ -62,6 +62,9 @@ namespace TypographyDatabaseImplements.Migrations
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("PrintedId")
.HasColumnType("int");
@ -75,6 +78,8 @@ namespace TypographyDatabaseImplements.Migrations
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("PrintedId");
b.ToTable("Orders");
@ -105,6 +110,33 @@ namespace TypographyDatabaseImplements.Migrations
b.ToTable("Clients");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Printed", b =>
{
b.Property<int>("Id")
@ -159,6 +191,10 @@ namespace TypographyDatabaseImplements.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TypographyDatabaseImplements.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("TypographyDatabaseImplements.Models.Printed", "Printed")
.WithMany("Orders")
.HasForeignKey("PrintedId")
@ -167,6 +203,8 @@ namespace TypographyDatabaseImplements.Migrations
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Printed");
});
@ -199,6 +237,11 @@ namespace TypographyDatabaseImplements.Migrations
b.Navigation("Orders");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("TypographyDatabaseImplements.Models.Printed", b =>
{
b.Navigation("Components");

View File

@ -32,8 +32,8 @@ namespace TypographyDatabaseImplement.Models
public DateTime? DateImplement { get; set; }
public virtual Printed Printed { get; set; }
public virtual Client Client { get; set; }
public virtual Printed? Printed { get; set; }
public virtual Client? Client { get; set; }
public Implementer? Implementer { get; private set; }
public static Order? Create(OrderBindingModel? model)
@ -78,8 +78,8 @@ namespace TypographyDatabaseImplement.Models
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement,
PrintedName = Printed.PrintedName ?? string.Empty,
ClientFIO = Client.ClientFIO ?? string.Empty,
PrintedName = Printed?.PrintedName ?? string.Empty,
ClientFIO = Client?.ClientFIO ?? string.Empty,
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
};
}

View File

@ -16,7 +16,7 @@ namespace TypographyDatabaseImplements
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source = .\SQLEXPRESS;
Initial Catalog=TypographyDatabaseFullBase;
Initial Catalog=TypographyDatabaseFullBaseNew;
Integrated Security=True;MultipleActiveResultSets=True;;
TrustServerCertificate=True");
}

View File

@ -20,8 +20,4 @@
<ProjectReference Include="..\TypographyDataModels\TypographyDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@ -162,9 +162,7 @@
private Button buttonCancel;
private Button buttonSave;
private TextBox textBoxCost;
private TextBox textBoxFIO;
private Label labelCost;
private Label labelFIO;
private TextBox textBoxPassword;
private NumericUpDown numericUpDownQualification;

View File

@ -1,14 +1,13 @@
using TypographyBusinessLogic.BusinessLogics;
using TypographyContracts.BusinessLogicsContracts;
using TypographyContracts.StoragesContracts;
using TypographyDatabaseImplement.Implements;
using TypographyDatabaseImplements.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using TypographyBusinessLogic.OfficePackage.Implements;
using TypographyBusinessLogic.OfficePackage;
using AbstractShopView;
using TypographyDatabaseImplements.Implements;
namespace TypographyView
@ -41,7 +40,7 @@ namespace TypographyView
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IPrintedStorage, PrintedStorage>();
services.AddTransient<IClientStorage, TypographyDatabaseImplements.Implements.ClientStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();