This commit is contained in:
a.puchkina 2024-10-28 20:45:12 +04:00
parent 30b3ef6a2d
commit 17c1521e2a
8 changed files with 54 additions and 127 deletions

View File

@ -9,7 +9,7 @@ namespace LibraryAccountingApp_lab3.DatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) 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"); //optionsBuilder.UseNpgsql("Host=localhost;Database=LibraryAppCOP;Username=postgres;Password=postgres");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);

View File

@ -29,9 +29,9 @@
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
componentDocumentWithChartBarWord1 = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord(components);
buttonChooseImage = new Button(); buttonChooseImage = new Button();
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
buttonBookDelete = new Button();
buttonAddAuthor = new Button(); buttonAddAuthor = new Button();
textBoxTitle = new TextBox(); textBoxTitle = new TextBox();
buttonBookAdd = new Button(); buttonBookAdd = new Button();
@ -43,9 +43,14 @@
label1 = new Label(); label1 = new Label();
groupBox2 = new GroupBox(); groupBox2 = new GroupBox();
controlDataTableCellBooks = new ControlsLibraryNet60.Data.ControlDataTableCell(); 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(); groupBox1.SuspendLayout();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
groupBox3.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// buttonChooseImage // buttonChooseImage
@ -81,6 +86,18 @@
groupBox1.TabStop = false; groupBox1.TabStop = false;
groupBox1.Text = "Загрузка книги"; 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
// //
buttonAddAuthor.Anchor = AnchorStyles.None; buttonAddAuthor.Anchor = AnchorStyles.None;
@ -195,23 +212,31 @@
controlDataTableCellBooks.Size = new Size(517, 261); controlDataTableCellBooks.Size = new Size(517, 261);
controlDataTableCellBooks.TabIndex = 0; controlDataTableCellBooks.TabIndex = 0;
// //
// buttonBookDelete // buttonPdfCreate
// //
buttonBookDelete.Anchor = AnchorStyles.None; buttonPdfCreate.Location = new Point(46, 32);
buttonBookDelete.BackColor = Color.LightCoral; buttonPdfCreate.Name = "buttonPdfCreate";
buttonBookDelete.Location = new Point(18, 405); buttonPdfCreate.Size = new Size(114, 48);
buttonBookDelete.Name = "buttonBookDelete"; buttonPdfCreate.TabIndex = 20;
buttonBookDelete.Size = new Size(231, 36); buttonPdfCreate.Text = "Создать PDF с обложками";
buttonBookDelete.TabIndex = 26; buttonPdfCreate.UseVisualStyleBackColor = true;
buttonBookDelete.Text = "Удалить книгу"; //
buttonBookDelete.UseVisualStyleBackColor = false; // groupBox3
buttonBookDelete.Click += buttonBookDelete_Click; //
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 // FormLibrary
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(821, 489); ClientSize = new Size(821, 489);
Controls.Add(groupBox3);
Controls.Add(groupBox2); Controls.Add(groupBox2);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Name = "FormLibrary"; Name = "FormLibrary";
@ -221,11 +246,11 @@
groupBox1.PerformLayout(); groupBox1.PerformLayout();
groupBox2.ResumeLayout(false); groupBox2.ResumeLayout(false);
groupBox2.PerformLayout(); groupBox2.PerformLayout();
groupBox3.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord componentDocumentWithChartBarWord1;
private Button buttonChooseImage; private Button buttonChooseImage;
private GroupBox groupBox1; private GroupBox groupBox1;
private FedComponentLib.DateTextBox dateTextBoxDate; private FedComponentLib.DateTextBox dateTextBoxDate;
@ -240,5 +265,10 @@
private ControlsLibraryNet60.Data.ControlDataTableCell controlDataTableCellBooks; private ControlsLibraryNet60.Data.ControlDataTableCell controlDataTableCellBooks;
private Button buttonAddAuthor; private Button buttonAddAuthor;
private Button buttonBookDelete; private Button buttonBookDelete;
private COP_5.PdfForImages pdfForImages1;
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarWord componentDocumentWithChartBarWord1;
private FedComponentLib.NonVisualComponents.TableComponent tableComponent1;
private Button buttonPdfCreate;
private GroupBox groupBox3;
} }
} }

View File

@ -167,7 +167,7 @@ namespace LibraryAccountingApp_lab3
Title = textBoxTitle.Text, Title = textBoxTitle.Text,
Author = controlSelectedComboBoxSingleAuthor.SelectedElement, Author = controlSelectedComboBoxSingleAuthor.SelectedElement,
Date = dateTextBoxDate.TextBoxValue, Date = dateTextBoxDate.TextBoxValue,
Image = textBoxImage.Text, Image = selectedImage.ToString(),
}); });
LoadDataInTable(); LoadDataInTable();
MessageBox.Show("Ñîõðàíåíèå ïðîøëî óñïåøíî", "Ñîîáùåíèå", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Ñîõðàíåíèå ïðîøëî óñïåøíî", "Ñîîáùåíèå", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@ -117,7 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="pdfForImages1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>295, 17</value>
</metadata>
<metadata name="componentDocumentWithChartBarWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="componentDocumentWithChartBarWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="tableComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>428, 17</value>
</metadata>
</root> </root>

View File

@ -1,75 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("LibraryAccountingApp_lab3.DatabaseImplement.Models.Book", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Author")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Date")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Image")
.IsRequired()
.HasColumnType("varbinary(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Books");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LibraryAccountingApp_lab3.Migrations
{
/// <inheritdoc />
public partial class imageFix : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Image",
table: "Books",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(byte[]),
oldType: "varbinary(max)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<byte[]>(
name: "Image",
table: "Books",
type: "varbinary(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
}
}

View File

@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace LibraryAccountingApp_lab3.Migrations namespace LibraryAccountingApp_lab3.Migrations
{ {
[DbContext(typeof(LibraryDatabase))] [DbContext(typeof(LibraryDatabase))]
[Migration("20241028091634_imageFix")] [Migration("20241028163659_InitialCreate")]
partial class imageFix partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -32,7 +32,7 @@ namespace LibraryAccountingApp_lab3.Migrations
Title = table.Column<string>(type: "nvarchar(max)", nullable: false), Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Author = table.Column<string>(type: "nvarchar(max)", nullable: false), Author = table.Column<string>(type: "nvarchar(max)", nullable: false),
Date = table.Column<string>(type: "nvarchar(max)", nullable: false), Date = table.Column<string>(type: "nvarchar(max)", nullable: false),
Image = table.Column<byte[]>(type: "varbinary(max)", nullable: false) Image = table.Column<string>(type: "nvarchar(max)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {