WIP : check 'Update' related forms one more time
190
ProjLibrary/ProjLibrary/AdditionalForms/BookF.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class BookF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
Titlelabel = new Label();
|
||||||
|
Authorlabel = new Label();
|
||||||
|
PrintYlabel = new Label();
|
||||||
|
Genrelabel = new Label();
|
||||||
|
Statlabel = new Label();
|
||||||
|
TitleTb = new TextBox();
|
||||||
|
AuthorTb = new TextBox();
|
||||||
|
YearNud = new NumericUpDown();
|
||||||
|
SaveBtn = new Button();
|
||||||
|
DiscardBtn = new Button();
|
||||||
|
StatusCbox = new ComboBox();
|
||||||
|
GenresChBoxList = new CheckedListBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)YearNud).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// Titlelabel
|
||||||
|
//
|
||||||
|
Titlelabel.AutoSize = true;
|
||||||
|
Titlelabel.Location = new Point(27, 32);
|
||||||
|
Titlelabel.Name = "Titlelabel";
|
||||||
|
Titlelabel.Size = new Size(48, 25);
|
||||||
|
Titlelabel.TabIndex = 1;
|
||||||
|
Titlelabel.Text = "Title:";
|
||||||
|
//
|
||||||
|
// Authorlabel
|
||||||
|
//
|
||||||
|
Authorlabel.AutoSize = true;
|
||||||
|
Authorlabel.Location = new Point(27, 68);
|
||||||
|
Authorlabel.Name = "Authorlabel";
|
||||||
|
Authorlabel.Size = new Size(71, 25);
|
||||||
|
Authorlabel.TabIndex = 2;
|
||||||
|
Authorlabel.Text = "Author:";
|
||||||
|
//
|
||||||
|
// PrintYlabel
|
||||||
|
//
|
||||||
|
PrintYlabel.AutoSize = true;
|
||||||
|
PrintYlabel.Location = new Point(25, 104);
|
||||||
|
PrintYlabel.Name = "PrintYlabel";
|
||||||
|
PrintYlabel.Size = new Size(112, 25);
|
||||||
|
PrintYlabel.TabIndex = 3;
|
||||||
|
PrintYlabel.Text = "Year of print:";
|
||||||
|
//
|
||||||
|
// Genrelabel
|
||||||
|
//
|
||||||
|
Genrelabel.AutoSize = true;
|
||||||
|
Genrelabel.Location = new Point(27, 185);
|
||||||
|
Genrelabel.Name = "Genrelabel";
|
||||||
|
Genrelabel.Size = new Size(70, 25);
|
||||||
|
Genrelabel.TabIndex = 4;
|
||||||
|
Genrelabel.Text = "Genres:";
|
||||||
|
//
|
||||||
|
// Statlabel
|
||||||
|
//
|
||||||
|
Statlabel.AutoSize = true;
|
||||||
|
Statlabel.Location = new Point(27, 147);
|
||||||
|
Statlabel.Name = "Statlabel";
|
||||||
|
Statlabel.Size = new Size(126, 25);
|
||||||
|
Statlabel.TabIndex = 5;
|
||||||
|
Statlabel.Text = "Current status:";
|
||||||
|
//
|
||||||
|
// TitleTb
|
||||||
|
//
|
||||||
|
TitleTb.Location = new Point(163, 29);
|
||||||
|
TitleTb.Name = "TitleTb";
|
||||||
|
TitleTb.Size = new Size(452, 31);
|
||||||
|
TitleTb.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// AuthorTb
|
||||||
|
//
|
||||||
|
AuthorTb.Location = new Point(163, 65);
|
||||||
|
AuthorTb.Name = "AuthorTb";
|
||||||
|
AuthorTb.Size = new Size(452, 31);
|
||||||
|
AuthorTb.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// YearNud
|
||||||
|
//
|
||||||
|
YearNud.Location = new Point(163, 102);
|
||||||
|
YearNud.Maximum = new decimal(new int[] { 2025, 0, 0, 0 });
|
||||||
|
YearNud.Minimum = new decimal(new int[] { 1980, 0, 0, 0 });
|
||||||
|
YearNud.Name = "YearNud";
|
||||||
|
YearNud.Size = new Size(127, 31);
|
||||||
|
YearNud.TabIndex = 9;
|
||||||
|
YearNud.Value = new decimal(new int[] { 1980, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// SaveBtn
|
||||||
|
//
|
||||||
|
SaveBtn.Location = new Point(27, 241);
|
||||||
|
SaveBtn.Name = "SaveBtn";
|
||||||
|
SaveBtn.Size = new Size(110, 68);
|
||||||
|
SaveBtn.TabIndex = 13;
|
||||||
|
SaveBtn.Text = "Save";
|
||||||
|
SaveBtn.UseVisualStyleBackColor = true;
|
||||||
|
SaveBtn.Click += SaveBtn_Click;
|
||||||
|
//
|
||||||
|
// DiscardBtn
|
||||||
|
//
|
||||||
|
DiscardBtn.Location = new Point(27, 315);
|
||||||
|
DiscardBtn.Name = "DiscardBtn";
|
||||||
|
DiscardBtn.Size = new Size(110, 70);
|
||||||
|
DiscardBtn.TabIndex = 14;
|
||||||
|
DiscardBtn.Text = "Discard";
|
||||||
|
DiscardBtn.UseVisualStyleBackColor = true;
|
||||||
|
DiscardBtn.Click += DiscardBtn_Click;
|
||||||
|
//
|
||||||
|
// StatusCbox
|
||||||
|
//
|
||||||
|
StatusCbox.FormattingEnabled = true;
|
||||||
|
StatusCbox.Location = new Point(163, 139);
|
||||||
|
StatusCbox.Name = "StatusCbox";
|
||||||
|
StatusCbox.Size = new Size(211, 33);
|
||||||
|
StatusCbox.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// GenresChBoxList
|
||||||
|
//
|
||||||
|
GenresChBoxList.FormattingEnabled = true;
|
||||||
|
GenresChBoxList.Location = new Point(163, 185);
|
||||||
|
GenresChBoxList.Name = "GenresChBoxList";
|
||||||
|
GenresChBoxList.Size = new Size(211, 200);
|
||||||
|
GenresChBoxList.TabIndex = 16;
|
||||||
|
//
|
||||||
|
// BookF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(647, 412);
|
||||||
|
Controls.Add(GenresChBoxList);
|
||||||
|
Controls.Add(StatusCbox);
|
||||||
|
Controls.Add(DiscardBtn);
|
||||||
|
Controls.Add(SaveBtn);
|
||||||
|
Controls.Add(YearNud);
|
||||||
|
Controls.Add(AuthorTb);
|
||||||
|
Controls.Add(TitleTb);
|
||||||
|
Controls.Add(Statlabel);
|
||||||
|
Controls.Add(Genrelabel);
|
||||||
|
Controls.Add(PrintYlabel);
|
||||||
|
Controls.Add(Authorlabel);
|
||||||
|
Controls.Add(Titlelabel);
|
||||||
|
Name = "BookF";
|
||||||
|
Text = "Book";
|
||||||
|
((System.ComponentModel.ISupportInitialize)YearNud).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private Label Titlelabel;
|
||||||
|
private Label Authorlabel;
|
||||||
|
private Label PrintYlabel;
|
||||||
|
private Label Genrelabel;
|
||||||
|
private Label Statlabel;
|
||||||
|
private TextBox IDtb;
|
||||||
|
private TextBox TitleTb;
|
||||||
|
private TextBox AuthorTb;
|
||||||
|
private NumericUpDown YearNud;
|
||||||
|
private Button SaveBtn;
|
||||||
|
private Button DiscardBtn;
|
||||||
|
private ComboBox StatusCbox;
|
||||||
|
private CheckedListBox GenresChBoxList;
|
||||||
|
}
|
||||||
|
}
|
107
ProjLibrary/ProjLibrary/AdditionalForms/BookF.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
using ProjLibrary.Entities.Enums;
|
||||||
|
using ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class BookF : Form
|
||||||
|
{
|
||||||
|
private readonly IBookRep _bookRepository;
|
||||||
|
|
||||||
|
private int? _bookID;
|
||||||
|
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var book = _bookRepository.GetBookByID(value);
|
||||||
|
|
||||||
|
if (book == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(book));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Genres elem in Enum.GetValues(typeof(Genres)))
|
||||||
|
{
|
||||||
|
if ((elem & book.GenreID) != 0)
|
||||||
|
{
|
||||||
|
GenresChBoxList.SetItemChecked(
|
||||||
|
GenresChBoxList.Items.IndexOf(elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TitleTb.Text = book.Title;
|
||||||
|
AuthorTb.Text = book.Author;
|
||||||
|
YearNud.Value = book.PublishYear;
|
||||||
|
|
||||||
|
StatusCbox.SelectedItem = book.Status;
|
||||||
|
|
||||||
|
_bookID = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error : wrong data ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookF(IBookRep bookR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_bookRepository = bookR ?? throw new ArgumentNullException(nameof(bookR));
|
||||||
|
|
||||||
|
StatusCbox.DataSource = Enum.GetValues(typeof(BookStat));
|
||||||
|
|
||||||
|
foreach (var elem in Enum.GetValues(typeof(Genres)))
|
||||||
|
{
|
||||||
|
GenresChBoxList.Items.Add(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(TitleTb.Text)
|
||||||
|
|| GenresChBoxList.CheckedItems.Count == 0
|
||||||
|
|| StatusCbox.SelectedIndex < 1)
|
||||||
|
{
|
||||||
|
throw new Exception("[ Blank spaces were left, not enough information ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_bookID.HasValue)
|
||||||
|
{
|
||||||
|
_bookRepository.UpdateBook(CreateBook(_bookID.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bookRepository.AddBook(CreateBook(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error : while saving ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DiscardBtn_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Book CreateBook(int id)
|
||||||
|
{
|
||||||
|
Genres genre = Genres.None;
|
||||||
|
foreach (var elem in GenresChBoxList.CheckedItems)
|
||||||
|
{
|
||||||
|
genre |= (Genres) elem;
|
||||||
|
}
|
||||||
|
return Book.AddBook(id, TitleTb.Text, AuthorTb.Text,
|
||||||
|
Convert.ToInt32(YearNud.Value), genre, (BookStat)StatusCbox.SelectedItem!);
|
||||||
|
}
|
||||||
|
// [!] Genres genre, BookStat status [!]
|
||||||
|
}
|
||||||
|
}
|
120
ProjLibrary/ProjLibrary/AdditionalForms/BookF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
134
ProjLibrary/ProjLibrary/AdditionalForms/BookListF.Designer.cs
generated
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class BookListF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
PanelWithOperations = new Panel();
|
||||||
|
DelBtn = new Button();
|
||||||
|
AddBtn = new Button();
|
||||||
|
UpdBtn = new Button();
|
||||||
|
DataGV = new DataGridView();
|
||||||
|
PanelWithOperations.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// PanelWithOperations
|
||||||
|
//
|
||||||
|
PanelWithOperations.BackColor = Color.Transparent;
|
||||||
|
PanelWithOperations.Controls.Add(DelBtn);
|
||||||
|
PanelWithOperations.Controls.Add(AddBtn);
|
||||||
|
PanelWithOperations.Controls.Add(UpdBtn);
|
||||||
|
PanelWithOperations.Dock = DockStyle.Right;
|
||||||
|
PanelWithOperations.Location = new Point(623, 0);
|
||||||
|
PanelWithOperations.Name = "PanelWithOperations";
|
||||||
|
PanelWithOperations.Size = new Size(154, 396);
|
||||||
|
PanelWithOperations.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// DelBtn
|
||||||
|
//
|
||||||
|
DelBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
DelBtn.BackgroundImage = Properties.Resources.DelImg;
|
||||||
|
DelBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
DelBtn.ForeColor = Color.Transparent;
|
||||||
|
DelBtn.Location = new Point(23, 207);
|
||||||
|
DelBtn.Name = "DelBtn";
|
||||||
|
DelBtn.Size = new Size(78, 71);
|
||||||
|
DelBtn.TabIndex = 4;
|
||||||
|
DelBtn.UseVisualStyleBackColor = false;
|
||||||
|
DelBtn.Click += DelBtn_Click;
|
||||||
|
//
|
||||||
|
// AddBtn
|
||||||
|
//
|
||||||
|
AddBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
AddBtn.BackgroundImage = Properties.Resources.AddImg;
|
||||||
|
AddBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
AddBtn.ForeColor = Color.Transparent;
|
||||||
|
AddBtn.Location = new Point(23, 53);
|
||||||
|
AddBtn.Name = "AddBtn";
|
||||||
|
AddBtn.Size = new Size(78, 71);
|
||||||
|
AddBtn.TabIndex = 3;
|
||||||
|
AddBtn.UseVisualStyleBackColor = false;
|
||||||
|
AddBtn.Click += AddBtn_Click;
|
||||||
|
//
|
||||||
|
// UpdBtn
|
||||||
|
//
|
||||||
|
UpdBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
UpdBtn.BackgroundImage = Properties.Resources.OperationImg;
|
||||||
|
UpdBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
UpdBtn.ForeColor = Color.Transparent;
|
||||||
|
UpdBtn.Location = new Point(23, 130);
|
||||||
|
UpdBtn.Name = "UpdBtn";
|
||||||
|
UpdBtn.Size = new Size(78, 71);
|
||||||
|
UpdBtn.TabIndex = 1;
|
||||||
|
UpdBtn.UseVisualStyleBackColor = false;
|
||||||
|
UpdBtn.Click += UpdBtn_Click;
|
||||||
|
//
|
||||||
|
// DataGV
|
||||||
|
//
|
||||||
|
DataGV.AllowUserToResizeColumns = false;
|
||||||
|
DataGV.AllowUserToResizeRows = false;
|
||||||
|
DataGV.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
DataGV.BackgroundColor = Color.DarkSlateBlue;
|
||||||
|
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
DataGV.GridColor = Color.GreenYellow;
|
||||||
|
DataGV.Location = new Point(25, 101);
|
||||||
|
DataGV.Name = "DataGV";
|
||||||
|
DataGV.RowHeadersVisible = false;
|
||||||
|
DataGV.RowHeadersWidth = 62;
|
||||||
|
DataGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
DataGV.Size = new Size(583, 259);
|
||||||
|
DataGV.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// BookListF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.BookListFrameCover;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(777, 396);
|
||||||
|
Controls.Add(DataGV);
|
||||||
|
Controls.Add(PanelWithOperations);
|
||||||
|
DoubleBuffered = true;
|
||||||
|
Name = "BookListF";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "BookListF";
|
||||||
|
Load += BookListF_Load;
|
||||||
|
PanelWithOperations.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel PanelWithOperations;
|
||||||
|
private Button AddBtn;
|
||||||
|
private Button UpdBtn;
|
||||||
|
private Button DelBtn;
|
||||||
|
private DataGridView DataGV;
|
||||||
|
}
|
||||||
|
}
|
103
ProjLibrary/ProjLibrary/AdditionalForms/BookListF.cs
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
using ProjLibrary.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class BookListF : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly IBookRep _bookR;
|
||||||
|
|
||||||
|
public BookListF(IUnityContainer container, IBookRep bookR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_bookR = bookR ?? throw new ArgumentNullException(nameof(bookR));
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BookListF_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while saving ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<BookF>().ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while adding element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var findID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<BookF>();
|
||||||
|
form.ID = findID;
|
||||||
|
form.ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while updating element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DelBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var foundID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Remove element?", "Deleting", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_bookR.DeleteBook(foundID);
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while removing element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadList() =>
|
||||||
|
DataGV.DataSource = _bookR.GetBookList();
|
||||||
|
|
||||||
|
private bool GetiDFromRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (DataGV.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("[ Error : element doesn't exist ]", "<ERROR>",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjLibrary/ProjLibrary/AdditionalForms/BookListF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
112
ProjLibrary/ProjLibrary/AdditionalForms/CardUpdatesF.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class CardUpdatesF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
DelBtn = new Button();
|
||||||
|
AddBtn = new Button();
|
||||||
|
DataGV = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BackColor = Color.Transparent;
|
||||||
|
panel1.Controls.Add(DelBtn);
|
||||||
|
panel1.Controls.Add(AddBtn);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(546, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(163, 360);
|
||||||
|
panel1.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// DelBtn
|
||||||
|
//
|
||||||
|
DelBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
DelBtn.BackgroundImage = Properties.Resources.DelImg;
|
||||||
|
DelBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
DelBtn.ForeColor = Color.Transparent;
|
||||||
|
DelBtn.Location = new Point(27, 218);
|
||||||
|
DelBtn.Name = "DelBtn";
|
||||||
|
DelBtn.Size = new Size(78, 71);
|
||||||
|
DelBtn.TabIndex = 6;
|
||||||
|
DelBtn.UseVisualStyleBackColor = false;
|
||||||
|
DelBtn.Click += DelBtn_Click;
|
||||||
|
//
|
||||||
|
// AddBtn
|
||||||
|
//
|
||||||
|
AddBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
AddBtn.BackgroundImage = Properties.Resources.AddImg;
|
||||||
|
AddBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
AddBtn.ForeColor = Color.Transparent;
|
||||||
|
AddBtn.Location = new Point(27, 126);
|
||||||
|
AddBtn.Name = "AddBtn";
|
||||||
|
AddBtn.Size = new Size(78, 71);
|
||||||
|
AddBtn.TabIndex = 4;
|
||||||
|
AddBtn.UseVisualStyleBackColor = false;
|
||||||
|
AddBtn.Click += AddBtn_Click;
|
||||||
|
//
|
||||||
|
// DataGV
|
||||||
|
//
|
||||||
|
DataGV.BackgroundColor = Color.DarkSlateBlue;
|
||||||
|
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
DataGV.GridColor = Color.GreenYellow;
|
||||||
|
DataGV.Location = new Point(30, 90);
|
||||||
|
DataGV.Name = "DataGV";
|
||||||
|
DataGV.RowHeadersWidth = 62;
|
||||||
|
DataGV.Size = new Size(489, 245);
|
||||||
|
DataGV.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// CardUpdatesF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.UpdListFrameCover;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(709, 360);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(DataGV);
|
||||||
|
DoubleBuffered = true;
|
||||||
|
Name = "CardUpdatesF";
|
||||||
|
Text = "CardUpdatesF";
|
||||||
|
Load += CardUpdatesF_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button DelBtn;
|
||||||
|
private Button AddBtn;
|
||||||
|
private DataGridView DataGV;
|
||||||
|
}
|
||||||
|
}
|
84
ProjLibrary/ProjLibrary/AdditionalForms/CardUpdatesF.cs
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
using ProjLibrary.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class CardUpdatesF : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly IUpdateRep _updR;
|
||||||
|
|
||||||
|
public CardUpdatesF(IUnityContainer container, IUpdateRep updR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_updR = updR ?? throw new ArgumentNullException(nameof(updR));
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CardUpdatesF_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while saving ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<UpdateF>().ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while adding element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DelBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var foundID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Remove element?", "Deleting", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_updR.RemoveUpd(foundID);
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while removing element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadList() =>
|
||||||
|
DataGV.DataSource = _updR.GetUpdateList();
|
||||||
|
|
||||||
|
private bool GetiDFromRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (DataGV.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("[ Error : element doesn't exist ]", "<ERROR>",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// (int)CardCBox.SelectedValue!
|
||||||
|
}
|
||||||
|
}
|
120
ProjLibrary/ProjLibrary/AdditionalForms/CardUpdatesF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
131
ProjLibrary/ProjLibrary/AdditionalForms/CustomerF.Designer.cs
generated
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class CustomerF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
CancelBtn = new Button();
|
||||||
|
SaveBtn = new Button();
|
||||||
|
FIOEnterTb = new TextBox();
|
||||||
|
FullNameLabel = new Label();
|
||||||
|
BDlabel = new Label();
|
||||||
|
BirthdayDTPicker = new DateTimePicker();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// CancelBtn
|
||||||
|
//
|
||||||
|
CancelBtn.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
CancelBtn.ForeColor = Color.DarkSlateBlue;
|
||||||
|
CancelBtn.Location = new Point(495, 70);
|
||||||
|
CancelBtn.Name = "CancelBtn";
|
||||||
|
CancelBtn.Size = new Size(102, 34);
|
||||||
|
CancelBtn.TabIndex = 8;
|
||||||
|
CancelBtn.Text = "Cancel";
|
||||||
|
CancelBtn.UseVisualStyleBackColor = true;
|
||||||
|
CancelBtn.Click += CancelBtn_Click;
|
||||||
|
//
|
||||||
|
// SaveBtn
|
||||||
|
//
|
||||||
|
SaveBtn.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
SaveBtn.ForeColor = Color.DarkSlateBlue;
|
||||||
|
SaveBtn.Location = new Point(404, 70);
|
||||||
|
SaveBtn.Name = "SaveBtn";
|
||||||
|
SaveBtn.Size = new Size(81, 34);
|
||||||
|
SaveBtn.TabIndex = 7;
|
||||||
|
SaveBtn.Text = "Save";
|
||||||
|
SaveBtn.UseVisualStyleBackColor = true;
|
||||||
|
SaveBtn.Click += SaveBtn_Click;
|
||||||
|
//
|
||||||
|
// FIOEnterTb
|
||||||
|
//
|
||||||
|
FIOEnterTb.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
FIOEnterTb.ForeColor = Color.MidnightBlue;
|
||||||
|
FIOEnterTb.Location = new Point(173, 27);
|
||||||
|
FIOEnterTb.Name = "FIOEnterTb";
|
||||||
|
FIOEnterTb.Size = new Size(424, 31);
|
||||||
|
FIOEnterTb.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// FullNameLabel
|
||||||
|
//
|
||||||
|
FullNameLabel.AutoSize = true;
|
||||||
|
FullNameLabel.Location = new Point(29, 30);
|
||||||
|
FullNameLabel.Name = "FullNameLabel";
|
||||||
|
FullNameLabel.Size = new Size(138, 25);
|
||||||
|
FullNameLabel.TabIndex = 9;
|
||||||
|
FullNameLabel.Text = "Full Name (FIO):";
|
||||||
|
//
|
||||||
|
// BDlabel
|
||||||
|
//
|
||||||
|
BDlabel.AutoSize = true;
|
||||||
|
BDlabel.Location = new Point(29, 75);
|
||||||
|
BDlabel.Name = "BDlabel";
|
||||||
|
BDlabel.Size = new Size(159, 25);
|
||||||
|
BDlabel.TabIndex = 10;
|
||||||
|
BDlabel.Text = "Birth day and year:";
|
||||||
|
//
|
||||||
|
// BirthdayDTPicker
|
||||||
|
//
|
||||||
|
BirthdayDTPicker.CalendarForeColor = Color.GreenYellow;
|
||||||
|
BirthdayDTPicker.CalendarMonthBackground = Color.DarkSlateBlue;
|
||||||
|
BirthdayDTPicker.CalendarTitleBackColor = Color.MidnightBlue;
|
||||||
|
BirthdayDTPicker.CalendarTitleForeColor = Color.DarkSlateBlue;
|
||||||
|
BirthdayDTPicker.CalendarTrailingForeColor = Color.GreenYellow;
|
||||||
|
BirthdayDTPicker.Location = new Point(194, 73);
|
||||||
|
BirthdayDTPicker.Name = "BirthdayDTPicker";
|
||||||
|
BirthdayDTPicker.Size = new Size(193, 31);
|
||||||
|
BirthdayDTPicker.TabIndex = 12;
|
||||||
|
BirthdayDTPicker.Value = new DateTime(2024, 11, 15, 12, 40, 0, 0);
|
||||||
|
//
|
||||||
|
// CustomerF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = Color.DarkSlateBlue;
|
||||||
|
ClientSize = new Size(631, 130);
|
||||||
|
Controls.Add(BirthdayDTPicker);
|
||||||
|
Controls.Add(BDlabel);
|
||||||
|
Controls.Add(FullNameLabel);
|
||||||
|
Controls.Add(CancelBtn);
|
||||||
|
Controls.Add(SaveBtn);
|
||||||
|
Controls.Add(FIOEnterTb);
|
||||||
|
ForeColor = Color.GreenYellow;
|
||||||
|
Name = "CustomerF";
|
||||||
|
Text = "CustomerF";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button CancelBtn;
|
||||||
|
private Button SaveBtn;
|
||||||
|
private TextBox FIOEnterTb;
|
||||||
|
private Label FullNameLabel;
|
||||||
|
private Label BDlabel;
|
||||||
|
private DateTimePicker BirthdayDTPicker;
|
||||||
|
}
|
||||||
|
}
|
79
ProjLibrary/ProjLibrary/AdditionalForms/CustomerF.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
using ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class CustomerF : Form
|
||||||
|
{
|
||||||
|
private readonly ICustomerCardsRep _customeRepository;
|
||||||
|
|
||||||
|
private int? _custID;
|
||||||
|
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var reader = _customeRepository.GetCardByID(value);
|
||||||
|
|
||||||
|
if (reader == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(reader));
|
||||||
|
}
|
||||||
|
|
||||||
|
FIOEnterTb.Text = reader.FIO;
|
||||||
|
BirthdayDTPicker.Value = reader.AgeBirthday;
|
||||||
|
|
||||||
|
_custID = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error : wrong data ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomerF(ICustomerCardsRep customeR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_customeRepository = customeR ?? throw new ArgumentNullException(nameof(customeR));
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomerCard CreateCustomer(int id)
|
||||||
|
{
|
||||||
|
return CustomerCard.AddCustomer(id, FIOEnterTb.Text, BirthdayDTPicker.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelBtn_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(FIOEnterTb.Text)
|
||||||
|
|| BirthdayDTPicker.Value.Year < 1940)
|
||||||
|
{
|
||||||
|
throw new Exception("[ Blank spaces were left, not enough information ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_custID.HasValue)
|
||||||
|
{
|
||||||
|
_customeRepository.UpdateCard(CreateCustomer(_custID.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_customeRepository.AddCard(CreateCustomer(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error : while saving ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjLibrary/ProjLibrary/AdditionalForms/CustomerF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
144
ProjLibrary/ProjLibrary/AdditionalForms/CustomerListF.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class CustomerListF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
ProlongBtn = new Button();
|
||||||
|
DelBtn = new Button();
|
||||||
|
UpdBtn = new Button();
|
||||||
|
AddBtn = new Button();
|
||||||
|
DataGV = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BackColor = Color.Transparent;
|
||||||
|
panel1.Controls.Add(ProlongBtn);
|
||||||
|
panel1.Controls.Add(DelBtn);
|
||||||
|
panel1.Controls.Add(UpdBtn);
|
||||||
|
panel1.Controls.Add(AddBtn);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(163, 404);
|
||||||
|
panel1.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// ProlongBtn
|
||||||
|
//
|
||||||
|
ProlongBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
ProlongBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ProlongBtn.ForeColor = Color.GreenYellow;
|
||||||
|
ProlongBtn.Location = new Point(15, 314);
|
||||||
|
ProlongBtn.Name = "ProlongBtn";
|
||||||
|
ProlongBtn.Size = new Size(105, 59);
|
||||||
|
ProlongBtn.TabIndex = 7;
|
||||||
|
ProlongBtn.Text = "Prolong";
|
||||||
|
ProlongBtn.UseVisualStyleBackColor = false;
|
||||||
|
ProlongBtn.Click += UpdateBtn_Click;
|
||||||
|
//
|
||||||
|
// DelBtn
|
||||||
|
//
|
||||||
|
DelBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
DelBtn.BackgroundImage = Properties.Resources.DelImg;
|
||||||
|
DelBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
DelBtn.ForeColor = Color.Transparent;
|
||||||
|
DelBtn.Location = new Point(27, 218);
|
||||||
|
DelBtn.Name = "DelBtn";
|
||||||
|
DelBtn.Size = new Size(78, 71);
|
||||||
|
DelBtn.TabIndex = 6;
|
||||||
|
DelBtn.UseVisualStyleBackColor = false;
|
||||||
|
DelBtn.Click += DelBtn_Click;
|
||||||
|
//
|
||||||
|
// UpdBtn
|
||||||
|
//
|
||||||
|
UpdBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
UpdBtn.BackgroundImage = Properties.Resources.OperationImg;
|
||||||
|
UpdBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
UpdBtn.ForeColor = Color.Transparent;
|
||||||
|
UpdBtn.Location = new Point(27, 141);
|
||||||
|
UpdBtn.Name = "UpdBtn";
|
||||||
|
UpdBtn.Size = new Size(78, 71);
|
||||||
|
UpdBtn.TabIndex = 5;
|
||||||
|
UpdBtn.UseVisualStyleBackColor = false;
|
||||||
|
UpdBtn.Click += UpdBtn_Click;
|
||||||
|
//
|
||||||
|
// AddBtn
|
||||||
|
//
|
||||||
|
AddBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
AddBtn.BackgroundImage = Properties.Resources.AddImg;
|
||||||
|
AddBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
AddBtn.ForeColor = Color.Transparent;
|
||||||
|
AddBtn.Location = new Point(27, 64);
|
||||||
|
AddBtn.Name = "AddBtn";
|
||||||
|
AddBtn.Size = new Size(78, 71);
|
||||||
|
AddBtn.TabIndex = 4;
|
||||||
|
AddBtn.UseVisualStyleBackColor = false;
|
||||||
|
AddBtn.Click += AddBtn_Click;
|
||||||
|
//
|
||||||
|
// DataGV
|
||||||
|
//
|
||||||
|
DataGV.BackgroundColor = Color.DarkSlateBlue;
|
||||||
|
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
DataGV.GridColor = Color.GreenYellow;
|
||||||
|
DataGV.Location = new Point(15, 100);
|
||||||
|
DataGV.Name = "DataGV";
|
||||||
|
DataGV.RowHeadersWidth = 62;
|
||||||
|
DataGV.Size = new Size(550, 273);
|
||||||
|
DataGV.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// CustomerListF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.ReadersFrameCover;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(766, 404);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(DataGV);
|
||||||
|
DoubleBuffered = true;
|
||||||
|
Name = "CustomerListF";
|
||||||
|
Text = "CustomerListF";
|
||||||
|
Load += CustomerListF_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button DelBtn;
|
||||||
|
private Button UpdBtn;
|
||||||
|
private Button AddBtn;
|
||||||
|
private DataGridView DataGV;
|
||||||
|
private Button ProlongBtn;
|
||||||
|
}
|
||||||
|
}
|
128
ProjLibrary/ProjLibrary/AdditionalForms/CustomerListF.cs
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
using ProjLibrary.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class CustomerListF : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly ICustomerCardsRep _custR;
|
||||||
|
|
||||||
|
public CustomerListF(IUnityContainer container, ICustomerCardsRep customeR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_custR = customeR ?? throw new ArgumentNullException(nameof(customeR));
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CustomerListF_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while saving ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<CustomerF>().ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while adding element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var findID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<CustomerF>();
|
||||||
|
form.ID = findID;
|
||||||
|
form.ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while updating element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DelBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var foundID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Remove element?", "Deleting", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_custR.DeleteCard(foundID);
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while removing element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadList() =>
|
||||||
|
DataGV.DataSource = _custR.GetCards();
|
||||||
|
|
||||||
|
private bool GetiDFromRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (DataGV.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("[ Error : element doesn't exist ]", "<ERROR>",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<UpdateF>();
|
||||||
|
form.ShowDialog();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (!GetiDFromRow(out var findID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<UpdateF>();
|
||||||
|
form.ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while prolonging card ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
120
ProjLibrary/ProjLibrary/AdditionalForms/CustomerListF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
129
ProjLibrary/ProjLibrary/AdditionalForms/EmployeeF.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class EmployeeF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
FullNameLabel = new Label();
|
||||||
|
FIOEnterTb = new TextBox();
|
||||||
|
GenreLabel = new Label();
|
||||||
|
SaveBtn = new Button();
|
||||||
|
CancelBtn = new Button();
|
||||||
|
GenresCheckedBL = new CheckedListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// FullNameLabel
|
||||||
|
//
|
||||||
|
FullNameLabel.AutoSize = true;
|
||||||
|
FullNameLabel.Location = new Point(23, 25);
|
||||||
|
FullNameLabel.Name = "FullNameLabel";
|
||||||
|
FullNameLabel.Size = new Size(138, 25);
|
||||||
|
FullNameLabel.TabIndex = 0;
|
||||||
|
FullNameLabel.Text = "Full Name (FIO):";
|
||||||
|
//
|
||||||
|
// FIOEnterTb
|
||||||
|
//
|
||||||
|
FIOEnterTb.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
FIOEnterTb.ForeColor = Color.MidnightBlue;
|
||||||
|
FIOEnterTb.Location = new Point(167, 22);
|
||||||
|
FIOEnterTb.Name = "FIOEnterTb";
|
||||||
|
FIOEnterTb.Size = new Size(456, 31);
|
||||||
|
FIOEnterTb.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// GenreLabel
|
||||||
|
//
|
||||||
|
GenreLabel.AutoSize = true;
|
||||||
|
GenreLabel.Location = new Point(23, 77);
|
||||||
|
GenreLabel.Name = "GenreLabel";
|
||||||
|
GenreLabel.Size = new Size(70, 25);
|
||||||
|
GenreLabel.TabIndex = 2;
|
||||||
|
GenreLabel.Text = "Genres:";
|
||||||
|
//
|
||||||
|
// SaveBtn
|
||||||
|
//
|
||||||
|
SaveBtn.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
SaveBtn.ForeColor = Color.DarkSlateBlue;
|
||||||
|
SaveBtn.Location = new Point(379, 131);
|
||||||
|
SaveBtn.Name = "SaveBtn";
|
||||||
|
SaveBtn.Size = new Size(112, 34);
|
||||||
|
SaveBtn.TabIndex = 4;
|
||||||
|
SaveBtn.Text = "Save";
|
||||||
|
SaveBtn.UseVisualStyleBackColor = true;
|
||||||
|
SaveBtn.Click += SaveBtn_Click;
|
||||||
|
//
|
||||||
|
// CancelBtn
|
||||||
|
//
|
||||||
|
CancelBtn.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
CancelBtn.ForeColor = Color.DarkSlateBlue;
|
||||||
|
CancelBtn.Location = new Point(497, 131);
|
||||||
|
CancelBtn.Name = "CancelBtn";
|
||||||
|
CancelBtn.Size = new Size(126, 34);
|
||||||
|
CancelBtn.TabIndex = 5;
|
||||||
|
CancelBtn.Text = "Cancel";
|
||||||
|
CancelBtn.UseVisualStyleBackColor = true;
|
||||||
|
CancelBtn.Click += CancelBtn_Click;
|
||||||
|
//
|
||||||
|
// GenresCheckedBL
|
||||||
|
//
|
||||||
|
GenresCheckedBL.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
GenresCheckedBL.ForeColor = Color.MidnightBlue;
|
||||||
|
GenresCheckedBL.FormattingEnabled = true;
|
||||||
|
GenresCheckedBL.Location = new Point(99, 77);
|
||||||
|
GenresCheckedBL.Name = "GenresCheckedBL";
|
||||||
|
GenresCheckedBL.Size = new Size(251, 88);
|
||||||
|
GenresCheckedBL.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// EmployeeF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = Color.DarkSlateBlue;
|
||||||
|
ClientSize = new Size(653, 191);
|
||||||
|
Controls.Add(GenresCheckedBL);
|
||||||
|
Controls.Add(CancelBtn);
|
||||||
|
Controls.Add(SaveBtn);
|
||||||
|
Controls.Add(GenreLabel);
|
||||||
|
Controls.Add(FIOEnterTb);
|
||||||
|
Controls.Add(FullNameLabel);
|
||||||
|
ForeColor = Color.GreenYellow;
|
||||||
|
Name = "EmployeeF";
|
||||||
|
Text = "EmployeeF";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label FullNameLabel;
|
||||||
|
private TextBox FIOEnterTb;
|
||||||
|
private Label GenreLabel;
|
||||||
|
private Button SaveBtn;
|
||||||
|
private Button CancelBtn;
|
||||||
|
private ComboBox GenreCbox;
|
||||||
|
private CheckedListBox GenresCheckedBL;
|
||||||
|
}
|
||||||
|
}
|
98
ProjLibrary/ProjLibrary/AdditionalForms/EmployeeF.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
using ProjLibrary.Entities.Enums;
|
||||||
|
using ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class EmployeeF : Form
|
||||||
|
{
|
||||||
|
private readonly ILibrarianRep _libRepository;
|
||||||
|
|
||||||
|
private int? _librarianID;
|
||||||
|
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var librarian = _libRepository.GetCardByID(value);
|
||||||
|
if (librarian == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(librarian));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Genres elem in Enum.GetValues(typeof(Genres)))
|
||||||
|
{
|
||||||
|
if ((elem & librarian.GenreID) != 0)
|
||||||
|
{
|
||||||
|
GenresCheckedBL.SetItemChecked(
|
||||||
|
GenresCheckedBL.Items.IndexOf(elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FIOEnterTb.Text = librarian.FIO;
|
||||||
|
_librarianID = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while getting data ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmployeeF(ILibrarianRep librarianR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_libRepository = librarianR ??
|
||||||
|
throw new ArgumentNullException(nameof(librarianR));
|
||||||
|
|
||||||
|
foreach (var elem in Enum.GetValues(typeof(Genres)))
|
||||||
|
{
|
||||||
|
GenresCheckedBL.Items.Add(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(FIOEnterTb.Text) ||
|
||||||
|
GenresCheckedBL.CheckedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("[ Error : blanc spaces, enter more information ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_librarianID.HasValue)
|
||||||
|
{
|
||||||
|
_libRepository.ChangeCardInfo(CreateWorker(_librarianID.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_libRepository.AddCard(CreateWorker(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while saving ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelBtn_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private LibrarianCard CreateWorker(int id)
|
||||||
|
{
|
||||||
|
Genres genre = Genres.None;
|
||||||
|
foreach (var elem in GenresCheckedBL.CheckedItems)
|
||||||
|
{
|
||||||
|
genre |= (Genres)elem;
|
||||||
|
}
|
||||||
|
return LibrarianCard.AddWorker(id, FIOEnterTb.Text, genre);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
120
ProjLibrary/ProjLibrary/AdditionalForms/EmployeeF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
128
ProjLibrary/ProjLibrary/AdditionalForms/EmployeesF.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class EmployeesF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
DataGV = new DataGridView();
|
||||||
|
panel1 = new Panel();
|
||||||
|
DelBtn = new Button();
|
||||||
|
UpdBtn = new Button();
|
||||||
|
AddBtn = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGV
|
||||||
|
//
|
||||||
|
DataGV.BackgroundColor = Color.DarkSlateBlue;
|
||||||
|
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
DataGV.GridColor = Color.GreenYellow;
|
||||||
|
DataGV.Location = new Point(30, 100);
|
||||||
|
DataGV.Name = "DataGV";
|
||||||
|
DataGV.RowHeadersWidth = 62;
|
||||||
|
DataGV.Size = new Size(550, 273);
|
||||||
|
DataGV.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BackColor = Color.Transparent;
|
||||||
|
panel1.Controls.Add(DelBtn);
|
||||||
|
panel1.Controls.Add(UpdBtn);
|
||||||
|
panel1.Controls.Add(AddBtn);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(586, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(163, 407);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// DelBtn
|
||||||
|
//
|
||||||
|
DelBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
DelBtn.BackgroundImage = Properties.Resources.DelImg;
|
||||||
|
DelBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
DelBtn.ForeColor = Color.Transparent;
|
||||||
|
DelBtn.Location = new Point(27, 218);
|
||||||
|
DelBtn.Name = "DelBtn";
|
||||||
|
DelBtn.Size = new Size(78, 71);
|
||||||
|
DelBtn.TabIndex = 6;
|
||||||
|
DelBtn.UseVisualStyleBackColor = false;
|
||||||
|
DelBtn.Click += DelBtn_Click;
|
||||||
|
//
|
||||||
|
// UpdBtn
|
||||||
|
//
|
||||||
|
UpdBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
UpdBtn.BackgroundImage = Properties.Resources.OperationImg;
|
||||||
|
UpdBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
UpdBtn.ForeColor = Color.Transparent;
|
||||||
|
UpdBtn.Location = new Point(27, 141);
|
||||||
|
UpdBtn.Name = "UpdBtn";
|
||||||
|
UpdBtn.Size = new Size(78, 71);
|
||||||
|
UpdBtn.TabIndex = 5;
|
||||||
|
UpdBtn.UseVisualStyleBackColor = false;
|
||||||
|
UpdBtn.Click += UpdBtn_Click;
|
||||||
|
//
|
||||||
|
// AddBtn
|
||||||
|
//
|
||||||
|
AddBtn.BackColor = Color.DarkSlateBlue;
|
||||||
|
AddBtn.BackgroundImage = Properties.Resources.AddImg;
|
||||||
|
AddBtn.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
AddBtn.ForeColor = Color.Transparent;
|
||||||
|
AddBtn.Location = new Point(27, 64);
|
||||||
|
AddBtn.Name = "AddBtn";
|
||||||
|
AddBtn.Size = new Size(78, 71);
|
||||||
|
AddBtn.TabIndex = 4;
|
||||||
|
AddBtn.UseVisualStyleBackColor = false;
|
||||||
|
AddBtn.Click += AddBtn_Click;
|
||||||
|
//
|
||||||
|
// EmployeesF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.EmployeesFrameCover;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(749, 407);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(DataGV);
|
||||||
|
DoubleBuffered = true;
|
||||||
|
Name = "EmployeesF";
|
||||||
|
Text = "EmployeesF";
|
||||||
|
Load += EmployeesF_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGV;
|
||||||
|
private Panel panel1;
|
||||||
|
private Button AddBtn;
|
||||||
|
private Button UpdBtn;
|
||||||
|
private Button DelBtn;
|
||||||
|
}
|
||||||
|
}
|
104
ProjLibrary/ProjLibrary/AdditionalForms/EmployeesF.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using ProjLibrary.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class EmployeesF : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly ILibrarianRep _libR;
|
||||||
|
|
||||||
|
public EmployeesF(IUnityContainer container, ILibrarianRep libR)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_libR = libR ?? throw new ArgumentNullException(nameof(libR));
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EmployeesF_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while saving ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<EmployeeF>().ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while adding element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var findID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<EmployeeF>();
|
||||||
|
form.ID = findID;
|
||||||
|
form.ShowDialog();
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while updating element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DelBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!GetiDFromRow(out var foundID))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Remove element?", "Deleting", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_libR.DeleteCard(foundID);
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Error while removing element ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadList() =>
|
||||||
|
DataGV.DataSource = _libR.GetCards();
|
||||||
|
|
||||||
|
private bool GetiDFromRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (DataGV.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("[ Error : element doesn't exist ]", "<ERROR>",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
120
ProjLibrary/ProjLibrary/AdditionalForms/EmployeesF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
188
ProjLibrary/ProjLibrary/AdditionalForms/RegOrder.Designer.cs
generated
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class RegOrder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
LibrarianCBox = new ComboBox();
|
||||||
|
LibLabel = new Label();
|
||||||
|
DateLabel = new Label();
|
||||||
|
ReturnDTPicker = new DateTimePicker();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
DataGV = new DataGridView();
|
||||||
|
BookColumnCBox = new DataGridViewComboBoxColumn();
|
||||||
|
AuthorColumn = new DataGridViewTextBoxColumn();
|
||||||
|
SaveBtn = new Button();
|
||||||
|
BackBtn = new Button();
|
||||||
|
ReaderLabel = new Label();
|
||||||
|
CardCBox = new ComboBox();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// LibrarianCBox
|
||||||
|
//
|
||||||
|
LibrarianCBox.FormattingEnabled = true;
|
||||||
|
LibrarianCBox.Location = new Point(119, 21);
|
||||||
|
LibrarianCBox.Name = "LibrarianCBox";
|
||||||
|
LibrarianCBox.Size = new Size(182, 33);
|
||||||
|
LibrarianCBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// LibLabel
|
||||||
|
//
|
||||||
|
LibLabel.AutoSize = true;
|
||||||
|
LibLabel.Location = new Point(30, 24);
|
||||||
|
LibLabel.Name = "LibLabel";
|
||||||
|
LibLabel.Size = new Size(83, 25);
|
||||||
|
LibLabel.TabIndex = 1;
|
||||||
|
LibLabel.Text = "Librarian:";
|
||||||
|
//
|
||||||
|
// DateLabel
|
||||||
|
//
|
||||||
|
DateLabel.AutoSize = true;
|
||||||
|
DateLabel.Location = new Point(30, 128);
|
||||||
|
DateLabel.Name = "DateLabel";
|
||||||
|
DateLabel.Size = new Size(107, 25);
|
||||||
|
DateLabel.TabIndex = 2;
|
||||||
|
DateLabel.Text = "Return date:";
|
||||||
|
//
|
||||||
|
// ReturnDTPicker
|
||||||
|
//
|
||||||
|
ReturnDTPicker.Location = new Point(37, 163);
|
||||||
|
ReturnDTPicker.Name = "ReturnDTPicker";
|
||||||
|
ReturnDTPicker.Size = new Size(264, 31);
|
||||||
|
ReturnDTPicker.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(DataGV);
|
||||||
|
groupBox1.Location = new Point(334, 24);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(423, 266);
|
||||||
|
groupBox1.TabIndex = 4;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "BookListGBox";
|
||||||
|
//
|
||||||
|
// DataGV
|
||||||
|
//
|
||||||
|
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
DataGV.Columns.AddRange(new DataGridViewColumn[] { BookColumnCBox, AuthorColumn });
|
||||||
|
DataGV.Location = new Point(6, 41);
|
||||||
|
DataGV.Name = "DataGV";
|
||||||
|
DataGV.RowHeadersWidth = 62;
|
||||||
|
DataGV.Size = new Size(411, 206);
|
||||||
|
DataGV.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// BookColumnCBox
|
||||||
|
//
|
||||||
|
BookColumnCBox.HeaderText = "Book's title";
|
||||||
|
BookColumnCBox.MinimumWidth = 8;
|
||||||
|
BookColumnCBox.Name = "BookColumnCBox";
|
||||||
|
BookColumnCBox.Width = 150;
|
||||||
|
//
|
||||||
|
// AuthorColumn
|
||||||
|
//
|
||||||
|
AuthorColumn.HeaderText = "Author";
|
||||||
|
AuthorColumn.MinimumWidth = 8;
|
||||||
|
AuthorColumn.Name = "AuthorColumn";
|
||||||
|
AuthorColumn.Width = 150;
|
||||||
|
//
|
||||||
|
// SaveBtn
|
||||||
|
//
|
||||||
|
SaveBtn.Location = new Point(37, 216);
|
||||||
|
SaveBtn.Name = "SaveBtn";
|
||||||
|
SaveBtn.Size = new Size(264, 34);
|
||||||
|
SaveBtn.TabIndex = 5;
|
||||||
|
SaveBtn.Text = "Save and give out";
|
||||||
|
SaveBtn.UseVisualStyleBackColor = true;
|
||||||
|
SaveBtn.Click += SaveBtn_Click;
|
||||||
|
//
|
||||||
|
// BackBtn
|
||||||
|
//
|
||||||
|
BackBtn.Location = new Point(37, 256);
|
||||||
|
BackBtn.Name = "BackBtn";
|
||||||
|
BackBtn.Size = new Size(264, 34);
|
||||||
|
BackBtn.TabIndex = 6;
|
||||||
|
BackBtn.Text = "Go back";
|
||||||
|
BackBtn.UseVisualStyleBackColor = true;
|
||||||
|
BackBtn.Click += BackBtn_Click;
|
||||||
|
//
|
||||||
|
// ReaderLabel
|
||||||
|
//
|
||||||
|
ReaderLabel.AutoSize = true;
|
||||||
|
ReaderLabel.Location = new Point(30, 65);
|
||||||
|
ReaderLabel.Name = "ReaderLabel";
|
||||||
|
ReaderLabel.Size = new Size(66, 50);
|
||||||
|
ReaderLabel.TabIndex = 7;
|
||||||
|
ReaderLabel.Text = "Reader\r\ncard:";
|
||||||
|
//
|
||||||
|
// CardCBox
|
||||||
|
//
|
||||||
|
CardCBox.FormattingEnabled = true;
|
||||||
|
CardCBox.Location = new Point(119, 82);
|
||||||
|
CardCBox.Name = "CardCBox";
|
||||||
|
CardCBox.Size = new Size(182, 33);
|
||||||
|
CardCBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// RegOrder
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(785, 314);
|
||||||
|
Controls.Add(CardCBox);
|
||||||
|
Controls.Add(ReaderLabel);
|
||||||
|
Controls.Add(BackBtn);
|
||||||
|
Controls.Add(SaveBtn);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Controls.Add(ReturnDTPicker);
|
||||||
|
Controls.Add(DateLabel);
|
||||||
|
Controls.Add(LibLabel);
|
||||||
|
Controls.Add(LibrarianCBox);
|
||||||
|
Name = "RegOrder";
|
||||||
|
Text = "RegOrder";
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGV).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox LibrarianCBox;
|
||||||
|
private Label LibLabel;
|
||||||
|
private Label DateLabel;
|
||||||
|
private DateTimePicker ReturnDTPicker;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private DataGridView DataGV;
|
||||||
|
private Button SaveBtn;
|
||||||
|
private Button BackBtn;
|
||||||
|
private Label ReaderLabel;
|
||||||
|
private ComboBox CardCBox;
|
||||||
|
private DataGridViewComboBoxColumn BookColumnCBox;
|
||||||
|
private DataGridViewTextBoxColumn AuthorColumn;
|
||||||
|
}
|
||||||
|
}
|
68
ProjLibrary/ProjLibrary/AdditionalForms/RegOrder.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
using ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms;
|
||||||
|
|
||||||
|
public partial class RegOrder : Form
|
||||||
|
{
|
||||||
|
private readonly IOrderRep _orderRepository;
|
||||||
|
|
||||||
|
public RegOrder(IOrderRep orderRep, ICustomerCardsRep readerRep,
|
||||||
|
ILibrarianRep employeeRep, IBookRep bookRep)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_orderRepository = orderRep ?? throw new ArgumentNullException(nameof(orderRep));
|
||||||
|
|
||||||
|
LibrarianCBox.DataSource = employeeRep.GetCards();
|
||||||
|
LibrarianCBox.DisplayMember = "FIO";
|
||||||
|
LibrarianCBox.ValueMember = "CardID";
|
||||||
|
|
||||||
|
CardCBox.DataSource = readerRep.GetCards();
|
||||||
|
CardCBox.DisplayMember = "FIO";
|
||||||
|
CardCBox.ValueMember = "CardID";
|
||||||
|
|
||||||
|
BookColumnCBox.DataSource = bookRep.GetBookList();
|
||||||
|
// AuthorColumn.DataSource = bookRep.GetBookList();
|
||||||
|
BookColumnCBox.DisplayMember = "Title";
|
||||||
|
BookColumnCBox.ValueMember = "BookID";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DataGV.RowCount < 1 || LibrarianCBox.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("[ Blanck space left ]");
|
||||||
|
}
|
||||||
|
_orderRepository.CreateOrder(
|
||||||
|
Order.NewOrder(0, (int)CardCBox.SelectedValue!,
|
||||||
|
(int)LibrarianCBox.SelectedValue!,
|
||||||
|
CreateBookListFromDG(), ReturnDTPicker.Value));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Saving error ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BackBtn_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private List<Registration> CreateBookListFromDG()
|
||||||
|
{
|
||||||
|
var list = new List<Registration>();
|
||||||
|
foreach (DataGridViewRow row in DataGV.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["BookColumn"].Value == null) // AUTHOR ADD [!]
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(Registration.OrderReg(0, string.Empty,
|
||||||
|
Convert.ToInt32(row.Cells["BookColumn"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
126
ProjLibrary/ProjLibrary/AdditionalForms/RegOrder.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="BookColumnCBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="AuthorColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
163
ProjLibrary/ProjLibrary/AdditionalForms/UpdateF.Designer.cs
generated
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
partial class UpdateF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
LibLabel = new Label();
|
||||||
|
LibrarianCBox = new ComboBox();
|
||||||
|
LastUpdLabel = new Label();
|
||||||
|
NextUpdLabel = new Label();
|
||||||
|
UpdDTPicker = new DateTimePicker();
|
||||||
|
NextUpdDTPicker = new DateTimePicker();
|
||||||
|
ConfirmBtn = new Button();
|
||||||
|
CancelBtn = new Button();
|
||||||
|
CardCBox = new ComboBox();
|
||||||
|
label1 = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// LibLabel
|
||||||
|
//
|
||||||
|
LibLabel.AutoSize = true;
|
||||||
|
LibLabel.Location = new Point(21, 71);
|
||||||
|
LibLabel.Name = "LibLabel";
|
||||||
|
LibLabel.Size = new Size(90, 25);
|
||||||
|
LibLabel.TabIndex = 0;
|
||||||
|
LibLabel.Text = "By whom:";
|
||||||
|
//
|
||||||
|
// LibrarianCBox
|
||||||
|
//
|
||||||
|
LibrarianCBox.FormattingEnabled = true;
|
||||||
|
LibrarianCBox.Location = new Point(117, 68);
|
||||||
|
LibrarianCBox.Name = "LibrarianCBox";
|
||||||
|
LibrarianCBox.Size = new Size(397, 33);
|
||||||
|
LibrarianCBox.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// LastUpdLabel
|
||||||
|
//
|
||||||
|
LastUpdLabel.AutoSize = true;
|
||||||
|
LastUpdLabel.Location = new Point(21, 123);
|
||||||
|
LastUpdLabel.Name = "LastUpdLabel";
|
||||||
|
LastUpdLabel.Size = new Size(58, 25);
|
||||||
|
LastUpdLabel.TabIndex = 2;
|
||||||
|
LastUpdLabel.Text = "From:";
|
||||||
|
//
|
||||||
|
// NextUpdLabel
|
||||||
|
//
|
||||||
|
NextUpdLabel.AutoSize = true;
|
||||||
|
NextUpdLabel.Location = new Point(21, 164);
|
||||||
|
NextUpdLabel.Name = "NextUpdLabel";
|
||||||
|
NextUpdLabel.Size = new Size(37, 25);
|
||||||
|
NextUpdLabel.TabIndex = 3;
|
||||||
|
NextUpdLabel.Text = "Till:";
|
||||||
|
//
|
||||||
|
// UpdDTPicker
|
||||||
|
//
|
||||||
|
UpdDTPicker.Location = new Point(85, 123);
|
||||||
|
UpdDTPicker.Name = "UpdDTPicker";
|
||||||
|
UpdDTPicker.Size = new Size(300, 31);
|
||||||
|
UpdDTPicker.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// NextUpdDTPicker
|
||||||
|
//
|
||||||
|
NextUpdDTPicker.Location = new Point(85, 164);
|
||||||
|
NextUpdDTPicker.Name = "NextUpdDTPicker";
|
||||||
|
NextUpdDTPicker.Size = new Size(300, 31);
|
||||||
|
NextUpdDTPicker.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// ConfirmBtn
|
||||||
|
//
|
||||||
|
ConfirmBtn.Location = new Point(402, 123);
|
||||||
|
ConfirmBtn.Name = "ConfirmBtn";
|
||||||
|
ConfirmBtn.Size = new Size(112, 34);
|
||||||
|
ConfirmBtn.TabIndex = 6;
|
||||||
|
ConfirmBtn.Text = "Confirm";
|
||||||
|
ConfirmBtn.UseVisualStyleBackColor = true;
|
||||||
|
ConfirmBtn.Click += ConfirmBtn_Click;
|
||||||
|
//
|
||||||
|
// CancelBtn
|
||||||
|
//
|
||||||
|
CancelBtn.Location = new Point(402, 164);
|
||||||
|
CancelBtn.Name = "CancelBtn";
|
||||||
|
CancelBtn.Size = new Size(112, 34);
|
||||||
|
CancelBtn.TabIndex = 7;
|
||||||
|
CancelBtn.Text = "Cancel";
|
||||||
|
CancelBtn.UseVisualStyleBackColor = true;
|
||||||
|
CancelBtn.Click += CancelBtn_Click;
|
||||||
|
//
|
||||||
|
// CardCBox
|
||||||
|
//
|
||||||
|
CardCBox.FormattingEnabled = true;
|
||||||
|
CardCBox.Location = new Point(171, 20);
|
||||||
|
CardCBox.Name = "CardCBox";
|
||||||
|
CardCBox.Size = new Size(343, 33);
|
||||||
|
CardCBox.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(21, 23);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(144, 25);
|
||||||
|
label1.TabIndex = 8;
|
||||||
|
label1.Text = "Card to prolong:";
|
||||||
|
//
|
||||||
|
// UpdateF
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(543, 217);
|
||||||
|
Controls.Add(CardCBox);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(CancelBtn);
|
||||||
|
Controls.Add(ConfirmBtn);
|
||||||
|
Controls.Add(NextUpdDTPicker);
|
||||||
|
Controls.Add(UpdDTPicker);
|
||||||
|
Controls.Add(NextUpdLabel);
|
||||||
|
Controls.Add(LastUpdLabel);
|
||||||
|
Controls.Add(LibrarianCBox);
|
||||||
|
Controls.Add(LibLabel);
|
||||||
|
Name = "UpdateF";
|
||||||
|
Text = "UpdateF";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label LibLabel;
|
||||||
|
private ComboBox LibrarianCBox;
|
||||||
|
private Label LastUpdLabel;
|
||||||
|
private Label NextUpdLabel;
|
||||||
|
private DateTimePicker UpdDTPicker;
|
||||||
|
private DateTimePicker NextUpdDTPicker;
|
||||||
|
private Button ConfirmBtn;
|
||||||
|
private Button CancelBtn;
|
||||||
|
private ComboBox CardCBox;
|
||||||
|
private Label label1;
|
||||||
|
}
|
||||||
|
}
|
46
ProjLibrary/ProjLibrary/AdditionalForms/UpdateF.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
using ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
namespace ProjLibrary.AdditionalForms
|
||||||
|
{
|
||||||
|
public partial class UpdateF : Form
|
||||||
|
{
|
||||||
|
private readonly IUpdateRep _updRep;
|
||||||
|
|
||||||
|
public UpdateF(IUpdateRep updRep, ILibrarianRep libRep, ICustomerCardsRep customersRep)
|
||||||
|
{
|
||||||
|
// _customerCard = customerCard;
|
||||||
|
InitializeComponent();
|
||||||
|
_updRep = updRep ?? throw new ArgumentNullException(nameof(updRep));
|
||||||
|
|
||||||
|
LibrarianCBox.DataSource = libRep.GetCards();
|
||||||
|
LibrarianCBox.DisplayMember = "FIO";
|
||||||
|
LibrarianCBox.ValueMember = "CardID";
|
||||||
|
|
||||||
|
CardCBox.DataSource = customersRep.GetCards();
|
||||||
|
CardCBox.DisplayMember = "FIO";
|
||||||
|
CardCBox.DisplayMember = "CardID";
|
||||||
|
CardCBox.ValueMember = "CardID";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfirmBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (LibrarianCBox.SelectedIndex < 0 || CardCBox.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("[ Blanck space left ]");
|
||||||
|
}
|
||||||
|
_updRep.AddUpdate(CustomerCard.AddCustomer(0, string.Empty, DateTime.Now));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Saving error ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelBtn_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
120
ProjLibrary/ProjLibrary/AdditionalForms/UpdateF.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
33
ProjLibrary/ProjLibrary/Entities/Book.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using ProjLibrary.Entities.Enums;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Entities
|
||||||
|
{
|
||||||
|
public class Book
|
||||||
|
{
|
||||||
|
public int BookID { get; private set; }
|
||||||
|
|
||||||
|
public string Title { get; private set; }
|
||||||
|
|
||||||
|
public string Author { get; private set; }
|
||||||
|
|
||||||
|
public int PublishYear { get; private set; }
|
||||||
|
|
||||||
|
public Genres GenreID { get; private set; }
|
||||||
|
|
||||||
|
public BookStat Status { get; private set; }
|
||||||
|
|
||||||
|
public static Book AddBook(
|
||||||
|
int bookIndex, string title, string author, int year, Genres genre, BookStat status)
|
||||||
|
{
|
||||||
|
return new Book
|
||||||
|
{
|
||||||
|
BookID = bookIndex,
|
||||||
|
Title = title,
|
||||||
|
Author = author,
|
||||||
|
PublishYear = year,
|
||||||
|
GenreID = genre,
|
||||||
|
Status = status
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
ProjLibrary/ProjLibrary/Entities/CustomerCard.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace ProjLibrary.Entities
|
||||||
|
{
|
||||||
|
public class CustomerCard
|
||||||
|
{
|
||||||
|
public int CardID { get; private set; }
|
||||||
|
|
||||||
|
public string FIO { get; private set; }
|
||||||
|
|
||||||
|
public DateTime AgeBirthday { get; private set; }
|
||||||
|
|
||||||
|
public static CustomerCard AddCustomer(
|
||||||
|
int cardIndex, string fullName, DateTime year)
|
||||||
|
{
|
||||||
|
return new CustomerCard
|
||||||
|
{
|
||||||
|
CardID = cardIndex,
|
||||||
|
FIO = fullName,
|
||||||
|
AgeBirthday = year
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
ProjLibrary/ProjLibrary/Entities/Enums/BookStat.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace ProjLibrary.Entities.Enums
|
||||||
|
{
|
||||||
|
public enum BookStat
|
||||||
|
{
|
||||||
|
Unable = 0,
|
||||||
|
Ordered = 1,
|
||||||
|
IDassignment = 2,
|
||||||
|
OnStock = 3,
|
||||||
|
Borrowed = 4,
|
||||||
|
Debited = 5
|
||||||
|
}
|
||||||
|
}
|
19
ProjLibrary/ProjLibrary/Entities/Enums/Genres.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
namespace ProjLibrary.Entities.Enums
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum Genres
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Adventure = 1, // 0001
|
||||||
|
Fantasy = 2, // 0010
|
||||||
|
Mystery = 3, // 0100
|
||||||
|
Fiction = 4, // 1000
|
||||||
|
Suspense = 5, // 0001 0000
|
||||||
|
Romance = 6, // 0010 0000
|
||||||
|
Crime = 7, // 0100 0000
|
||||||
|
Talent = 8, // 1000 0000
|
||||||
|
Realism = 9, // 0001 0000 0000
|
||||||
|
Horror = 10, // 0010 0000 0000
|
||||||
|
Historical = 11 // 0100 0000 0000
|
||||||
|
}
|
||||||
|
}
|
24
ProjLibrary/ProjLibrary/Entities/LibrarianCard.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using ProjLibrary.Entities.Enums;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Entities
|
||||||
|
{
|
||||||
|
public class LibrarianCard
|
||||||
|
{
|
||||||
|
public int CardID { get; private set; }
|
||||||
|
|
||||||
|
public string FIO { get; private set; }
|
||||||
|
|
||||||
|
public Genres GenreID { get; private set; }
|
||||||
|
|
||||||
|
public static LibrarianCard AddWorker(
|
||||||
|
int cardIndex, string fullName, Genres genre)
|
||||||
|
{
|
||||||
|
return new LibrarianCard
|
||||||
|
{
|
||||||
|
CardID = cardIndex,
|
||||||
|
FIO = fullName,
|
||||||
|
GenreID = genre
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
ProjLibrary/ProjLibrary/Entities/Order.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
namespace ProjLibrary.Entities
|
||||||
|
{
|
||||||
|
public class Order
|
||||||
|
{
|
||||||
|
public int OrderID { get; private set; }
|
||||||
|
|
||||||
|
public int CardID { get; private set; }
|
||||||
|
|
||||||
|
public DateTime BorrowDate { get; private set; }
|
||||||
|
|
||||||
|
public DateTime PlanReturnDate { get; private set; }
|
||||||
|
|
||||||
|
public DateTime FactReturnDate { get; private set; }
|
||||||
|
|
||||||
|
public int LibrarianID { get; private set; }
|
||||||
|
|
||||||
|
public IEnumerable<Registration> BookList { get; set; } = [];
|
||||||
|
|
||||||
|
public static Order NewOrder(
|
||||||
|
int orderIndex, int ticketIndex, int librarian, IEnumerable<Registration> list, DateTime factReturnD)
|
||||||
|
{
|
||||||
|
return new Order
|
||||||
|
{
|
||||||
|
OrderID = orderIndex,
|
||||||
|
CardID = ticketIndex,
|
||||||
|
LibrarianID = librarian,
|
||||||
|
BookList = list,
|
||||||
|
FactReturnDate = factReturnD
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
ProjLibrary/ProjLibrary/Entities/Registration.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
namespace ProjLibrary.Entities
|
||||||
|
{
|
||||||
|
public class Registration
|
||||||
|
{
|
||||||
|
public int OrderID { get; private set; }
|
||||||
|
|
||||||
|
public int BookID { get; private set; } // [!]
|
||||||
|
|
||||||
|
public string Note { get; private set; }
|
||||||
|
|
||||||
|
public static Registration OrderReg(
|
||||||
|
int orderIndex, string notes, int bookIndex) // int bookIndex
|
||||||
|
{
|
||||||
|
return new Registration
|
||||||
|
{
|
||||||
|
OrderID = orderIndex,
|
||||||
|
BookID = bookIndex,
|
||||||
|
Note = notes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
ProjLibrary/ProjLibrary/Entities/Update.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
namespace ProjLibrary.Entities;
|
||||||
|
|
||||||
|
public class Update
|
||||||
|
{
|
||||||
|
public int CardID { get; private set; }
|
||||||
|
|
||||||
|
public int LibrarianID { get; private set; }
|
||||||
|
|
||||||
|
public DateTime LastUpdate { get; private set; }
|
||||||
|
|
||||||
|
public DateTime UpdBoundary { get; private set; }
|
||||||
|
|
||||||
|
// LastUpd & DateTime NextUpd
|
||||||
|
|
||||||
|
public static Update CustomerUpd(
|
||||||
|
int cardIndex, int librIndex, DateTime updDate, DateTime updToDate) // IEnumerable<Book> allBooks
|
||||||
|
{
|
||||||
|
return new Update
|
||||||
|
{
|
||||||
|
CardID = cardIndex,
|
||||||
|
LastUpdate = updDate,
|
||||||
|
LibrarianID = librIndex,
|
||||||
|
UpdBoundary = updToDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
145
ProjLibrary/ProjLibrary/MainForm.Designer.cs
generated
@ -28,12 +28,149 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
menuStrip1 = new MenuStrip();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
toolStripMenuItem1 = new ToolStripMenuItem();
|
||||||
this.Text = "WorkForm";
|
menuStrip2 = new MenuStrip();
|
||||||
|
StaffTSMI = new ToolStripMenuItem();
|
||||||
|
EmployeeCard = new ToolStripMenuItem();
|
||||||
|
ReaderCard = new ToolStripMenuItem();
|
||||||
|
BookReg = new ToolStripMenuItem();
|
||||||
|
OperationsTSMI = new ToolStripMenuItem();
|
||||||
|
GiveOut = new ToolStripMenuItem();
|
||||||
|
Updating = new ToolStripMenuItem();
|
||||||
|
LogsTSMI = new ToolStripMenuItem();
|
||||||
|
menuStrip1.SuspendLayout();
|
||||||
|
menuStrip2.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
menuStrip1.ImageScalingSize = new Size(24, 24);
|
||||||
|
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1 });
|
||||||
|
menuStrip1.Location = new Point(0, 33);
|
||||||
|
menuStrip1.Name = "menuStrip1";
|
||||||
|
menuStrip1.Size = new Size(800, 24);
|
||||||
|
menuStrip1.TabIndex = 0;
|
||||||
|
menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// toolStripMenuItem1
|
||||||
|
//
|
||||||
|
toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
|
toolStripMenuItem1.Size = new Size(16, 20);
|
||||||
|
//
|
||||||
|
// menuStrip2
|
||||||
|
//
|
||||||
|
menuStrip2.BackColor = Color.GreenYellow;
|
||||||
|
menuStrip2.ImageScalingSize = new Size(24, 24);
|
||||||
|
menuStrip2.Items.AddRange(new ToolStripItem[] { StaffTSMI, OperationsTSMI, LogsTSMI });
|
||||||
|
menuStrip2.Location = new Point(0, 0);
|
||||||
|
menuStrip2.Name = "menuStrip2";
|
||||||
|
menuStrip2.Size = new Size(800, 33);
|
||||||
|
menuStrip2.TabIndex = 1;
|
||||||
|
menuStrip2.Text = "menuStrip2";
|
||||||
|
//
|
||||||
|
// StaffTSMI
|
||||||
|
//
|
||||||
|
StaffTSMI.DropDownItems.AddRange(new ToolStripItem[] { EmployeeCard, ReaderCard, BookReg });
|
||||||
|
StaffTSMI.ForeColor = Color.DarkSlateBlue;
|
||||||
|
StaffTSMI.Name = "StaffTSMI";
|
||||||
|
StaffTSMI.Size = new Size(256, 29);
|
||||||
|
StaffTSMI.Text = "Персональная информация";
|
||||||
|
//
|
||||||
|
// EmployeeCard
|
||||||
|
//
|
||||||
|
EmployeeCard.BackColor = Color.DarkSlateBlue;
|
||||||
|
EmployeeCard.ForeColor = Color.GreenYellow;
|
||||||
|
EmployeeCard.Name = "EmployeeCard";
|
||||||
|
EmployeeCard.Size = new Size(273, 34);
|
||||||
|
EmployeeCard.Text = "Карта сотрудника";
|
||||||
|
EmployeeCard.Click += EmployeeCard_Click;
|
||||||
|
//
|
||||||
|
// ReaderCard
|
||||||
|
//
|
||||||
|
ReaderCard.BackColor = Color.DarkSlateBlue;
|
||||||
|
ReaderCard.ForeColor = Color.GreenYellow;
|
||||||
|
ReaderCard.Name = "ReaderCard";
|
||||||
|
ReaderCard.Size = new Size(273, 34);
|
||||||
|
ReaderCard.Text = "Читательский билет";
|
||||||
|
ReaderCard.Click += ReaderCard_Click;
|
||||||
|
//
|
||||||
|
// BookReg
|
||||||
|
//
|
||||||
|
BookReg.BackColor = Color.DarkSlateBlue;
|
||||||
|
BookReg.ForeColor = Color.GreenYellow;
|
||||||
|
BookReg.Name = "BookReg";
|
||||||
|
BookReg.Size = new Size(273, 34);
|
||||||
|
BookReg.Text = "Книга";
|
||||||
|
BookReg.Click += BookReg_Click;
|
||||||
|
//
|
||||||
|
// OperationsTSMI
|
||||||
|
//
|
||||||
|
OperationsTSMI.DropDownItems.AddRange(new ToolStripItem[] { GiveOut, Updating });
|
||||||
|
OperationsTSMI.ForeColor = Color.DarkSlateBlue;
|
||||||
|
OperationsTSMI.Name = "OperationsTSMI";
|
||||||
|
OperationsTSMI.Size = new Size(112, 29);
|
||||||
|
OperationsTSMI.Text = "Операции";
|
||||||
|
//
|
||||||
|
// GiveOut
|
||||||
|
//
|
||||||
|
GiveOut.BackColor = Color.DarkSlateBlue;
|
||||||
|
GiveOut.ForeColor = Color.GreenYellow;
|
||||||
|
GiveOut.Name = "GiveOut";
|
||||||
|
GiveOut.Size = new Size(289, 34);
|
||||||
|
GiveOut.Text = "Оформление выдачи";
|
||||||
|
GiveOut.Click += GiveOut_Click;
|
||||||
|
//
|
||||||
|
// Updating
|
||||||
|
//
|
||||||
|
Updating.BackColor = Color.DarkSlateBlue;
|
||||||
|
Updating.ForeColor = Color.GreenYellow;
|
||||||
|
Updating.Name = "Updating";
|
||||||
|
Updating.Size = new Size(289, 34);
|
||||||
|
Updating.Text = "Обновление билета";
|
||||||
|
Updating.Click += Updating_Click;
|
||||||
|
//
|
||||||
|
// LogsTSMI
|
||||||
|
//
|
||||||
|
LogsTSMI.ForeColor = Color.DarkSlateBlue;
|
||||||
|
LogsTSMI.Name = "LogsTSMI";
|
||||||
|
LogsTSMI.Size = new Size(88, 29);
|
||||||
|
LogsTSMI.Text = "Отчёты";
|
||||||
|
//
|
||||||
|
// MainForm
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(menuStrip1);
|
||||||
|
Controls.Add(menuStrip2);
|
||||||
|
DoubleBuffered = true;
|
||||||
|
MainMenuStrip = menuStrip1;
|
||||||
|
Name = "MainForm";
|
||||||
|
Text = "WorkForm";
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
|
menuStrip2.ResumeLayout(false);
|
||||||
|
menuStrip2.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem toolStripMenuItem1;
|
||||||
|
private MenuStrip menuStrip2;
|
||||||
|
private ToolStripMenuItem StaffTSMI;
|
||||||
|
private ToolStripMenuItem EmployeeCard;
|
||||||
|
private ToolStripMenuItem OperationsTSMI;
|
||||||
|
private ToolStripMenuItem GiveOut;
|
||||||
|
private ToolStripMenuItem LogsTSMI;
|
||||||
|
private ToolStripMenuItem ReaderCard;
|
||||||
|
private ToolStripMenuItem BookReg;
|
||||||
|
private ToolStripMenuItem Updating;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,84 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using ProjLibrary.AdditionalForms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace ProjLibrary
|
namespace ProjLibrary
|
||||||
{
|
{
|
||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
public MainForm()
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
public MainForm(IUnityContainer container)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EmployeeCard_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<EmployeesF>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Download : mistake ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReaderCard_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<CustomerListF>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Download : mistake ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BookReg_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<BookListF>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Download : mistake ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GiveOut_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<RegOrder>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Download : mistake ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Updating_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<CardUpdatesF>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "[ Download : mistake ]",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
using ProjLibrary.Repositories;
|
||||||
|
using ProjLibrary.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace ProjLibrary
|
namespace ProjLibrary
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +15,21 @@ namespace ProjLibrary
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new MainForm());
|
Application.Run(CreateContainer().Resolve<MainForm>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
|
||||||
|
container.RegisterType<IBookRep, BookR>();
|
||||||
|
container.RegisterType<ICustomerCardsRep, CustomerCardR>();
|
||||||
|
container.RegisterType<ILibrarianRep, LibrarianR>();
|
||||||
|
container.RegisterType<IRegistrationRep, RegistR>();
|
||||||
|
container.RegisterType<IOrderRep, OrderR>();
|
||||||
|
container.RegisterType<IUpdateRep, UpdateR>();
|
||||||
|
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,4 +8,23 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,6 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="AdditionalForms\BookF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\BookListF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\CardUpdatesF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\CustomerF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\CustomerListF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\EmployeeF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\EmployeesF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\RegOrder.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="AdditionalForms\UpdateF.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="MainForm.cs">
|
<Compile Update="MainForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
133
ProjLibrary/ProjLibrary/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjLibrary.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[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("ProjLibrary.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap AddImg {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("AddImg", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap BookListFrameCover {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("BookListFrameCover", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap DelImg {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("DelImg", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap EmployeesFrameCover {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("EmployeesFrameCover", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap OperationImg {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("OperationImg", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ReadersFrameCover {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ReadersFrameCover", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap UpdListFrameCover {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("UpdListFrameCover", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
142
ProjLibrary/ProjLibrary/Properties/Resources.resx
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="ReadersFrameCover" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\ReadersFrameCover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="OperationImg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\OperationImg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="AddImg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\AddImg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="DelImg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\DelImg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="BookListFrameCover" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\BookListFrameCover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="EmployeesFrameCover" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\EmployeesFrameCover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpdListFrameCover" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\RscImages\UpdListFrameCover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
16
ProjLibrary/ProjLibrary/Repositories/IBookRep.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface IBookRep
|
||||||
|
{
|
||||||
|
IEnumerable<Book> GetBookList();
|
||||||
|
|
||||||
|
Book GetBookByID(int id);
|
||||||
|
|
||||||
|
void AddBook(Book card);
|
||||||
|
|
||||||
|
void UpdateBook(Book card);
|
||||||
|
|
||||||
|
void DeleteBook(int id);
|
||||||
|
}
|
16
ProjLibrary/ProjLibrary/Repositories/ICustomerCardsRep.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface ICustomerCardsRep
|
||||||
|
{
|
||||||
|
IEnumerable<CustomerCard> GetCards();
|
||||||
|
|
||||||
|
CustomerCard GetCardByID(int id);
|
||||||
|
|
||||||
|
void AddCard(CustomerCard card);
|
||||||
|
|
||||||
|
void UpdateCard(CustomerCard card);
|
||||||
|
|
||||||
|
void DeleteCard(int id);
|
||||||
|
}
|
16
ProjLibrary/ProjLibrary/Repositories/ILibrarianRep.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface ILibrarianRep
|
||||||
|
{
|
||||||
|
IEnumerable<LibrarianCard> GetCards();
|
||||||
|
|
||||||
|
LibrarianCard GetCardByID(int id);
|
||||||
|
|
||||||
|
void AddCard(LibrarianCard card);
|
||||||
|
|
||||||
|
void ChangeCardInfo(LibrarianCard card);
|
||||||
|
|
||||||
|
void DeleteCard(int id);
|
||||||
|
}
|
16
ProjLibrary/ProjLibrary/Repositories/IOrderRep.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface IOrderRep
|
||||||
|
{
|
||||||
|
IEnumerable<Order> GetOrdersInfo(
|
||||||
|
// DateTime? borrowingDateFrom = null, DateTime? returnDateTo = null,
|
||||||
|
int? librarianID, int? orderID = null, int? customerID = null);
|
||||||
|
|
||||||
|
// int? bookID = null -> another connection, check by orderID needed first [!]
|
||||||
|
|
||||||
|
void CreateOrder(Order order);
|
||||||
|
|
||||||
|
void DeleteOrderinfo(int orderID);
|
||||||
|
}
|
14
ProjLibrary/ProjLibrary/Repositories/IRegistrationRep.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface IRegistrationRep
|
||||||
|
{
|
||||||
|
IEnumerable<Registration> GetBookBorrowings(
|
||||||
|
DateTime? borrowingDateFrom = null, DateTime? returnDateTo = null,
|
||||||
|
int? orderID = null, int? bookID = null);
|
||||||
|
|
||||||
|
// int? customerID = null -> another connection, check by orderID needed first [!]
|
||||||
|
|
||||||
|
void MakeRegistration(Registration reg);
|
||||||
|
}
|
15
ProjLibrary/ProjLibrary/Repositories/IUpdateRep.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories;
|
||||||
|
|
||||||
|
public interface IUpdateRep
|
||||||
|
{
|
||||||
|
IEnumerable<Update> GetUpdateList();
|
||||||
|
|
||||||
|
CustomerCard GetUpdateByID(int id);
|
||||||
|
|
||||||
|
void AddUpdate(CustomerCard card);
|
||||||
|
|
||||||
|
void RemoveUpd(int cardID);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class BookR : IBookRep
|
||||||
|
{
|
||||||
|
public void AddBook(Book card) {}
|
||||||
|
|
||||||
|
public void DeleteBook(int id) {}
|
||||||
|
|
||||||
|
public Book GetBookByID(int id)
|
||||||
|
{
|
||||||
|
return Book.AddBook(0, string.Empty, string.Empty, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Book> GetBookList()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateBook(Book card) {}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class CustomerCardR : ICustomerCardsRep
|
||||||
|
{
|
||||||
|
public void AddCard(CustomerCard card) {}
|
||||||
|
|
||||||
|
public void DeleteCard(int id) {}
|
||||||
|
|
||||||
|
public CustomerCard GetCardByID(int id)
|
||||||
|
{
|
||||||
|
return CustomerCard.AddCustomer(0, string.Empty, DateTime.Now);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<CustomerCard> GetCards()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCard(CustomerCard card) {}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
internal class LibrarianR : ILibrarianRep
|
||||||
|
{
|
||||||
|
public void AddCard(LibrarianCard card) {}
|
||||||
|
|
||||||
|
public void ChangeCardInfo(LibrarianCard card) {}
|
||||||
|
|
||||||
|
public void DeleteCard(int id) {}
|
||||||
|
|
||||||
|
public LibrarianCard GetCardByID(int id)
|
||||||
|
{
|
||||||
|
return LibrarianCard.AddWorker(0, string.Empty, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<LibrarianCard> GetCards()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class OrderR : IOrderRep
|
||||||
|
{
|
||||||
|
public void CreateOrder(Order order) {}
|
||||||
|
|
||||||
|
public void DeleteOrderinfo(int orderID) {}
|
||||||
|
|
||||||
|
public IEnumerable<Order> GetOrdersInfo(int? librarianID, int? orderID = null, int? customerID = null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
internal class RegistR : IRegistrationRep
|
||||||
|
{
|
||||||
|
public IEnumerable<Registration> GetBookBorrowings(DateTime? borrowingDateFrom = null, DateTime? returnDateTo = null, int? orderID = null, int? bookID = null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MakeRegistration(Registration reg) {}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using ProjLibrary.Entities;
|
||||||
|
|
||||||
|
namespace ProjLibrary.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class UpdateR : IUpdateRep
|
||||||
|
{
|
||||||
|
public void AddUpdate(CustomerCard card) {}
|
||||||
|
|
||||||
|
public void RemoveUpd(int cardID) { }
|
||||||
|
|
||||||
|
public CustomerCard GetUpdateByID(int id)
|
||||||
|
{
|
||||||
|
return CustomerCard.AddCustomer(0, string.Empty, DateTime.Now);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Update> GetUpdateList()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
BIN
ProjLibrary/ProjLibrary/RscImages/AddImg.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/BookListFrameCover.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/DelImg.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/EmployeesFrameCover.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/OperationImg.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/ReadersFrameCover.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/UpdListFrameCover.png
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
ProjLibrary/ProjLibrary/RscImages/WorkFrameCover.png
Normal file
After Width: | Height: | Size: 128 KiB |
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETCoreApp,Version=v8.0",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETCoreApp,Version=v8.0": {
|
||||||
|
"ProjLibrary/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Unity": "5.11.10"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"ProjLibrary.dll": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {},
|
||||||
|
"Unity/5.11.10": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netcoreapp3.0/Unity.Abstractions.dll": {
|
||||||
|
"assemblyVersion": "5.11.7.0",
|
||||||
|
"fileVersion": "5.11.7.0"
|
||||||
|
},
|
||||||
|
"lib/netcoreapp3.0/Unity.Container.dll": {
|
||||||
|
"assemblyVersion": "5.11.11.0",
|
||||||
|
"fileVersion": "5.11.11.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"ProjLibrary/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==",
|
||||||
|
"path": "system.runtime.compilerservices.unsafe/4.5.2",
|
||||||
|
"hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Unity/5.11.10": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-B4+Ps3oqI78hJ+dAFsJhPkJT6qycsNExgLbtw7CEHSzKc2ac3YyUR8SHQ+ZyTwld/y5IbDx/aNOHnKE9Em1zWA==",
|
||||||
|
"path": "unity/5.11.10",
|
||||||
|
"hashPath": "unity.5.11.10.nupkg.sha512"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
ProjLibrary/ProjLibrary/bin/Debug/net8.0-windows/ProjLibrary.dll
Normal file
BIN
ProjLibrary/ProjLibrary/bin/Debug/net8.0-windows/ProjLibrary.exe
Normal file
BIN
ProjLibrary/ProjLibrary/bin/Debug/net8.0-windows/ProjLibrary.pdb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net8.0",
|
||||||
|
"frameworks": [
|
||||||
|
{
|
||||||
|
"name": "Microsoft.NETCore.App",
|
||||||
|
"version": "8.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Microsoft.WindowsDesktop.App",
|
||||||
|
"version": "8.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configProperties": {
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ProjLibrary")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("ProjLibrary")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f0892917d1c3c47fd068902052ae8a0991cc7b3e")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+dc2fbf77bfa1b263fa7863c8a0a465e360413810")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("ProjLibrary")]
|
[assembly: System.Reflection.AssemblyProductAttribute("ProjLibrary")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("ProjLibrary")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("ProjLibrary")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
ff7b9d7e96ae06dd431cac4e47fd9a443e80aba08bf36676ad60cf57c1c2a18d
|
541610bf278f686d251f50e1a430d591568c359956ca19fe8a9bfaeacb36b00d
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
da02128a733774853a1729ba13210d0393a2bf038737c88b37ae5920501c0e5b
|
@ -0,0 +1,30 @@
|
|||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.csproj.AssemblyReference.cache
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.BookF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.BookListF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.CustomerF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.CustomerListF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.EmployeeF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.EmployeesF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.RegOrder.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.MainForm.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.Properties.Resources.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.csproj.GenerateResource.cache
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AssemblyInfoInputs.cache
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AssemblyInfo.cs
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\ProjLibrary.exe
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\ProjLibrary.deps.json
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\ProjLibrary.runtimeconfig.json
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\ProjLibrary.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\ProjLibrary.pdb
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\Unity.Abstractions.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\bin\Debug\net8.0-windows\Unity.Container.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.csproj.CopyComplete
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\refint\ProjLibrary.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.pdb
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.genruntimeconfig.cache
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ref\ProjLibrary.dll
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.UpdateF.resources
|
||||||
|
C:\Users\inna\source\repos\LibraryPr\ProjLibrary\ProjLibrary\obj\Debug\net8.0-windows\ProjLibrary.AdditionalForms.CardUpdatesF.resources
|
@ -5,7 +5,46 @@
|
|||||||
},
|
},
|
||||||
"compilationOptions": {},
|
"compilationOptions": {},
|
||||||
"targets": {
|
"targets": {
|
||||||
".NETCoreApp,Version=v8.0": {}
|
".NETCoreApp,Version=v8.0": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {
|
||||||
|
"runtime": {
|
||||||
|
"lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll": {
|
||||||
|
"assemblyVersion": "4.0.4.1",
|
||||||
|
"fileVersion": "4.6.26919.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"libraries": {}
|
"Unity/5.11.10": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netcoreapp3.0/Unity.Abstractions.dll": {
|
||||||
|
"assemblyVersion": "5.11.7.0",
|
||||||
|
"fileVersion": "5.11.7.0"
|
||||||
|
},
|
||||||
|
"lib/netcoreapp3.0/Unity.Container.dll": {
|
||||||
|
"assemblyVersion": "5.11.11.0",
|
||||||
|
"fileVersion": "5.11.11.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==",
|
||||||
|
"path": "system.runtime.compilerservices.unsafe/4.5.2",
|
||||||
|
"hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Unity/5.11.10": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-B4+Ps3oqI78hJ+dAFsJhPkJT6qycsNExgLbtw7CEHSzKc2ac3YyUR8SHQ+ZyTwld/y5IbDx/aNOHnKE9Em1zWA==",
|
||||||
|
"path": "unity/5.11.10",
|
||||||
|
"hashPath": "unity.5.11.10.nupkg.sha512"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
BIN
ProjLibrary/ProjLibrary/obj/Debug/net8.0-windows/ProjLibrary.dll
Normal file
@ -0,0 +1 @@
|
|||||||
|
8a7ece7aa7ea32fc0c0f10a88e245693350031098bab633d3b4862e5a119f060
|