diff --git a/ProjectLibrary/Entites/Book_Orders.cs b/ProjectLibrary/Entites/Book_Orders.cs index 310aee2..4fe2865 100644 --- a/ProjectLibrary/Entites/Book_Orders.cs +++ b/ProjectLibrary/Entites/Book_Orders.cs @@ -6,14 +6,14 @@ using System.Threading.Tasks; namespace ProjectLibrary.Entites { - public class BookOrders + public class Book_Orders { public int BookID { get; private set; } public int OrderID { get; private set; } - public static BookOrders CreateEntity(int bookID, int orderID) + public static Book_Orders CreateEntity(int bookID, int orderID) { - return new BookOrders + return new Book_Orders { BookID = bookID, OrderID = orderID diff --git a/ProjectLibrary/Entites/Book_library.cs b/ProjectLibrary/Entites/Book_library.cs index df7606d..59c8984 100644 --- a/ProjectLibrary/Entites/Book_library.cs +++ b/ProjectLibrary/Entites/Book_library.cs @@ -6,15 +6,15 @@ using System.Threading.Tasks; namespace ProjectLibrary.Entites { - public class BookLibrary + public class Book_Library { public int BookID { get; private set; } public int LibraryID { get; private set; } public int Count { get; private set; } - public static BookLibrary CreateEntity(int bookID, int libraryID, int count) + public static Book_Library CreateEntity(int bookID, int libraryID, int count) { - return new BookLibrary + return new Book_Library { BookID = bookID, LibraryID = libraryID, diff --git a/ProjectLibrary/FormLibrary.Designer.cs b/ProjectLibrary/FormLibrary.Designer.cs index 6172ee3..fbb4b3e 100644 --- a/ProjectLibrary/FormLibrary.Designer.cs +++ b/ProjectLibrary/FormLibrary.Designer.cs @@ -28,12 +28,108 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; + menuStrip1 = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + читательскийБилетToolStripMenuItem = new ToolStripMenuItem(); + книгаToolStripMenuItem = new ToolStripMenuItem(); + картаСотрудникаToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + оформлениеБилетаToolStripMenuItem = new ToolStripMenuItem(); + обновлениеБилетаToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.BackColor = Color.SlateGray; + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(832, 28); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { читательскийБилетToolStripMenuItem, книгаToolStripMenuItem, картаСотрудникаToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // читательскийБилетToolStripMenuItem + // + читательскийБилетToolStripMenuItem.Name = "читательскийБилетToolStripMenuItem"; + читательскийБилетToolStripMenuItem.Size = new Size(231, 26); + читательскийБилетToolStripMenuItem.Text = "Читательский билет"; + // + // книгаToolStripMenuItem + // + книгаToolStripMenuItem.Name = "книгаToolStripMenuItem"; + книгаToolStripMenuItem.Size = new Size(231, 26); + книгаToolStripMenuItem.Text = "Книга"; + // + // картаСотрудникаToolStripMenuItem + // + картаСотрудникаToolStripMenuItem.Name = "картаСотрудникаToolStripMenuItem"; + картаСотрудникаToolStripMenuItem.Size = new Size(231, 26); + картаСотрудникаToolStripMenuItem.Text = "Сотрудники"; + картаСотрудникаToolStripMenuItem.Click += картаСотрудникаToolStripMenuItem_Click; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { оформлениеБилетаToolStripMenuItem, обновлениеБилетаToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(95, 24); + операцииToolStripMenuItem.Text = "Операции"; + // + // оформлениеБилетаToolStripMenuItem + // + оформлениеБилетаToolStripMenuItem.Name = "оформлениеБилетаToolStripMenuItem"; + оформлениеБилетаToolStripMenuItem.Size = new Size(240, 26); + оформлениеБилетаToolStripMenuItem.Text = "Оформление билета "; + // + // обновлениеБилетаToolStripMenuItem + // + обновлениеБилетаToolStripMenuItem.Name = "обновлениеБилетаToolStripMenuItem"; + обновлениеБилетаToolStripMenuItem.Size = new Size(240, 26); + обновлениеБилетаToolStripMenuItem.Text = "Обновление билета"; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(73, 24); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormLibrary + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = SystemColors.ButtonHighlight; + BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_19_132940; + ClientSize = new Size(832, 453); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormLibrary"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Библиотека"; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem читательскийБилетToolStripMenuItem; + private ToolStripMenuItem книгаToolStripMenuItem; + private ToolStripMenuItem картаСотрудникаToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem оформлениеБилетаToolStripMenuItem; + private ToolStripMenuItem обновлениеБилетаToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; } } diff --git a/ProjectLibrary/FormLibrary.cs b/ProjectLibrary/FormLibrary.cs index 0c8abff..3258552 100644 --- a/ProjectLibrary/FormLibrary.cs +++ b/ProjectLibrary/FormLibrary.cs @@ -6,5 +6,10 @@ namespace ProjectLibrary { InitializeComponent(); } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + + } } } diff --git a/ProjectLibrary/FormLibrary.resx b/ProjectLibrary/FormLibrary.resx index 1af7de1..b48baf1 100644 --- a/ProjectLibrary/FormLibrary.resx +++ b/ProjectLibrary/FormLibrary.resx @@ -1,17 +1,17 @@  - @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FBook.Designer.cs b/ProjectLibrary/Forms/FBook.Designer.cs new file mode 100644 index 0000000..892339f --- /dev/null +++ b/ProjectLibrary/Forms/FBook.Designer.cs @@ -0,0 +1,183 @@ +namespace ProjectLibrary.Forms +{ + partial class FBook + { + /// + /// Обязательная переменная конструктора + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Очистка всех используемых ресурсов + /// + /// true, если управляемые ресурсы нужно освободить; иначе false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором Windows Form Designer + + /// + /// Требуемый метод для поддержки конструктора - не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + lblId = new Label(); + txtId = new TextBox(); + lblAuthor = new Label(); + txtAuthor = new TextBox(); + lblName = new Label(); + txtName = new TextBox(); + lblType = new Label(); + cmbType = new ComboBox(); + lblLibraryId = new Label(); + txtLibraryId = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblId + // + lblId.AutoSize = true; + lblId.Location = new Point(20, 20); + lblId.Name = "lblId"; + lblId.Size = new Size(27, 20); + lblId.TabIndex = 0; + lblId.Text = "ID:"; + // + // txtId + // + txtId.Location = new Point(100, 20); + txtId.Name = "txtId"; + txtId.ReadOnly = true; + txtId.Size = new Size(200, 27); + txtId.TabIndex = 1; + // + // lblAuthor + // + lblAuthor.AutoSize = true; + lblAuthor.Location = new Point(20, 60); + lblAuthor.Name = "lblAuthor"; + lblAuthor.Size = new Size(54, 20); + lblAuthor.TabIndex = 2; + lblAuthor.Text = "Автор:"; + // + // txtAuthor + // + txtAuthor.Location = new Point(100, 60); + txtAuthor.Name = "txtAuthor"; + txtAuthor.Size = new Size(200, 27); + txtAuthor.TabIndex = 3; + // + // lblName + // + lblName.AutoSize = true; + lblName.Location = new Point(20, 100); + lblName.Name = "lblName"; + lblName.Size = new Size(80, 20); + lblName.TabIndex = 4; + lblName.Text = "Название:"; + // + // txtName + // + txtName.Location = new Point(100, 100); + txtName.Name = "txtName"; + txtName.Size = new Size(200, 27); + txtName.TabIndex = 5; + // + // lblType + // + lblType.AutoSize = true; + lblType.Location = new Point(20, 140); + lblType.Name = "lblType"; + lblType.Size = new Size(38, 20); + lblType.TabIndex = 6; + lblType.Text = "Тип:"; + // + // cmbType + // + cmbType.DropDownStyle = ComboBoxStyle.DropDownList; + cmbType.FormattingEnabled = true; + cmbType.Items.AddRange(new object[] { "Fiction", "Non-Fiction", "Science", "Biography" }); + cmbType.Location = new Point(100, 140); + cmbType.Name = "cmbType"; + cmbType.Size = new Size(200, 28); + cmbType.TabIndex = 7; + // + // lblLibraryId + // + lblLibraryId.AutoSize = true; + lblLibraryId.Location = new Point(20, 180); + lblLibraryId.Name = "lblLibraryId"; + lblLibraryId.Size = new Size(114, 20); + lblLibraryId.TabIndex = 8; + lblLibraryId.Text = "ID библиотеки:"; + // + // txtLibraryId + // + txtLibraryId.Location = new Point(140, 177); + txtLibraryId.Name = "txtLibraryId"; + txtLibraryId.Size = new Size(200, 27); + txtLibraryId.TabIndex = 9; + // + // btnSave + // + btnSave.Location = new Point(20, 220); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 10; + btnSave.Text = "Сохранить"; + btnSave.UseVisualStyleBackColor = true; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(240, 220); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 11; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FBook + // + ClientSize = new Size(400, 300); + Controls.Add(buttonCancel_Click); + Controls.Add(lblId); + Controls.Add(txtId); + Controls.Add(lblAuthor); + Controls.Add(txtAuthor); + Controls.Add(lblName); + Controls.Add(txtName); + Controls.Add(lblType); + Controls.Add(cmbType); + Controls.Add(lblLibraryId); + Controls.Add(txtLibraryId); + Controls.Add(btnSave); + Name = "FBook"; + Text = "Книга"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private System.Windows.Forms.Label lblId; + private System.Windows.Forms.TextBox txtId; + private System.Windows.Forms.Label lblAuthor; + private System.Windows.Forms.TextBox txtAuthor; + private System.Windows.Forms.Label lblName; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Label lblType; + private System.Windows.Forms.ComboBox cmbType; + private System.Windows.Forms.Label lblLibraryId; + private System.Windows.Forms.TextBox txtLibraryId; + private System.Windows.Forms.Button btnSave; + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FBook.cs b/ProjectLibrary/Forms/FBook.cs new file mode 100644 index 0000000..c446942 --- /dev/null +++ b/ProjectLibrary/Forms/FBook.cs @@ -0,0 +1,123 @@ +namespace ProjectLibrary.Forms +{ + public partial class FBook : Form + { + public FBook() + { + InitializeComponent(); + InitializeFormElements(); + } + + private void InitializeFormElements() + { + // Заголовок формы + this.Text = "Книга"; + + // Создание метки и текстового поля для Id + Label lblId = new Label + { + Text = "ID:", + Location = new System.Drawing.Point(20, 20), + AutoSize = true + }; + TextBox txtId = new TextBox + { + Location = new System.Drawing.Point(100, 20), + Width = 200, + ReadOnly = true // ID обычно только для чтения + }; + + // Создание метки и текстового поля для Author + Label lblAuthor = new Label + { + Text = "Автор:", + Location = new System.Drawing.Point(20, 60), + AutoSize = true + }; + TextBox txtAuthor = new TextBox + { + Location = new System.Drawing.Point(100, 60), + Width = 200 + }; + + // Создание метки и текстового поля для Name + Label lblName = new Label + { + Text = "Название:", + Location = new System.Drawing.Point(20, 100), + AutoSize = true + }; + TextBox txtName = new TextBox + { + Location = new System.Drawing.Point(100, 100), + Width = 200 + }; + + // Создание метки и выпадающего списка для Type + Label lblType = new Label + { + Text = "Тип:", + Location = new System.Drawing.Point(20, 140), + AutoSize = true + }; + ComboBox cmbType = new ComboBox + { + Location = new System.Drawing.Point(100, 140), + Width = 200, + DropDownStyle = ComboBoxStyle.DropDownList + }; + cmbType.Items.AddRange(new string[] { "Fiction", "Non-Fiction", "Science", "Biography" }); // Пример данных + + // Создание метки и текстового поля для LibraryID + Label lblLibraryId = new Label + { + Text = "ID библиотеки:", + Location = new System.Drawing.Point(20, 180), + AutoSize = true + }; + TextBox txtLibraryId = new TextBox + { + Location = new System.Drawing.Point(100, 180), + Width = 200 + }; + + // Кнопка "Сохранить" + Button btnSave = new Button + { + Text = "Сохранить", + Location = new System.Drawing.Point(100, 220), + Width = 100 + }; + btnSave.Click += (sender, e) => SaveData(txtId.Text, txtAuthor.Text, txtName.Text, cmbType.SelectedItem?.ToString(), txtLibraryId.Text); + + // Добавление элементов на форму + this.Controls.Add(lblId); + this.Controls.Add(txtId); + this.Controls.Add(lblAuthor); + this.Controls.Add(txtAuthor); + this.Controls.Add(lblName); + this.Controls.Add(txtName); + this.Controls.Add(lblType); + this.Controls.Add(cmbType); + this.Controls.Add(lblLibraryId); + this.Controls.Add(txtLibraryId); + this.Controls.Add(btnSave); + } + + private void SaveData(string id, string author, string name, string type, string libraryId) + { + // Логика сохранения данных (например, в базу данных) + MessageBox.Show("Данные сохранены:\n" + + $"ID: {id}\n" + + $"Автор: {author}\n" + + $"Название: {name}\n" + + $"Тип: {type}\n" + + $"ID библиотеки: {libraryId}"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FBook.resx b/ProjectLibrary/Forms/FBook.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FBook.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FBook_Orders.Designer.cs b/ProjectLibrary/Forms/FBook_Orders.Designer.cs new file mode 100644 index 0000000..4df4107 --- /dev/null +++ b/ProjectLibrary/Forms/FBook_Orders.Designer.cs @@ -0,0 +1,101 @@ +namespace ProjectLibrary.Forms +{ + partial class FBook_Orders + { + private System.ComponentModel.IContainer components = null; + + private Label lblBookID; + private TextBox txtBookID; + private Label lblOrderID; + private TextBox txtOrderID; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + lblBookID = new Label(); + txtBookID = new TextBox(); + lblOrderID = new Label(); + txtOrderID = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblBookID + // + lblBookID.AutoSize = true; + lblBookID.Location = new Point(20, 20); + lblBookID.Name = "lblBookID"; + lblBookID.Size = new Size(71, 20); + lblBookID.TabIndex = 0; + lblBookID.Text = "ID книги:"; + // + // txtBookID + // + txtBookID.Location = new Point(100, 20); + txtBookID.Name = "txtBookID"; + txtBookID.ReadOnly = true; + txtBookID.Size = new Size(200, 27); + txtBookID.TabIndex = 1; + // + // lblOrderID + // + lblOrderID.AutoSize = true; + lblOrderID.Location = new Point(20, 60); + lblOrderID.Name = "lblOrderID"; + lblOrderID.Size = new Size(76, 20); + lblOrderID.TabIndex = 2; + lblOrderID.Text = "ID заказа:"; + // + // txtOrderID + // + txtOrderID.Location = new Point(100, 60); + txtOrderID.Name = "txtOrderID"; + txtOrderID.ReadOnly = true; + txtOrderID.Size = new Size(200, 27); + txtOrderID.TabIndex = 3; + // + // btnSave + // + btnSave.Location = new Point(20, 93); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 4; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(200, 93); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 10; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FBook_Orders + // + ClientSize = new Size(400, 200); + Controls.Add(buttonCancel_Click); + Controls.Add(lblBookID); + Controls.Add(txtBookID); + Controls.Add(lblOrderID); + Controls.Add(txtOrderID); + Controls.Add(btnSave); + Name = "FBook_Orders"; + Text = "Книга и заказ"; + ResumeLayout(false); + PerformLayout(); + } + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FBook_Orders.cs b/ProjectLibrary/Forms/FBook_Orders.cs new file mode 100644 index 0000000..c4809cf --- /dev/null +++ b/ProjectLibrary/Forms/FBook_Orders.cs @@ -0,0 +1,43 @@ +using System; +using System.Windows.Forms; +using ProjectLibrary.Entites; + +namespace ProjectLibrary.Forms +{ + public partial class FBook_Orders : Form + { + private Book_Orders _bookOrders; + + public FBook_Orders(Book_Orders bookOrders) + { + InitializeComponent(); + _bookOrders = bookOrders; + LoadOrderData(); + } + + private void LoadOrderData() + { + txtBookID.Text = _bookOrders.BookID.ToString(); + txtOrderID.Text = _bookOrders.OrderID.ToString(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание новой сущности с обновленными данными + var updatedBookOrders = Book_Orders.CreateEntity( + int.Parse(txtBookID.Text), + int.Parse(txtOrderID.Text) + ); + + // Обновление внутренней переменной + _bookOrders = updatedBookOrders; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FBook_Orders.resx b/ProjectLibrary/Forms/FBook_Orders.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FBook_Orders.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FBook_library.Designer.cs b/ProjectLibrary/Forms/FBook_library.Designer.cs new file mode 100644 index 0000000..3668682 --- /dev/null +++ b/ProjectLibrary/Forms/FBook_library.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectLibrary.Forms +{ + partial class FBook_library + { + private System.ComponentModel.IContainer components = null; + + private Label lblBookID; + private TextBox txtBookID; + private Label lblLibraryID; + private TextBox txtLibraryID; + private Label lblCount; + private TextBox txtCount; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + private void InitializeComponent() + { + lblBookID = new Label(); + txtBookID = new TextBox(); + lblLibraryID = new Label(); + txtLibraryID = new TextBox(); + lblCount = new Label(); + txtCount = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblBookID + // + lblBookID.AutoSize = true; + lblBookID.Location = new Point(20, 20); + lblBookID.Name = "lblBookID"; + lblBookID.Size = new Size(71, 20); + lblBookID.TabIndex = 0; + lblBookID.Text = "ID книги:"; + // + // txtBookID + // + txtBookID.Location = new Point(140, 20); + txtBookID.Name = "txtBookID"; + txtBookID.ReadOnly = true; + txtBookID.Size = new Size(200, 27); + txtBookID.TabIndex = 1; + // + // lblLibraryID + // + lblLibraryID.AutoSize = true; + lblLibraryID.Location = new Point(20, 60); + lblLibraryID.Name = "lblLibraryID"; + lblLibraryID.Size = new Size(114, 20); + lblLibraryID.TabIndex = 2; + lblLibraryID.Text = "ID библиотеки:"; + // + // txtLibraryID + // + txtLibraryID.Location = new Point(140, 57); + txtLibraryID.Name = "txtLibraryID"; + txtLibraryID.ReadOnly = true; + txtLibraryID.Size = new Size(200, 27); + txtLibraryID.TabIndex = 3; + // + // lblCount + // + lblCount.AutoSize = true; + lblCount.Location = new Point(20, 100); + lblCount.Name = "lblCount"; + lblCount.Size = new Size(93, 20); + lblCount.TabIndex = 4; + lblCount.Text = "Количество:"; + // + // txtCount + // + txtCount.Location = new Point(140, 93); + txtCount.Name = "txtCount"; + txtCount.Size = new Size(200, 27); + txtCount.TabIndex = 5; + // + // btnSave + // + btnSave.Location = new Point(20, 140); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 6; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(240, 140); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 10; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FBook_library + // + ClientSize = new Size(400, 200); + Controls.Add(buttonCancel_Click); + Controls.Add(lblBookID); + Controls.Add(txtBookID); + Controls.Add(lblLibraryID); + Controls.Add(txtLibraryID); + Controls.Add(lblCount); + Controls.Add(txtCount); + Controls.Add(btnSave); + Name = "FBook_library"; + Text = "Книга в библиотеке"; + ResumeLayout(false); + PerformLayout(); + } + #endregion + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FBook_library.cs b/ProjectLibrary/Forms/FBook_library.cs new file mode 100644 index 0000000..ae1dbe1 --- /dev/null +++ b/ProjectLibrary/Forms/FBook_library.cs @@ -0,0 +1,45 @@ +using System; +using System.Windows.Forms; +using ProjectLibrary.Entites; + +namespace ProjectLibrary.Forms +{ + public partial class FBook_library : Form + { + private Book_Library _bookLibrary; + + public FBook_library(Book_Library bookLibrary) + { + InitializeComponent(); + _bookLibrary = bookLibrary; + LoadLibraryData(); + } + + private void LoadLibraryData() + { + txtBookID.Text = _bookLibrary.BookID.ToString(); + txtLibraryID.Text = _bookLibrary.LibraryID.ToString(); + txtCount.Text = _bookLibrary.Count.ToString(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание новой сущности с измененными данными + var updatedBookLibrary = Book_Library.CreateEntity( + int.Parse(txtBookID.Text), + int.Parse(txtLibraryID.Text), + int.Parse(txtCount.Text) + ); + + // Обновление внутренней переменной + _bookLibrary = updatedBookLibrary; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FBook_library.resx b/ProjectLibrary/Forms/FBook_library.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FBook_library.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FLibrary.Designer.cs b/ProjectLibrary/Forms/FLibrary.Designer.cs new file mode 100644 index 0000000..e04e04b --- /dev/null +++ b/ProjectLibrary/Forms/FLibrary.Designer.cs @@ -0,0 +1,122 @@ +namespace ProjectLibrary.Forms +{ + partial class FLibrary + { + private System.ComponentModel.IContainer components = null; + + private Label lblId; + private TextBox txtId; + private Label lblName; + private TextBox txtName; + private Label lblAddress; + private TextBox txtAddress; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + lblId = new Label(); + txtId = new TextBox(); + lblName = new Label(); + txtName = new TextBox(); + lblAddress = new Label(); + txtAddress = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblId + // + lblId.AutoSize = true; + lblId.Location = new Point(20, 20); + lblId.Name = "lblId"; + lblId.Size = new Size(27, 20); + lblId.TabIndex = 0; + lblId.Text = "ID:"; + // + // txtId + // + txtId.Location = new Point(100, 20); + txtId.Name = "txtId"; + txtId.ReadOnly = true; + txtId.Size = new Size(200, 27); + txtId.TabIndex = 1; + // + // lblName + // + lblName.AutoSize = true; + lblName.Location = new Point(20, 60); + lblName.Name = "lblName"; + lblName.Size = new Size(42, 20); + lblName.TabIndex = 2; + lblName.Text = "Имя:"; + // + // txtName + // + txtName.Location = new Point(100, 60); + txtName.Name = "txtName"; + txtName.Size = new Size(200, 27); + txtName.TabIndex = 3; + // + // lblAddress + // + lblAddress.AutoSize = true; + lblAddress.Location = new Point(20, 100); + lblAddress.Name = "lblAddress"; + lblAddress.Size = new Size(54, 20); + lblAddress.TabIndex = 4; + lblAddress.Text = "Адрес:"; + // + // txtAddress + // + txtAddress.Location = new Point(100, 100); + txtAddress.Name = "txtAddress"; + txtAddress.Size = new Size(200, 27); + txtAddress.TabIndex = 5; + // + // btnSave + // + btnSave.Location = new Point(20, 133); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 6; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(200, 133); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 10; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FLibrary + // + ClientSize = new Size(400, 200); + Controls.Add(buttonCancel_Click); + Controls.Add(lblId); + Controls.Add(txtId); + Controls.Add(lblName); + Controls.Add(txtName); + Controls.Add(lblAddress); + Controls.Add(txtAddress); + Controls.Add(btnSave); + Name = "FLibrary"; + Text = "Библиотека"; + ResumeLayout(false); + PerformLayout(); + } + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FLibrary.cs b/ProjectLibrary/Forms/FLibrary.cs new file mode 100644 index 0000000..bade384 --- /dev/null +++ b/ProjectLibrary/Forms/FLibrary.cs @@ -0,0 +1,45 @@ +using System; +using System.Windows.Forms; +using ProjectLibrary.Entites; + +namespace ProjectLibrary.Forms +{ + public partial class FLibrary : Form + { + private Library _library; + + public FLibrary(Library library) + { + InitializeComponent(); + _library = library; + LoadLibraryData(); + } + + private void LoadLibraryData() + { + txtId.Text = _library.Id.ToString(); + txtName.Text = _library.Name; + txtAddress.Text = _library.Address; + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание новой сущности с обновленными данными + var updatedLibrary = Library.CreateEntity( + int.Parse(txtId.Text), + txtName.Text, + txtAddress.Text + ); + + // Обновление внутренней переменной + _library = updatedLibrary; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FLibrary.resx b/ProjectLibrary/Forms/FLibrary.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FLibrary.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FOrders.Designer.cs b/ProjectLibrary/Forms/FOrders.Designer.cs new file mode 100644 index 0000000..fd85e3a --- /dev/null +++ b/ProjectLibrary/Forms/FOrders.Designer.cs @@ -0,0 +1,167 @@ +namespace ProjectLibrary.Forms +{ + partial class FOrders + { + private System.ComponentModel.IContainer components = null; + + private Label lblOrderID; + private TextBox txtOrderID; + private Label lblOrderDate; + private TextBox txtOrderDate; + private Label lblReturnDate; + private TextBox txtReturnDate; + private Label lblReaderID; + private TextBox txtReaderID; + private Label lblBookID; + private TextBox txtBookID; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + lblOrderID = new Label(); + txtOrderID = new TextBox(); + lblOrderDate = new Label(); + txtOrderDate = new TextBox(); + lblReturnDate = new Label(); + txtReturnDate = new TextBox(); + lblReaderID = new Label(); + txtReaderID = new TextBox(); + lblBookID = new Label(); + txtBookID = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblOrderID + // + lblOrderID.AutoSize = true; + lblOrderID.Location = new Point(20, 20); + lblOrderID.Name = "lblOrderID"; + lblOrderID.Size = new Size(76, 20); + lblOrderID.TabIndex = 0; + lblOrderID.Text = "ID заказа:"; + // + // txtOrderID + // + txtOrderID.Location = new Point(137, 20); + txtOrderID.Name = "txtOrderID"; + txtOrderID.ReadOnly = true; + txtOrderID.Size = new Size(200, 27); + txtOrderID.TabIndex = 1; + // + // lblOrderDate + // + lblOrderDate.AutoSize = true; + lblOrderDate.Location = new Point(20, 60); + lblOrderDate.Name = "lblOrderDate"; + lblOrderDate.Size = new Size(93, 20); + lblOrderDate.TabIndex = 2; + lblOrderDate.Text = "Дата заказа:"; + // + // txtOrderDate + // + txtOrderDate.Location = new Point(137, 60); + txtOrderDate.Name = "txtOrderDate"; + txtOrderDate.Size = new Size(200, 27); + txtOrderDate.TabIndex = 3; + // + // lblReturnDate + // + lblReturnDate.AutoSize = true; + lblReturnDate.Location = new Point(20, 100); + lblReturnDate.Name = "lblReturnDate"; + lblReturnDate.Size = new Size(111, 20); + lblReturnDate.TabIndex = 4; + lblReturnDate.Text = "Дата возврата:"; + // + // txtReturnDate + // + txtReturnDate.Location = new Point(137, 100); + txtReturnDate.Name = "txtReturnDate"; + txtReturnDate.Size = new Size(200, 27); + txtReturnDate.TabIndex = 5; + // + // lblReaderID + // + lblReaderID.AutoSize = true; + lblReaderID.Location = new Point(20, 140); + lblReaderID.Name = "lblReaderID"; + lblReaderID.Size = new Size(92, 20); + lblReaderID.TabIndex = 6; + lblReaderID.Text = "ID читателя:"; + // + // txtReaderID + // + txtReaderID.Location = new Point(137, 140); + txtReaderID.Name = "txtReaderID"; + txtReaderID.Size = new Size(200, 27); + txtReaderID.TabIndex = 7; + // + // lblBookID + // + lblBookID.AutoSize = true; + lblBookID.Location = new Point(20, 180); + lblBookID.Name = "lblBookID"; + lblBookID.Size = new Size(71, 20); + lblBookID.TabIndex = 8; + lblBookID.Text = "ID книги:"; + // + // txtBookID + // + txtBookID.Location = new Point(137, 177); + txtBookID.Name = "txtBookID"; + txtBookID.ReadOnly = true; + txtBookID.Size = new Size(200, 27); + txtBookID.TabIndex = 9; + // + // btnSave + // + btnSave.Location = new Point(20, 222); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 10; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(237, 222); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 11; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FOrders + // + ClientSize = new Size(400, 300); + Controls.Add(buttonCancel_Click); + Controls.Add(lblOrderID); + Controls.Add(txtOrderID); + Controls.Add(lblOrderDate); + Controls.Add(txtOrderDate); + Controls.Add(lblReturnDate); + Controls.Add(txtReturnDate); + Controls.Add(lblReaderID); + Controls.Add(txtReaderID); + Controls.Add(lblBookID); + Controls.Add(txtBookID); + Controls.Add(btnSave); + Name = "FOrders"; + Text = "Заказы"; + ResumeLayout(false); + PerformLayout(); + } + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FOrders.cs b/ProjectLibrary/Forms/FOrders.cs new file mode 100644 index 0000000..9bcdb0f --- /dev/null +++ b/ProjectLibrary/Forms/FOrders.cs @@ -0,0 +1,56 @@ +using System; +using System.Windows.Forms; +using ProjectLibrary.Entites; + +namespace ProjectLibrary.Forms +{ + public partial class FOrders : Form + { + private Orders _order; + private Book_Orders _bookOrder; + + public FOrders(Orders order, Book_Orders bookOrder) + { + InitializeComponent(); + _order = order; + _bookOrder = bookOrder; + LoadOrderData(); + } + + private void LoadOrderData() + { + txtOrderID.Text = _order.Id.ToString(); + txtOrderDate.Text = _order.OrderDate.ToString(); + txtReturnDate.Text = _order.ReturnDate.ToString(); + txtReaderID.Text = _order.ReaderID.ToString(); + txtBookID.Text = _bookOrder.BookID.ToString(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание обновленных данных + var updatedOrder = Orders.CreateEntity( + int.Parse(txtOrderID.Text), + int.Parse(txtOrderDate.Text), + int.Parse(txtReturnDate.Text), + int.Parse(txtReaderID.Text) + ); + + var updatedBookOrder = Book_Orders.CreateEntity( + int.Parse(txtBookID.Text), + int.Parse(txtOrderID.Text) + ); + + // Обновление объектов + _order = updatedOrder; + _bookOrder = updatedBookOrder; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FOrders.resx b/ProjectLibrary/Forms/FOrders.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FOrders.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FReader.Designer.cs b/ProjectLibrary/Forms/FReader.Designer.cs new file mode 100644 index 0000000..2d12eb0 --- /dev/null +++ b/ProjectLibrary/Forms/FReader.Designer.cs @@ -0,0 +1,144 @@ +namespace ProjectLibrary.Forms +{ + partial class FReader + { + private System.ComponentModel.IContainer components = null; + + private Label lblId; + private TextBox txtId; + private Label lblName; + private TextBox txtName; + private Label lblReaderTicket; + private TextBox txtReaderTicket; + private Label lblRegistrationDate; + private TextBox txtRegistrationDate; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + lblId = new Label(); + txtId = new TextBox(); + lblName = new Label(); + txtName = new TextBox(); + lblReaderTicket = new Label(); + txtReaderTicket = new TextBox(); + lblRegistrationDate = new Label(); + txtRegistrationDate = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblId + // + lblId.AutoSize = true; + lblId.Location = new Point(20, 20); + lblId.Name = "lblId"; + lblId.Size = new Size(27, 20); + lblId.TabIndex = 0; + lblId.Text = "ID:"; + // + // txtId + // + txtId.Location = new Point(177, 20); + txtId.Name = "txtId"; + txtId.ReadOnly = true; + txtId.Size = new Size(200, 27); + txtId.TabIndex = 1; + // + // lblName + // + lblName.AutoSize = true; + lblName.Location = new Point(20, 60); + lblName.Name = "lblName"; + lblName.Size = new Size(42, 20); + lblName.TabIndex = 2; + lblName.Text = "Имя:"; + // + // txtName + // + txtName.Location = new Point(177, 60); + txtName.Name = "txtName"; + txtName.Size = new Size(200, 27); + txtName.TabIndex = 3; + // + // lblReaderTicket + // + lblReaderTicket.AutoSize = true; + lblReaderTicket.Location = new Point(20, 100); + lblReaderTicket.Name = "lblReaderTicket"; + lblReaderTicket.Size = new Size(151, 20); + lblReaderTicket.TabIndex = 4; + lblReaderTicket.Text = "Читательский билет:"; + // + // txtReaderTicket + // + txtReaderTicket.Location = new Point(177, 100); + txtReaderTicket.Name = "txtReaderTicket"; + txtReaderTicket.Size = new Size(200, 27); + txtReaderTicket.TabIndex = 5; + // + // lblRegistrationDate + // + lblRegistrationDate.AutoSize = true; + lblRegistrationDate.Location = new Point(20, 140); + lblRegistrationDate.Name = "lblRegistrationDate"; + lblRegistrationDate.Size = new Size(137, 20); + lblRegistrationDate.TabIndex = 6; + lblRegistrationDate.Text = "Дата регистрации:"; + // + // txtRegistrationDate + // + txtRegistrationDate.Location = new Point(177, 140); + txtRegistrationDate.Name = "txtRegistrationDate"; + txtRegistrationDate.Size = new Size(200, 27); + txtRegistrationDate.TabIndex = 7; + // + // btnSave + // + btnSave.Location = new Point(20, 181); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 8; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(277, 181); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 10; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FReader + // + ClientSize = new Size(400, 250); + Controls.Add(buttonCancel_Click); + Controls.Add(lblId); + Controls.Add(txtId); + Controls.Add(lblName); + Controls.Add(txtName); + Controls.Add(lblReaderTicket); + Controls.Add(txtReaderTicket); + Controls.Add(lblRegistrationDate); + Controls.Add(txtRegistrationDate); + Controls.Add(btnSave); + Name = "FReader"; + Text = "Читатель"; + ResumeLayout(false); + PerformLayout(); + } + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FReader.cs b/ProjectLibrary/Forms/FReader.cs new file mode 100644 index 0000000..2484207 --- /dev/null +++ b/ProjectLibrary/Forms/FReader.cs @@ -0,0 +1,48 @@ +using System; +using System.Windows.Forms; +using System.Xml.Linq; +using ProjectLibrary.Entities; + +namespace ProjectLibrary.Forms +{ + public partial class FReader : Form + { + private Reader _reader; + + public FReader(Reader reader) + { + InitializeComponent(); + _reader = reader; + LoadReaderData(); + } + + private void LoadReaderData() + { + txtId.Text = _reader.Id.ToString(); + txtName.Text = _reader.Name; + txtReaderTicket.Text = _reader.ReaderTicket.ToString(); + txtRegistrationDate.Text = _reader.RegistrationDateRT.ToShortDateString(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание новой сущности с обновленными данными + var updatedReader = Reader.CreateEntity( + int.Parse(txtId.Text), + txtName.Text, + int.Parse(txtReaderTicket.Text), + DateTime.Parse(txtRegistrationDate.Text) + ); + + // Обновление внутренней переменной + _reader = updatedReader; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FReader.resx b/ProjectLibrary/Forms/FReader.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FReader.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/Forms/FTicket_Extension.Designer.cs b/ProjectLibrary/Forms/FTicket_Extension.Designer.cs new file mode 100644 index 0000000..b2e5c0c --- /dev/null +++ b/ProjectLibrary/Forms/FTicket_Extension.Designer.cs @@ -0,0 +1,145 @@ +namespace ProjectLibrary.Forms +{ + partial class FTicket_Extension + { + private System.ComponentModel.IContainer components = null; + + private Label lblReaderID; + private TextBox txtReaderID; + private Label lblExtensionID; + private TextBox txtExtensionID; + private Label lblLastUpdateDate; + private TextBox txtLastUpdateDate; + private Label lblNextUpdateDate; + private TextBox txtNextUpdateDate; + private Button btnSave; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + lblReaderID = new Label(); + txtReaderID = new TextBox(); + lblExtensionID = new Label(); + txtExtensionID = new TextBox(); + lblLastUpdateDate = new Label(); + txtLastUpdateDate = new TextBox(); + lblNextUpdateDate = new Label(); + txtNextUpdateDate = new TextBox(); + btnSave = new Button(); + buttonCancel_Click = new Button(); + SuspendLayout(); + // + // lblReaderID + // + lblReaderID.AutoSize = true; + lblReaderID.Location = new Point(20, 20); + lblReaderID.Name = "lblReaderID"; + lblReaderID.Size = new Size(92, 20); + lblReaderID.TabIndex = 0; + lblReaderID.Text = "ID читателя:"; + // + // txtReaderID + // + txtReaderID.Location = new Point(255, 13); + txtReaderID.Name = "txtReaderID"; + txtReaderID.ReadOnly = true; + txtReaderID.Size = new Size(200, 27); + txtReaderID.TabIndex = 1; + // + // lblExtensionID + // + lblExtensionID.AutoSize = true; + lblExtensionID.Location = new Point(20, 60); + lblExtensionID.Name = "lblExtensionID"; + lblExtensionID.Size = new Size(110, 20); + lblExtensionID.TabIndex = 2; + lblExtensionID.Text = "ID Продления:"; + // + // txtExtensionID + // + txtExtensionID.Location = new Point(255, 57); + txtExtensionID.Name = "txtExtensionID"; + txtExtensionID.ReadOnly = true; + txtExtensionID.Size = new Size(200, 27); + txtExtensionID.TabIndex = 3; + // + // lblLastUpdateDate + // + lblLastUpdateDate.AutoSize = true; + lblLastUpdateDate.Location = new Point(20, 100); + lblLastUpdateDate.Name = "lblLastUpdateDate"; + lblLastUpdateDate.Size = new Size(219, 20); + lblLastUpdateDate.TabIndex = 4; + lblLastUpdateDate.Text = "Дата последнего обновления:"; + // + // txtLastUpdateDate + // + txtLastUpdateDate.Location = new Point(255, 100); + txtLastUpdateDate.Name = "txtLastUpdateDate"; + txtLastUpdateDate.Size = new Size(200, 27); + txtLastUpdateDate.TabIndex = 5; + // + // lblNextUpdateDate + // + lblNextUpdateDate.AutoSize = true; + lblNextUpdateDate.Location = new Point(20, 140); + lblNextUpdateDate.Name = "lblNextUpdateDate"; + lblNextUpdateDate.Size = new Size(223, 20); + lblNextUpdateDate.TabIndex = 6; + lblNextUpdateDate.Text = "Дата следующего обновления:"; + // + // txtNextUpdateDate + // + txtNextUpdateDate.Location = new Point(255, 140); + txtNextUpdateDate.Name = "txtNextUpdateDate"; + txtNextUpdateDate.Size = new Size(200, 27); + txtNextUpdateDate.TabIndex = 7; + // + // btnSave + // + btnSave.Location = new Point(20, 178); + btnSave.Name = "btnSave"; + btnSave.Size = new Size(100, 30); + btnSave.TabIndex = 8; + btnSave.Text = "Сохранить"; + btnSave.Click += btnSave_Click; + // + // buttonCancel_Click + // + buttonCancel_Click.Location = new Point(355, 178); + buttonCancel_Click.Name = "buttonCancel_Click"; + buttonCancel_Click.Size = new Size(100, 30); + buttonCancel_Click.TabIndex = 9; + buttonCancel_Click.Text = "Отмена"; + buttonCancel_Click.Click += buttonCancel_Click_Click; + // + // FTicket_Extension + // + ClientSize = new Size(560, 250); + Controls.Add(buttonCancel_Click); + Controls.Add(lblReaderID); + Controls.Add(txtReaderID); + Controls.Add(lblExtensionID); + Controls.Add(txtExtensionID); + Controls.Add(lblLastUpdateDate); + Controls.Add(txtLastUpdateDate); + Controls.Add(lblNextUpdateDate); + Controls.Add(txtNextUpdateDate); + Controls.Add(btnSave); + Name = "FTicket_Extension"; + Text = "Продление билета"; + ResumeLayout(false); + PerformLayout(); + } + + private Button buttonCancel_Click; + } +} diff --git a/ProjectLibrary/Forms/FTicket_Extension.cs b/ProjectLibrary/Forms/FTicket_Extension.cs new file mode 100644 index 0000000..1f1b885 --- /dev/null +++ b/ProjectLibrary/Forms/FTicket_Extension.cs @@ -0,0 +1,48 @@ +using System; +using System.Windows.Forms; +using ProjectLibrary.Entites; +using ProjectLibrary.Entities; + +namespace ProjectLibrary.Forms +{ + public partial class FTicket_Extension : Form + { + private TicketExtensions _ticketExtensions; + + public FTicket_Extension(TicketExtensions ticketExtensions) + { + InitializeComponent(); + _ticketExtensions = ticketExtensions; + LoadTicketExtensionData(); + } + + private void LoadTicketExtensionData() + { + txtReaderID.Text = _ticketExtensions.ReaderID.ToString(); + txtExtensionID.Text = _ticketExtensions.ExtensionID.ToString(); + txtLastUpdateDate.Text = _ticketExtensions.LastUpdateDate.ToShortDateString(); + txtNextUpdateDate.Text = _ticketExtensions.NextUpdateDate.ToShortDateString(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + // Создание новой сущности с обновленными данными + var updatedTicketExtensions = TicketExtensions.CreateEntity( + int.Parse(txtReaderID.Text), + int.Parse(txtExtensionID.Text), + DateTime.Parse(txtLastUpdateDate.Text), + DateTime.Parse(txtNextUpdateDate.Text) + ); + + // Обновление внутренней переменной + _ticketExtensions = updatedTicketExtensions; + + MessageBox.Show("Данные успешно сохранены!"); + } + + private void buttonCancel_Click_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ProjectLibrary/Forms/FTicket_Extension.resx b/ProjectLibrary/Forms/FTicket_Extension.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectLibrary/Forms/FTicket_Extension.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary.csproj b/ProjectLibrary/ProjectLibrary.csproj index 894afcd..accbdf0 100644 --- a/ProjectLibrary/ProjectLibrary.csproj +++ b/ProjectLibrary/ProjectLibrary.csproj @@ -12,4 +12,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectLibrary/Properties/Resources.Designer.cs b/ProjectLibrary/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fca8482 --- /dev/null +++ b/ProjectLibrary/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectLibrary.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectLibrary.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Снимок_экрана_2024_11_19_132940 { + get { + object obj = ResourceManager.GetObject("Снимок экрана 2024-11-19 132940", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectLibrary/Properties/Resources.resx b/ProjectLibrary/Properties/Resources.resx new file mode 100644 index 0000000..1db6ab7 --- /dev/null +++ b/ProjectLibrary/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\Снимок экрана 2024-11-19 132940.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectLibrary/Repositores/IBookLibraryRepository.cs b/ProjectLibrary/Repositores/IBookLibraryRepository.cs index 4ef06aa..9e49609 100644 --- a/ProjectLibrary/Repositores/IBookLibraryRepository.cs +++ b/ProjectLibrary/Repositores/IBookLibraryRepository.cs @@ -5,8 +5,8 @@ public interface IBookLibraryRepository { - IEnumerable ReadBookLibraries(int? bookId = null, int? libraryId = null); - void CreateBookLibrary(BookLibrary bookLibrary); + IEnumerable ReadBookLibraries(int? bookId = null, int? libraryId = null); + void CreateBookLibrary(Book_Library bookLibrary); void DeleteBookLibrary(int bookId, int libraryId); } } diff --git a/ProjectLibrary/Repositores/IBookOrderRepository.cs b/ProjectLibrary/Repositores/IBookOrderRepository.cs index d5cdfa0..5d8ec73 100644 --- a/ProjectLibrary/Repositores/IBookOrderRepository.cs +++ b/ProjectLibrary/Repositores/IBookOrderRepository.cs @@ -5,8 +5,8 @@ public interface IBookOrdersRepository { - IEnumerable ReadBookOrders(int? bookId = null, int? orderId = null); - void CreateBookOrder(BookOrders bookOrder); + IEnumerable ReadBookOrders(int? bookId = null, int? orderId = null); + void CreateBookOrder(Book_Orders bookOrder); void DeleteBookOrder(int bookId, int orderId); } } diff --git a/ProjectLibrary/Repositores/Implementations/BookLibraryRepository.cs b/ProjectLibrary/Repositores/Implementations/BookLibraryRepository.cs index 3c61e25..d389b25 100644 --- a/ProjectLibrary/Repositores/Implementations/BookLibraryRepository.cs +++ b/ProjectLibrary/Repositores/Implementations/BookLibraryRepository.cs @@ -9,9 +9,9 @@ namespace ProjectLibrary.Repositories.Implementations public class BookLibraryRepository : IBookLibraryRepository { // Эмулируем базу данных в виде списка - private readonly List _bookLibraries = new List(); + private readonly List _bookLibraries = new List(); - public void CreateBookLibrary(BookLibrary bookLibrary) + public void CreateBookLibrary(Book_Library bookLibrary) { // Логика для добавления связи книги и библиотеки _bookLibraries.Add(bookLibrary); @@ -27,7 +27,7 @@ namespace ProjectLibrary.Repositories.Implementations } } - public IEnumerable ReadBookLibraries(int? bookId = null, int? libraryId = null) + public IEnumerable ReadBookLibraries(int? bookId = null, int? libraryId = null) { // Логика для получения всех связей книг и библиотек с возможностью фильтрации по bookId и libraryId return _bookLibraries.Where(bl => @@ -35,7 +35,7 @@ namespace ProjectLibrary.Repositories.Implementations (!libraryId.HasValue || bl.LibraryID == libraryId)); } - public void UpdateBookLibrary(BookLibrary bookLibrary) + public void UpdateBookLibrary(Book_Library bookLibrary) { // Логика для обновления информации о связи книги и библиотеки var existingBookLibrary = _bookLibraries.FirstOrDefault(bl => bl.BookID == bookLibrary.BookID && bl.LibraryID == bookLibrary.LibraryID); diff --git a/ProjectLibrary/Repositores/Implementations/BookOrdersRepository.cs b/ProjectLibrary/Repositores/Implementations/BookOrdersRepository.cs index 522cea5..f5a07f5 100644 --- a/ProjectLibrary/Repositores/Implementations/BookOrdersRepository.cs +++ b/ProjectLibrary/Repositores/Implementations/BookOrdersRepository.cs @@ -9,9 +9,9 @@ namespace ProjectLibrary.Repositories.Implementations public class BookOrdersRepository : IBookOrdersRepository { // Эмулируем базу данных в виде списка - private readonly List _bookOrders = new List(); + private readonly List _bookOrders = new List(); - public void CreateBookOrder(BookOrders bookOrder) + public void CreateBookOrder(Book_Orders bookOrder) { // Логика для добавления связи книги и заказа _bookOrders.Add(bookOrder); @@ -27,7 +27,7 @@ namespace ProjectLibrary.Repositories.Implementations } } - public IEnumerable ReadBookOrders(int? bookId = null, int? orderId = null) + public IEnumerable ReadBookOrders(int? bookId = null, int? orderId = null) { // Логика для получения всех связей книг и заказов с возможностью фильтрации по bookId и orderId return _bookOrders.Where(bo => diff --git a/ProjectLibrary/Resources/Снимок экрана 2024-11-19 132940.png b/ProjectLibrary/Resources/Снимок экрана 2024-11-19 132940.png new file mode 100644 index 0000000..42e3a3b Binary files /dev/null and b/ProjectLibrary/Resources/Снимок экрана 2024-11-19 132940.png differ