From c7d8071340c889eb61925b9dd1b2e1ee14143634 Mon Sep 17 00:00:00 2001 From: Salikh Date: Thu, 4 Apr 2024 12:35:33 +0400 Subject: [PATCH] fourth commit --- .../BusinessLogic/ReportLogic.cs | 2 +- .../OfficePackage/AbstractSaveToPdf.cs | 11 +- .../20240403125759_InitMigration.Designer.cs | 171 ------------------ .../20240403125759_InitMigration.cs | 126 ------------- .../MotorPlantDatabaseModelSnapshot.cs | 168 ----------------- MotorPlant/MotorPlantView/FormReportOrders.cs | 2 +- MotorPlant/MotorPlantView/ReportOrders.rdlc | 4 +- 7 files changed, 11 insertions(+), 473 deletions(-) delete mode 100644 MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.Designer.cs delete mode 100644 MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.cs delete mode 100644 MotorPlant/MotorPlantDatabaseImplement/Migrations/MotorPlantDatabaseModelSnapshot.cs diff --git a/MotorPlant/MotorPlantBusinessLogic/BusinessLogic/ReportLogic.cs b/MotorPlant/MotorPlantBusinessLogic/BusinessLogic/ReportLogic.cs index 3be637c..7f284bb 100644 --- a/MotorPlant/MotorPlantBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/MotorPlant/MotorPlantBusinessLogic/BusinessLogic/ReportLogic.cs @@ -92,7 +92,7 @@ namespace MotorPlantBusinessLogic.BusinessLogic _saveToExcel.CreateReport(new ExcelInfo { FileName = model.FileName, - Title = "Список мороженого", + Title = "Список двигателей", EngineComponents = GetEngineComponents() }); } diff --git a/MotorPlant/MotorPlantBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/MotorPlant/MotorPlantBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 7c3060c..b746823 100644 --- a/MotorPlant/MotorPlantBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/MotorPlant/MotorPlantBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -34,14 +34,17 @@ namespace MotorPlantBusinessLogic.OfficePackage { CreateRow(new PdfRowParameters { - Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.EngineName, - order.OrderStatus, order.Sum.ToString() }, + Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.EngineName, order.Sum.ToString(), order.OrderStatus }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } - CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right }); - + CreateParagraph(new PdfParagraph + { + Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Right + }); SavePdf(info); } diff --git a/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.Designer.cs b/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.Designer.cs deleted file mode 100644 index 681748f..0000000 --- a/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.Designer.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MotorPlantDatabaseImplement; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MotorPlantDatabaseImplement.Migrations -{ - [DbContext(typeof(MotorPlantDatabase))] - [Migration("20240403125759_InitMigration")] - partial class InitMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Component", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Cost") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Components"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Engine", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EngineName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Price") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Engines"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.EngineComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("integer"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("EngineId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("EngineId"); - - b.ToTable("EngineComponents"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("DateCreate") - .HasColumnType("timestamp without time zone"); - - b.Property("DateImplement") - .HasColumnType("timestamp without time zone"); - - b.Property("EngineId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Sum") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("EngineId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.EngineComponent", b => - { - b.HasOne("MotorPlantDatabaseImplement.Models.Component", "Component") - .WithMany("EngineComponents") - .HasForeignKey("ComponentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MotorPlantDatabaseImplement.Models.Engine", "Engine") - .WithMany("Components") - .HasForeignKey("EngineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Component"); - - b.Navigation("Engine"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Order", b => - { - b.HasOne("MotorPlantDatabaseImplement.Models.Engine", "Engine") - .WithMany("Orders") - .HasForeignKey("EngineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Engine"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Component", b => - { - b.Navigation("EngineComponents"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Engine", b => - { - b.Navigation("Components"); - - b.Navigation("Orders"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.cs b/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.cs deleted file mode 100644 index 53bde97..0000000 --- a/MotorPlant/MotorPlantDatabaseImplement/Migrations/20240403125759_InitMigration.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MotorPlantDatabaseImplement.Migrations -{ - /// - public partial class InitMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Components", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ComponentName = table.Column(type: "text", nullable: false), - Cost = table.Column(type: "double precision", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Components", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Engines", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EngineName = table.Column(type: "text", nullable: false), - Price = table.Column(type: "double precision", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Engines", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "EngineComponents", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EngineId = table.Column(type: "integer", nullable: false), - ComponentId = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_EngineComponents", x => x.Id); - table.ForeignKey( - name: "FK_EngineComponents_Components_ComponentId", - column: x => x.ComponentId, - principalTable: "Components", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_EngineComponents_Engines_EngineId", - column: x => x.EngineId, - principalTable: "Engines", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Orders", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EngineId = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false), - Sum = table.Column(type: "double precision", nullable: false), - Status = table.Column(type: "integer", nullable: false), - DateCreate = table.Column(type: "timestamp without time zone", nullable: false), - DateImplement = table.Column(type: "timestamp without time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Orders", x => x.Id); - table.ForeignKey( - name: "FK_Orders_Engines_EngineId", - column: x => x.EngineId, - principalTable: "Engines", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_EngineComponents_ComponentId", - table: "EngineComponents", - column: "ComponentId"); - - migrationBuilder.CreateIndex( - name: "IX_EngineComponents_EngineId", - table: "EngineComponents", - column: "EngineId"); - - migrationBuilder.CreateIndex( - name: "IX_Orders_EngineId", - table: "Orders", - column: "EngineId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "EngineComponents"); - - migrationBuilder.DropTable( - name: "Orders"); - - migrationBuilder.DropTable( - name: "Components"); - - migrationBuilder.DropTable( - name: "Engines"); - } - } -} diff --git a/MotorPlant/MotorPlantDatabaseImplement/Migrations/MotorPlantDatabaseModelSnapshot.cs b/MotorPlant/MotorPlantDatabaseImplement/Migrations/MotorPlantDatabaseModelSnapshot.cs deleted file mode 100644 index 8e0807e..0000000 --- a/MotorPlant/MotorPlantDatabaseImplement/Migrations/MotorPlantDatabaseModelSnapshot.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MotorPlantDatabaseImplement; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MotorPlantDatabaseImplement.Migrations -{ - [DbContext(typeof(MotorPlantDatabase))] - partial class MotorPlantDatabaseModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Component", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Cost") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Components"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Engine", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EngineName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Price") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Engines"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.EngineComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("integer"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("EngineId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("EngineId"); - - b.ToTable("EngineComponents"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("DateCreate") - .HasColumnType("timestamp without time zone"); - - b.Property("DateImplement") - .HasColumnType("timestamp without time zone"); - - b.Property("EngineId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Sum") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("EngineId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.EngineComponent", b => - { - b.HasOne("MotorPlantDatabaseImplement.Models.Component", "Component") - .WithMany("EngineComponents") - .HasForeignKey("ComponentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MotorPlantDatabaseImplement.Models.Engine", "Engine") - .WithMany("Components") - .HasForeignKey("EngineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Component"); - - b.Navigation("Engine"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Order", b => - { - b.HasOne("MotorPlantDatabaseImplement.Models.Engine", "Engine") - .WithMany("Orders") - .HasForeignKey("EngineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Engine"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Component", b => - { - b.Navigation("EngineComponents"); - }); - - modelBuilder.Entity("MotorPlantDatabaseImplement.Models.Engine", b => - { - b.Navigation("Components"); - - b.Navigation("Orders"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MotorPlant/MotorPlantView/FormReportOrders.cs b/MotorPlant/MotorPlantView/FormReportOrders.cs index fe73e79..de0a81b 100644 --- a/MotorPlant/MotorPlantView/FormReportOrders.cs +++ b/MotorPlant/MotorPlantView/FormReportOrders.cs @@ -23,7 +23,7 @@ namespace MotorPlantView { Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); + reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\salih\\OneDrive\\Рабочий стол\\MotorPlant\\MotorPlant\\MotorPlantView\\ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); Controls.Add(panel); diff --git a/MotorPlant/MotorPlantView/ReportOrders.rdlc b/MotorPlant/MotorPlantView/ReportOrders.rdlc index 4eae60b..7c7dcb7 100644 --- a/MotorPlant/MotorPlantView/ReportOrders.rdlc +++ b/MotorPlant/MotorPlantView/ReportOrders.rdlc @@ -40,8 +40,8 @@ MorotPlantContracts.ViewModels - ReportOrderViewModel - MorotPlantContracts.ViewModels.ReportOrderViewModel, MorotPlantContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + ReportOrdersViewModel + MorotPlantContracts.ViewModels.ReportOrdersViewModel, MorotPlantContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null