Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
680f99d018 | |||
683b6f2f84 | |||
8b6f1036e2 | |||
6b8329bbe9 | |||
afafe3814f | |||
f1db680efb |
16
Publication/Entites/Customers.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Publication.Entites.Enums;
|
||||||
|
|
||||||
|
public class Customers
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FullName { get; set; }
|
||||||
|
public int Age { get; set; }
|
||||||
|
public TypeCustomers TypeCustomer { get; set; }
|
||||||
|
public string Phone { get; set; }
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public static Customers CreateEntity(int id, string fullName, int age, TypeCustomers typeCustomer, string phone, string email)
|
||||||
|
{
|
||||||
|
return new Customers { Id = id, FullName = fullName, Age = age, TypeCustomer = typeCustomer, Phone = phone, Email = email };
|
||||||
|
}
|
||||||
|
}
|
9
Publication/Entites/Enums/TypeCustomers.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Publication.Entites.Enums;
|
||||||
|
|
||||||
|
public enum TypeCustomers
|
||||||
|
{
|
||||||
|
None =0,
|
||||||
|
Author = 1,
|
||||||
|
Organization = 2,
|
||||||
|
AuthorКepresentative = 3
|
||||||
|
}
|
11
Publication/Entites/Enums/TypeMaterials.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Publication.Entites.Enums;
|
||||||
|
[Flags]
|
||||||
|
public enum TypeMaterials
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Brochures = 1,
|
||||||
|
Booklets = 2,
|
||||||
|
Flyers = 4,
|
||||||
|
Books = 8,
|
||||||
|
Newspapers = 16
|
||||||
|
}
|
15
Publication/Entites/Materials.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Publication.Entites.Enums;
|
||||||
|
namespace Publication.Entites;
|
||||||
|
|
||||||
|
public class Materials
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime DateMaterials { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public TypeMaterials Material { get; set; }
|
||||||
|
|
||||||
|
public static Materials CreateEntity(int id, DateTime dateMaterials, int count, TypeMaterials typeMaterials)
|
||||||
|
{
|
||||||
|
return new Materials { Id = id, DateMaterials = dateMaterials, Count = count, Material = typeMaterials };
|
||||||
|
}
|
||||||
|
}
|
18
Publication/Entites/Orders.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
namespace Publication.Entites;
|
||||||
|
|
||||||
|
public class Orders
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime OrderDate { get; set; }
|
||||||
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int CustomerId { get; set; }
|
||||||
|
public int PublishingHouseId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Orders CreateEntity(int id, string description, int customerId, int publishingHouseId)
|
||||||
|
{
|
||||||
|
return new Orders { Id = id, Description = description, CustomerId = customerId, PublishingHouseId = publishingHouseId, OrderDate = DateTime.Now };
|
||||||
|
}
|
||||||
|
}
|
12
Publication/Entites/PrintingHouseOrders.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Publication.Entites;
|
||||||
|
|
||||||
|
public class PrintingHouseOrders
|
||||||
|
{
|
||||||
|
public int PrintingHouseId { get; set; }
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public static PrintingHouseOrders CreateEntity(int id, int orderId, int count)
|
||||||
|
{
|
||||||
|
return new PrintingHouseOrders { PrintingHouseId = id, OrderId = orderId, Count = count };
|
||||||
|
}
|
||||||
|
}
|
30
Publication/Entites/PrintingHouses.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
namespace Publication.Entites;
|
||||||
|
|
||||||
|
public class PrintingHouses
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Phone { get; set; }
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
public int MaterialsId { get; set; }
|
||||||
|
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<PrintingHouseOrders> printingHouseOrder { get; set; } = [];
|
||||||
|
|
||||||
|
public static PrintingHouses CreateEntity(int id, string title, string phone, string address, int materialsId, IEnumerable<PrintingHouseOrders> printingHouseOrders)
|
||||||
|
{
|
||||||
|
|
||||||
|
return new PrintingHouses
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Title = title,
|
||||||
|
Phone = phone,
|
||||||
|
Address = address,
|
||||||
|
MaterialsId = materialsId,
|
||||||
|
Date = DateTime.Now,
|
||||||
|
printingHouseOrder = printingHouseOrders
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
13
Publication/Entites/PublishingHouse.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Publication.Entites;
|
||||||
|
|
||||||
|
public class PublishingHouse
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Address { get; set; }
|
||||||
|
public string WorkPhone { get; set; }
|
||||||
|
public static PublishingHouse CreateEntity(int id, string title, string address, string workPhone)
|
||||||
|
{
|
||||||
|
return new PublishingHouse { Id = id, Address = address, Title = title, WorkPhone = workPhone };
|
||||||
|
}
|
||||||
|
}
|
39
Publication/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace Publication
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Publication
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
190
Publication/Forms/FormCustomer.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormCustomer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelFIO = new Label();
|
||||||
|
textBoxFullName = new TextBox();
|
||||||
|
lablelAge = new Label();
|
||||||
|
labelTypeCustomer = new Label();
|
||||||
|
labelPhone = new Label();
|
||||||
|
labelEmail = new Label();
|
||||||
|
numericUpDownAge = new NumericUpDown();
|
||||||
|
comboBoxTypeCustomer = new ComboBox();
|
||||||
|
textBoxEmail = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonBreak = new Button();
|
||||||
|
textBoxPhone = new TextBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownAge).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelFIO
|
||||||
|
//
|
||||||
|
labelFIO.AutoSize = true;
|
||||||
|
labelFIO.Location = new Point(30, 37);
|
||||||
|
labelFIO.Name = "labelFIO";
|
||||||
|
labelFIO.Size = new Size(42, 20);
|
||||||
|
labelFIO.TabIndex = 0;
|
||||||
|
labelFIO.Text = "ФИО";
|
||||||
|
//
|
||||||
|
// textBoxFullName
|
||||||
|
//
|
||||||
|
textBoxFullName.Location = new Point(183, 37);
|
||||||
|
textBoxFullName.Name = "textBoxFullName";
|
||||||
|
textBoxFullName.Size = new Size(150, 27);
|
||||||
|
textBoxFullName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// lablelAge
|
||||||
|
//
|
||||||
|
lablelAge.AutoSize = true;
|
||||||
|
lablelAge.Location = new Point(30, 94);
|
||||||
|
lablelAge.Name = "lablelAge";
|
||||||
|
lablelAge.Size = new Size(64, 20);
|
||||||
|
lablelAge.TabIndex = 2;
|
||||||
|
lablelAge.Text = "Возраст";
|
||||||
|
//
|
||||||
|
// labelTypeCustomer
|
||||||
|
//
|
||||||
|
labelTypeCustomer.AutoSize = true;
|
||||||
|
labelTypeCustomer.Location = new Point(30, 161);
|
||||||
|
labelTypeCustomer.Name = "labelTypeCustomer";
|
||||||
|
labelTypeCustomer.Size = new Size(108, 20);
|
||||||
|
labelTypeCustomer.TabIndex = 3;
|
||||||
|
labelTypeCustomer.Text = "Тип заказчика";
|
||||||
|
//
|
||||||
|
// labelPhone
|
||||||
|
//
|
||||||
|
labelPhone.AutoSize = true;
|
||||||
|
labelPhone.Location = new Point(30, 227);
|
||||||
|
labelPhone.Name = "labelPhone";
|
||||||
|
labelPhone.Size = new Size(127, 20);
|
||||||
|
labelPhone.TabIndex = 4;
|
||||||
|
labelPhone.Text = "Номер телефона";
|
||||||
|
//
|
||||||
|
// labelEmail
|
||||||
|
//
|
||||||
|
labelEmail.AutoSize = true;
|
||||||
|
labelEmail.Location = new Point(30, 301);
|
||||||
|
labelEmail.Name = "labelEmail";
|
||||||
|
labelEmail.Size = new Size(51, 20);
|
||||||
|
labelEmail.TabIndex = 5;
|
||||||
|
labelEmail.Text = "Почта";
|
||||||
|
//
|
||||||
|
// numericUpDownAge
|
||||||
|
//
|
||||||
|
numericUpDownAge.Location = new Point(182, 94);
|
||||||
|
numericUpDownAge.Name = "numericUpDownAge";
|
||||||
|
numericUpDownAge.Size = new Size(150, 27);
|
||||||
|
numericUpDownAge.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// comboBoxTypeCustomer
|
||||||
|
//
|
||||||
|
comboBoxTypeCustomer.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxTypeCustomer.FormattingEnabled = true;
|
||||||
|
comboBoxTypeCustomer.Location = new Point(182, 161);
|
||||||
|
comboBoxTypeCustomer.Name = "comboBoxTypeCustomer";
|
||||||
|
comboBoxTypeCustomer.Size = new Size(151, 28);
|
||||||
|
comboBoxTypeCustomer.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// textBoxEmail
|
||||||
|
//
|
||||||
|
textBoxEmail.Location = new Point(182, 298);
|
||||||
|
textBoxEmail.Name = "textBoxEmail";
|
||||||
|
textBoxEmail.Size = new Size(150, 27);
|
||||||
|
textBoxEmail.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonSave.Location = new Point(30, 371);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 10;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonBreak
|
||||||
|
//
|
||||||
|
buttonBreak.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonBreak.Location = new Point(238, 371);
|
||||||
|
buttonBreak.Name = "buttonBreak";
|
||||||
|
buttonBreak.Size = new Size(94, 29);
|
||||||
|
buttonBreak.TabIndex = 11;
|
||||||
|
buttonBreak.Text = "Отмена";
|
||||||
|
buttonBreak.UseVisualStyleBackColor = true;
|
||||||
|
buttonBreak.Click += buttonBreak_Click;
|
||||||
|
//
|
||||||
|
// textBoxPhone
|
||||||
|
//
|
||||||
|
textBoxPhone.Location = new Point(182, 227);
|
||||||
|
textBoxPhone.Name = "textBoxPhone";
|
||||||
|
textBoxPhone.Size = new Size(150, 27);
|
||||||
|
textBoxPhone.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// FormCustomer
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(403, 433);
|
||||||
|
Controls.Add(textBoxPhone);
|
||||||
|
Controls.Add(buttonBreak);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxEmail);
|
||||||
|
Controls.Add(comboBoxTypeCustomer);
|
||||||
|
Controls.Add(numericUpDownAge);
|
||||||
|
Controls.Add(labelEmail);
|
||||||
|
Controls.Add(labelPhone);
|
||||||
|
Controls.Add(labelTypeCustomer);
|
||||||
|
Controls.Add(lablelAge);
|
||||||
|
Controls.Add(textBoxFullName);
|
||||||
|
Controls.Add(labelFIO);
|
||||||
|
Name = "FormCustomer";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Заказчик";
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownAge).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelFIO;
|
||||||
|
private TextBox textBoxFullName;
|
||||||
|
private Label lablelAge;
|
||||||
|
private Label labelTypeCustomer;
|
||||||
|
private Label labelPhone;
|
||||||
|
private Label labelEmail;
|
||||||
|
private NumericUpDown numericUpDownAge;
|
||||||
|
private ComboBox comboBoxTypeCustomer;
|
||||||
|
private TextBox textBoxEmail;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonBreak;
|
||||||
|
private TextBox textBoxPhone;
|
||||||
|
}
|
||||||
|
}
|
80
Publication/Forms/FormCustomer.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using Publication.Entites.Enums;
|
||||||
|
using Publication.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace Publication.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));
|
||||||
|
}
|
||||||
|
textBoxFullName.Text = customer.FullName;
|
||||||
|
numericUpDownAge.Value = customer.Age;
|
||||||
|
textBoxPhone.Text = customer.Phone;
|
||||||
|
textBoxEmail.Text = customer.Email;
|
||||||
|
comboBoxTypeCustomer.SelectedItem = customer.TypeCustomer;
|
||||||
|
customer.Age = int.Parse(numericUpDownAge.Value.ToString());
|
||||||
|
customerId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormCustomer(ICustomerRepository _customerRepository)
|
||||||
|
{
|
||||||
|
customerRepository = _customerRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(_customerRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
comboBoxTypeCustomer.DataSource = Enum.GetValues(typeof(TypeCustomers));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxFullName.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxPhone.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxEmail.Text) ||
|
||||||
|
comboBoxTypeCustomer.SelectedIndex < 1 ||
|
||||||
|
int.Parse(numericUpDownAge.Value.ToString()) <= 0)
|
||||||
|
{
|
||||||
|
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 buttonBreak_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Customers CreateCustomer(int id) => Customers.CreateEntity(id, textBoxFullName.Text, int.Parse(numericUpDownAge.Value.ToString()), (TypeCustomers)comboBoxTypeCustomer.SelectedItem!, textBoxPhone.Text, textBoxEmail.Text);
|
||||||
|
}
|
128
Publication/Forms/FormCustomers.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormCustomers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCustomers));
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonEdit = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonEdit);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(197, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = (Image)resources.GetObject("buttonDelete.BackgroundImage");
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDelete.Location = new Point(67, 312);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(94, 103);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += buttonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
buttonEdit.BackgroundImage = (Image)resources.GetObject("buttonEdit.BackgroundImage");
|
||||||
|
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonEdit.Location = new Point(67, 168);
|
||||||
|
buttonEdit.Name = "buttonEdit";
|
||||||
|
buttonEdit.Size = new Size(94, 103);
|
||||||
|
buttonEdit.TabIndex = 1;
|
||||||
|
buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
buttonEdit.Click += buttonEdit_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(67, 31);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 103);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(603, 450);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormCustomers
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormCustomers";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Заказчики";
|
||||||
|
Load += FormCustomers_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
110
Publication/Forms/FormCustomers.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Mail;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormCustomers : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer container;
|
||||||
|
private readonly ICustomerRepository customerRepository;
|
||||||
|
public FormCustomers(IUnityContainer _unityContainer, ICustomerRepository _customerRepository)
|
||||||
|
{
|
||||||
|
container = _unityContainer ?? throw new ArgumentNullException(nameof(_unityContainer));
|
||||||
|
customerRepository = _customerRepository ?? throw new ArgumentNullException(nameof(_customerRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
container.Resolve<FormCustomer>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = container.Resolve<FormCustomer>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(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 bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id =
|
||||||
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = customerRepository.ReadCustomers();
|
||||||
|
}
|
4782
Publication/Forms/FormCustomers.resx
Normal file
146
Publication/Forms/FormMaterial.Designer.cs
generated
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormMaterial
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelDateMaterials = new Label();
|
||||||
|
labelCount = new Label();
|
||||||
|
labelTypeMaterials = new Label();
|
||||||
|
checkedListBox = new CheckedListBox();
|
||||||
|
dateTimePickerDateMaterial = new DateTimePicker();
|
||||||
|
numericUpDownCount = new NumericUpDown();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonBreak = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelDateMaterials
|
||||||
|
//
|
||||||
|
labelDateMaterials.AutoSize = true;
|
||||||
|
labelDateMaterials.Location = new Point(22, 31);
|
||||||
|
labelDateMaterials.Name = "labelDateMaterials";
|
||||||
|
labelDateMaterials.Size = new Size(107, 20);
|
||||||
|
labelDateMaterials.TabIndex = 0;
|
||||||
|
labelDateMaterials.Text = "Дата доставки";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
labelCount.AutoSize = true;
|
||||||
|
labelCount.Location = new Point(22, 90);
|
||||||
|
labelCount.Name = "labelCount";
|
||||||
|
labelCount.Size = new Size(58, 20);
|
||||||
|
labelCount.TabIndex = 1;
|
||||||
|
labelCount.Text = "Кол-во";
|
||||||
|
//
|
||||||
|
// labelTypeMaterials
|
||||||
|
//
|
||||||
|
labelTypeMaterials.AutoSize = true;
|
||||||
|
labelTypeMaterials.Location = new Point(22, 140);
|
||||||
|
labelTypeMaterials.Name = "labelTypeMaterials";
|
||||||
|
labelTypeMaterials.Size = new Size(114, 20);
|
||||||
|
labelTypeMaterials.TabIndex = 2;
|
||||||
|
labelTypeMaterials.Text = "Тип материала";
|
||||||
|
//
|
||||||
|
// checkedListBox
|
||||||
|
//
|
||||||
|
checkedListBox.FormattingEnabled = true;
|
||||||
|
checkedListBox.Location = new Point(168, 140);
|
||||||
|
checkedListBox.Name = "checkedListBox";
|
||||||
|
checkedListBox.Size = new Size(164, 114);
|
||||||
|
checkedListBox.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// dateTimePickerDateMaterial
|
||||||
|
//
|
||||||
|
dateTimePickerDateMaterial.Location = new Point(168, 31);
|
||||||
|
dateTimePickerDateMaterial.Name = "dateTimePickerDateMaterial";
|
||||||
|
dateTimePickerDateMaterial.Size = new Size(164, 27);
|
||||||
|
dateTimePickerDateMaterial.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// numericUpDownCount
|
||||||
|
//
|
||||||
|
numericUpDownCount.Location = new Point(168, 90);
|
||||||
|
numericUpDownCount.Name = "numericUpDownCount";
|
||||||
|
numericUpDownCount.Size = new Size(164, 27);
|
||||||
|
numericUpDownCount.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonSave.Location = new Point(22, 303);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonBreak
|
||||||
|
//
|
||||||
|
buttonBreak.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonBreak.Location = new Point(238, 303);
|
||||||
|
buttonBreak.Name = "buttonBreak";
|
||||||
|
buttonBreak.Size = new Size(94, 29);
|
||||||
|
buttonBreak.TabIndex = 7;
|
||||||
|
buttonBreak.Text = "Отмена";
|
||||||
|
buttonBreak.UseVisualStyleBackColor = true;
|
||||||
|
buttonBreak.Click += ButtonBreak_Click;
|
||||||
|
//
|
||||||
|
// FormMaterial
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(361, 367);
|
||||||
|
Controls.Add(buttonBreak);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(numericUpDownCount);
|
||||||
|
Controls.Add(dateTimePickerDateMaterial);
|
||||||
|
Controls.Add(checkedListBox);
|
||||||
|
Controls.Add(labelTypeMaterials);
|
||||||
|
Controls.Add(labelCount);
|
||||||
|
Controls.Add(labelDateMaterials);
|
||||||
|
Name = "FormMaterial";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Материал";
|
||||||
|
Load += FormMaterials_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelDateMaterials;
|
||||||
|
private Label labelCount;
|
||||||
|
private Label labelTypeMaterials;
|
||||||
|
private CheckedListBox checkedListBox;
|
||||||
|
private DateTimePicker dateTimePickerDateMaterial;
|
||||||
|
private NumericUpDown numericUpDownCount;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonBreak;
|
||||||
|
}
|
||||||
|
}
|
108
Publication/Forms/FormMaterial.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using Microsoft.VisualBasic.FileIO;
|
||||||
|
using Publication.Entites;
|
||||||
|
using Publication.Entites.Enums;
|
||||||
|
using Publication.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Publication.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));
|
||||||
|
}
|
||||||
|
foreach (TypeMaterials elem in Enum.GetValues(typeof(TypeMaterials)))
|
||||||
|
{
|
||||||
|
if ((elem & material.Material) != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
material.DateMaterials = dateTimePickerDateMaterial.Value.Date;
|
||||||
|
material.Count = int.Parse(numericUpDownCount.Value.ToString());
|
||||||
|
materialId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormMaterial(IMaterialRepository _materialRepository)
|
||||||
|
{
|
||||||
|
materialRepository = _materialRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(_materialRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
foreach (var item in Enum.GetValues(typeof(TypeMaterials)))
|
||||||
|
{
|
||||||
|
checkedListBox.Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMaterials_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (int.Parse(numericUpDownCount.Value.ToString()) <= 0 || dateTimePickerDateMaterial.Value.Date < DateTime.Now || checkedListBox.SelectedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (materialId.HasValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
materialRepository.UpdateMaterial(CreateMaterials(materialId.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
materialRepository.CreateMaterial(CreateMaterials(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBreak_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Materials CreateMaterials(int id)
|
||||||
|
{
|
||||||
|
TypeMaterials typeMaterials = TypeMaterials.None;
|
||||||
|
foreach (var elem in checkedListBox.CheckedItems)
|
||||||
|
{
|
||||||
|
typeMaterials |= (TypeMaterials)elem;
|
||||||
|
}
|
||||||
|
return Materials.CreateEntity(id, dateTimePickerDateMaterial.Value.Date, int.Parse(numericUpDownCount.Value.ToString()), typeMaterials);
|
||||||
|
}
|
||||||
|
}
|
120
Publication/Forms/FormMaterial.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
128
Publication/Forms/FormMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormMaterials
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMaterials));
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonEdit = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonEdit);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(197, 450);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = (Image)resources.GetObject("buttonDelete.BackgroundImage");
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDelete.Location = new Point(67, 312);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(94, 103);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += buttonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
buttonEdit.BackgroundImage = (Image)resources.GetObject("buttonEdit.BackgroundImage");
|
||||||
|
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonEdit.Location = new Point(67, 168);
|
||||||
|
buttonEdit.Name = "buttonEdit";
|
||||||
|
buttonEdit.Size = new Size(94, 103);
|
||||||
|
buttonEdit.TabIndex = 1;
|
||||||
|
buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
buttonEdit.Click += buttonEdit_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(67, 31);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 103);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(603, 450);
|
||||||
|
dataGridView.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// FormMaterials
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormMaterials";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Материалы";
|
||||||
|
Load += FormMaterials_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
110
Publication/Forms/FormMaterials.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormMaterials : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer container;
|
||||||
|
private readonly IMaterialRepository materialRepository;
|
||||||
|
public FormMaterials(IUnityContainer _unityContainer, IMaterialRepository _materialRepository)
|
||||||
|
{
|
||||||
|
container = _unityContainer ?? throw new ArgumentNullException(nameof(_unityContainer));
|
||||||
|
materialRepository = _materialRepository ?? throw new ArgumentNullException(nameof(_materialRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
container.Resolve<FormMaterial>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = container.Resolve<FormMaterial>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(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 bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id =
|
||||||
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = materialRepository.ReadMaterials();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
4782
Publication/Forms/FormMaterials.resx
Normal file
146
Publication/Forms/FormOrder.Designer.cs
generated
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormOrder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelCustomer = new Label();
|
||||||
|
labelPublishingHouse = new Label();
|
||||||
|
labelDescription = new Label();
|
||||||
|
comboBoxPublishingHouse = new ComboBox();
|
||||||
|
comboBoxCutomer = new ComboBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonBreak = new Button();
|
||||||
|
textBoxDescription = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelCustomer
|
||||||
|
//
|
||||||
|
labelCustomer.AutoSize = true;
|
||||||
|
labelCustomer.Location = new Point(28, 37);
|
||||||
|
labelCustomer.Name = "labelCustomer";
|
||||||
|
labelCustomer.Size = new Size(71, 20);
|
||||||
|
labelCustomer.TabIndex = 0;
|
||||||
|
labelCustomer.Text = "Заказчик";
|
||||||
|
//
|
||||||
|
// labelPublishingHouse
|
||||||
|
//
|
||||||
|
labelPublishingHouse.AutoSize = true;
|
||||||
|
labelPublishingHouse.Location = new Point(28, 104);
|
||||||
|
labelPublishingHouse.Name = "labelPublishingHouse";
|
||||||
|
labelPublishingHouse.Size = new Size(103, 20);
|
||||||
|
labelPublishingHouse.TabIndex = 1;
|
||||||
|
labelPublishingHouse.Text = "Издательство";
|
||||||
|
//
|
||||||
|
// labelDescription
|
||||||
|
//
|
||||||
|
labelDescription.AutoSize = true;
|
||||||
|
labelDescription.Location = new Point(28, 175);
|
||||||
|
labelDescription.Name = "labelDescription";
|
||||||
|
labelDescription.Size = new Size(128, 20);
|
||||||
|
labelDescription.TabIndex = 3;
|
||||||
|
labelDescription.Text = "Описание заказа";
|
||||||
|
//
|
||||||
|
// comboBoxPublishingHouse
|
||||||
|
//
|
||||||
|
comboBoxPublishingHouse.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxPublishingHouse.FormattingEnabled = true;
|
||||||
|
comboBoxPublishingHouse.Location = new Point(274, 101);
|
||||||
|
comboBoxPublishingHouse.Name = "comboBoxPublishingHouse";
|
||||||
|
comboBoxPublishingHouse.Size = new Size(151, 28);
|
||||||
|
comboBoxPublishingHouse.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// comboBoxCutomer
|
||||||
|
//
|
||||||
|
comboBoxCutomer.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCutomer.FormattingEnabled = true;
|
||||||
|
comboBoxCutomer.Location = new Point(274, 37);
|
||||||
|
comboBoxCutomer.Name = "comboBoxCutomer";
|
||||||
|
comboBoxCutomer.Size = new Size(151, 28);
|
||||||
|
comboBoxCutomer.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(28, 337);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 8;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonBreak
|
||||||
|
//
|
||||||
|
buttonBreak.Location = new Point(331, 337);
|
||||||
|
buttonBreak.Name = "buttonBreak";
|
||||||
|
buttonBreak.Size = new Size(94, 29);
|
||||||
|
buttonBreak.TabIndex = 9;
|
||||||
|
buttonBreak.Text = "Отмена";
|
||||||
|
buttonBreak.UseVisualStyleBackColor = true;
|
||||||
|
buttonBreak.Click += buttonBreak_Click;
|
||||||
|
//
|
||||||
|
// textBoxDescription
|
||||||
|
//
|
||||||
|
textBoxDescription.Location = new Point(274, 175);
|
||||||
|
textBoxDescription.Multiline = true;
|
||||||
|
textBoxDescription.Name = "textBoxDescription";
|
||||||
|
textBoxDescription.ScrollBars = ScrollBars.Vertical;
|
||||||
|
textBoxDescription.Size = new Size(151, 102);
|
||||||
|
textBoxDescription.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// FormOrder
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(469, 416);
|
||||||
|
Controls.Add(textBoxDescription);
|
||||||
|
Controls.Add(buttonBreak);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(comboBoxCutomer);
|
||||||
|
Controls.Add(comboBoxPublishingHouse);
|
||||||
|
Controls.Add(labelDescription);
|
||||||
|
Controls.Add(labelPublishingHouse);
|
||||||
|
Controls.Add(labelCustomer);
|
||||||
|
Name = "FormOrder";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Заказ";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelCustomer;
|
||||||
|
private Label labelPublishingHouse;
|
||||||
|
private Label labelDescription;
|
||||||
|
private ComboBox comboBoxPublishingHouse;
|
||||||
|
private ComboBox comboBoxCutomer;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonBreak;
|
||||||
|
private TextBox textBoxDescription;
|
||||||
|
}
|
||||||
|
}
|
57
Publication/Forms/FormOrder.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
using Publication.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormOrder : Form
|
||||||
|
{
|
||||||
|
private readonly IOrderRepository orderRepository;
|
||||||
|
public FormOrder(IOrderRepository _orderRepository, ICustomerRepository _customerRepository, IPublisingHouseRepository _publisingHouseRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
orderRepository = _orderRepository ?? throw new ArgumentNullException(nameof(_orderRepository));
|
||||||
|
|
||||||
|
comboBoxCutomer.DataSource = _customerRepository.ReadCustomers();
|
||||||
|
comboBoxCutomer.DisplayMember = "FullName";
|
||||||
|
comboBoxCutomer.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxPublishingHouse.DataSource = _publisingHouseRepository.ReadPublishingHouses();
|
||||||
|
comboBoxPublishingHouse.DisplayMember = "Title";
|
||||||
|
comboBoxPublishingHouse.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxCutomer.SelectedIndex < 0 ||
|
||||||
|
comboBoxPublishingHouse.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
orderRepository.CreateOrder(Orders.CreateEntity(
|
||||||
|
0,
|
||||||
|
textBoxDescription.Text,
|
||||||
|
(int)comboBoxCutomer.SelectedValue!,
|
||||||
|
(int)comboBoxPublishingHouse.SelectedValue!
|
||||||
|
));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonBreak_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
120
Publication/Forms/FormOrder.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
100
Publication/Forms/FormOrders.Designer.cs
generated
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormOrders
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormOrders));
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(197, 450);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(67, 31);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 103);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(603, 450);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormOrders
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormOrders";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Заказы";
|
||||||
|
Load += FormOrders_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
52
Publication/Forms/FormOrders.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormOrders : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer container;
|
||||||
|
private readonly IOrderRepository orderRepository;
|
||||||
|
public FormOrders(IUnityContainer _container,IOrderRepository _orderRepository)
|
||||||
|
{
|
||||||
|
container = _container ?? throw new ArgumentNullException(nameof(_container));
|
||||||
|
orderRepository = _orderRepository ?? throw new ArgumentNullException(nameof(_orderRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
container.Resolve<FormOrder>().ShowDialog();
|
||||||
|
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();
|
||||||
|
}
|
1742
Publication/Forms/FormOrders.resx
Normal file
216
Publication/Forms/FormPrintingHouse.Designer.cs
generated
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormPrintingHouse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelTitle = new Label();
|
||||||
|
labelPhone = new Label();
|
||||||
|
labelAddress = new Label();
|
||||||
|
labelMaterials = new Label();
|
||||||
|
textBoxTitle = new TextBox();
|
||||||
|
textBoxPhone = new TextBox();
|
||||||
|
textBoxAddress = new TextBox();
|
||||||
|
comboBoxMaterials = new ComboBox();
|
||||||
|
groupBoxGridView = new GroupBox();
|
||||||
|
dataGridView1 = new DataGridView();
|
||||||
|
ColumnOrders = new DataGridViewComboBoxColumn();
|
||||||
|
ColumnCopy = new DataGridViewTextBoxColumn();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonBreak = new Button();
|
||||||
|
groupBoxGridView.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelTitle
|
||||||
|
//
|
||||||
|
labelTitle.AutoSize = true;
|
||||||
|
labelTitle.Location = new Point(28, 36);
|
||||||
|
labelTitle.Name = "labelTitle";
|
||||||
|
labelTitle.Size = new Size(77, 20);
|
||||||
|
labelTitle.TabIndex = 0;
|
||||||
|
labelTitle.Text = "Название";
|
||||||
|
//
|
||||||
|
// labelPhone
|
||||||
|
//
|
||||||
|
labelPhone.AutoSize = true;
|
||||||
|
labelPhone.Location = new Point(28, 93);
|
||||||
|
labelPhone.Name = "labelPhone";
|
||||||
|
labelPhone.Size = new Size(69, 20);
|
||||||
|
labelPhone.TabIndex = 1;
|
||||||
|
labelPhone.Text = "Телефон";
|
||||||
|
//
|
||||||
|
// labelAddress
|
||||||
|
//
|
||||||
|
labelAddress.AutoSize = true;
|
||||||
|
labelAddress.Location = new Point(28, 143);
|
||||||
|
labelAddress.Name = "labelAddress";
|
||||||
|
labelAddress.Size = new Size(51, 20);
|
||||||
|
labelAddress.TabIndex = 2;
|
||||||
|
labelAddress.Text = "Адрес";
|
||||||
|
//
|
||||||
|
// labelMaterials
|
||||||
|
//
|
||||||
|
labelMaterials.AutoSize = true;
|
||||||
|
labelMaterials.Location = new Point(28, 200);
|
||||||
|
labelMaterials.Name = "labelMaterials";
|
||||||
|
labelMaterials.Size = new Size(89, 20);
|
||||||
|
labelMaterials.TabIndex = 3;
|
||||||
|
labelMaterials.Text = "Материалы";
|
||||||
|
//
|
||||||
|
// textBoxTitle
|
||||||
|
//
|
||||||
|
textBoxTitle.Location = new Point(129, 36);
|
||||||
|
textBoxTitle.Name = "textBoxTitle";
|
||||||
|
textBoxTitle.Size = new Size(151, 27);
|
||||||
|
textBoxTitle.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// textBoxPhone
|
||||||
|
//
|
||||||
|
textBoxPhone.Location = new Point(129, 86);
|
||||||
|
textBoxPhone.Name = "textBoxPhone";
|
||||||
|
textBoxPhone.Size = new Size(151, 27);
|
||||||
|
textBoxPhone.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// textBoxAddress
|
||||||
|
//
|
||||||
|
textBoxAddress.Location = new Point(129, 143);
|
||||||
|
textBoxAddress.Name = "textBoxAddress";
|
||||||
|
textBoxAddress.Size = new Size(151, 27);
|
||||||
|
textBoxAddress.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// comboBoxMaterials
|
||||||
|
//
|
||||||
|
comboBoxMaterials.FormattingEnabled = true;
|
||||||
|
comboBoxMaterials.Location = new Point(129, 200);
|
||||||
|
comboBoxMaterials.Name = "comboBoxMaterials";
|
||||||
|
comboBoxMaterials.Size = new Size(151, 28);
|
||||||
|
comboBoxMaterials.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// groupBoxGridView
|
||||||
|
//
|
||||||
|
groupBoxGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBoxGridView.Controls.Add(dataGridView1);
|
||||||
|
groupBoxGridView.Location = new Point(28, 256);
|
||||||
|
groupBoxGridView.Name = "groupBoxGridView";
|
||||||
|
groupBoxGridView.Size = new Size(309, 123);
|
||||||
|
groupBoxGridView.TabIndex = 9;
|
||||||
|
groupBoxGridView.TabStop = false;
|
||||||
|
groupBoxGridView.Text = "Заказы";
|
||||||
|
//
|
||||||
|
// dataGridView1
|
||||||
|
//
|
||||||
|
dataGridView1.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView1.AllowUserToResizeRows = false;
|
||||||
|
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView1.ColumnHeadersHeight = 29;
|
||||||
|
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnOrders, ColumnCopy });
|
||||||
|
dataGridView1.Location = new Point(3, 23);
|
||||||
|
dataGridView1.MultiSelect = false;
|
||||||
|
dataGridView1.Name = "dataGridView1";
|
||||||
|
dataGridView1.RowHeadersVisible = false;
|
||||||
|
dataGridView1.RowHeadersWidth = 51;
|
||||||
|
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView1.Size = new Size(303, 97);
|
||||||
|
dataGridView1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ColumnOrders
|
||||||
|
//
|
||||||
|
ColumnOrders.HeaderText = "Заказы";
|
||||||
|
ColumnOrders.MinimumWidth = 6;
|
||||||
|
ColumnOrders.Name = "ColumnOrders";
|
||||||
|
//
|
||||||
|
// ColumnCopy
|
||||||
|
//
|
||||||
|
ColumnCopy.HeaderText = "Кол-во копий";
|
||||||
|
ColumnCopy.MinimumWidth = 6;
|
||||||
|
ColumnCopy.Name = "ColumnCopy";
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(31, 406);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 10;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonBreak
|
||||||
|
//
|
||||||
|
buttonBreak.Location = new Point(240, 406);
|
||||||
|
buttonBreak.Name = "buttonBreak";
|
||||||
|
buttonBreak.Size = new Size(94, 29);
|
||||||
|
buttonBreak.TabIndex = 11;
|
||||||
|
buttonBreak.Text = "Отмена";
|
||||||
|
buttonBreak.UseVisualStyleBackColor = true;
|
||||||
|
buttonBreak.Click += ButtonBreak_Click;
|
||||||
|
//
|
||||||
|
// FormPrintingHouse
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(360, 448);
|
||||||
|
Controls.Add(buttonBreak);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(groupBoxGridView);
|
||||||
|
Controls.Add(comboBoxMaterials);
|
||||||
|
Controls.Add(textBoxAddress);
|
||||||
|
Controls.Add(textBoxPhone);
|
||||||
|
Controls.Add(textBoxTitle);
|
||||||
|
Controls.Add(labelMaterials);
|
||||||
|
Controls.Add(labelAddress);
|
||||||
|
Controls.Add(labelPhone);
|
||||||
|
Controls.Add(labelTitle);
|
||||||
|
Name = "FormPrintingHouse";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Печать";
|
||||||
|
groupBoxGridView.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelTitle;
|
||||||
|
private Label labelPhone;
|
||||||
|
private Label labelAddress;
|
||||||
|
private Label labelMaterials;
|
||||||
|
private TextBox textBoxTitle;
|
||||||
|
private TextBox textBoxPhone;
|
||||||
|
private TextBox textBoxAddress;
|
||||||
|
private ComboBox comboBoxMaterials;
|
||||||
|
private GroupBox groupBoxGridView;
|
||||||
|
private DataGridView dataGridView1;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonBreak;
|
||||||
|
private DataGridViewComboBoxColumn ColumnOrders;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCopy;
|
||||||
|
}
|
||||||
|
}
|
87
Publication/Forms/FormPrintingHouse.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
using Publication.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 Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormPrintingHouse : Form
|
||||||
|
{
|
||||||
|
private readonly IPrintingHouseRepository printingHouseRepository;
|
||||||
|
public FormPrintingHouse(IPrintingHouseRepository _printingHouseRepository,
|
||||||
|
IMaterialRepository materialRepository,
|
||||||
|
IOrderRepository orderRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
printingHouseRepository = _printingHouseRepository ?? throw new ArgumentNullException(nameof(_printingHouseRepository));
|
||||||
|
|
||||||
|
comboBoxMaterials.DataSource = materialRepository.ReadMaterials();
|
||||||
|
comboBoxMaterials.DisplayMember = "Material";
|
||||||
|
comboBoxMaterials.ValueMember = "Id";
|
||||||
|
|
||||||
|
ColumnOrders.DataSource = orderRepository.ReadOrders();
|
||||||
|
ColumnOrders.DisplayMember = "Id";
|
||||||
|
ColumnOrders.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dataGridView1.RowCount < 1 ||
|
||||||
|
comboBoxMaterials.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
printingHouseRepository.CreatePrintingHouse
|
||||||
|
(
|
||||||
|
PrintingHouses.CreateEntity
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
textBoxTitle.Text,
|
||||||
|
textBoxPhone.Text,
|
||||||
|
textBoxAddress.Text,
|
||||||
|
(int)comboBoxMaterials.SelectedValue!,
|
||||||
|
CreateListPrintingHouseOrdersFromDataGrid()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<PrintingHouseOrders> CreateListPrintingHouseOrdersFromDataGrid()
|
||||||
|
{
|
||||||
|
var list =
|
||||||
|
new List<PrintingHouseOrders>();
|
||||||
|
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnOrders"].Value == null ||
|
||||||
|
row.Cells["ColumnCopy"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add
|
||||||
|
(
|
||||||
|
PrintingHouseOrders.CreateEntity
|
||||||
|
(
|
||||||
|
0, Convert.ToInt32(row.Cells["ColumnOrders"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["ColumnCopy"].Value)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBreak_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
126
Publication/Forms/FormPrintingHouse.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="ColumnOrders.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnCopy.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
114
Publication/Forms/FormPrintingHouses.Designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormPrintingHouses
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPrintingHouses));
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(197, 450);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = (Image)resources.GetObject("buttonDelete.BackgroundImage");
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDelete.Location = new Point(67, 192);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(94, 103);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += buttonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(67, 31);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 103);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(603, 450);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormPrintingHouses
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormPrintingHouses";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Печати";
|
||||||
|
Load += FormPrintingHouses_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
91
Publication/Forms/FormPrintingHouses.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormPrintingHouses : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer container;
|
||||||
|
private readonly IPrintingHouseRepository printingHouseRepository;
|
||||||
|
public FormPrintingHouses(IUnityContainer _unityContainer,IPrintingHouseRepository _printingHouseRepository)
|
||||||
|
{
|
||||||
|
container = _unityContainer ?? throw new ArgumentNullException(nameof(_unityContainer));
|
||||||
|
printingHouseRepository = _printingHouseRepository ?? throw new ArgumentNullException(nameof(_printingHouseRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
container.Resolve<FormPrintingHouse>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(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 bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id =
|
||||||
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = printingHouseRepository.ReadPrintingHouses();
|
||||||
|
}
|
3981
Publication/Forms/FormPrintingHouses.resx
Normal file
143
Publication/Forms/FormPublishingHouse.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormPublishingHouse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelTitle = new Label();
|
||||||
|
labelAddress = new Label();
|
||||||
|
labelWorkPhone = new Label();
|
||||||
|
textBoxTitle = new TextBox();
|
||||||
|
textBoxAddress = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonBreak = new Button();
|
||||||
|
textBoxWorkPhone = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelTitle
|
||||||
|
//
|
||||||
|
labelTitle.AutoSize = true;
|
||||||
|
labelTitle.Location = new Point(24, 36);
|
||||||
|
labelTitle.Name = "labelTitle";
|
||||||
|
labelTitle.Size = new Size(77, 20);
|
||||||
|
labelTitle.TabIndex = 0;
|
||||||
|
labelTitle.Text = "Название";
|
||||||
|
//
|
||||||
|
// labelAddress
|
||||||
|
//
|
||||||
|
labelAddress.AutoSize = true;
|
||||||
|
labelAddress.Location = new Point(24, 91);
|
||||||
|
labelAddress.Name = "labelAddress";
|
||||||
|
labelAddress.Size = new Size(51, 20);
|
||||||
|
labelAddress.TabIndex = 1;
|
||||||
|
labelAddress.Text = "Адрес";
|
||||||
|
//
|
||||||
|
// labelWorkPhone
|
||||||
|
//
|
||||||
|
labelWorkPhone.AutoSize = true;
|
||||||
|
labelWorkPhone.Location = new Point(24, 146);
|
||||||
|
labelWorkPhone.Name = "labelWorkPhone";
|
||||||
|
labelWorkPhone.Size = new Size(131, 20);
|
||||||
|
labelWorkPhone.TabIndex = 2;
|
||||||
|
labelWorkPhone.Text = "Рабочий телефон";
|
||||||
|
//
|
||||||
|
// textBoxTitle
|
||||||
|
//
|
||||||
|
textBoxTitle.Location = new Point(184, 36);
|
||||||
|
textBoxTitle.Name = "textBoxTitle";
|
||||||
|
textBoxTitle.Size = new Size(125, 27);
|
||||||
|
textBoxTitle.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxAddress
|
||||||
|
//
|
||||||
|
textBoxAddress.Location = new Point(184, 91);
|
||||||
|
textBoxAddress.Name = "textBoxAddress";
|
||||||
|
textBoxAddress.Size = new Size(125, 27);
|
||||||
|
textBoxAddress.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonSave.Location = new Point(24, 232);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(105, 29);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранение";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonBreak
|
||||||
|
//
|
||||||
|
buttonBreak.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonBreak.Location = new Point(215, 232);
|
||||||
|
buttonBreak.Name = "buttonBreak";
|
||||||
|
buttonBreak.Size = new Size(94, 29);
|
||||||
|
buttonBreak.TabIndex = 7;
|
||||||
|
buttonBreak.Text = "Отмена";
|
||||||
|
buttonBreak.UseVisualStyleBackColor = true;
|
||||||
|
buttonBreak.Click += buttonBreak_Click;
|
||||||
|
//
|
||||||
|
// textBoxWorkPhone
|
||||||
|
//
|
||||||
|
textBoxWorkPhone.Location = new Point(184, 146);
|
||||||
|
textBoxWorkPhone.Name = "textBoxWorkPhone";
|
||||||
|
textBoxWorkPhone.Size = new Size(125, 27);
|
||||||
|
textBoxWorkPhone.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FormPublishingHouse
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(339, 290);
|
||||||
|
Controls.Add(textBoxWorkPhone);
|
||||||
|
Controls.Add(buttonBreak);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxAddress);
|
||||||
|
Controls.Add(textBoxTitle);
|
||||||
|
Controls.Add(labelWorkPhone);
|
||||||
|
Controls.Add(labelAddress);
|
||||||
|
Controls.Add(labelTitle);
|
||||||
|
Name = "FormPublishingHouse";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Типография";
|
||||||
|
Load += FormPublishingHouse_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelTitle;
|
||||||
|
private Label labelAddress;
|
||||||
|
private Label labelWorkPhone;
|
||||||
|
private TextBox textBoxTitle;
|
||||||
|
private TextBox textBoxAddress;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonBreak;
|
||||||
|
private TextBox textBoxWorkPhone;
|
||||||
|
}
|
||||||
|
}
|
87
Publication/Forms/FormPublishingHouse.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.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 Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormPublishingHouse : Form
|
||||||
|
{
|
||||||
|
private readonly IPublisingHouseRepository publisingHouseRepository;
|
||||||
|
private int? publishingHouseId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var publishingHouse = publisingHouseRepository.ReadPublishingHouseById(value);
|
||||||
|
if (publishingHouse == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(publishingHouse));
|
||||||
|
}
|
||||||
|
textBoxTitle.Text = publishingHouse.Title;
|
||||||
|
textBoxAddress.Text = publishingHouse.Address;
|
||||||
|
textBoxWorkPhone.Text = publishingHouse.WorkPhone;
|
||||||
|
publishingHouseId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormPublishingHouse(IPublisingHouseRepository _publisingHouseRepository)
|
||||||
|
{
|
||||||
|
publisingHouseRepository = _publisingHouseRepository ?? throw new ArgumentNullException(nameof(_publisingHouseRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormPublishingHouse_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonBreak_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxAddress.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxTitle.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxWorkPhone.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (publishingHouseId.HasValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
publisingHouseRepository.UpdatePublishingHouse(CreatePublishingHouse(publishingHouseId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
publisingHouseRepository.CreatePublishingHouse(CreatePublishingHouse(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PublishingHouse CreatePublishingHouse(int id)=>PublishingHouse.CreateEntity(id,textBoxTitle.Text,textBoxAddress.Text,textBoxWorkPhone.Text);
|
||||||
|
}
|
120
Publication/Forms/FormPublishingHouse.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
128
Publication/Forms/FormPublishingHouses.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
namespace Publication.Forms
|
||||||
|
{
|
||||||
|
partial class FormPublishingHouses
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPublishingHouses));
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonEdit = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDelete);
|
||||||
|
panel1.Controls.Add(buttonEdit);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(603, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(197, 450);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.BackgroundImage = (Image)resources.GetObject("buttonDelete.BackgroundImage");
|
||||||
|
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDelete.Location = new Point(67, 312);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(94, 103);
|
||||||
|
buttonDelete.TabIndex = 2;
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += buttonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
buttonEdit.BackgroundImage = (Image)resources.GetObject("buttonEdit.BackgroundImage");
|
||||||
|
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonEdit.Location = new Point(67, 168);
|
||||||
|
buttonEdit.Name = "buttonEdit";
|
||||||
|
buttonEdit.Size = new Size(94, 103);
|
||||||
|
buttonEdit.TabIndex = 1;
|
||||||
|
buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
buttonEdit.Click += buttonEdit_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(67, 31);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 103);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(603, 450);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormPublishingHouses
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormPublishingHouses";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Издательства";
|
||||||
|
Load += FormPublishingHouses_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
111
Publication/Forms/FormPublishingHouses.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication.Forms;
|
||||||
|
|
||||||
|
public partial class FormPublishingHouses : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer container;
|
||||||
|
private readonly IPublisingHouseRepository publisingHouseRepository;
|
||||||
|
public FormPublishingHouses(IUnityContainer _container, IPublisingHouseRepository _publisingHouseRepository)
|
||||||
|
{
|
||||||
|
container = _container ?? throw new ArgumentNullException(nameof(_container));
|
||||||
|
publisingHouseRepository = _publisingHouseRepository ?? throw new ArgumentNullException(nameof(_publisingHouseRepository));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
container.Resolve<FormPublishingHouse>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = container.Resolve<FormPublishingHouse>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
publisingHouseRepository.DeletePublishingHouse(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormPublishingHouses_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id =
|
||||||
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = publisingHouseRepository.ReadPublishingHouses();
|
||||||
|
}
|
4782
Publication/Forms/FormPublishingHouses.resx
Normal file
123
Publication/Forms/Publication.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
namespace Publication
|
||||||
|
{
|
||||||
|
partial class Publication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Publication));
|
||||||
|
menuStrip = new MenuStrip();
|
||||||
|
DictionsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
CustomersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
MaterialsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
PublishingHousesToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
CreateOrderToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
PrintingToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
ReportsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
menuStrip.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
|
menuStrip.Items.AddRange(new ToolStripItem[] { DictionsToolStripMenuItem, OperationsToolStripMenuItem, ReportsToolStripMenuItem });
|
||||||
|
resources.ApplyResources(menuStrip, "menuStrip");
|
||||||
|
menuStrip.Name = "menuStrip";
|
||||||
|
//
|
||||||
|
// DictionsToolStripMenuItem
|
||||||
|
//
|
||||||
|
DictionsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomersToolStripMenuItem, MaterialsToolStripMenuItem, PublishingHousesToolStripMenuItem });
|
||||||
|
DictionsToolStripMenuItem.Name = "DictionsToolStripMenuItem";
|
||||||
|
resources.ApplyResources(DictionsToolStripMenuItem, "DictionsToolStripMenuItem");
|
||||||
|
//
|
||||||
|
// CustomersToolStripMenuItem
|
||||||
|
//
|
||||||
|
CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem";
|
||||||
|
resources.ApplyResources(CustomersToolStripMenuItem, "CustomersToolStripMenuItem");
|
||||||
|
CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// MaterialsToolStripMenuItem
|
||||||
|
//
|
||||||
|
MaterialsToolStripMenuItem.Name = "MaterialsToolStripMenuItem";
|
||||||
|
resources.ApplyResources(MaterialsToolStripMenuItem, "MaterialsToolStripMenuItem");
|
||||||
|
MaterialsToolStripMenuItem.Click += MaterialsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// PublishingHousesToolStripMenuItem
|
||||||
|
//
|
||||||
|
PublishingHousesToolStripMenuItem.Name = "PublishingHousesToolStripMenuItem";
|
||||||
|
resources.ApplyResources(PublishingHousesToolStripMenuItem, "PublishingHousesToolStripMenuItem");
|
||||||
|
PublishingHousesToolStripMenuItem.Click += PublishingHousesToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// OperationsToolStripMenuItem
|
||||||
|
//
|
||||||
|
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CreateOrderToolStripMenuItem, PrintingToolStripMenuItem });
|
||||||
|
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||||
|
resources.ApplyResources(OperationsToolStripMenuItem, "OperationsToolStripMenuItem");
|
||||||
|
//
|
||||||
|
// CreateOrderToolStripMenuItem
|
||||||
|
//
|
||||||
|
CreateOrderToolStripMenuItem.Name = "CreateOrderToolStripMenuItem";
|
||||||
|
resources.ApplyResources(CreateOrderToolStripMenuItem, "CreateOrderToolStripMenuItem");
|
||||||
|
CreateOrderToolStripMenuItem.Click += CreateOrderToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// PrintingToolStripMenuItem
|
||||||
|
//
|
||||||
|
PrintingToolStripMenuItem.Name = "PrintingToolStripMenuItem";
|
||||||
|
resources.ApplyResources(PrintingToolStripMenuItem, "PrintingToolStripMenuItem");
|
||||||
|
PrintingToolStripMenuItem.Click += PrintingToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// ReportsToolStripMenuItem
|
||||||
|
//
|
||||||
|
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
|
||||||
|
resources.ApplyResources(ReportsToolStripMenuItem, "ReportsToolStripMenuItem");
|
||||||
|
//
|
||||||
|
// Publication
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this, "$this");
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(menuStrip);
|
||||||
|
MainMenuStrip = menuStrip;
|
||||||
|
Name = "Publication";
|
||||||
|
menuStrip.ResumeLayout(false);
|
||||||
|
menuStrip.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem DictionsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem CustomersToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem MaterialsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem PublishingHousesToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem CreateOrderToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem PrintingToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ReportsToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
80
Publication/Forms/Publication.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using Publication.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Publication;
|
||||||
|
|
||||||
|
public partial class Publication : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IUnityContainer unityContainer;
|
||||||
|
public Publication(IUnityContainer _unityContainer)
|
||||||
|
{
|
||||||
|
unityContainer = _unityContainer ?? throw new ArgumentNullException(nameof(_unityContainer));
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CustomersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
unityContainer.Resolve<FormCustomers>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaterialsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
unityContainer.Resolve<FormMaterials>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PublishingHousesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
unityContainer.Resolve<FormPublishingHouses>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateOrderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
unityContainer.Resolve<FormOrders>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrintingToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
unityContainer.Resolve<FormPrintingHouses>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2226
Publication/Forms/Publication.resx
Normal file
@ -1,3 +1,8 @@
|
|||||||
|
using Publication.Repositories;
|
||||||
|
using Publication.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
using Unity.Lifetime;
|
||||||
|
|
||||||
namespace Publication
|
namespace Publication
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +16,19 @@ namespace Publication
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(CreateContainer().Resolve<Publication>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
container.RegisterType<ICustomerRepository,CustomerRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IMaterialRepository, MaterialRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IOrderRepository, OrderRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IPrintingHouseRepository, PrintingHouseRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IPublisingHouseRepository, PublishingHouseRepository>(new TransientLifetimeManager());
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
163
Publication/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Publication.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||||
|
// с помощью такого средства, как ResGen или Visual Studio.
|
||||||
|
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||||
|
// с параметром /str или перестройте свой проект VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Publication.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap mines {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("mines", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap pen {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("pen", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap plus {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("plus", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap sdljfdjfk {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("sdljfdjfk", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap карандаш {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("карандаш", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap карандаш1 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("карандаш1", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap минус {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("минус", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap минус1 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("минус1", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap плюс {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("плюс", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap плюс1 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("плюс1", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
151
Publication/Properties/Resources.resx
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="плюс1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\плюс.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="карандаш1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\карандаш.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="карандаш" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\карандаш.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="pen" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\pen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="mines" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\mines.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="минус1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\минус.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="плюс" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\плюс.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="минус" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\минус.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="sdljfdjfk" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\sdljfdjfk.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -8,4 +8,23 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
10
Publication/Repositories/ICustomerRepository.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Publication.Repositories;
|
||||||
|
|
||||||
|
public interface ICustomerRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Customers> ReadCustomers();
|
||||||
|
Customers ReadCustomerById(int id);
|
||||||
|
void CreateCustomer(Customers customer);
|
||||||
|
void UpdateCustomer(Customers customer);
|
||||||
|
void DeleteCustomer(int id);
|
||||||
|
}
|
12
Publication/Repositories/IMaterialRepository.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories;
|
||||||
|
|
||||||
|
public interface IMaterialRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Materials> ReadMaterials();
|
||||||
|
Materials ReadMaterialById(int id);
|
||||||
|
void CreateMaterial(Materials material);
|
||||||
|
void UpdateMaterial(Materials material);
|
||||||
|
void DeleteMaterial(int id);
|
||||||
|
}
|
9
Publication/Repositories/IOrderRepository.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories;
|
||||||
|
|
||||||
|
public interface IOrderRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Orders> ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderId = null, int? customerId = null, int? publishingHouseId = null);
|
||||||
|
void CreateOrder(Orders order);
|
||||||
|
}
|
10
Publication/Repositories/IPrintingHouseRepository.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories;
|
||||||
|
|
||||||
|
public interface IPrintingHouseRepository
|
||||||
|
{
|
||||||
|
IEnumerable<PrintingHouses> ReadPrintingHouses(int? printingHouseId = null, string? printingHousePhone = null, string? printingHouseAddress = null, int? materialsId = null);
|
||||||
|
void CreatePrintingHouse(PrintingHouses printerHouse);
|
||||||
|
void DeletePrintingHouse(int id);
|
||||||
|
}
|
12
Publication/Repositories/IPublisingHouseRepository.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories;
|
||||||
|
|
||||||
|
public interface IPublisingHouseRepository
|
||||||
|
{
|
||||||
|
IEnumerable<PublishingHouse> ReadPublishingHouses();
|
||||||
|
PublishingHouse ReadPublishingHouseById(int id);
|
||||||
|
void CreatePublishingHouse(PublishingHouse publishingHouse);
|
||||||
|
void UpdatePublishingHouse(PublishingHouse publishingHouse);
|
||||||
|
void DeletePublishingHouse(int id);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
namespace Publication.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class CustomerRepository : ICustomerRepository
|
||||||
|
{
|
||||||
|
public void CreateCustomer(Customers customer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteCustomer(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customers ReadCustomerById(int id)
|
||||||
|
{
|
||||||
|
return Customers.CreateEntity(0, string.Empty, 0, Entites.Enums.TypeCustomers.None, string.Empty, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Customers> ReadCustomers()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCustomer(Customers customer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class MaterialRepository : IMaterialRepository
|
||||||
|
{
|
||||||
|
public void CreateMaterial(Materials material)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteMaterial(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Materials ReadMaterialById(int id)
|
||||||
|
{
|
||||||
|
return Materials.CreateEntity(0, DateTime.Now, 0, Entites.Enums.TypeMaterials.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Materials> ReadMaterials()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateMaterial(Materials material)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
23
Publication/Repositories/Implementations/OrderRepository.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class OrderRepository : IOrderRepository
|
||||||
|
{
|
||||||
|
public void CreateOrder(Orders order)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteOrder(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Orders> ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderId = null, int? customerId = null, int? publishingHouseId = null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class PrintingHouseRepository : IPrintingHouseRepository
|
||||||
|
{
|
||||||
|
public void CreatePrintingHouse(PrintingHouses printerHouse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeletePrintingHouse(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<PrintingHouses> ReadPrintingHouses(int? printingHouseId = null, string? printingHousePhone = null, string? printingHouseAddress = null, int? materialsId = null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using Publication.Entites;
|
||||||
|
|
||||||
|
namespace Publication.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class PublishingHouseRepository : IPublisingHouseRepository
|
||||||
|
{
|
||||||
|
public void CreatePublishingHouse(PublishingHouse publishingHouse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeletePublishingHouse(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<PublishingHouse> ReadPublishingHouses()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublishingHouse ReadPublishingHouseById(int id)
|
||||||
|
{
|
||||||
|
return PublishingHouse.CreateEntity(0, string.Empty,string.Empty,string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdatePublishingHouse(PublishingHouse publishingHouse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
BIN
Publication/Resources/mines.png
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
Publication/Resources/pen.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
Publication/Resources/plus.png
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
Publication/Resources/sdljfdjfk.jpg
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
Publication/карандаш.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
Publication/минус.png
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
Publication/плюс.png
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
Publication/типография.jpg
Normal file
After Width: | Height: | Size: 114 KiB |