diff --git a/ProjectPublishing/ProjectPublishing/Entities/ContactPerson.cs b/ProjectPublishing/ProjectPublishing/Entities/ContactPerson.cs new file mode 100644 index 0000000..bcb0509 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/ContactPerson.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class ContactPerson + { + public int Id { get; private set; } + + public string Name { get; private set; } + + public string PhoneNumber { get; private set; } + + public string Email { get; private set; } + + public static ContactPerson CreateContactPerson(int id, string name, string phoneNumber, string email) + { + return new ContactPerson + { + Id = id, + Name = name, + PhoneNumber = phoneNumber, + Email = email + }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Customer.cs b/ProjectPublishing/ProjectPublishing/Entities/Customer.cs new file mode 100644 index 0000000..e71de71 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Customer.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class Customer + { + public int Id { get; private set; } + + public string PhoneNumber { get; private set; } + + public string Email { get; private set; } + + public int PublisherId { get; private set; } + + public static Customer CreateCustomer(int id, string phoneNumber, string email, int publisherId) + { + return new Customer + { + Id = id, + PhoneNumber = phoneNumber, + Email = email, + PublisherId = publisherId + }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Enums/MaterialType.cs b/ProjectPublishing/ProjectPublishing/Entities/Enums/MaterialType.cs new file mode 100644 index 0000000..d1a04fa --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Enums/MaterialType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities.Enums +{ + public enum MaterialType + { + Paper = 0, + Cardboard = 1, + Ink = 2, + Cover = 3 + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Enums/OrderStatus.cs b/ProjectPublishing/ProjectPublishing/Entities/Enums/OrderStatus.cs new file mode 100644 index 0000000..eed795c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Enums/OrderStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities.Enums +{ + public enum OrderStatus + { + Waiting = 0, + InProgress = 1, + Done = 2 + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Enums/ProductType.cs b/ProjectPublishing/ProjectPublishing/Entities/Enums/ProductType.cs new file mode 100644 index 0000000..76767d7 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Enums/ProductType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities.Enums +{ + public enum ProductType + { + Book = 0, + Brochure = 1, + Booklet = 2, + Advertisement = 3, + Bulletin = 4 + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Material.cs b/ProjectPublishing/ProjectPublishing/Entities/Material.cs new file mode 100644 index 0000000..53d61f7 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Material.cs @@ -0,0 +1,21 @@ +using ProjectPublishing.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class Material + { + public int Id { get; private set; } + + public MaterialType MaterialType { get; private set; } + + public static Material CreateMaterial(int id, MaterialType materialType) + { + return new Material { Id = id, MaterialType = materialType }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/MaterialsAdmission.cs b/ProjectPublishing/ProjectPublishing/Entities/MaterialsAdmission.cs new file mode 100644 index 0000000..5065bc0 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/MaterialsAdmission.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class MaterialsAdmission + { + public int Id { get; private set; } + + public int Amount { get; private set; } + + public DateTime DateTime { get; private set; } + + public int MaterialId { get; private set; } + + public static MaterialsAdmission CreateOperation(int id, int amount, int materialId) + { + return new MaterialsAdmission { Id = id, Amount = amount, DateTime = DateTime.Now, MaterialId = materialId }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/Order.cs b/ProjectPublishing/ProjectPublishing/Entities/Order.cs new file mode 100644 index 0000000..5a44ba6 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/Order.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class Order + { + public int Id { get; private set; } + public DateTime OrderDate { get; private set; } + + public string Description { get; private set; } + + public ProductType ProductType { get; private set; } + + public int Amount { get; private set; } + + public OrderStatus Status { get; private set; } + + public int CustomerId { get; private set; } + + public int PrintingId { get; private set; } + + public int MaterialsId { get; private set; } + + public static Order CreateOrder(int id, string description, ProductType productType, int amount, OrderStatus status, int customerId, int printingId, int materialsId) + { + return new Order { ProductType = productType, Id = id, Amount = amount, Status = status, CustomerId = customerId, PrintingId = printingId, MaterialsId = materialsId, OrderDate = DateTime.Now, Description = description ?? string.Empty }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Entities/PrintingHouse.cs b/ProjectPublishing/ProjectPublishing/Entities/PrintingHouse.cs new file mode 100644 index 0000000..cc86698 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Entities/PrintingHouse.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Entities +{ + public class PrintingHouse + { + public int Id { get; private set; } + + public string Name { get; private set; } + + public string Address { get; private set; } + + public string PhoneNumber { get; private set; } + + public string Email { get; private set; } + + public static PrintingHouse CreatePrintingHouse(int Id, string name, string address, string phoneNumber, string email) + { + return new PrintingHouse { Id = Id, Name = name, Address = address, PhoneNumber = phoneNumber, Email = email }; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Form1.Designer.cs b/ProjectPublishing/ProjectPublishing/Form1.Designer.cs deleted file mode 100644 index 3752acd..0000000 --- a/ProjectPublishing/ProjectPublishing/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectPublishing -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} diff --git a/ProjectPublishing/ProjectPublishing/Form1.cs b/ProjectPublishing/ProjectPublishing/Form1.cs deleted file mode 100644 index a88ef72..0000000 --- a/ProjectPublishing/ProjectPublishing/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectPublishing -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectPublishing/ProjectPublishing/FormPublishing.Designer.cs b/ProjectPublishing/ProjectPublishing/FormPublishing.Designer.cs new file mode 100644 index 0000000..c0d8346 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/FormPublishing.Designer.cs @@ -0,0 +1,144 @@ +namespace ProjectPublishing +{ + partial class FormPublishing + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + menuStrip1 = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + покупательToolStripMenuItem = new ToolStripMenuItem(); + контактнаяПерсонаToolStripMenuItem = new ToolStripMenuItem(); + заказToolStripMenuItem = new ToolStripMenuItem(); + материалыToolStripMenuItem = new ToolStripMenuItem(); + типографияToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + получениеМатериаловToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(800, 28); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { покупательToolStripMenuItem, контактнаяПерсонаToolStripMenuItem, заказToolStripMenuItem, материалыToolStripMenuItem, типографияToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // покупательToolStripMenuItem + // + покупательToolStripMenuItem.Name = "покупательToolStripMenuItem"; + покупательToolStripMenuItem.Size = new Size(234, 26); + покупательToolStripMenuItem.Text = "Покупатель"; + покупательToolStripMenuItem.Click += покупательToolStripMenuItem_Click; + // + // контактнаяПерсонаToolStripMenuItem + // + контактнаяПерсонаToolStripMenuItem.Name = "контактнаяПерсонаToolStripMenuItem"; + контактнаяПерсонаToolStripMenuItem.Size = new Size(234, 26); + контактнаяПерсонаToolStripMenuItem.Text = "Контактная персона"; + контактнаяПерсонаToolStripMenuItem.Click += контактнаяПерсонаToolStripMenuItem_Click; + // + // заказToolStripMenuItem + // + заказToolStripMenuItem.Name = "заказToolStripMenuItem"; + заказToolStripMenuItem.Size = new Size(234, 26); + заказToolStripMenuItem.Text = "Заказ"; + заказToolStripMenuItem.Click += заказToolStripMenuItem_Click; + // + // материалыToolStripMenuItem + // + материалыToolStripMenuItem.Name = "материалыToolStripMenuItem"; + материалыToolStripMenuItem.Size = new Size(234, 26); + материалыToolStripMenuItem.Text = "Материалы"; + материалыToolStripMenuItem.Click += материалыToolStripMenuItem_Click; + // + // типографияToolStripMenuItem + // + типографияToolStripMenuItem.Name = "типографияToolStripMenuItem"; + типографияToolStripMenuItem.Size = new Size(234, 26); + типографияToolStripMenuItem.Text = "Типография"; + типографияToolStripMenuItem.Click += типографияToolStripMenuItem_Click; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { получениеМатериаловToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(95, 24); + операцииToolStripMenuItem.Text = "Операции"; + // + // получениеМатериаловToolStripMenuItem + // + получениеМатериаловToolStripMenuItem.Name = "получениеМатериаловToolStripMenuItem"; + получениеМатериаловToolStripMenuItem.Size = new Size(257, 26); + получениеМатериаловToolStripMenuItem.Text = "Получение материалов"; + получениеМатериаловToolStripMenuItem.Click += получениеМатериаловToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(73, 24); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormPublishing + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormPublishing"; + Text = "Издательство"; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem покупательToolStripMenuItem; + private ToolStripMenuItem контактнаяПерсонаToolStripMenuItem; + private ToolStripMenuItem заказToolStripMenuItem; + private ToolStripMenuItem материалыToolStripMenuItem; + private ToolStripMenuItem типографияToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem получениеМатериаловToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + } +} diff --git a/ProjectPublishing/ProjectPublishing/FormPublishing.cs b/ProjectPublishing/ProjectPublishing/FormPublishing.cs new file mode 100644 index 0000000..1e2d086 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/FormPublishing.cs @@ -0,0 +1,87 @@ +using ProjectPublishing.Forms; +using Unity; + +namespace ProjectPublishing +{ + public partial class FormPublishing : Form + { + private readonly IUnityContainer _container; + public FormPublishing(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/FormPublishing.resx b/ProjectPublishing/ProjectPublishing/FormPublishing.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/FormPublishing.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.Designer.cs new file mode 100644 index 0000000..ddefbcd --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.Designer.cs @@ -0,0 +1,123 @@ +namespace ProjectPublishing.Forms +{ + partial class FormContactPeople + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormContactPeople)); + dataGridView = new DataGridView(); + panelButtons = new Panel(); + buttonRemove = new Button(); + buttonEdit = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panelButtons.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 3; + // + // panelButtons + // + panelButtons.Controls.Add(buttonRemove); + panelButtons.Controls.Add(buttonEdit); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 2; + // + // buttonRemove + // + buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Location = new Point(23, 254); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(115, 115); + buttonRemove.TabIndex = 2; + buttonRemove.UseVisualStyleBackColor = true; + // + // buttonEdit + // + buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; + buttonEdit.Image = (Image)resources.GetObject("buttonEdit.Image"); + buttonEdit.Location = new Point(23, 133); + buttonEdit.Name = "buttonEdit"; + buttonEdit.Size = new Size(115, 115); + buttonEdit.TabIndex = 1; + buttonEdit.UseVisualStyleBackColor = true; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + // + // FormContactPeople + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormContactPeople"; + StartPosition = FormStartPosition.CenterParent; + Text = "Контактные личности издательств"; + Load += FormContactPeople_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panelButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panelButtons; + private Button buttonRemove; + private Button buttonEdit; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.cs b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.cs new file mode 100644 index 0000000..6a22172 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.cs @@ -0,0 +1,106 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormContactPeople : Form + { + private readonly IUnityContainer _container; + private readonly IContactPersonRepository _contactPersonRepository; + public FormContactPeople(IUnityContainer container, IContactPersonRepository contactPersonRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _contactPersonRepository = contactPersonRepository ?? throw new ArgumentException(nameof(contactPersonRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonEdit_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _contactPersonRepository.DeleteContactPerson(findId); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void FormContactPeople_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _contactPersonRepository.ReadContactPeople(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.resx b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.resx new file mode 100644 index 0000000..e4fecdb --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPeople.resx @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH6AcSDjMPELkl4AAACdZJREFU + eF7tnUWsJUUUhh8Ed3d3h+CaQHBfsSH4gg0e3II7JDhhga5wHSDBQ3DXDcEXOAR3+79kXhiKc9871bf6 + 3u7b50u+ZDLzprq7+nV3yalTY0EQBEEQBEHQi+nlsnJ7eZi8Uj4gn5Gvy3fl1/LXqfJn/o5/e1reL6+Q + h0rKWEZSZjAkZpXbyLMkN+hn+XdhKfMpeabcWnLMoEaWlsfLx+Uv0ropdcoxH5PHyaVkUACemj3kvfIP + aVX8MPxTPikPlHPKIJPV5PXyJ2lVcJP8UV4nV5XBJKwlb5RNelq98lTzptlABgnrS1qyVsW1zb/kFLmu + 7DzzyEtkG5/YyeSJ5m00v+wc08l95GfSqpxR8ktJY4xr7gR0d56QVmWMsnSxRr57tbtkFMmqgH79Tb4m + b5UMTuwtN5FryuXkvHKmqfJnRr7WkPwMP8v/4f9SBmVZx+jXr+SucuSYQZ4raYBYF15FvtsvSr7h9JXn + kqWYTTJSdqp8SJa84dQB58wv2kiwuHxeWhdbxefkwXIBOSgWlIxTvyCtc6ris3Ix2WpWlh9I6wJz/Eae + J1eRw4YBjfPlt9I61xzflyvJVkLf9nNpXZjXLySvSb6ZTYMhSmauPpHWuXvlu0w7oFUw5fa9tC7II//3 + GDm7bDpzSCZBfpDWtXjkereVrYCby5yrdSEeb5F8t9vGkvJ2aV2TR+qs8Td5Q1n1yX1Pbifbzg6Sb6t1 + jZP5neTT1khWkFVHpu6UTfzOVoUu283SutbJpN1B47RR0Nyv8lvLJDoNlVEdx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jFRy13AY5WOeumF3Dgc4G2hDWaysY23oIuNUyeEA + 82HNDCxWNtCpu93mcIALCV0BWazsXfRysw53US96itVpzachMk6VHA4wTdx1zcXK/nPqPGoOBxgqGM1Q + LlW93rLMOFfRW5a5ad/LEBmnSg4HuC6i6E37mm0reyzjKL3euNUgY7Fqti7usZrNu3usZvv6HqvOCxzM + 3kuJtzt5dC1E16jiRJLtULGq0wtyWazR03ZybJE6ui7+FSbOiKWGo41cutVZOzltmpqf7xRp0S/xsb6u + 8xY9Q9etBk7mW6Y+UVL8a6zUYRAZZyKcIN8TjKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.Designer.cs new file mode 100644 index 0000000..4de77dd --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.Designer.cs @@ -0,0 +1,139 @@ +namespace ProjectPublishing.Forms +{ + partial class FormContactPerson + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonSave = new Button(); + textBoxEmail = new TextBox(); + textBoxPhone = new TextBox(); + label2 = new Label(); + label1 = new Label(); + textBoxName = new TextBox(); + label3 = new Label(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(217, 195); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(18, 195); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 12; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // textBoxEmail + // + textBoxEmail.Location = new Point(150, 118); + textBoxEmail.Name = "textBoxEmail"; + textBoxEmail.Size = new Size(161, 27); + textBoxEmail.TabIndex = 11; + // + // textBoxPhone + // + textBoxPhone.Location = new Point(150, 68); + textBoxPhone.Name = "textBoxPhone"; + textBoxPhone.Size = new Size(161, 27); + textBoxPhone.TabIndex = 10; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(18, 121); + label2.Name = "label2"; + label2.Size = new Size(51, 20); + label2.TabIndex = 9; + label2.Text = "Почта"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(18, 71); + label1.Name = "label1"; + label1.Size = new Size(69, 20); + label1.TabIndex = 8; + label1.Text = "Телефон"; + // + // textBoxName + // + textBoxName.Location = new Point(150, 22); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(161, 27); + textBoxName.TabIndex = 14; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(18, 25); + label3.Name = "label3"; + label3.Size = new Size(39, 20); + label3.TabIndex = 8; + label3.Text = "Имя"; + // + // FormContactPerson + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(341, 249); + Controls.Add(textBoxName); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxEmail); + Controls.Add(textBoxPhone); + Controls.Add(label2); + Controls.Add(label3); + Controls.Add(label1); + Name = "FormContactPerson"; + Text = "FormContactPerson"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonSave; + private TextBox textBoxEmail; + private TextBox textBoxPhone; + private Label label2; + private Label label1; + private TextBox textBoxName; + private Label label3; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.cs b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.cs new file mode 100644 index 0000000..54278d3 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.cs @@ -0,0 +1,79 @@ +using ProjectPublishing.Entities; +using ProjectPublishing.Repositories; +using ProjectPublishing.Repositories.Implementations; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormContactPerson : Form + { + private readonly IContactPersonRepository _contactPersonRepository; + private int? _contactPersonId; + + public int Id + { + set + { + try + { + var contact = _contactPersonRepository.ReadContactPersonById(value); + if (contact == null) + { + throw new InvalidDataException(nameof(contact)); + } + textBoxPhone.Text = contact.PhoneNumber; + textBoxEmail.Text = contact.Email; + textBoxName.Text = contact.Name; + _contactPersonId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormContactPerson(IContactPersonRepository contactPersonRepository) + { + InitializeComponent(); + _contactPersonRepository = contactPersonRepository ?? throw new ArgumentException(nameof(contactPersonRepository)); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxPhone.Text) || string.IsNullOrWhiteSpace(textBoxEmail.Text) || string.IsNullOrWhiteSpace(textBoxName.Text)) + { + throw new Exception("Имеются незаполненные поля!"); + } + + if (_contactPersonId.HasValue) + { + _contactPersonRepository.UpdateContactPerson(CreateContactPerson(_contactPersonId.Value)); + } + else + { + _contactPersonRepository.CreateContactPerson(CreateContactPerson(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private ContactPerson CreateContactPerson(int id) => ContactPerson.CreateContactPerson(id, textBoxName.Text, textBoxPhone.Text, textBoxEmail.Text); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.resx b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormContactPerson.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.Designer.cs new file mode 100644 index 0000000..4ca6b69 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.Designer.cs @@ -0,0 +1,142 @@ +namespace ProjectPublishing.Forms +{ + partial class FormCustomer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + textBoxCustomerPhone = new TextBox(); + textBoxCustomerEmail = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + comboBoxPublisherID = new ComboBox(); + SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(19, 24); + label1.Name = "label1"; + label1.Size = new Size(69, 20); + label1.TabIndex = 0; + label1.Text = "Телефон"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(19, 74); + label2.Name = "label2"; + label2.Size = new Size(51, 20); + label2.TabIndex = 1; + label2.Text = "Почта"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(19, 121); + label3.Name = "label3"; + label3.Size = new Size(90, 20); + label3.TabIndex = 2; + label3.Text = "ID издателя"; + // + // textBoxCustomerPhone + // + textBoxCustomerPhone.Location = new Point(151, 21); + textBoxCustomerPhone.Name = "textBoxCustomerPhone"; + textBoxCustomerPhone.Size = new Size(161, 27); + textBoxCustomerPhone.TabIndex = 3; + // + // textBoxCustomerEmail + // + textBoxCustomerEmail.Location = new Point(151, 71); + textBoxCustomerEmail.Name = "textBoxCustomerEmail"; + textBoxCustomerEmail.Size = new Size(161, 27); + textBoxCustomerEmail.TabIndex = 4; + // + // buttonSave + // + buttonSave.Location = new Point(19, 170); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(218, 170); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // comboBoxPublisherID + // + comboBoxPublisherID.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPublisherID.FormattingEnabled = true; + comboBoxPublisherID.Location = new Point(151, 113); + comboBoxPublisherID.Name = "comboBoxPublisherID"; + comboBoxPublisherID.Size = new Size(151, 28); + comboBoxPublisherID.TabIndex = 15; + // + // FormCustomer + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(328, 224); + Controls.Add(comboBoxPublisherID); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxCustomerEmail); + Controls.Add(textBoxCustomerPhone); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Name = "FormCustomer"; + StartPosition = FormStartPosition.CenterParent; + Text = "Заказчик"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label label1; + private Label label2; + private Label label3; + private TextBox textBoxCustomerPhone; + private TextBox textBoxCustomerEmail; + private Button buttonSave; + private Button buttonCancel; + private ComboBox comboBoxPublisherID; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.cs new file mode 100644 index 0000000..d4233f6 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.cs @@ -0,0 +1,83 @@ +using ProjectPublishing.Entities; +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormCustomer : Form + { + private readonly ICustomerRepository _customerRepository; + private int? _customerId; + + public int Id + { + set + { + try + { + var customer = _customerRepository.ReadCustomerById(value); + if (customer == null) + { + throw new InvalidDataException(nameof(customer)); + } + textBoxCustomerPhone.Text = customer.PhoneNumber; + textBoxCustomerEmail.Text = customer.Email; + comboBoxPublisherID.SelectedValue = customer.PublisherId; + _customerId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormCustomer(ICustomerRepository customerRepository, IContactPersonRepository contactPersonRepository) + { + InitializeComponent(); + _customerRepository = customerRepository ?? throw new ArgumentException(nameof(customerRepository)); + + comboBoxPublisherID.DataSource = contactPersonRepository.ReadContactPeople(); + comboBoxPublisherID.DisplayMember = "Name"; + comboBoxPublisherID.ValueMember = "Id"; + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxCustomerPhone.Text) || string.IsNullOrWhiteSpace(textBoxCustomerEmail.Text)) + { + throw new Exception("Имеются незаполненные поля!"); + } + + if (_customerId.HasValue) + { + _customerRepository.UpdateCustomer(CreateCustomer(_customerId.Value)); + } + else + { + _customerRepository.CreateCustomer(CreateCustomer(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private Customer CreateCustomer(int id) => Customer.CreateCustomer(id, textBoxCustomerPhone.Text, textBoxCustomerEmail.Text, (int)comboBoxPublisherID.SelectedValue!); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.resx b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.Designer.cs new file mode 100644 index 0000000..9ef1515 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectPublishing.Forms +{ + partial class FormCustomers + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCustomers)); + panelButtons = new Panel(); + buttonRemove = new Button(); + buttonEdit = new Button(); + buttonAdd = new Button(); + dataGridView = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonRemove); + panelButtons.Controls.Add(buttonEdit); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 0; + // + // buttonRemove + // + buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Location = new Point(23, 254); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(115, 115); + buttonRemove.TabIndex = 2; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += buttonRemove_Click; + // + // buttonEdit + // + buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; + buttonEdit.Image = (Image)resources.GetObject("buttonEdit.Image"); + buttonEdit.Location = new Point(23, 133); + buttonEdit.Name = "buttonEdit"; + buttonEdit.Size = new Size(115, 115); + buttonEdit.TabIndex = 1; + buttonEdit.UseVisualStyleBackColor = true; + buttonEdit.Click += buttonEdit_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 1; + // + // FormCustomers + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormCustomers"; + StartPosition = FormStartPosition.CenterParent; + Text = "Клиенты"; + Load += FormCustomers_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonAdd; + private Button buttonRemove; + private Button buttonEdit; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.cs b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.cs new file mode 100644 index 0000000..280743c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.cs @@ -0,0 +1,106 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormCustomers : Form + { + private readonly IUnityContainer _container; + private readonly ICustomerRepository _customerRepository; + public FormCustomers(IUnityContainer container, ICustomerRepository customerRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _customerRepository = customerRepository ?? throw new ArgumentException(nameof(customerRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonEdit_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _customerRepository.DeleteCustomer(findId); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void FormCustomers_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _customerRepository.ReadCustomers(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.resx b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.resx new file mode 100644 index 0000000..d5ce03c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormCustomers.resx @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH6AcSDjMPELkl4AAACdZJREFU + eF7tnUWsJUUUhh8Ed3d3h+CaQHBfsSH4gg0e3II7JDhhga5wHSDBQ3DXDcEXOAR3+79kXhiKc9871bf6 + 3u7b50u+ZDLzprq7+nV3yalTY0EQBEEQBEHQi+nlsnJ7eZi8Uj4gn5Gvy3fl1/LXqfJn/o5/e1reL6+Q + h0rKWEZSZjAkZpXbyLMkN+hn+XdhKfMpeabcWnLMoEaWlsfLx+Uv0ropdcoxH5PHyaVkUACemj3kvfIP + aVX8MPxTPikPlHPKIJPV5PXyJ2lVcJP8UV4nV5XBJKwlb5RNelq98lTzptlABgnrS1qyVsW1zb/kFLmu + 7DzzyEtkG5/YyeSJ5m00v+wc08l95GfSqpxR8ktJY4xr7gR0d56QVmWMsnSxRr57tbtkFMmqgH79Tb4m + b5UMTuwtN5FryuXkvHKmqfJnRr7WkPwMP8v/4f9SBmV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bvNIDrAWM9JMOkdWewduYbK/EYTtpxGi76oGwyKA4wqmDV+Hpje3pGNAXWEyboH + wBngogoDSWZ6GczzXzdesp6z/XBCwtxSV0A6SnQq0032fBQ99za4GW4C+8RRQarkcIDG8t6Mh90KVrv2 + Uu4DN5E1Auw2aY76LZOhBstoWd1ryLKbcujnnuc9OmJ33UBHDB/Jof5s4E5TLkxwvx0fMbtWVluGY12A + bejaGImzaC7GcxLf80x5NxXGZDA/7+UKGUMqLsrwHO9JvEfv1fVrLkSxDJbFMllmy2hZLbNl1wZ+7nl1 + 4lV9IW/aX05knCo5HGD8xtUwxcpfmo97ZJwqORzgjFRy13AY5WOeumF3Dgc4G2hDWaysY23oIuNUyeEA + 82HNDCxWNtCpu93mcIALCV0BWazsXfRysw53US96itVpzachMk6VHA4wTdx1zcXK/nPqPGoOBxgqGM1Q + LlW93rLMOFfRW5a5ad/LEBmnSg4HuC6i6E37mm0reyzjKL3euNUgY7Fqti7usZrNu3usZvv6HqvOCxzM + 3kuJtzt5dC1E16jiRJLtULGq0wtyWazR03ZybJE6ui7+FSbOiKWGo41cutVZOzltmpqf7xRp0S/xsb6u + 8xY9Q9etBk7mW6Y+UVL8a6zUYRAZZyKcIN8TjKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.Designer.cs new file mode 100644 index 0000000..918a87d --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.Designer.cs @@ -0,0 +1,97 @@ +namespace ProjectPublishing.Forms +{ + partial class FormMaterial + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonSave = new Button(); + label2 = new Label(); + comboBoxMaterialType = new ComboBox(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(195, 74); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(12, 74); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 12; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 15); + label2.Name = "label2"; + label2.Size = new Size(114, 20); + label2.TabIndex = 9; + label2.Text = "Тип материала"; + // + // comboBoxMaterialType + // + comboBoxMaterialType.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxMaterialType.FormattingEnabled = true; + comboBoxMaterialType.Location = new Point(138, 12); + comboBoxMaterialType.Name = "comboBoxMaterialType"; + comboBoxMaterialType.Size = new Size(151, 28); + comboBoxMaterialType.TabIndex = 14; + // + // FormMaterial + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(301, 124); + Controls.Add(comboBoxMaterialType); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(label2); + Name = "FormMaterial"; + Text = "FormMaterial"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonSave; + private Label label2; + private ComboBox comboBoxMaterialType; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.cs new file mode 100644 index 0000000..1acd98e --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.cs @@ -0,0 +1,76 @@ +using ProjectPublishing.Entities; +using ProjectPublishing.Entities.Enums; +using ProjectPublishing.Repositories; +using ProjectPublishing.Repositories.Implementations; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormMaterial : Form + { + private readonly IMaterialRepository _materialRepository; + private int? _materialId; + + public int Id + { + set + { + try + { + var material = _materialRepository.ReadMaterialById(value); + if (material == null) + { + throw new InvalidDataException(nameof(material)); + } + comboBoxMaterialType.SelectedItem = material.MaterialType; + _materialId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormMaterial(IMaterialRepository materialRepository) + { + InitializeComponent(); + _materialRepository = materialRepository ?? throw new ArgumentException(nameof(materialRepository)); + comboBoxMaterialType.DataSource = Enum.GetValues(typeof(MaterialType)); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + + if (_materialId.HasValue) + { + _materialRepository.UpdateMaterial(CreateMaterial(_materialId.Value)); + } + else + { + _materialRepository.UpdateMaterial(CreateMaterial(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private Material CreateMaterial(int id) => Material.CreateMaterial(id, (MaterialType)comboBoxMaterialType.SelectedItem!); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.resx b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterial.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.Designer.cs new file mode 100644 index 0000000..7823450 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.Designer.cs @@ -0,0 +1,124 @@ +namespace ProjectPublishing.Forms +{ + partial class FormMaterialAdmission + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + comboBoxMaterialId = new ComboBox(); + label4 = new Label(); + numericUpDownAmount = new NumericUpDown(); + label3 = new Label(); + buttonCancel = new Button(); + buttonSave = new Button(); + ((System.ComponentModel.ISupportInitialize)numericUpDownAmount).BeginInit(); + SuspendLayout(); + // + // comboBoxMaterialId + // + comboBoxMaterialId.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxMaterialId.FormattingEnabled = true; + comboBoxMaterialId.Location = new Point(140, 54); + comboBoxMaterialId.Name = "comboBoxMaterialId"; + comboBoxMaterialId.Size = new Size(161, 28); + comboBoxMaterialId.TabIndex = 26; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(8, 57); + label4.Name = "label4"; + label4.Size = new Size(103, 20); + label4.TabIndex = 25; + label4.Text = "ID материала"; + // + // numericUpDownAmount + // + numericUpDownAmount.Location = new Point(140, 12); + numericUpDownAmount.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + numericUpDownAmount.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownAmount.Name = "numericUpDownAmount"; + numericUpDownAmount.Size = new Size(161, 27); + numericUpDownAmount.TabIndex = 24; + numericUpDownAmount.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(8, 14); + label3.Name = "label3"; + label3.Size = new Size(58, 20); + label3.TabIndex = 23; + label3.Text = "Кол-во"; + // + // buttonCancel + // + buttonCancel.Location = new Point(207, 217); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 22; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(8, 217); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 21; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // FormMaterialAdmission + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(313, 262); + Controls.Add(comboBoxMaterialId); + Controls.Add(label4); + Controls.Add(numericUpDownAmount); + Controls.Add(label3); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Name = "FormMaterialAdmission"; + Text = "Прием материалов"; + ((System.ComponentModel.ISupportInitialize)numericUpDownAmount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxMaterialId; + private Label label4; + private NumericUpDown numericUpDownAmount; + private Label label3; + private Button buttonCancel; + private Button buttonSave; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.cs new file mode 100644 index 0000000..698c896 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.cs @@ -0,0 +1,47 @@ +using ProjectPublishing.Entities; +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormMaterialAdmission : Form + { + private readonly IMaterialAdmissionRepository _materialAdmissionRepository; + + + public FormMaterialAdmission(IMaterialAdmissionRepository materialAdmissionRepository, IMaterialRepository materialRepository) + { + InitializeComponent(); + _materialAdmissionRepository = materialAdmissionRepository ?? throw new ArgumentException(nameof(materialAdmissionRepository)); + + comboBoxMaterialId.DataSource = materialRepository.ReadMaterials(); + comboBoxMaterialId.DisplayMember = "MaterialType"; + comboBoxMaterialId.ValueMember = "Id"; + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + _materialAdmissionRepository.CreateMaterialsAdmission(MaterialsAdmission.CreateOperation(0, (int)numericUpDownAmount.Value, (int)comboBoxMaterialId.SelectedValue!)); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.resx b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmission.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.Designer.cs new file mode 100644 index 0000000..c41f7ea --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.Designer.cs @@ -0,0 +1,98 @@ +namespace ProjectPublishing.Forms +{ + partial class FormMaterialAdmissions + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMaterialAdmissions)); + dataGridView = new DataGridView(); + panelButtons = new Panel(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panelButtons.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 5; + // + // panelButtons + // + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 4; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormMaterialAdmissions + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormMaterialAdmissions"; + Text = "FormMaterialAdmissions"; + Load += FormMaterial_admissions_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panelButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panelButtons; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.cs new file mode 100644 index 0000000..2a47864 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.cs @@ -0,0 +1,66 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormMaterialAdmissions : Form + { + private readonly IUnityContainer _container; + private readonly IMaterialAdmissionRepository _materialAdmissionRepository; + public FormMaterialAdmissions(IUnityContainer container, IMaterialAdmissionRepository materialAdmissionRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _materialAdmissionRepository = materialAdmissionRepository ?? throw new ArgumentException(nameof(materialAdmissionRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + private void FormMaterial_admissions_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _materialAdmissionRepository.ReadMaterialsAdmission(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.resx b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.resx new file mode 100644 index 0000000..48213ba --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterialAdmissions.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKey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aY76LZOhBstoWd1ryLKbcujnnuc9OmJ33UBHDB/Jof5s4E5TLkxwvx0fMbtWVluGY12A + bejaGImzaC7GcxLf80x5NxXGZDA/7+UKGUMqLsrwHO9JvEfv1fVrLkSxDJbFMllmy2hZLbNl1wZ+7nl1 + 4lV9IW/aX05knCo5HGD8xtUwxcpfmo97ZJwqORzgjFRy13AY5WOeumF3Dgc4G2hDWaysY23oIuNUyeEA + 82HNDCxWNtCpu93mcIALCV0BWazsXfRysw53US96itVpzachMk6VHA4wTdx1zcXK/nPqPGoOBxgqGM1Q + LlW93rLMOFfRW5a5ad/LEBmnSg4HuC6i6E37mm0reyzjKL3euNUgY7Fqti7usZrNu3usZvv6HqvOCxzM + 3kuJtzt5dC1E16jiRJLtULGq0wtyWazR03ZybJE6ui7+FSbOiKWGo41cutVZOzltmpqf7xRp0S/xsb6u + 8xY9Q9etBk7mW6Y+UVL8a6zUYRAZZyKcIN8TjKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.Designer.cs new file mode 100644 index 0000000..2970b5c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectPublishing.Forms +{ + partial class FormMaterials + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMaterials)); + dataGridView = new DataGridView(); + panelButtons = new Panel(); + buttonRemove = new Button(); + buttonEdit = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panelButtons.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 3; + // + // panelButtons + // + panelButtons.Controls.Add(buttonRemove); + panelButtons.Controls.Add(buttonEdit); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 2; + // + // buttonRemove + // + buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Location = new Point(23, 254); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(115, 115); + buttonRemove.TabIndex = 2; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += buttonRemove_Click; + // + // buttonEdit + // + buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; + buttonEdit.Image = (Image)resources.GetObject("buttonEdit.Image"); + buttonEdit.Location = new Point(23, 133); + buttonEdit.Name = "buttonEdit"; + buttonEdit.Size = new Size(115, 115); + buttonEdit.TabIndex = 1; + buttonEdit.UseVisualStyleBackColor = true; + buttonEdit.Click += buttonEdit_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormMaterials + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormMaterials"; + StartPosition = FormStartPosition.CenterParent; + Text = "FormMaterials"; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panelButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panelButtons; + private Button buttonRemove; + private Button buttonEdit; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.cs b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.cs new file mode 100644 index 0000000..54e8412 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.cs @@ -0,0 +1,106 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormMaterials : Form + { + private readonly IUnityContainer _container; + private readonly IMaterialRepository _materialRepository; + public FormMaterials(IUnityContainer container, IMaterialRepository materialRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _materialRepository = materialRepository ?? throw new ArgumentException(nameof(materialRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonEdit_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _materialRepository.DeleteMaterial(findId); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void FormMaterials_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _materialRepository.ReadMaterials(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.resx b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.resx new file mode 100644 index 0000000..e4fecdb --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormMaterials.resx @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH6AcSDjMPELkl4AAACdZJREFU + eF7tnUWsJUUUhh8Ed3d3h+CaQHBfsSH4gg0e3II7JDhhga5wHSDBQ3DXDcEXOAR3+79kXhiKc9871bf6 + 3u7b50u+ZDLzprq7+nV3yalTY0EQBEEQBEHQi+nlsnJ7eZi8Uj4gn5Gvy3fl1/LXqfJn/o5/e1reL6+Q + h0rKWEZSZjAkZpXbyLMkN+hn+XdhKfMpeabcWnLMoEaWlsfLx+Uv0ropdcoxH5PHyaVkUACemj3kvfIP + aVX8MPxTPikPlHPKIJPV5PXyJ2lVcJP8UV4nV5XBJKwlb5RNelq98lTzptlABgnrS1qyVsW1zb/kFLmu + 7DzzyEtkG5/YyeSJ5m00v+wc08l95GfSqpxR8ktJY4xr7gR0d56QVmWMsnSxRr57tbtkFMmqgH79Tb4m + b5UMTuwtN5FryuXkvHKmqfJnRr7WkPwMP8v/4f9SBmVZx+jXr+SucuSYQZ4raYBYF15FvtsvSr7h9JXn + kqWYTTJSdqp8SJa84dQB58wv2kiwuHxeWhdbxefkwXIBOSgWlIxTvyCtc6ris3Ix2WpWlh9I6wJz/Eae + J1eRw4YBjfPlt9I61xzflyvJVkLf9nNpXZjXLySvSb6ZTYMhSmauPpHWuXvlu0w7oFUw5fa9tC7II//3 + GDm7bDpzSC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MbtWVluGY12A + bejaGImzaC7GcxLf80x5NxXGZDA/7+UKGUMqLsrwHO9JvEfv1fVrLkSxDJbFMllmy2hZLbNl1wZ+7nl1 + 4lV9IW/aX05knCo5HGD8xtUwxcpfmo97ZJwqORzgjFRy13AY5WOeumF3Dgc4G2hDWaysY23oIuNUyeEA + 82HNDCxWNtCpu93mcIALCV0BWazsXfRysw53US96itVpzachMk6VHA4wTdx1zcXK/nPqPGoOBxgqGM1Q + LlW93rLMOFfRW5a5ad/LEBmnSg4HuC6i6E37mm0reyzjKL3euNUgY7Fqti7usZrNu3usZvv6HqvOCxzM + 3kuJtzt5dC1E16jiRJLtULGq0wtyWazR03ZybJE6ui7+FSbOiKWGo41cutVZOzltmpqf7xRp0S/xsb6u + 8xY9Q9etBk7mW6Y+UVL8a6zUYRAZZyKcIN8TjKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrder.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.Designer.cs new file mode 100644 index 0000000..4fe7b4e --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.Designer.cs @@ -0,0 +1,244 @@ +namespace ProjectPublishing.Forms +{ + partial class FormOrder + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonSave = new Button(); + textBoxDesc = new TextBox(); + label1 = new Label(); + comboBoxOrderType = new ComboBox(); + label2 = new Label(); + numericUpDownAmount = new NumericUpDown(); + label3 = new Label(); + comboBoxStatus = new ComboBox(); + label4 = new Label(); + label5 = new Label(); + label6 = new Label(); + label7 = new Label(); + comboBoxCustomerID = new ComboBox(); + comboBoxPrintingUD = new ComboBox(); + comboBoxMaterialsID = new ComboBox(); + ((System.ComponentModel.ISupportInitialize)numericUpDownAmount).BeginInit(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(211, 401); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(12, 401); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 12; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // textBoxDesc + // + textBoxDesc.Location = new Point(144, 12); + textBoxDesc.Multiline = true; + textBoxDesc.Name = "textBoxDesc"; + textBoxDesc.Size = new Size(161, 129); + textBoxDesc.TabIndex = 10; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 15); + label1.Name = "label1"; + label1.Size = new Size(79, 20); + label1.TabIndex = 8; + label1.Text = "Описание"; + // + // comboBoxOrderType + // + comboBoxOrderType.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxOrderType.FormattingEnabled = true; + comboBoxOrderType.Location = new Point(144, 147); + comboBoxOrderType.Name = "comboBoxOrderType"; + comboBoxOrderType.Size = new Size(161, 28); + comboBoxOrderType.TabIndex = 16; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 150); + label2.Name = "label2"; + label2.Size = new Size(102, 20); + label2.TabIndex = 15; + label2.Text = "Тип продукта"; + // + // numericUpDownAmount + // + numericUpDownAmount.Location = new Point(144, 196); + numericUpDownAmount.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + numericUpDownAmount.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownAmount.Name = "numericUpDownAmount"; + numericUpDownAmount.Size = new Size(161, 27); + numericUpDownAmount.TabIndex = 18; + numericUpDownAmount.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 198); + label3.Name = "label3"; + label3.Size = new Size(58, 20); + label3.TabIndex = 17; + label3.Text = "Кол-во"; + // + // comboBoxStatus + // + comboBoxStatus.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStatus.FormattingEnabled = true; + comboBoxStatus.Location = new Point(144, 238); + comboBoxStatus.Name = "comboBoxStatus"; + comboBoxStatus.Size = new Size(161, 28); + comboBoxStatus.TabIndex = 20; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(12, 241); + label4.Name = "label4"; + label4.Size = new Size(52, 20); + label4.TabIndex = 19; + label4.Text = "Статус"; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(12, 275); + label5.Name = "label5"; + label5.Size = new Size(97, 20); + label5.TabIndex = 21; + label5.Text = "ID заказчика"; + // + // label6 + // + label6.AutoSize = true; + label6.Location = new Point(12, 309); + label6.Name = "label6"; + label6.Size = new Size(112, 20); + label6.TabIndex = 23; + label6.Text = "ID типографии"; + // + // label7 + // + label7.AutoSize = true; + label7.Location = new Point(12, 343); + label7.Name = "label7"; + label7.Size = new Size(112, 20); + label7.TabIndex = 25; + label7.Text = "ID материалов"; + // + // comboBoxCustomerID + // + comboBoxCustomerID.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxCustomerID.FormattingEnabled = true; + comboBoxCustomerID.Location = new Point(144, 272); + comboBoxCustomerID.Name = "comboBoxCustomerID"; + comboBoxCustomerID.Size = new Size(161, 28); + comboBoxCustomerID.TabIndex = 26; + // + // comboBoxPrintingUD + // + comboBoxPrintingUD.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPrintingUD.FormattingEnabled = true; + comboBoxPrintingUD.Location = new Point(144, 306); + comboBoxPrintingUD.Name = "comboBoxPrintingUD"; + comboBoxPrintingUD.Size = new Size(161, 28); + comboBoxPrintingUD.TabIndex = 27; + // + // comboBoxMaterialsID + // + comboBoxMaterialsID.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxMaterialsID.FormattingEnabled = true; + comboBoxMaterialsID.Location = new Point(144, 340); + comboBoxMaterialsID.Name = "comboBoxMaterialsID"; + comboBoxMaterialsID.Size = new Size(161, 28); + comboBoxMaterialsID.TabIndex = 28; + // + // FormOrder + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(317, 450); + Controls.Add(comboBoxMaterialsID); + Controls.Add(comboBoxPrintingUD); + Controls.Add(comboBoxCustomerID); + Controls.Add(label7); + Controls.Add(label6); + Controls.Add(label5); + Controls.Add(comboBoxStatus); + Controls.Add(label4); + Controls.Add(numericUpDownAmount); + Controls.Add(label3); + Controls.Add(comboBoxOrderType); + Controls.Add(label2); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxDesc); + Controls.Add(label1); + Name = "FormOrder"; + StartPosition = FormStartPosition.CenterParent; + Text = "FormOrder"; + ((System.ComponentModel.ISupportInitialize)numericUpDownAmount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonSave; + private TextBox textBoxDesc; + private Label label1; + private ComboBox comboBoxOrderType; + private Label label2; + private NumericUpDown numericUpDownAmount; + private Label label3; + private ComboBox comboBoxStatus; + private Label label4; + private Label label5; + private Label label6; + private Label label7; + private ComboBox comboBoxCustomerID; + private ComboBox comboBoxPrintingUD; + private ComboBox comboBoxMaterialsID; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrder.cs b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.cs new file mode 100644 index 0000000..190c8ba --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.cs @@ -0,0 +1,104 @@ +using ProjectPublishing.Entities.Enums; +using ProjectPublishing.Entities; +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormOrder : Form + { + private readonly IOrderRepository _orderRepository; + private int? _orderId; + + public int Id + { + set + { + try + { + var material = _orderRepository.ReadOrderById(value); + if (material == null) + { + throw new InvalidDataException(nameof(material)); + } + textBoxDesc.Text = material.Description; + numericUpDownAmount.Value = material.Amount; + comboBoxOrderType.SelectedItem = material.ProductType; + comboBoxStatus.SelectedItem = material.Status; + comboBoxCustomerID.SelectedItem = material.CustomerId; + comboBoxPrintingUD.SelectedItem = material.PrintingId; + comboBoxMaterialsID.SelectedItem = material.MaterialsId; + _orderId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormOrder(IOrderRepository orderRepository, ICustomerRepository customerRepository, IPrintingHouseRepository printingHouseRepository, IMaterialRepository materialRepository) + { + InitializeComponent(); + _orderRepository = orderRepository ?? throw new ArgumentException(nameof(orderRepository)); + comboBoxOrderType.DataSource = Enum.GetValues(typeof(ProductType)); + comboBoxStatus.DataSource = Enum.GetValues(typeof(OrderStatus)); + comboBoxCustomerID.DataSource = customerRepository.ReadCustomers(); + comboBoxPrintingUD.DataSource = printingHouseRepository.ReadPrintingHouses(); + comboBoxMaterialsID.DataSource = materialRepository.ReadMaterials(); + + comboBoxCustomerID.DisplayMember = "Name"; + comboBoxCustomerID.ValueMember = "Id"; + + comboBoxPrintingUD.DisplayMember = "Name"; + comboBoxPrintingUD.ValueMember = "Id"; + + comboBoxMaterialsID.DisplayMember = "MaterialType"; + comboBoxMaterialsID.ValueMember= "Id"; + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + + if (_orderId.HasValue) + { + _orderRepository.UpdateOrder(CreateOrder(_orderId.Value)); + } + else + { + _orderRepository.UpdateOrder(CreateOrder(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private Order CreateOrder(int id) => Order.CreateOrder + ( + id, + textBoxDesc.Text, + (ProductType)comboBoxOrderType.SelectedItem!, + (int)numericUpDownAmount.Value, + (OrderStatus)comboBoxStatus.SelectedItem!, + (int)comboBoxCustomerID.SelectedValue!, + (int)comboBoxPrintingUD.SelectedValue!, + (int)comboBoxMaterialsID.SelectedValue! + ); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrder.resx b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrder.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrders.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.Designer.cs new file mode 100644 index 0000000..e212f04 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectPublishing.Forms +{ + partial class FormOrders + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormOrders)); + dataGridView = new DataGridView(); + panelButtons = new Panel(); + buttonRemove = new Button(); + buttonEdit = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panelButtons.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 5; + // + // panelButtons + // + panelButtons.Controls.Add(buttonRemove); + panelButtons.Controls.Add(buttonEdit); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 4; + // + // buttonRemove + // + buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Location = new Point(23, 254); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(115, 115); + buttonRemove.TabIndex = 2; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += buttonRemove_Click; + // + // buttonEdit + // + buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; + buttonEdit.Image = (Image)resources.GetObject("buttonEdit.Image"); + buttonEdit.Location = new Point(23, 133); + buttonEdit.Name = "buttonEdit"; + buttonEdit.Size = new Size(115, 115); + buttonEdit.TabIndex = 1; + buttonEdit.UseVisualStyleBackColor = true; + buttonEdit.Click += buttonEdit_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormOrders + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormOrders"; + StartPosition = FormStartPosition.CenterParent; + Text = "FormOrders"; + Load += FormOrders_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panelButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panelButtons; + private Button buttonRemove; + private Button buttonEdit; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrders.cs b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.cs new file mode 100644 index 0000000..69857c4 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.cs @@ -0,0 +1,106 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormOrders : Form + { + private readonly IUnityContainer _container; + private readonly IOrderRepository _orderRepository; + public FormOrders(IUnityContainer container, IOrderRepository orderRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _orderRepository = orderRepository ?? throw new ArgumentException(nameof(orderRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonEdit_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _orderRepository.DeleteOrder(findId); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void FormOrders_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _orderRepository.ReadOrders(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormOrders.resx b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.resx new file mode 100644 index 0000000..629d2a2 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormOrders.resx @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH6AcSDjMPELkl4AAACdZJREFU + eF7tnUWsJUUUhh8Ed3d3h+CaQHBfsSH4gg0e3II7JDhhga5wHSDBQ3DXDcEXOAR3+79kXhiKc9871bf6 + 3u7b50u+ZDLzprq7+nV3yalTY0EQBEEQBEHQi+nlsnJ7eZi8Uj4gn5Gvy3fl1/LXqfJn/o5/e1reL6+Q + h0rKWEZSZjAkZpXbyLMkN+hn+XdhKfMpeabcWnLMoEaWlsfLx+Uv0ropdcoxH5PHyaVkUACemj3kvfIP + aVX8MPxTPikPlHPKIJPV5PXyJ2lVcJP8UV4nV5XBJKwlb5RNelq98lTzptlABgnrS1qyVsW1zb/kFLmu + 7DzzyEtkG5/YyeSJ5m00v+wc08l95GfSqpxR8ktJY4xr7gR0d56QVmWMsnSxRr57tbtkFMmqgH79Tb4m + b5UMTuwtN5FryuXkvHKmqfJnRr7WkPwMP8v/4f9SBmVZx+jXr+SucuSYQZ4raYBYF15FvtsvSr7h9JXn + kqWYTTJSdqp8SJa84dQB58wv2kiwuHxeWhdbxefkwXIBOSgWlIxTvy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SV0A6SnQq0032fBQ99za4GW4C+8RRQarkcIDG8t6Mh90KVrv2 + Uu4DN5E1Auw2aY76LZOhBstoWd1ryLKbcujnnuc9OmJ33UBHDB/Jof5s4E5TLkxwvx0fMbtWVluGY12A + bejaGImzaC7GcxLf80x5NxXGZDA/7+UKGUMqLsrwHO9JvEfv1fVrLkSxDJbFMllmy2hZLbNl1wZ+7nl1 + 4lV9IW/aX05knCo5HGD8xtUwxcpfmo97ZJwqORzgjFRy13AY5WOeumF3Dgc4G2hDWaysY23oIuNUyeEA + 82HNDCxWNtCpu93mcIALCV0BWazsXfRysw53US96itVpzachMk6VHA4wTdx1zcXK/nPqPGoOBxgqGM1Q + LlW93rLMOFfRW5a5ad/LEBmnSg4HuC6i6E37mm0reyzjKL3euNUgY7Fqti7usZrNu3usZvv6HqvOCxzM + 3kuJtzt5dC1E16jiRJLtULGq0wtyWazR03ZybJE6ui7+FSbOiKWGo41cutVZOzltmpqf7xRp0S/xsb6u + 8xY9Q9etBk7mW6Y+UVL8a6zUYRAZZyKcIN8TjKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.Designer.cs new file mode 100644 index 0000000..1de28f4 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.Designer.cs @@ -0,0 +1,162 @@ +namespace ProjectPublishing.Forms +{ + partial class FormPrintingHouse + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonSave = new Button(); + textBoxEmail = new TextBox(); + textBoxPhone = new TextBox(); + label2 = new Label(); + label1 = new Label(); + label3 = new Label(); + label4 = new Label(); + textBoxName = new TextBox(); + textBoxAddress = new TextBox(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(206, 255); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(7, 255); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 12; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // textBoxEmail + // + textBoxEmail.Location = new Point(139, 156); + textBoxEmail.Name = "textBoxEmail"; + textBoxEmail.Size = new Size(161, 27); + textBoxEmail.TabIndex = 11; + // + // textBoxPhone + // + textBoxPhone.Location = new Point(139, 106); + textBoxPhone.Name = "textBoxPhone"; + textBoxPhone.Size = new Size(161, 27); + textBoxPhone.TabIndex = 10; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(7, 159); + label2.Name = "label2"; + label2.Size = new Size(51, 20); + label2.TabIndex = 9; + label2.Text = "Почта"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(7, 109); + label1.Name = "label1"; + label1.Size = new Size(69, 20); + label1.TabIndex = 8; + label1.Text = "Телефон"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(7, 15); + label3.Name = "label3"; + label3.Size = new Size(77, 20); + label3.TabIndex = 8; + label3.Text = "Название"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(7, 65); + label4.Name = "label4"; + label4.Size = new Size(51, 20); + label4.TabIndex = 9; + label4.Text = "Адрес"; + // + // textBoxName + // + textBoxName.Location = new Point(139, 12); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(161, 27); + textBoxName.TabIndex = 10; + // + // textBoxAddress + // + textBoxAddress.Location = new Point(139, 62); + textBoxAddress.Name = "textBoxAddress"; + textBoxAddress.Size = new Size(161, 27); + textBoxAddress.TabIndex = 11; + // + // FormPrintingHouse + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(307, 301); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxAddress); + Controls.Add(textBoxEmail); + Controls.Add(textBoxName); + Controls.Add(label4); + Controls.Add(textBoxPhone); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Name = "FormPrintingHouse"; + StartPosition = FormStartPosition.CenterParent; + Text = "Типография"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonSave; + private TextBox textBoxEmail; + private TextBox textBoxPhone; + private Label label2; + private Label label1; + private Label label3; + private Label label4; + private TextBox textBoxName; + private TextBox textBoxAddress; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.cs b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.cs new file mode 100644 index 0000000..4aa85d6 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.cs @@ -0,0 +1,80 @@ +using ProjectPublishing.Entities; +using ProjectPublishing.Repositories; +using ProjectPublishing.Repositories.Implementations; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectPublishing.Forms +{ + public partial class FormPrintingHouse : Form + { + private readonly IPrintingHouseRepository _printingHouseRepository; + private int? _printingHouseId; + + public int Id + { + set + { + try + { + var printingHouse = _printingHouseRepository.ReadPrintingHouseById(value); + if (printingHouse == null) + { + throw new InvalidDataException(nameof(printingHouse)); + } + textBoxAddress.Text = printingHouse.Address; + textBoxPhone.Text = printingHouse.PhoneNumber; + textBoxEmail.Text = printingHouse.Email; + textBoxName.Text = printingHouse.Name; + _printingHouseId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormPrintingHouse(IPrintingHouseRepository printingHouseRepository) + { + InitializeComponent(); + _printingHouseRepository = printingHouseRepository ?? throw new ArgumentException(nameof(printingHouseRepository)); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxPhone.Text) || string.IsNullOrWhiteSpace(textBoxEmail.Text) || string.IsNullOrWhiteSpace(textBoxName.Text)) + { + throw new Exception("Имеются незаполненные поля!"); + } + + if (_printingHouseId.HasValue) + { + _printingHouseRepository.UpdatePrintingHouse(CreatePrintingHouse(_printingHouseId.Value)); + } + else + { + _printingHouseRepository.UpdatePrintingHouse(CreatePrintingHouse(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private PrintingHouse CreatePrintingHouse(int id) => PrintingHouse.CreatePrintingHouse(id, textBoxName.Text, textBoxAddress.Text, textBoxPhone.Text, textBoxEmail.Text); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.resx b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouse.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.Designer.cs b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.Designer.cs new file mode 100644 index 0000000..9d43a40 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectPublishing.Forms +{ + partial class FormPrintingHouses + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPrintingHouses)); + dataGridView = new DataGridView(); + panelButtons = new Panel(); + buttonRemove = new Button(); + buttonEdit = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panelButtons.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(648, 450); + dataGridView.TabIndex = 5; + // + // panelButtons + // + panelButtons.Controls.Add(buttonRemove); + panelButtons.Controls.Add(buttonEdit); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(648, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(152, 450); + panelButtons.TabIndex = 4; + // + // buttonRemove + // + buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Location = new Point(23, 254); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(115, 115); + buttonRemove.TabIndex = 2; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += buttonRemove_Click; + // + // buttonEdit + // + buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; + buttonEdit.Image = (Image)resources.GetObject("buttonEdit.Image"); + buttonEdit.Location = new Point(23, 133); + buttonEdit.Name = "buttonEdit"; + buttonEdit.Size = new Size(115, 115); + buttonEdit.TabIndex = 1; + buttonEdit.UseVisualStyleBackColor = true; + buttonEdit.Click += buttonEdit_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImageLayout = ImageLayout.Center; + buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Location = new Point(23, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(115, 115); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormPrintingHouses + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panelButtons); + Name = "FormPrintingHouses"; + StartPosition = FormStartPosition.CenterParent; + Text = "Типографии"; + Load += FormPrintingHouses_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panelButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panelButtons; + private Button buttonRemove; + private Button buttonEdit; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.cs b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.cs new file mode 100644 index 0000000..c95d67c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.cs @@ -0,0 +1,106 @@ +using ProjectPublishing.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectPublishing.Forms +{ + public partial class FormPrintingHouses : Form + { + private readonly IUnityContainer _container; + private readonly IPrintingHouseRepository _printingHouseRepository; + public FormPrintingHouses(IUnityContainer container, IPrintingHouseRepository printingHouseRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _printingHouseRepository = printingHouseRepository ?? throw new ArgumentException(nameof(printingHouseRepository)); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonEdit_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!tryGetIDFromRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _printingHouseRepository.DeletePrintingHouse(findId); + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void FormPrintingHouses_Load(object sender, EventArgs e) + { + try + { + loadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void loadList() => dataGridView.DataSource = _printingHouseRepository.ReadPrintingHouses(); + + private bool tryGetIDFromRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.resx b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.resx new file mode 100644 index 0000000..629d2a2 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Forms/FormPrintingHouses.resx @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH6AcSDjMPELkl4AAACdZJREFU + eF7tnUWsJUUUhh8Ed3d3h+CaQHBfsSH4gg0e3II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jKRa34vViL/81DcySfMitzEZjaybe+RcrvMIrk9wbzbr + fCfYo2MnonmV4ZjMjnAxRWSknNirypY6MmjyNebOTkWGyoFrIZp3zI+Tq3RM+IqMlQPXQth2NBont3ZM + naCfCo4nih58tZI5OqnR0cng3MP60KiF3IsohxM0ftFZcHVkspRJs53YKtlrWO00v/yaMkx8GrhpdmTY + FOzt2OA2df4kZe/IauMicOCUsqLfNQxGWM3Pd7lV09fvgBysubjtKLgBjPf4ZDj6FROsDEO4y/sR4B7/ + Oq/PNTLyL00LnOXokiBjAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Program.cs b/ProjectPublishing/ProjectPublishing/Program.cs index 10acd16..90ab980 100644 --- a/ProjectPublishing/ProjectPublishing/Program.cs +++ b/ProjectPublishing/ProjectPublishing/Program.cs @@ -1,3 +1,7 @@ +using ProjectPublishing.Repositories; +using ProjectPublishing.Repositories.Implementations; +using Unity; + namespace ProjectPublishing { internal static class Program @@ -11,7 +15,21 @@ namespace ProjectPublishing // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(CreateContainer().Resolve()); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; } } } \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/ProjectPublishing.csproj b/ProjectPublishing/ProjectPublishing/ProjectPublishing.csproj index 663fdb8..6b260fe 100644 --- a/ProjectPublishing/ProjectPublishing/ProjectPublishing.csproj +++ b/ProjectPublishing/ProjectPublishing/ProjectPublishing.csproj @@ -8,4 +8,24 @@ enable + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectPublishing/ProjectPublishing/Properties/Resources.Designer.cs b/ProjectPublishing/ProjectPublishing/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4afe480 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectPublishing.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectPublishing.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Form1.resx b/ProjectPublishing/ProjectPublishing/Properties/Resources.resx similarity index 100% rename from ProjectPublishing/ProjectPublishing/Form1.resx rename to ProjectPublishing/ProjectPublishing/Properties/Resources.resx diff --git a/ProjectPublishing/ProjectPublishing/Repositories/IContactPersonRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/IContactPersonRepository.cs new file mode 100644 index 0000000..a846433 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/IContactPersonRepository.cs @@ -0,0 +1,22 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface IContactPersonRepository + { + IEnumerable ReadContactPeople(); + + ContactPerson ReadContactPersonById(int id); + + void CreateContactPerson(ContactPerson contactPerson); + + void UpdateContactPerson(ContactPerson contactPerson); + + void DeleteContactPerson(int id); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/ICustomerRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/ICustomerRepository.cs new file mode 100644 index 0000000..217c80c --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/ICustomerRepository.cs @@ -0,0 +1,22 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface ICustomerRepository + { + IEnumerable ReadCustomers(); + + Customer ReadCustomerById(int id); + + void CreateCustomer(Customer customer); + + void UpdateCustomer(Customer customer); + + void DeleteCustomer(int id); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/IMaterialAdmissionRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/IMaterialAdmissionRepository.cs new file mode 100644 index 0000000..624079f --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/IMaterialAdmissionRepository.cs @@ -0,0 +1,19 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface IMaterialAdmissionRepository + { + IEnumerable ReadMaterialsAdmission(int? amount = null, DateTime? date = null, int? materialId = null); + + MaterialsAdmission ReadAdmissionById(int id); + + void CreateMaterialsAdmission(MaterialsAdmission materialAdmission); + + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/IMaterialRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/IMaterialRepository.cs new file mode 100644 index 0000000..7a0714e --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/IMaterialRepository.cs @@ -0,0 +1,22 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface IMaterialRepository + { + IEnumerable ReadMaterials(); + + Material ReadMaterialById(int id); + + void CreateMaterial(Material material); + + void UpdateMaterial(Material material); + + void DeleteMaterial(int id); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/IOrderRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..8890366 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/IOrderRepository.cs @@ -0,0 +1,22 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface IOrderRepository + { + IEnumerable ReadOrders(); + + Order ReadOrderById(int id); + + void CreateOrder(Order order); + + void UpdateOrder(Order order); + + void DeleteOrder(int id); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/IPrintingHouseRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/IPrintingHouseRepository.cs new file mode 100644 index 0000000..81dd6d9 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/IPrintingHouseRepository.cs @@ -0,0 +1,22 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories +{ + public interface IPrintingHouseRepository + { + IEnumerable ReadPrintingHouses(); + + PrintingHouse ReadPrintingHouseById(int id); + + void CreatePrintingHouse(PrintingHouse printingHouse); + + void UpdatePrintingHouse(PrintingHouse printingHouse); + + void DeletePrintingHouse(int id); + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/ContactPersonRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/ContactPersonRepository.cs new file mode 100644 index 0000000..9878620 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/ContactPersonRepository.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class ContactPersonRepository : IContactPersonRepository + { + public void CreateContactPerson(ContactPerson contactPerson) + { + } + + public void DeleteContactPerson(int id) + { + } + + public IEnumerable ReadContactPeople() + { + return []; + } + + public ContactPerson ReadContactPersonById(int id) + { + return ContactPerson.CreateContactPerson(0, string.Empty, string.Empty, string.Empty); + } + + public void UpdateContactPerson(ContactPerson contactPerson) + { + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/CustomerRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/CustomerRepository.cs new file mode 100644 index 0000000..f296f2f --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/CustomerRepository.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class CustomerRepository : ICustomerRepository + { + public void CreateCustomer(Customer customer) + { + } + + public void DeleteCustomer(int id) + { + } + + public Customer ReadCustomerById(int id) + { + return Customer.CreateCustomer(0, string.Empty, string.Empty, 0); + } + + public IEnumerable ReadCustomers() + { + return []; + } + + public void UpdateCustomer(Customer customer) + { + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialAdmissionRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialAdmissionRepository.cs new file mode 100644 index 0000000..2e4422a --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialAdmissionRepository.cs @@ -0,0 +1,28 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class MaterialAdmissionRepository : IMaterialAdmissionRepository + { + public void CreateMaterialsAdmission(MaterialsAdmission materialAdmission) + { + } + + + public MaterialsAdmission ReadAdmissionById(int id) + { + return MaterialsAdmission.CreateOperation(0, 0, 0); + } + + public IEnumerable ReadMaterialsAdmission(int? amount = null, DateTime? date = null, int? materialId = null) + { + return []; + } + + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialRepository.cs new file mode 100644 index 0000000..309c3f3 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/MaterialRepository.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class MaterialRepository : IMaterialRepository + { + public void CreateMaterial(Material material) + { + } + + public void DeleteMaterial(int id) + { + } + + public Material ReadMaterialById(int id) + { + return Material.CreateMaterial(0, Entities.Enums.MaterialType.Cardboard); + } + + public IEnumerable ReadMaterials() + { + return []; + } + + public void UpdateMaterial(Material material) + { + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/OrderRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/OrderRepository.cs new file mode 100644 index 0000000..5005c55 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/OrderRepository.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class OrderRepository : IOrderRepository + { + public void CreateOrder(Order order) + { + } + + public void DeleteOrder(int id) + { + } + + public Order ReadOrderById(int id) + { + return Order.CreateOrder(0, string.Empty, Entities.Enums.ProductType.Advertisement, 0, Entities.Enums.OrderStatus.Done, 0, 0, 0); + } + + public IEnumerable ReadOrders() + { + return []; + } + + public void UpdateOrder(Order order) + { + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Repositories/Implementations/PrintingHouseRepository.cs b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/PrintingHouseRepository.cs new file mode 100644 index 0000000..349c9b7 --- /dev/null +++ b/ProjectPublishing/ProjectPublishing/Repositories/Implementations/PrintingHouseRepository.cs @@ -0,0 +1,34 @@ +using ProjectPublishing.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPublishing.Repositories.Implementations +{ + public class PrintingHouseRepository : IPrintingHouseRepository + { + public void CreatePrintingHouse(PrintingHouse printingHouse) + { + } + + public void DeletePrintingHouse(int id) + { + } + + public PrintingHouse ReadPrintingHouseById(int id) + { + return PrintingHouse.CreatePrintingHouse(0, string.Empty, string.Empty, string.Empty, string.Empty); + } + + public IEnumerable ReadPrintingHouses() + { + return []; + } + + public void UpdatePrintingHouse(PrintingHouse printingHouse) + { + } + } +} diff --git a/ProjectPublishing/ProjectPublishing/Resources/edit.png b/ProjectPublishing/ProjectPublishing/Resources/edit.png new file mode 100644 index 0000000..795772b Binary files /dev/null and b/ProjectPublishing/ProjectPublishing/Resources/edit.png differ diff --git a/ProjectPublishing/ProjectPublishing/Resources/minus.png b/ProjectPublishing/ProjectPublishing/Resources/minus.png new file mode 100644 index 0000000..76cac4a Binary files /dev/null and b/ProjectPublishing/ProjectPublishing/Resources/minus.png differ diff --git a/ProjectPublishing/ProjectPublishing/Resources/plus.png b/ProjectPublishing/ProjectPublishing/Resources/plus.png new file mode 100644 index 0000000..fd689b6 Binary files /dev/null and b/ProjectPublishing/ProjectPublishing/Resources/plus.png differ