From 17c1521e2aa03d83d235b1546ff2921fa32cca8a Mon Sep 17 00:00:00 2001 From: "a.puchkina" Date: Mon, 28 Oct 2024 20:45:12 +0400 Subject: [PATCH] =?UTF-8?q?=D1=8B=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DatabaseImplement/LibraryDatabase.cs | 2 +- .../FormLibrary.Designer.cs | 56 ++++++++++---- .../LibraryAccountingApp_lab3/FormLibrary.cs | 2 +- .../FormLibrary.resx | 6 ++ .../20241015201338_InitialCreate.Designer.cs | 75 ------------------- .../Migrations/20241028091634_imageFix.cs | 34 --------- ... 20241028163659_InitialCreate.Designer.cs} | 4 +- ...ate.cs => 20241028163659_InitialCreate.cs} | 2 +- 8 files changed, 54 insertions(+), 127 deletions(-) delete mode 100644 COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.Designer.cs delete mode 100644 COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.cs rename COP_5/LibraryAccountingApp_lab3/Migrations/{20241028091634_imageFix.Designer.cs => 20241028163659_InitialCreate.Designer.cs} (96%) rename COP_5/LibraryAccountingApp_lab3/Migrations/{20241015201338_InitialCreate.cs => 20241028163659_InitialCreate.cs} (95%) diff --git a/COP_5/LibraryAccountingApp_lab3/DatabaseImplement/LibraryDatabase.cs b/COP_5/LibraryAccountingApp_lab3/DatabaseImplement/LibraryDatabase.cs index ba5593d..d8c0f25 100644 --- a/COP_5/LibraryAccountingApp_lab3/DatabaseImplement/LibraryDatabase.cs +++ b/COP_5/LibraryAccountingApp_lab3/DatabaseImplement/LibraryDatabase.cs @@ -9,7 +9,7 @@ namespace LibraryAccountingApp_lab3.DatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LibraryAppCOP;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LibraryAppCOP3;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); //optionsBuilder.UseNpgsql("Host=localhost;Database=LibraryAppCOP;Username=postgres;Password=postgres"); } base.OnConfiguring(optionsBuilder); diff --git a/COP_5/LibraryAccountingApp_lab3/FormLibrary.Designer.cs b/COP_5/LibraryAccountingApp_lab3/FormLibrary.Designer.cs index b1d6739..6017f48 100644 --- a/COP_5/LibraryAccountingApp_lab3/FormLibrary.Designer.cs +++ b/COP_5/LibraryAccountingApp_lab3/FormLibrary.Designer.cs @@ -29,9 +29,9 @@ private void InitializeComponent() { components = new System.ComponentModel.Container(); - componentDocumentWithChartBarWord1 = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord(components); buttonChooseImage = new Button(); groupBox1 = new GroupBox(); + buttonBookDelete = new Button(); buttonAddAuthor = new Button(); textBoxTitle = new TextBox(); buttonBookAdd = new Button(); @@ -43,9 +43,14 @@ label1 = new Label(); groupBox2 = new GroupBox(); controlDataTableCellBooks = new ControlsLibraryNet60.Data.ControlDataTableCell(); - buttonBookDelete = new Button(); + pdfForImages1 = new COP_5.PdfForImages(components); + componentDocumentWithChartBarWord1 = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord(components); + tableComponent1 = new FedComponentLib.NonVisualComponents.TableComponent(components); + buttonPdfCreate = new Button(); + groupBox3 = new GroupBox(); groupBox1.SuspendLayout(); groupBox2.SuspendLayout(); + groupBox3.SuspendLayout(); SuspendLayout(); // // buttonChooseImage @@ -81,6 +86,18 @@ groupBox1.TabStop = false; groupBox1.Text = "Загрузка книги"; // + // buttonBookDelete + // + buttonBookDelete.Anchor = AnchorStyles.None; + buttonBookDelete.BackColor = Color.LightCoral; + buttonBookDelete.Location = new Point(18, 405); + buttonBookDelete.Name = "buttonBookDelete"; + buttonBookDelete.Size = new Size(231, 36); + buttonBookDelete.TabIndex = 26; + buttonBookDelete.Text = "Удалить книгу"; + buttonBookDelete.UseVisualStyleBackColor = false; + buttonBookDelete.Click += buttonBookDelete_Click; + // // buttonAddAuthor // buttonAddAuthor.Anchor = AnchorStyles.None; @@ -195,23 +212,31 @@ controlDataTableCellBooks.Size = new Size(517, 261); controlDataTableCellBooks.TabIndex = 0; // - // buttonBookDelete + // buttonPdfCreate // - buttonBookDelete.Anchor = AnchorStyles.None; - buttonBookDelete.BackColor = Color.LightCoral; - buttonBookDelete.Location = new Point(18, 405); - buttonBookDelete.Name = "buttonBookDelete"; - buttonBookDelete.Size = new Size(231, 36); - buttonBookDelete.TabIndex = 26; - buttonBookDelete.Text = "Удалить книгу"; - buttonBookDelete.UseVisualStyleBackColor = false; - buttonBookDelete.Click += buttonBookDelete_Click; + buttonPdfCreate.Location = new Point(46, 32); + buttonPdfCreate.Name = "buttonPdfCreate"; + buttonPdfCreate.Size = new Size(114, 48); + buttonPdfCreate.TabIndex = 20; + buttonPdfCreate.Text = "Создать PDF с обложками"; + buttonPdfCreate.UseVisualStyleBackColor = true; + // + // groupBox3 + // + groupBox3.Controls.Add(buttonPdfCreate); + groupBox3.Location = new Point(291, 304); + groupBox3.Name = "groupBox3"; + groupBox3.Size = new Size(524, 173); + groupBox3.TabIndex = 21; + groupBox3.TabStop = false; + groupBox3.Text = "Формирование отчётов"; // // FormLibrary // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(821, 489); + Controls.Add(groupBox3); Controls.Add(groupBox2); Controls.Add(groupBox1); Name = "FormLibrary"; @@ -221,11 +246,11 @@ groupBox1.PerformLayout(); groupBox2.ResumeLayout(false); groupBox2.PerformLayout(); + groupBox3.ResumeLayout(false); ResumeLayout(false); } #endregion - private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord componentDocumentWithChartBarWord1; private Button buttonChooseImage; private GroupBox groupBox1; private FedComponentLib.DateTextBox dateTextBoxDate; @@ -240,5 +265,10 @@ private ControlsLibraryNet60.Data.ControlDataTableCell controlDataTableCellBooks; private Button buttonAddAuthor; private Button buttonBookDelete; + private COP_5.PdfForImages pdfForImages1; + private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord componentDocumentWithChartBarWord1; + private FedComponentLib.NonVisualComponents.TableComponent tableComponent1; + private Button buttonPdfCreate; + private GroupBox groupBox3; } } \ No newline at end of file diff --git a/COP_5/LibraryAccountingApp_lab3/FormLibrary.cs b/COP_5/LibraryAccountingApp_lab3/FormLibrary.cs index ea80c51..74ef6bc 100644 --- a/COP_5/LibraryAccountingApp_lab3/FormLibrary.cs +++ b/COP_5/LibraryAccountingApp_lab3/FormLibrary.cs @@ -167,7 +167,7 @@ namespace LibraryAccountingApp_lab3 Title = textBoxTitle.Text, Author = controlSelectedComboBoxSingleAuthor.SelectedElement, Date = dateTextBoxDate.TextBoxValue, - Image = textBoxImage.Text, + Image = selectedImage.ToString(), }); LoadDataInTable(); MessageBox.Show(" ", "", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/COP_5/LibraryAccountingApp_lab3/FormLibrary.resx b/COP_5/LibraryAccountingApp_lab3/FormLibrary.resx index bfd1b63..792bbe9 100644 --- a/COP_5/LibraryAccountingApp_lab3/FormLibrary.resx +++ b/COP_5/LibraryAccountingApp_lab3/FormLibrary.resx @@ -117,7 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 295, 17 + 17, 17 + + 428, 17 + \ No newline at end of file diff --git a/COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.Designer.cs b/COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.Designer.cs deleted file mode 100644 index 420697d..0000000 --- a/COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.Designer.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -using LibraryAccountingApp_lab3.DatabaseImplement; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace LibraryAccountingApp_lab3.Migrations -{ - [DbContext(typeof(LibraryDatabase))] - [Migration("20241015201338_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.18") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("LibraryAccountingApp_lab3.DatabaseImplement.Models.Author", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("LibraryAccountingApp_lab3.DatabaseImplement.Models.Book", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Author") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .IsRequired() - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Books"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.cs b/COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.cs deleted file mode 100644 index 3738aee..0000000 --- a/COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LibraryAccountingApp_lab3.Migrations -{ - /// - public partial class imageFix : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Image", - table: "Books", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(byte[]), - oldType: "varbinary(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Image", - table: "Books", - type: "varbinary(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - } -} diff --git a/COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.Designer.cs b/COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.Designer.cs similarity index 96% rename from COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.Designer.cs rename to COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.Designer.cs index f1b6a58..3928152 100644 --- a/COP_5/LibraryAccountingApp_lab3/Migrations/20241028091634_imageFix.Designer.cs +++ b/COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.Designer.cs @@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace LibraryAccountingApp_lab3.Migrations { [DbContext(typeof(LibraryDatabase))] - [Migration("20241028091634_imageFix")] - partial class imageFix + [Migration("20241028163659_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.cs b/COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.cs similarity index 95% rename from COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.cs rename to COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.cs index 04a7fda..0041958 100644 --- a/COP_5/LibraryAccountingApp_lab3/Migrations/20241015201338_InitialCreate.cs +++ b/COP_5/LibraryAccountingApp_lab3/Migrations/20241028163659_InitialCreate.cs @@ -32,7 +32,7 @@ namespace LibraryAccountingApp_lab3.Migrations Title = table.Column(type: "nvarchar(max)", nullable: false), Author = table.Column(type: "nvarchar(max)", nullable: false), Date = table.Column(type: "nvarchar(max)", nullable: false), - Image = table.Column(type: "varbinary(max)", nullable: false) + Image = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => {