опять формочки ломаются :(

This commit is contained in:
Полина Чубыкина 2024-05-21 23:58:37 +04:00
parent c1c4991315
commit bb8ce8010d
24 changed files with 2065 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using System;
using BookshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace BookshopContracts.ViewModels
{
public class PublisherViewModel
public class PublisherViewModel : IPublisherModel
{
public int Id { get; set; }
[DisplayName("Название издательства")]

View File

@ -44,6 +44,7 @@
this.ButtonUpd.TabIndex = 14;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonDel
//
@ -53,6 +54,7 @@
this.ButtonDel.TabIndex = 13;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonRef
//
@ -62,6 +64,7 @@
this.ButtonRef.TabIndex = 12;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// ButtonAdd
//
@ -71,6 +74,7 @@
this.ButtonAdd.TabIndex = 11;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridView
//
@ -94,6 +98,7 @@
this.Controls.Add(this.dataGridView);
this.Name = "FormAuthors";
this.Text = "Авторы";
this.Load += new System.EventHandler(this.FormAuthors_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);

236
Bookshop/BookshopView/FormBook.Designer.cs generated Normal file
View File

@ -0,0 +1,236 @@
namespace BookshopView
{
partial class FormBook
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.labelPrice = new System.Windows.Forms.Label();
this.labelName = new System.Windows.Forms.Label();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.groupBox = new System.Windows.Forms.GroupBox();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxName = new System.Windows.Forms.TextBox();
this.Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Author = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Genre = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Publisher = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// labelPrice
//
this.labelPrice.AutoSize = true;
this.labelPrice.Location = new System.Drawing.Point(109, 83);
this.labelPrice.Name = "labelPrice";
this.labelPrice.Size = new System.Drawing.Size(97, 20);
this.labelPrice.TabIndex = 17;
this.labelPrice.Text = "Год выпуска:";
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(109, 35);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(80, 20);
this.labelName.TabIndex = 16;
this.labelName.Text = "Название:";
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(262, 475);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
this.ButtonSave.TabIndex = 14;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(460, 475);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
this.ButtonCancel.TabIndex = 15;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
//
// groupBox
//
this.groupBox.Controls.Add(this.ButtonRef);
this.groupBox.Controls.Add(this.ButtonDel);
this.groupBox.Controls.Add(this.ButtonUpd);
this.groupBox.Controls.Add(this.ButtonAdd);
this.groupBox.Controls.Add(this.dataGridView);
this.groupBox.Location = new System.Drawing.Point(39, 125);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(619, 329);
this.groupBox.TabIndex = 13;
this.groupBox.TabStop = false;
this.groupBox.Text = "Компоненты";
//
// ButtonRef
//
this.ButtonRef.Location = new System.Drawing.Point(477, 251);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(94, 29);
this.ButtonRef.TabIndex = 6;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
//
// ButtonDel
//
this.ButtonDel.Location = new System.Drawing.Point(477, 184);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(94, 29);
this.ButtonDel.TabIndex = 5;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
//
// ButtonUpd
//
this.ButtonUpd.Location = new System.Drawing.Point(477, 118);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(94, 29);
this.ButtonUpd.TabIndex = 4;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
//
// ButtonAdd
//
this.ButtonAdd.Location = new System.Drawing.Point(477, 53);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(94, 29);
this.ButtonAdd.TabIndex = 3;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Number,
this.Author,
this.Genre,
this.Publisher});
this.dataGridView.Location = new System.Drawing.Point(6, 26);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(430, 297);
this.dataGridView.TabIndex = 2;
//
// textBoxPrice
//
this.textBoxPrice.Enabled = false;
this.textBoxPrice.Location = new System.Drawing.Point(231, 80);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.Size = new System.Drawing.Size(125, 27);
this.textBoxPrice.TabIndex = 12;
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(231, 32);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(223, 27);
this.textBoxName.TabIndex = 11;
//
// Number
//
this.Number.HeaderText = "Номер";
this.Number.MinimumWidth = 6;
this.Number.Name = "Number";
this.Number.Visible = false;
this.Number.Width = 125;
//
// Author
//
this.Author.HeaderText = "Автор";
this.Author.MinimumWidth = 6;
this.Author.Name = "Author";
this.Author.Width = 125;
//
// Genre
//
this.Genre.HeaderText = "Жанр";
this.Genre.MinimumWidth = 6;
this.Genre.Name = "Genre";
this.Genre.Width = 125;
//
// Publisher
//
this.Publisher.HeaderText = "Издательство";
this.Publisher.MinimumWidth = 6;
this.Publisher.Name = "Publisher";
this.Publisher.Width = 125;
//
// FormBook
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(711, 531);
this.Controls.Add(this.labelPrice);
this.Controls.Add(this.labelName);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.textBoxPrice);
this.Controls.Add(this.textBoxName);
this.Name = "FormBook";
this.Text = "FormBook";
this.groupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label labelPrice;
private Label labelName;
private Button ButtonSave;
private Button ButtonCancel;
private GroupBox groupBox;
private Button ButtonRef;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
private DataGridView dataGridView;
private DataGridViewTextBoxColumn Number;
private DataGridViewTextBoxColumn Author;
private DataGridViewTextBoxColumn Genre;
private DataGridViewTextBoxColumn Publisher;
private TextBox textBoxPrice;
private TextBox textBoxName;
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormBook : Form
{
public FormBook()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,72 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Author.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Genre.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Publisher.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,141 @@
namespace BookshopView
{
partial class FormBookCreate
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.comboBoxAuthor = new System.Windows.Forms.ComboBox();
this.labelComponent = new System.Windows.Forms.Label();
this.ButtonCancel = new System.Windows.Forms.Button();
this.ButtonSave = new System.Windows.Forms.Button();
this.comboBoxGenre = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxPublisher = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// comboBoxAuthor
//
this.comboBoxAuthor.FormattingEnabled = true;
this.comboBoxAuthor.Location = new System.Drawing.Point(167, 26);
this.comboBoxAuthor.Name = "comboBoxAuthor";
this.comboBoxAuthor.Size = new System.Drawing.Size(151, 28);
this.comboBoxAuthor.TabIndex = 5;
//
// labelComponent
//
this.labelComponent.AutoSize = true;
this.labelComponent.Location = new System.Drawing.Point(41, 29);
this.labelComponent.Name = "labelComponent";
this.labelComponent.Size = new System.Drawing.Size(54, 20);
this.labelComponent.TabIndex = 4;
this.labelComponent.Text = "Автор:";
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(213, 188);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
this.ButtonCancel.TabIndex = 7;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(31, 188);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
this.ButtonSave.TabIndex = 6;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
//
// comboBoxGenre
//
this.comboBoxGenre.FormattingEnabled = true;
this.comboBoxGenre.Location = new System.Drawing.Point(167, 77);
this.comboBoxGenre.Name = "comboBoxGenre";
this.comboBoxGenre.Size = new System.Drawing.Size(151, 28);
this.comboBoxGenre.TabIndex = 9;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(41, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 20);
this.label1.TabIndex = 8;
this.label1.Text = "Жанр:";
//
// comboBoxPublisher
//
this.comboBoxPublisher.FormattingEnabled = true;
this.comboBoxPublisher.Location = new System.Drawing.Point(167, 132);
this.comboBoxPublisher.Name = "comboBoxPublisher";
this.comboBoxPublisher.Size = new System.Drawing.Size(151, 28);
this.comboBoxPublisher.TabIndex = 11;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(41, 135);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(106, 20);
this.label2.TabIndex = 10;
this.label2.Text = "Издательство:";
//
// FormBookCreate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(354, 244);
this.Controls.Add(this.comboBoxPublisher);
this.Controls.Add(this.label2);
this.Controls.Add(this.comboBoxGenre);
this.Controls.Add(this.label1);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.comboBoxAuthor);
this.Controls.Add(this.labelComponent);
this.Name = "FormBookCreate";
this.Text = "FormBookCreate";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private ComboBox comboBoxAuthor;
private Label labelComponent;
private Button ButtonCancel;
private Button ButtonSave;
private ComboBox comboBoxGenre;
private Label label1;
private ComboBox comboBoxPublisher;
private Label label2;
}
}

View File

@ -0,0 +1,135 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BookshopContracts.BusinessLogicsContracts;
using BookshopContracts.ViewModels;
using BookshopDataModels.Models;
namespace BookshopView
{
public partial class FormBookCreate : Form
{
private readonly List<AuthorViewModel>? _listA;
private readonly List<GenreViewModel>? _listG;
//private readonly List<PublisherViewModel>? _listP;
public int IdA
{
get
{
return Convert.ToInt32(comboBoxAuthor.SelectedValue);
}
set
{
comboBoxAuthor.SelectedValue = value;
}
}
public int IdG
{
get
{
return Convert.ToInt32(comboBoxGenre.SelectedValue);
}
set
{
comboBoxGenre.SelectedValue = value;
}
}
//public int IdP
//{
// get
// {
// return Convert.ToInt32(comboBoxPublisher.SelectedValue);
// }
// set
// {
// comboBoxPublisher.SelectedValue = value;
// }
//}
public IAuthorModel? AuthorModel
{
get
{
if (_listA == null)
{
return null;
}
foreach (var elem in _listA)
{
if (elem.Id == IdA)
{
return elem;
}
}
return null;
}
}
public IGenreModel? GenreModel
{
get
{
if (_listG == null)
{
return null;
}
foreach (var elem in _listG)
{
if (elem.Id == IdG)
{
return elem;
}
}
return null;
}
}
//public IPublisherModel? PublisherModel
//{
// get
// {
// if (_listP == null)
// {
// return null;
// }
// foreach (var elem in _listP)
// {
// if (elem.Id == IdP)
// {
// return elem;
// }
// }
// return null;
// }
//}
public FormBookCreate(IAuthorLogic logicA, IGenreLogic logicG)
{
InitializeComponent();
_listA = logicA.ReadList(null);
_listG = logicG.ReadList(null);
//_listP = logicP.ReadList(null);
if (_listA != null && _listG != null)
{
comboBoxAuthor.DisplayMember = "AuthorName";
comboBoxAuthor.ValueMember = "Id";
comboBoxAuthor.DataSource = _listA;
comboBoxAuthor.SelectedItem = null;
comboBoxGenre.DisplayMember = "GenreName";
comboBoxGenre.ValueMember = "Id";
comboBoxGenre.DataSource = _listG;
comboBoxGenre.SelectedItem = null;
//comboBoxPublisher.DisplayMember = "Publisher";
//comboBoxPublisher.ValueMember = "Id";
//comboBoxPublisher.DataSource = _listP;
//comboBoxPublisher.SelectedItem = null;
}
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,110 @@
namespace BookshopView
{
partial class FormBooks
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// ButtonUpd
//
this.ButtonUpd.Location = new System.Drawing.Point(529, 94);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(111, 32);
this.ButtonUpd.TabIndex = 13;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
//
// ButtonDel
//
this.ButtonDel.Location = new System.Drawing.Point(529, 163);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(111, 32);
this.ButtonDel.TabIndex = 12;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
//
// ButtonRef
//
this.ButtonRef.Location = new System.Drawing.Point(529, 232);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(111, 32);
this.ButtonRef.TabIndex = 11;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
//
// ButtonAdd
//
this.ButtonAdd.Location = new System.Drawing.Point(529, 26);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(111, 32);
this.ButtonAdd.TabIndex = 10;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(11, 12);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(490, 426);
this.dataGridView.TabIndex = 9;
//
// FormBooks
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(651, 450);
this.Controls.Add(this.ButtonUpd);
this.Controls.Add(this.ButtonDel);
this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonAdd);
this.Controls.Add(this.dataGridView);
this.Name = "FormBooks";
this.Text = "FormBooks";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Button ButtonUpd;
private Button ButtonDel;
private Button ButtonRef;
private Button ButtonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormBooks : Form
{
public FormBooks()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,163 @@
namespace BookshopView
{
partial class FormPublisher
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxAddress = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.ButtonCancel = new System.Windows.Forms.Button();
this.ButtonSave = new System.Windows.Forms.Button();
this.textBoxName = new System.Windows.Forms.TextBox();
this.labelName = new System.Windows.Forms.Label();
this.textBoxPhone = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxEmail = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBoxAddress
//
this.textBoxAddress.Location = new System.Drawing.Point(229, 77);
this.textBoxAddress.Name = "textBoxAddress";
this.textBoxAddress.Size = new System.Drawing.Size(295, 27);
this.textBoxAddress.TabIndex = 29;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(149, 20);
this.label1.TabIndex = 28;
this.label1.Text = "Адрес издательства:";
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(310, 232);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
this.ButtonCancel.TabIndex = 27;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(113, 232);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
this.ButtonSave.TabIndex = 26;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(229, 30);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(295, 27);
this.textBoxName.TabIndex = 25;
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(20, 33);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(175, 20);
this.labelName.TabIndex = 24;
this.labelName.Text = "Название издательства:";
//
// textBoxPhone
//
this.textBoxPhone.Location = new System.Drawing.Point(229, 126);
this.textBoxPhone.Name = "textBoxPhone";
this.textBoxPhone.Size = new System.Drawing.Size(295, 27);
this.textBoxPhone.TabIndex = 31;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(20, 129);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(130, 20);
this.label2.TabIndex = 30;
this.label2.Text = "Номер телефона:";
//
// textBoxEmail
//
this.textBoxEmail.Location = new System.Drawing.Point(229, 176);
this.textBoxEmail.Name = "textBoxEmail";
this.textBoxEmail.Size = new System.Drawing.Size(295, 27);
this.textBoxEmail.TabIndex = 33;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(20, 179);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(146, 20);
this.label3.TabIndex = 32;
this.label3.Text = "Электронная почта:";
//
// FormPublisher
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(552, 291);
this.Controls.Add(this.textBoxEmail);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBoxPhone);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxAddress);
this.Controls.Add(this.label1);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.labelName);
this.Name = "FormPublisher";
this.Text = "FormPublisher";
this.Load += new System.EventHandler(this.FormPublisher_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private TextBox textBoxAddress;
private Label label1;
private Button ButtonCancel;
private Button ButtonSave;
private TextBox textBoxName;
private Label labelName;
private TextBox textBoxPhone;
private Label label2;
private TextBox textBoxEmail;
private Label label3;
}
}

View File

@ -0,0 +1,103 @@
using BookshopContracts.BindingModels;
using BookshopContracts.BusinessLogicsContracts;
using BookshopContracts.SearchModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormPublisher : Form
{
private readonly ILogger _logger;
private readonly IPublisherLogic _logic;
private int? _id;
public int Id { set { _id = value; } }
public FormPublisher(ILogger<FormPublisher> logger, IPublisherLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormPublisher_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
try
{
_logger.LogInformation("Получение компонента");
var view = _logic.ReadElement(new PublisherSearchModel
{
Id =
_id.Value
});
if (view != null)
{
textBoxName.Text = view.PublisherName;
textBoxAddress.Text = view.Address;
textBoxPhone.Text = view.PhoneNumber;
textBoxEmail.Text = view.Email;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения компонента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text))
{
MessageBox.Show("Заполните название", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Сохранение компонента");
try
{
var model = new PublisherBindingModel
{
Id = _id ?? 0,
PublisherName = textBoxName.Text,
Address = textBoxAddress.Text,
PhoneNumber = textBoxPhone.Text,
Email = textBoxEmail.Text
};
var operationResult = _id.HasValue ? _logic.Update(model) :
_logic.Create(model);
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения компонента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,115 @@
namespace BookshopView
{
partial class FormPublishers
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// ButtonUpd
//
this.ButtonUpd.Location = new System.Drawing.Point(528, 94);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(111, 32);
this.ButtonUpd.TabIndex = 24;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonDel
//
this.ButtonDel.Location = new System.Drawing.Point(528, 163);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(111, 32);
this.ButtonDel.TabIndex = 23;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonRef
//
this.ButtonRef.Location = new System.Drawing.Point(528, 232);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(111, 32);
this.ButtonRef.TabIndex = 22;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// ButtonAdd
//
this.ButtonAdd.Location = new System.Drawing.Point(528, 26);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(111, 32);
this.ButtonAdd.TabIndex = 21;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(6, 12);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(490, 426);
this.dataGridView.TabIndex = 20;
//
// FormPublishers
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(664, 450);
this.Controls.Add(this.ButtonUpd);
this.Controls.Add(this.ButtonDel);
this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonAdd);
this.Controls.Add(this.dataGridView);
this.Name = "FormPublishers";
this.Text = "FormPublishers";
this.Load += new System.EventHandler(this.FormPublishers_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Button ButtonUpd;
private Button ButtonDel;
private Button ButtonRef;
private Button ButtonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,120 @@
using BookshopContracts.BindingModels;
using BookshopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormPublishers : Form
{
private readonly ILogger _logger;
private readonly IPublisherLogic _logic;
public FormPublishers(ILogger<FormPublishers> logger, IPublisherLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormPublishers_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["PublisherName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["Address"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["PhoneNumber"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["Email"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка компонентов");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки компонентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPublisher));
if (service is FormPublisher form)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormPublisher));
if (service is FormPublisher form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление компонента");
try
{
if (!_logic.Delete(new PublisherBindingModel
{
Id = id
}))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка удаления компонента");
MessageBox.Show(ex.Message, "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

119
Bookshop/BookshopView/FormUser.Designer.cs generated Normal file
View File

@ -0,0 +1,119 @@
namespace BookshopView
{
partial class FormUser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxEmail = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.ButtonCancel = new System.Windows.Forms.Button();
this.ButtonSave = new System.Windows.Forms.Button();
this.textBoxName = new System.Windows.Forms.TextBox();
this.labelName = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBoxEmail
//
this.textBoxEmail.Location = new System.Drawing.Point(207, 84);
this.textBoxEmail.Name = "textBoxEmail";
this.textBoxEmail.Size = new System.Drawing.Size(295, 27);
this.textBoxEmail.TabIndex = 23;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(34, 87);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(146, 20);
this.label1.TabIndex = 22;
this.label1.Text = "Электронная почта:";
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(316, 139);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
this.ButtonCancel.TabIndex = 21;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(132, 139);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
this.ButtonSave.TabIndex = 20;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(207, 37);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(295, 27);
this.textBoxName.TabIndex = 19;
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(34, 40);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(142, 20);
this.labelName.TabIndex = 18;
this.labelName.Text = "Имя пользователя:";
//
// FormUser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(541, 205);
this.Controls.Add(this.textBoxEmail);
this.Controls.Add(this.label1);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.labelName);
this.Name = "FormUser";
this.Text = "Пользователь";
this.Load += new System.EventHandler(this.FormUser_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private TextBox textBoxEmail;
private Label label1;
private Button ButtonCancel;
private Button ButtonSave;
private TextBox textBoxName;
private Label labelName;
}
}

View File

@ -0,0 +1,99 @@
using BookshopContracts.BindingModels;
using BookshopContracts.BusinessLogicsContracts;
using BookshopContracts.SearchModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormUser : Form
{
private readonly ILogger _logger;
private readonly IUserLogic _logic;
private int? _id;
public int Id { set { _id = value; } }
public FormUser(ILogger<FormUser> logger, IUserLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormUser_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
try
{
_logger.LogInformation("Получение компонента");
var view = _logic.ReadElement(new UserSearchModel
{
Id =
_id.Value
});
if (view != null)
{
textBoxName.Text = view.Username;
textBoxEmail.Text = view.UserEmail;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения компонента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text))
{
MessageBox.Show("Заполните название", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Сохранение компонента");
try
{
var model = new UserBindingModel
{
Id = _id ?? 0,
Username = textBoxName.Text,
UserEmail = textBoxEmail.Text
};
var operationResult = _id.HasValue ? _logic.Update(model) :
_logic.Create(model);
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения компонента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,115 @@
namespace BookshopView
{
partial class FormUsers
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// ButtonUpd
//
this.ButtonUpd.Location = new System.Drawing.Point(550, 94);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(111, 32);
this.ButtonUpd.TabIndex = 19;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonDel
//
this.ButtonDel.Location = new System.Drawing.Point(550, 163);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(111, 32);
this.ButtonDel.TabIndex = 18;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonRef
//
this.ButtonRef.Location = new System.Drawing.Point(550, 232);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(111, 32);
this.ButtonRef.TabIndex = 17;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// ButtonAdd
//
this.ButtonAdd.Location = new System.Drawing.Point(550, 26);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(111, 32);
this.ButtonAdd.TabIndex = 16;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(28, 12);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(490, 426);
this.dataGridView.TabIndex = 15;
//
// FormUsers
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(688, 450);
this.Controls.Add(this.ButtonUpd);
this.Controls.Add(this.ButtonDel);
this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonAdd);
this.Controls.Add(this.dataGridView);
this.Name = "FormUsers";
this.Text = "Пользователи";
this.Load += new System.EventHandler(this.FormUsers_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Button ButtonUpd;
private Button ButtonDel;
private Button ButtonRef;
private Button ButtonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,118 @@
using BookshopContracts.BindingModels;
using BookshopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookshopView
{
public partial class FormUsers : Form
{
private readonly ILogger _logger;
private readonly IUserLogic _logic;
public FormUsers(ILogger<FormUsers> logger, IUserLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormUsers_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["Username"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["UserEmail"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка компонентов");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки компонентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormUser));
if (service is FormUser form)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormUser));
if (service is FormUser form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление компонента");
try
{
if (!_logic.Delete(new UserBindingModel
{
Id = id
}))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка удаления компонента");
MessageBox.Show(ex.Message, "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -25,7 +25,7 @@ namespace BookshopView
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormAuthors>());
Application.Run(_serviceProvider.GetRequiredService<FormBookCreate>());
}
private static void ConfigureServices(ServiceCollection services)
{
@ -37,10 +37,15 @@ namespace BookshopView
services.AddTransient<IAuthorStorage, AuthorStorage>();
services.AddTransient<IGenreStorage, GenreStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IUserStorage, UserStorage>();
services.AddTransient<IPublisherStorage, PublisherStorage>();
services.AddTransient<IAuthorLogic, AuthorLogic>();
services.AddTransient<IBookLogic, BookLogic>();
services.AddTransient<IGenreLogic, GenreLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IUserLogic, UserLogic>();
services.AddTransient<IPublisherLogic, PublisherLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormCreateOrder>();
@ -48,6 +53,11 @@ namespace BookshopView
services.AddTransient<FormGenres>();
services.AddTransient<FormAuthor>();
services.AddTransient<FormAuthors>();
services.AddTransient<FormUser>();
services.AddTransient<FormUsers>();
services.AddTransient<FormPublisher>();
services.AddTransient<FormPublishers>();
services.AddTransient<FormBookCreate>();
}
}
}