diff --git a/ProjectLibrary/ProjectLibrary/Entities/BookIssue.cs b/ProjectLibrary/ProjectLibrary/Entities/BookIssue.cs new file mode 100644 index 0000000..dda611c --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Entities/BookIssue.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLibrary.Entities; + +public class BookIssue +{ + public string Description { get; private set; } + + public int BookId { get;private set; } + + public int IssueId { get; private set; } + + public static BookIssue CreateElement(string description, int bookId, int issueId) + { + return new BookIssue + { + Description = description, + BookId = bookId, + IssueId = issueId, + }; + } + +} diff --git a/ProjectLibrary/ProjectLibrary/Entities/BookRestoration.cs b/ProjectLibrary/ProjectLibrary/Entities/BookRestoration.cs new file mode 100644 index 0000000..19037ea --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Entities/BookRestoration.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLibrary.Entities; + +public class BookRestoration +{ + public int LibrarianId { get; private set; } + + public DateTime RestorationDate { get; private set; } + + public string Description { get; private set; } = string.Empty; + + public static BookRestoration CreateOperation(int librarianId, string description) + { + return new BookRestoration + { + LibrarianId = librarianId, + RestorationDate = DateTime.Now, + Description = description, + }; + } +} diff --git a/ProjectLibrary/ProjectLibrary/Entities/DoIssue.cs b/ProjectLibrary/ProjectLibrary/Entities/DoIssue.cs deleted file mode 100644 index fbaa84e..0000000 --- a/ProjectLibrary/ProjectLibrary/Entities/DoIssue.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectLibrary.Entities; - -public class DoIssue -{ - public int Id { get;private set; } - - public DateTime IssueDate { get;private set; } - - public DateTime DueDate { get; private set; } - - public DateTime ReturnDate { get; private set; } - - public IEnumerable Issue { get; private set; } = []; - public static DoIssue CreateOperation(int id, IEnumerable issue) - { - return new DoIssue - { - Id = id, - IssueDate = DateTime.Now, - DueDate = DateTime.Now, - ReturnDate = DateTime.Now, - Issue = issue - }; - } - -} diff --git a/ProjectLibrary/ProjectLibrary/Entities/Enums/BookTopic.cs b/ProjectLibrary/ProjectLibrary/Entities/Enums/BookTopic.cs index 240f6de..0536b6c 100644 --- a/ProjectLibrary/ProjectLibrary/Entities/Enums/BookTopic.cs +++ b/ProjectLibrary/ProjectLibrary/Entities/Enums/BookTopic.cs @@ -15,5 +15,5 @@ public enum BookTopic Tale = 2, - Fantasy = 3 + Fantasy = 4 } diff --git a/ProjectLibrary/ProjectLibrary/Entities/Issue.cs b/ProjectLibrary/ProjectLibrary/Entities/Issue.cs index 1f07632..8b749ee 100644 --- a/ProjectLibrary/ProjectLibrary/Entities/Issue.cs +++ b/ProjectLibrary/ProjectLibrary/Entities/Issue.cs @@ -10,17 +10,29 @@ public class Issue { public int Id { get; private set; } + public DateTime IssueDate { get; private set; } + + public DateTime DueDate { get; private set; } + + public DateTime ReturnDate { get; private set; } + public int LibrarianId { get; private set;} public int ReaderId { get; private set; } - public static Issue CreateElement(int id, int librarianId, int readerId) + public IEnumerable BookIssue { get; private set; } = []; + + public static Issue CreateOperation(int id, int librarianId, int readerId, IEnumerable bookIssue) { return new Issue { Id = id, + IssueDate = DateTime.Now, + DueDate = DateTime.Now, + ReturnDate = DateTime.Now, LibrarianId = librarianId, - ReaderId = readerId + ReaderId = readerId, + BookIssue = bookIssue }; } } diff --git a/ProjectLibrary/ProjectLibrary/Entities/LibrarianTopic.cs b/ProjectLibrary/ProjectLibrary/Entities/LibrarianTopic.cs deleted file mode 100644 index 30a0f1e..0000000 --- a/ProjectLibrary/ProjectLibrary/Entities/LibrarianTopic.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectLibrary.Entities; - -public class LibrarianTopic -{ - public int LibrarianId { get; private set; } - - public int TopicId { get; private set; } - - public static LibrarianTopic CreateOperation(int librarianId, int topicId) - { - return new LibrarianTopic - { - LibrarianId = librarianId, - TopicId = topicId - }; - } -} diff --git a/ProjectLibrary/ProjectLibrary/FormLibrary.Designer.cs b/ProjectLibrary/ProjectLibrary/FormLibrary.Designer.cs index 7d13464..2faa2d1 100644 --- a/ProjectLibrary/ProjectLibrary/FormLibrary.Designer.cs +++ b/ProjectLibrary/ProjectLibrary/FormLibrary.Designer.cs @@ -30,13 +30,13 @@ { menuStrip1 = new MenuStrip(); справочникиToolStripMenuItem = new ToolStripMenuItem(); - библиотекариToolStripMenuItem = new ToolStripMenuItem(); - книгиToolStripMenuItem = new ToolStripMenuItem(); - читателиToolStripMenuItem = new ToolStripMenuItem(); + LibrariansToolStripMenuItem = new ToolStripMenuItem(); + BooksToolStripMenuItem = new ToolStripMenuItem(); + ReadersToolStripMenuItem = new ToolStripMenuItem(); операцииToolStripMenuItem = new ToolStripMenuItem(); - выдачаКнигиToolStripMenuItem = new ToolStripMenuItem(); + IssueToolStripMenuItem = new ToolStripMenuItem(); + BookRestorationToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); - закрепитьТемуЗаБиблиотекаремToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); SuspendLayout(); // @@ -51,41 +51,52 @@ // // справочникиToolStripMenuItem // - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { библиотекариToolStripMenuItem, книгиToolStripMenuItem, читателиToolStripMenuItem }); + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { LibrariansToolStripMenuItem, BooksToolStripMenuItem, ReadersToolStripMenuItem }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Size = new Size(94, 20); справочникиToolStripMenuItem.Text = "Справочники"; // - // библиотекариToolStripMenuItem + // LibrariansToolStripMenuItem // - библиотекариToolStripMenuItem.Name = "библиотекариToolStripMenuItem"; - библиотекариToolStripMenuItem.Size = new Size(180, 22); - библиотекариToolStripMenuItem.Text = "Библиотекари"; + LibrariansToolStripMenuItem.Name = "LibrariansToolStripMenuItem"; + LibrariansToolStripMenuItem.Size = new Size(180, 22); + LibrariansToolStripMenuItem.Text = "Библиотекари"; + LibrariansToolStripMenuItem.Click += LibrariansToolStripMenuItem_Click; // - // книгиToolStripMenuItem + // BooksToolStripMenuItem // - книгиToolStripMenuItem.Name = "книгиToolStripMenuItem"; - книгиToolStripMenuItem.Size = new Size(180, 22); - книгиToolStripMenuItem.Text = "Книги"; + BooksToolStripMenuItem.Name = "BooksToolStripMenuItem"; + BooksToolStripMenuItem.Size = new Size(180, 22); + BooksToolStripMenuItem.Text = "Книги"; + BooksToolStripMenuItem.Click += BooksToolStripMenuItem_Click; // - // читателиToolStripMenuItem + // ReadersToolStripMenuItem // - читателиToolStripMenuItem.Name = "читателиToolStripMenuItem"; - читателиToolStripMenuItem.Size = new Size(180, 22); - читателиToolStripMenuItem.Text = "Читатели"; + ReadersToolStripMenuItem.Name = "ReadersToolStripMenuItem"; + ReadersToolStripMenuItem.Size = new Size(180, 22); + ReadersToolStripMenuItem.Text = "Читатели"; + ReadersToolStripMenuItem.Click += ReadersToolStripMenuItem_Click; // // операцииToolStripMenuItem // - операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { выдачаКнигиToolStripMenuItem, закрепитьТемуЗаБиблиотекаремToolStripMenuItem }); + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { IssueToolStripMenuItem, BookRestorationToolStripMenuItem }); операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; операцииToolStripMenuItem.Size = new Size(75, 20); операцииToolStripMenuItem.Text = "Операции"; // - // выдачаКнигиToolStripMenuItem + // IssueToolStripMenuItem // - выдачаКнигиToolStripMenuItem.Name = "выдачаКнигиToolStripMenuItem"; - выдачаКнигиToolStripMenuItem.Size = new Size(264, 22); - выдачаКнигиToolStripMenuItem.Text = "Выдача книги"; + IssueToolStripMenuItem.Name = "IssueToolStripMenuItem"; + IssueToolStripMenuItem.Size = new Size(180, 22); + IssueToolStripMenuItem.Text = "Выдача книги"; + IssueToolStripMenuItem.Click += IssueToolStripMenuItem_Click; + // + // BookRestorationToolStripMenuItem + // + BookRestorationToolStripMenuItem.Name = "BookRestorationToolStripMenuItem"; + BookRestorationToolStripMenuItem.Size = new Size(180, 22); + BookRestorationToolStripMenuItem.Text = "Реставрация книг"; + BookRestorationToolStripMenuItem.Click += BookRestorationToolStripMenuItem_Click; // // отчетыToolStripMenuItem // @@ -93,12 +104,6 @@ отчетыToolStripMenuItem.Size = new Size(60, 20); отчетыToolStripMenuItem.Text = "Отчеты"; // - // закрепитьТемуЗаБиблиотекаремToolStripMenuItem - // - закрепитьТемуЗаБиблиотекаремToolStripMenuItem.Name = "закрепитьТемуЗаБиблиотекаремToolStripMenuItem"; - закрепитьТемуЗаБиблиотекаремToolStripMenuItem.Size = new Size(264, 22); - закрепитьТемуЗаБиблиотекаремToolStripMenuItem.Text = "Закрепить тему за библиотекарем"; - // // FormLibrary // AutoScaleDimensions = new SizeF(7F, 15F); @@ -121,12 +126,12 @@ private MenuStrip menuStrip1; private ToolStripMenuItem справочникиToolStripMenuItem; - private ToolStripMenuItem библиотекариToolStripMenuItem; - private ToolStripMenuItem книгиToolStripMenuItem; - private ToolStripMenuItem читателиToolStripMenuItem; + private ToolStripMenuItem LibrariansToolStripMenuItem; + private ToolStripMenuItem BooksToolStripMenuItem; + private ToolStripMenuItem ReadersToolStripMenuItem; private ToolStripMenuItem операцииToolStripMenuItem; - private ToolStripMenuItem выдачаКнигиToolStripMenuItem; + private ToolStripMenuItem IssueToolStripMenuItem; private ToolStripMenuItem отчетыToolStripMenuItem; - private ToolStripMenuItem закрепитьТемуЗаБиблиотекаремToolStripMenuItem; + private ToolStripMenuItem BookRestorationToolStripMenuItem; } } diff --git a/ProjectLibrary/ProjectLibrary/FormLibrary.cs b/ProjectLibrary/ProjectLibrary/FormLibrary.cs index 0c8abff..8fd3847 100644 --- a/ProjectLibrary/ProjectLibrary/FormLibrary.cs +++ b/ProjectLibrary/ProjectLibrary/FormLibrary.cs @@ -1,10 +1,82 @@ +using ProjectLibrary.Forms; +using System.ComponentModel; +using Unity; + namespace ProjectLibrary { public partial class FormLibrary : Form { - public FormLibrary() + private readonly IUnityContainer _container; + + public FormLibrary(IUnityContainer container) { InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + } + + private void LibrariansToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void BooksToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ReadersToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void IssueToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void BookRestorationToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } } diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.Designer.cs b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.Designer.cs new file mode 100644 index 0000000..c93ae72 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.Designer.cs @@ -0,0 +1,159 @@ +namespace ProjectLibrary.Forms +{ + partial class FormBookRestoration + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + label1 = new Label(); + buttonCancel = new Button(); + buttonSave = new Button(); + label2 = new Label(); + textBoxDescription = new TextBox(); + dataGridView = new DataGridView(); + groupBox = new GroupBox(); + ColumnLibrarian = new DataGridViewComboBoxColumn(); + ColumnBook = new DataGridViewComboBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + groupBox.SuspendLayout(); + SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(24, 30); + label1.Name = "label1"; + label1.Size = new Size(39, 15); + label1.TabIndex = 5; + label1.Text = "Книга"; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(394, 325); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 9; + buttonCancel.Text = "Отменить"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonSave.Location = new Point(24, 325); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 8; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(24, 186); + label2.Name = "label2"; + label2.Size = new Size(97, 15); + label2.TabIndex = 10; + label2.Text = "Описание работ"; + // + // textBoxDescription + // + textBoxDescription.Location = new Point(24, 215); + textBoxDescription.Multiline = true; + textBoxDescription.Name = "textBoxDescription"; + textBoxDescription.Size = new Size(445, 98); + textBoxDescription.TabIndex = 11; + // + // dataGridView + // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnLibrarian, ColumnBook }); + dataGridView.Location = new Point(6, 18); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(415, 147); + dataGridView.TabIndex = 0; + // + // groupBox + // + groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(69, 12); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(427, 171); + groupBox.TabIndex = 12; + groupBox.TabStop = false; + groupBox.Text = "groupBox1"; + // + // ColumnLibrarian + // + ColumnLibrarian.HeaderText = "Библиотекарь"; + ColumnLibrarian.Name = "ColumnLibrarian"; + // + // ColumnBook + // + ColumnBook.HeaderText = "Книга"; + ColumnBook.Name = "ColumnBook"; + // + // FormBookRestoration + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(508, 360); + Controls.Add(groupBox); + Controls.Add(textBoxDescription); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Name = "FormBookRestoration"; + Text = "FormBookRestoration"; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + groupBox.ResumeLayout(false); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private Label label1; + private Button buttonCancel; + private Button buttonSave; + private Label label2; + private TextBox textBoxDescription; + private DataGridView dataGridView; + private DataGridViewComboBoxColumn ColumnLibrarian; + private DataGridViewComboBoxColumn ColumnBook; + private GroupBox groupBox; + } +} \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.cs b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.cs new file mode 100644 index 0000000..3e4ea5d --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.cs @@ -0,0 +1,54 @@ +using ProjectLibrary.Entities; +using ProjectLibrary.Entities.Enums; +using ProjectLibrary.Repositories; +using ProjectLibrary.Repositories.Implementations; +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 ProjectLibrary.Forms +{ + public partial class FormBookRestoration : Form + { + private readonly IBookRestorationRepository _bookRestorationRepository; + + + + public FormBookRestoration(IBookRestorationRepository bookRestorationRepository, IBookRepository bookRepository, ILibrarianRepository librarianRepository) + { + InitializeComponent(); + _bookRestorationRepository = bookRestorationRepository ?? throw new ArgumentNullException(nameof(bookRestorationRepository)); + ColumnBook.DataSource = bookRepository.ReadBooks(); + ColumnBook.DisplayMember = "Title"; + ColumnLibrarian.DataSource = librarianRepository.ReadLibrarians(); + ColumnLibrarian.DisplayMember = "Name"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (dataGridView.RowCount < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + _bookRestorationRepository.CreateBookRestoration(BookRestoration.CreateOperation(Convert.ToInt32(ColumnLibrarian.ValueMember), textBoxDescription.Text)); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + } +} diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.resx b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.resx new file mode 100644 index 0000000..b8b1146 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestoration.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.Designer.cs b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.Designer.cs new file mode 100644 index 0000000..66f0fb4 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.Designer.cs @@ -0,0 +1,111 @@ +namespace ProjectLibrary.Forms +{ + partial class FormBookRestorations + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + panel1 = new Panel(); + buttonDel = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel1.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(656, 450); + dataGridView.TabIndex = 3; + // + // panel1 + // + panel1.Controls.Add(buttonDel); + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(656, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(144, 450); + panel1.TabIndex = 2; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.minus; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(33, 119); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(75, 60); + buttonDel.TabIndex = 1; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.plus; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(33, 36); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 63); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // FormBookRestorations + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormBookRestorations"; + Text = "FormBookRestorations"; + Load += FormBookRestorations_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel1.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel1; + private Button buttonDel; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.cs b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.cs new file mode 100644 index 0000000..91d1ee4 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.cs @@ -0,0 +1,92 @@ +using ProjectLibrary.Repositories; +using ProjectLibrary.Repositories.Implementations; +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; +using Unity; + +namespace ProjectLibrary.Forms +{ + public partial class FormBookRestorations : Form + { + private readonly IUnityContainer _container; + + private readonly IBookRestorationRepository _bookRestorationRepository; + + public FormBookRestorations(IUnityContainer container, IBookRestorationRepository bookRestorationRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _bookRestorationRepository = bookRestorationRepository ?? throw new ArgumentNullException(nameof(bookRestorationRepository)); + } + + private void FormBookRestorations_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _bookRestorationRepository.DeleteBookRestoration(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _bookRestorationRepository.ReadBookRestorations(); + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.resx b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormBookRestorations.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/Forms/FormIssue.Designer.cs b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.Designer.cs new file mode 100644 index 0000000..890743e --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.Designer.cs @@ -0,0 +1,149 @@ +namespace ProjectLibrary.Forms +{ + partial class FormIssue + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + label1 = new Label(); + comboBoxSelectLibrarian = new ComboBox(); + groupBox = new GroupBox(); + dataGridView = new DataGridView(); + ColumnReader = new DataGridViewComboBoxColumn(); + ColumnBook = new DataGridViewComboBoxColumn(); + buttonSave = new Button(); + buttonCancel = new Button(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(30, 25); + label1.Name = "label1"; + label1.Size = new Size(85, 15); + label1.TabIndex = 0; + label1.Text = "Библиотекарь"; + // + // comboBoxSelectLibrarian + // + comboBoxSelectLibrarian.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxSelectLibrarian.FormattingEnabled = true; + comboBoxSelectLibrarian.Location = new Point(204, 22); + comboBoxSelectLibrarian.Name = "comboBoxSelectLibrarian"; + comboBoxSelectLibrarian.Size = new Size(121, 23); + comboBoxSelectLibrarian.TabIndex = 1; + // + // groupBox + // + groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(30, 63); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(357, 259); + groupBox.TabIndex = 2; + groupBox.TabStop = false; + groupBox.Text = "groupBox1"; + // + // dataGridView + // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnReader, ColumnBook }); + dataGridView.Location = new Point(6, 22); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(336, 221); + dataGridView.TabIndex = 0; + // + // ColumnReader + // + ColumnReader.HeaderText = "Читатель"; + ColumnReader.Name = "ColumnReader"; + // + // ColumnBook + // + ColumnBook.HeaderText = "Книга"; + ColumnBook.Name = "ColumnBook"; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonSave.Location = new Point(30, 328); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 3; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(297, 328); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 4; + buttonCancel.Text = "Отменить"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormIssue + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(397, 371); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(groupBox); + Controls.Add(comboBoxSelectLibrarian); + Controls.Add(label1); + Name = "FormIssue"; + Text = "Выдача книги"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label label1; + private ComboBox comboBoxSelectLibrarian; + private GroupBox groupBox; + private DataGridView dataGridView; + private DataGridViewComboBoxColumn ColumnReader; + private DataGridViewComboBoxColumn ColumnBook; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormIssue.cs b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.cs new file mode 100644 index 0000000..7312d64 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.cs @@ -0,0 +1,75 @@ +using ProjectLibrary.Entities; +using ProjectLibrary.Repositories; +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 ProjectLibrary.Forms +{ + public partial class FormIssue : Form + { + private readonly IIssueRepository _issueRepository; + + + public FormIssue(IIssueRepository issueRepository, ILibrarianRepository librarianRepository, IBookRepository bookRepository, IReaderRepository readerRepository) + { + InitializeComponent(); + _issueRepository = issueRepository ?? throw new ArgumentNullException(nameof(issueRepository)); + comboBoxSelectLibrarian.DataSource = librarianRepository.ReadLibrarians(); + comboBoxSelectLibrarian.DisplayMember = "Name"; + comboBoxSelectLibrarian.ValueMember = "Id"; + ColumnReader.DataSource = readerRepository.ReadReaders(); + ColumnReader.DisplayMember = "Name"; + ColumnReader.ValueMember = "Id"; + ColumnBook.DataSource = bookRepository.ReadBooks(); + ColumnBook.DisplayMember = "Title"; + ColumnReader.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (dataGridView.RowCount < 1 || + comboBoxSelectLibrarian.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + _issueRepository.CreateIssue(Issue.CreateOperation(0, (int)comboBoxSelectLibrarian.SelectedValue!, Convert.ToInt32(ColumnReader.ValueMember), + CreateListBookIssueFromDataGrid())); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListBookIssueFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["ColumnReader"].Value == null || + row.Cells["ColumnBook"].Value == null) + { + continue; + } + list.Add(BookIssue.CreateElement(string.Empty, + Convert.ToInt32(row.Cells["ColumnReader"].Value), + Convert.ToInt32(row.Cells["ColumnBook"].Value))); + } + return list; + } + + } +} diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormIssue.resx b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.resx new file mode 100644 index 0000000..ae7c145 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssue.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormIssues.Designer.cs b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.Designer.cs new file mode 100644 index 0000000..234a3ca --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.Designer.cs @@ -0,0 +1,114 @@ +namespace ProjectLibrary.Forms +{ + partial class FormIssues + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + panel1 = new Panel(); + buttonUpd = new Button(); + buttonDel = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel1.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(656, 450); + dataGridView.TabIndex = 3; + // + // panel1 + // + panel1.Controls.Add(buttonUpd); + panel1.Controls.Add(buttonDel); + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(656, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(144, 450); + panel1.TabIndex = 2; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.minus; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(33, 119); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(75, 60); + buttonDel.TabIndex = 1; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.plus; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(33, 36); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 63); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // FormIssues + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormIssues"; + Text = "FormIssues"; + Load += FormIssues_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel1.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel1; + private Button buttonUpd; + private Button buttonDel; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormIssues.cs b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.cs new file mode 100644 index 0000000..71840fa --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.cs @@ -0,0 +1,95 @@ +using ProjectLibrary.Repositories; +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; +using System.Xml.Linq; +using Unity; + +namespace ProjectLibrary.Forms +{ + public partial class FormIssues : Form + { + private readonly IUnityContainer _container; + + private readonly IIssueRepository _issueRepository; + + public FormIssues(IUnityContainer container, IIssueRepository issueRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _issueRepository = issueRepository ?? throw new ArgumentNullException(nameof(issueRepository)); + } + + private void FormIssues_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _issueRepository.DeleteIssue(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + private void LoadList() => dataGridView.DataSource = _issueRepository.ReadIssue(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectLibrary/ProjectLibrary/Forms/FormIssues.resx b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Forms/FormIssues.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/Program.cs b/ProjectLibrary/ProjectLibrary/Program.cs index da391c5..b699bb0 100644 --- a/ProjectLibrary/ProjectLibrary/Program.cs +++ b/ProjectLibrary/ProjectLibrary/Program.cs @@ -23,9 +23,10 @@ namespace ProjectLibrary { var container = new UnityContainer(); container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); return container; } } diff --git a/ProjectLibrary/ProjectLibrary/Repositories/IBookRestorationRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/IBookRestorationRepository.cs new file mode 100644 index 0000000..04e1db3 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Repositories/IBookRestorationRepository.cs @@ -0,0 +1,15 @@ +using ProjectLibrary.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLibrary.Repositories; + +public interface IBookRestorationRepository +{ + IEnumerable ReadBookRestorations(int? librarianId = null, string? description = null, DateTime? dateFrom = null, DateTime? dateTo = null); + void CreateBookRestoration(BookRestoration bookRestoration); + void DeleteBookRestoration(int id); +} diff --git a/ProjectLibrary/ProjectLibrary/Repositories/IDoIssueRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/IDoIssueRepository.cs deleted file mode 100644 index 1699fca..0000000 --- a/ProjectLibrary/ProjectLibrary/Repositories/IDoIssueRepository.cs +++ /dev/null @@ -1,15 +0,0 @@ -using ProjectLibrary.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectLibrary.Repositories; - -public interface IDoIssueRepository -{ - IEnumerable ReadDoIssue(int? id, DateTime? dateFrom = null, DateTime? dateTo = null); - void CreateDoIssue(DoIssue doIssue); - void DeleteDoIssue(int id); -} diff --git a/ProjectLibrary/ProjectLibrary/Repositories/IIssueRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/IIssueRepository.cs new file mode 100644 index 0000000..46437b2 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Repositories/IIssueRepository.cs @@ -0,0 +1,15 @@ +using ProjectLibrary.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLibrary.Repositories; + +public interface IIssueRepository +{ + IEnumerable ReadIssue(int? id=null, int? librarianId = null, int? readerId = null, DateTime? dateFrom = null, DateTime? dateTo = null); + void CreateIssue(Issue issue); + void DeleteIssue(int id); +} diff --git a/ProjectLibrary/ProjectLibrary/Repositories/ILibrarianTopic.cs b/ProjectLibrary/ProjectLibrary/Repositories/ILibrarianTopic.cs deleted file mode 100644 index cbf9657..0000000 --- a/ProjectLibrary/ProjectLibrary/Repositories/ILibrarianTopic.cs +++ /dev/null @@ -1,21 +0,0 @@ -using ProjectLibrary.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectLibrary.Repositories; - -public interface ILibrarianTopicRepository -{ - IEnumerable ReadLibrarianTopics(); - - LibrarianTopic ReadLibrarianTopicById(int id); - - void CreateLibrarianTopic(LibrarianTopic librarianTopic); - - void UpdateLibrarianTopic(LibrarianTopic librarianTopic); - - void DeleteLibrarianTopic(int id); -} diff --git a/ProjectLibrary/ProjectLibrary/Repositories/Implementations/BookRestorationRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/Implementations/BookRestorationRepository.cs new file mode 100644 index 0000000..bd6bb35 --- /dev/null +++ b/ProjectLibrary/ProjectLibrary/Repositories/Implementations/BookRestorationRepository.cs @@ -0,0 +1,24 @@ +using ProjectLibrary.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLibrary.Repositories.Implementations; + +public class BookRestorationRepository : IBookRestorationRepository +{ + public void CreateBookRestoration(BookRestoration bookRestoration) + { + } + + public void DeleteBookRestoration(int id) + { + } + + public IEnumerable ReadBookRestorations(int? librarianId, string? description, DateTime? dateFrom = null, DateTime? dateTo = null) + { + return []; + } +} diff --git a/ProjectLibrary/ProjectLibrary/Repositories/Implementations/DoIssueRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/Implementations/IssueRepository.cs similarity index 50% rename from ProjectLibrary/ProjectLibrary/Repositories/Implementations/DoIssueRepository.cs rename to ProjectLibrary/ProjectLibrary/Repositories/Implementations/IssueRepository.cs index bdb705a..13eb810 100644 --- a/ProjectLibrary/ProjectLibrary/Repositories/Implementations/DoIssueRepository.cs +++ b/ProjectLibrary/ProjectLibrary/Repositories/Implementations/IssueRepository.cs @@ -7,17 +7,17 @@ using System.Threading.Tasks; namespace ProjectLibrary.Repositories.Implementations; -public class DoIssueRepository : IDoIssueRepository +public class IssueRepository : IIssueRepository { - public void CreateDoIssue(DoIssue doissue) + public void CreateIssue(Issue issue) { } - public void DeleteDoIssue(int id) + public void DeleteIssue(int id) { } - public IEnumerable ReadDoIssue(int? id, DateTime? dateFrom = null, DateTime? dateTo = null) + public IEnumerable ReadIssue(int? id, int? librarianId, int? readerId, DateTime? dateFrom = null, DateTime? dateTo = null) { return []; } diff --git a/ProjectLibrary/ProjectLibrary/Repositories/Implementations/LibrarianTopicRepository.cs b/ProjectLibrary/ProjectLibrary/Repositories/Implementations/LibrarianTopicRepository.cs deleted file mode 100644 index 4e783fd..0000000 --- a/ProjectLibrary/ProjectLibrary/Repositories/Implementations/LibrarianTopicRepository.cs +++ /dev/null @@ -1,33 +0,0 @@ -using ProjectLibrary.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectLibrary.Repositories.Implementations; - -public class LibrarianTopicRepository : ILibrarianTopicRepository -{ - public void CreateLibrarianTopic(LibrarianTopic librarianTopic) - { - } - - public void DeleteLibrarianTopic(int id) - { - } - - public LibrarianTopic ReadLibrarianTopicById(int id) - { - return LibrarianTopic.CreateOperation(0,0); - } - - public IEnumerable ReadLibrarianTopics() - { - return []; - } - - public void UpdateLibrarianTopic(LibrarianTopic librarianTopic) - { - } -}