Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ea71f0caca | ||
|
758c0a76c3 | ||
|
3a5a72dbbc | ||
|
6f6b08f5cf | ||
|
7758c9be8c | ||
|
64db0e8a91 | ||
|
74bda6e3f8 | ||
|
bab142cf74 | ||
|
4b4adda0d9 | ||
|
c3fde5d3da | ||
|
b4487e7ae0 | ||
|
c3f1ec8d35 | ||
|
b72eae4c7b | ||
|
3d216ab940 | ||
|
a3d699187c | ||
|
d7a906aca0 | ||
|
98d2b7ba70 | ||
|
9f80622d0d | ||
|
7963f6e9f0 |
27
ProductionInCehOTP/Entities/ArrivalMaterials.cs
Normal file
27
ProductionInCehOTP/Entities/ArrivalMaterials.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class ArrivalMaterials
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[DisplayName("Дата")]
|
||||
public DateTime Date { get; private set; }
|
||||
[DisplayName("Перечь поставленных материалов")]
|
||||
public NameOfMaterials Name { get; private set; }
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static ArrivalMaterials CreateArrivalMaterials(int id, DateTime Date, NameOfMaterials name, int count)
|
||||
{
|
||||
return new ArrivalMaterials
|
||||
{
|
||||
Id = id,
|
||||
Date = Date,
|
||||
Name = name,
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
}
|
10
ProductionInCehOTP/Entities/Enums/NameOfMaterials.cs
Normal file
10
ProductionInCehOTP/Entities/Enums/NameOfMaterials.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace ProductionInCehOTP.Entities.Enums;
|
||||
[Flags]
|
||||
public enum NameOfMaterials
|
||||
{
|
||||
None = 0,
|
||||
Metal = 1,
|
||||
GraphiteDust = 2,
|
||||
Soil = 4,
|
||||
Oil = 8
|
||||
}
|
7
ProductionInCehOTP/Entities/Enums/NameOfProductTypes.cs
Normal file
7
ProductionInCehOTP/Entities/Enums/NameOfProductTypes.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace ProductionInCehOTP.Entities.Enums;
|
||||
|
||||
public enum NameOfProductTypes
|
||||
{
|
||||
machine = 0,
|
||||
kernel = 1
|
||||
}
|
14
ProductionInCehOTP/Entities/Enums/PlansOfWork.cs
Normal file
14
ProductionInCehOTP/Entities/Enums/PlansOfWork.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Entities.Enums;
|
||||
|
||||
public enum PlansOfWork
|
||||
{
|
||||
None = 0,
|
||||
ProductMechanic = 1,
|
||||
ProductKernel = 2
|
||||
}
|
53
ProductionInCehOTP/Entities/Material.cs
Normal file
53
ProductionInCehOTP/Entities/Material.cs
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class Material
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Материал")]
|
||||
public NameOfMaterials Name { get; private set; }
|
||||
|
||||
[DisplayName("Номеер поставки")]
|
||||
public int ArrivalMaterialID { get; private set; }
|
||||
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
public IEnumerable<MaterialForProduct> MaterialForProducts { get; set; } = [];
|
||||
|
||||
[DisplayName("Количество переданного")]
|
||||
public string CountToProduct => MaterialForProducts != null ?
|
||||
string.Join(", ", MaterialForProducts.Select(x => $"{x.ProductID},{x.Count} ")) :
|
||||
string.Empty;
|
||||
|
||||
|
||||
|
||||
[DisplayName("Дата передачи в производство")]
|
||||
public DateTime DateArrivalToProduct { get; private set; }
|
||||
|
||||
public static Material TransferMaterial(int id, NameOfMaterials name, int arrivalMaterialsID, DateTime dateArrivalToProduct,IEnumerable<MaterialForProduct> materialForProducts )
|
||||
{
|
||||
return new Material
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
ArrivalMaterialID = arrivalMaterialsID,
|
||||
DateArrivalToProduct = dateArrivalToProduct,
|
||||
MaterialForProducts = materialForProducts
|
||||
};
|
||||
}
|
||||
|
||||
public void SetMaterialForProduct(IEnumerable<MaterialForProduct> materialForProducts)
|
||||
{
|
||||
if(materialForProducts != null && materialForProducts.Any())
|
||||
{
|
||||
MaterialForProducts = materialForProducts;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
13
ProductionInCehOTP/Entities/MaterialForProduct.cs
Normal file
13
ProductionInCehOTP/Entities/MaterialForProduct.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class MaterialForProduct
|
||||
{
|
||||
public int ProductID { get; private set; }
|
||||
public int MaterialID { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static MaterialForProduct CreateDependenceMaterialsToProduct( int materialsId, int productID, int count)
|
||||
{
|
||||
return new MaterialForProduct { ProductID = productID, MaterialID = materialsId, Count = count};
|
||||
}
|
||||
}
|
36
ProductionInCehOTP/Entities/PlanWork.cs
Normal file
36
ProductionInCehOTP/Entities/PlanWork.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class PlanWork
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[DisplayName("Запланированное количество готовой продукции")]
|
||||
public int Plan { get; private set; }
|
||||
|
||||
[DisplayName("Дата установки плана")]
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
public int WorkerId { get; private set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public IEnumerable<PlanWorkForProduct> PlanWorkForProducts { get; set; } = [];
|
||||
|
||||
[DisplayName("Установленный план")]
|
||||
public string Manufacture => PlanWorkForProducts != null ?
|
||||
string.Join(", ", PlanWorkForProducts.Select(x => $"{x.ProductId},{x.Count} ")) :
|
||||
string.Empty;
|
||||
|
||||
public static PlanWork CreatePlanWork(int id,int workerId, int Plan, DateTime Date, IEnumerable<PlanWorkForProduct> planWorkForProducts)
|
||||
{
|
||||
return new PlanWork { Id = id,WorkerId = workerId, Plan = Plan, Date = Date, PlanWorkForProducts = planWorkForProducts };
|
||||
}
|
||||
|
||||
public void SetPlanWorkForProduct(IEnumerable<PlanWorkForProduct> planWorkForProducts)
|
||||
{
|
||||
if (planWorkForProducts != null && planWorkForProducts.Any())
|
||||
{
|
||||
PlanWorkForProducts = planWorkForProducts;
|
||||
}
|
||||
}
|
||||
}
|
18
ProductionInCehOTP/Entities/PlanWorkForProduct.cs
Normal file
18
ProductionInCehOTP/Entities/PlanWorkForProduct.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class PlanWorkForProduct
|
||||
{
|
||||
public int PlanWorkId { get; private set; }
|
||||
public int ProductId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static PlanWorkForProduct CreateDependencePlanWorkToProduct(int planworkId, int productID, int Count)
|
||||
{
|
||||
return new PlanWorkForProduct
|
||||
{
|
||||
PlanWorkId = planworkId,
|
||||
ProductId = productID,
|
||||
Count = Count
|
||||
};
|
||||
}
|
||||
}
|
26
ProductionInCehOTP/Entities/Product.cs
Normal file
26
ProductionInCehOTP/Entities/Product.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Наименование продукта")]
|
||||
public string Name { get; private set; }
|
||||
|
||||
[DisplayName("Цена")]
|
||||
public int Price { get; private set; }
|
||||
|
||||
[DisplayName("Официальный регистрационный номер")]
|
||||
public string ProductionId { get; private set; }
|
||||
|
||||
[DisplayName("Наименование типа изделия")]
|
||||
public NameOfProductTypes ProductionTypeID { get; private set; }
|
||||
|
||||
public static Product CreateProducts(int id, string name, int price, string productionId, NameOfProductTypes productionType)
|
||||
{
|
||||
return new Product { Id = id, Name = name, Price = price, ProductionId = productionId, ProductionTypeID = productionType };
|
||||
}
|
||||
}
|
33
ProductionInCehOTP/Entities/QueryBuilder.cs
Normal file
33
ProductionInCehOTP/Entities/QueryBuilder.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
internal class QueryBuilder
|
||||
{
|
||||
private readonly StringBuilder _builder;
|
||||
public QueryBuilder()
|
||||
{
|
||||
_builder = new();
|
||||
}
|
||||
public QueryBuilder AddCondition(string condition)
|
||||
{
|
||||
if (_builder.Length > 0)
|
||||
{
|
||||
_builder.Append(" AND ");
|
||||
}
|
||||
_builder.Append(condition);
|
||||
return this;
|
||||
}
|
||||
public string Build()
|
||||
{
|
||||
if (_builder.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return $"WHERE {_builder}";
|
||||
}
|
||||
}
|
35
ProductionInCehOTP/Entities/Worker.cs
Normal file
35
ProductionInCehOTP/Entities/Worker.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace ProductionInCehOTP.Entities;
|
||||
|
||||
public class Worker
|
||||
{
|
||||
|
||||
public int Id { get; private set; }
|
||||
[Browsable(false)]
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
[DisplayName("ФИО(разряд)")]
|
||||
public string NameClass => $"{Name}({Class})";
|
||||
|
||||
[DisplayName("Рабочий стаж")]
|
||||
public DateTime Experience { get; private set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public int Class { get; private set; }
|
||||
|
||||
[DisplayName("Дневная норма выработки")]
|
||||
public int PlanWork { get; private set; }
|
||||
|
||||
public static Worker CreateWorker(int id, string name, DateTime experience, int classOfWorker, int planWorkID)
|
||||
{
|
||||
return new Worker
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
Experience = experience,
|
||||
Class = classOfWorker,
|
||||
PlanWork = planWorkID
|
||||
};
|
||||
}
|
||||
}
|
150
ProductionInCehOTP/Forms/ArrivalsMaterials_Forms/FormArrivalMaterials.Designer.cs
generated
Normal file
150
ProductionInCehOTP/Forms/ArrivalsMaterials_Forms/FormArrivalMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,150 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormArrivalMaterials
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkedListBoxMaterials = new CheckedListBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
numericUpDownCountMaterials = new NumericUpDown();
|
||||
dateTimePickerDateArrival = new DateTimePicker();
|
||||
label3 = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonCensel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCountMaterials).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkedListBoxMaterials
|
||||
//
|
||||
checkedListBoxMaterials.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
checkedListBoxMaterials.FormattingEnabled = true;
|
||||
checkedListBoxMaterials.Location = new Point(12, 42);
|
||||
checkedListBoxMaterials.Name = "checkedListBoxMaterials";
|
||||
checkedListBoxMaterials.Size = new Size(300, 158);
|
||||
checkedListBoxMaterials.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(128, 20);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "Поставка товара:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 213);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(118, 20);
|
||||
label2.TabIndex = 3;
|
||||
label2.Text = "Количество(Кг):";
|
||||
//
|
||||
// numericUpDownCountMaterials
|
||||
//
|
||||
numericUpDownCountMaterials.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
numericUpDownCountMaterials.Location = new Point(136, 211);
|
||||
numericUpDownCountMaterials.Maximum = new decimal(new int[] { 300000, 0, 0, 0 });
|
||||
numericUpDownCountMaterials.Name = "numericUpDownCountMaterials";
|
||||
numericUpDownCountMaterials.Size = new Size(176, 27);
|
||||
numericUpDownCountMaterials.TabIndex = 4;
|
||||
//
|
||||
// dateTimePickerDateArrival
|
||||
//
|
||||
dateTimePickerDateArrival.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerDateArrival.Location = new Point(12, 271);
|
||||
dateTimePickerDateArrival.Name = "dateTimePickerDateArrival";
|
||||
dateTimePickerDateArrival.Size = new Size(300, 27);
|
||||
dateTimePickerDateArrival.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 248);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(111, 20);
|
||||
label3.TabIndex = 6;
|
||||
label3.Text = "Дата поставки:";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(15, 309);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(146, 29);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCensel
|
||||
//
|
||||
buttonCensel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCensel.Location = new Point(166, 309);
|
||||
buttonCensel.Name = "buttonCensel";
|
||||
buttonCensel.Size = new Size(146, 29);
|
||||
buttonCensel.TabIndex = 8;
|
||||
buttonCensel.Text = "Отмена";
|
||||
buttonCensel.UseVisualStyleBackColor = true;
|
||||
buttonCensel.Click += ButtonCensel_Click;
|
||||
//
|
||||
// FormArrivalMaterials
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(324, 348);
|
||||
Controls.Add(buttonCensel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(dateTimePickerDateArrival);
|
||||
Controls.Add(numericUpDownCountMaterials);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(checkedListBoxMaterials);
|
||||
Name = "FormArrivalMaterials";
|
||||
Text = "Поставка материалов";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCountMaterials).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBoxMaterials;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private NumericUpDown numericUpDownCountMaterials;
|
||||
private DateTimePicker dateTimePickerDateArrival;
|
||||
private Label label3;
|
||||
private Button buttonSave;
|
||||
private Button buttonCensel;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.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 ProductionInCehOTP.Forms
|
||||
{
|
||||
public partial class FormArrivalMaterials : Form
|
||||
{
|
||||
private readonly IArrivalMaterialsRepository _ArrivalMaterialsrepository;
|
||||
private int? _arrivalId;
|
||||
|
||||
public FormArrivalMaterials(IArrivalMaterialsRepository arrivalMaterialsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_ArrivalMaterialsrepository = arrivalMaterialsRepository ??
|
||||
throw new ArgumentNullException(nameof(arrivalMaterialsRepository));
|
||||
foreach (var elem in Enum.GetValues(typeof(NameOfMaterials)))
|
||||
{
|
||||
checkedListBoxMaterials.Items.Add(elem);
|
||||
}
|
||||
}
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var arrival = _ArrivalMaterialsrepository.GetArrivalMaterialsById(value);
|
||||
if (arrival == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(value));
|
||||
}
|
||||
foreach (NameOfMaterials elem in Enum.GetValues(typeof(NameOfMaterials)))
|
||||
{
|
||||
if ((elem & arrival.Name) != 0)
|
||||
{
|
||||
checkedListBoxMaterials.SetItemChecked(checkedListBoxMaterials.Items.IndexOf(elem), true);
|
||||
}
|
||||
}
|
||||
numericUpDownCountMaterials.Value = arrival.Count;
|
||||
dateTimePickerDateArrival.Value = arrival.Date;
|
||||
_arrivalId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (numericUpDownCountMaterials == null || checkedListBoxMaterials.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
|
||||
}
|
||||
if (_arrivalId.HasValue)
|
||||
{
|
||||
_ArrivalMaterialsrepository.UpdateArrivalMaterials(CreateMaterials(_arrivalId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ArrivalMaterialsrepository.CreateArrivalMaterials(CreateMaterials(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
private ArrivalMaterials CreateMaterials(int id)
|
||||
{
|
||||
NameOfMaterials nameOfMaterials = NameOfMaterials.None;
|
||||
foreach (var elem in checkedListBoxMaterials.CheckedItems)
|
||||
{
|
||||
nameOfMaterials |= (NameOfMaterials)elem;
|
||||
}
|
||||
return ArrivalMaterials.CreateArrivalMaterials(id, dateTimePickerDateArrival.Value, nameOfMaterials,Convert.ToInt32(numericUpDownCountMaterials.Value));
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCensel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
122
ProductionInCehOTP/Forms/ArrivalsMaterials_Forms/FormArrivalsOfMaterials.Designer.cs
generated
Normal file
122
ProductionInCehOTP/Forms/ArrivalsMaterials_Forms/FormArrivalsOfMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
namespace ProductionInCehOTP.Forms.ArrivalsMaterials_Forms
|
||||
{
|
||||
partial class FormArrivalsOfMaterials
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
ButtonAdd = new Button();
|
||||
panel1 = new Panel();
|
||||
ButtonDel = new Button();
|
||||
buttonUpdate = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToOrderColumns = true;
|
||||
dataGridViewData.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(647, 450);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
ButtonAdd.Location = new Point(30, 30);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(94, 74);
|
||||
ButtonAdd.TabIndex = 0;
|
||||
ButtonAdd.Text = "+";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(ButtonDel);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(ButtonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(647, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 450);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
ButtonDel.Location = new Point(30, 237);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(94, 74);
|
||||
ButtonDel.TabIndex = 2;
|
||||
ButtonDel.Text = "-";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonUpdate.Location = new Point(30, 136);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(94, 74);
|
||||
buttonUpdate.TabIndex = 1;
|
||||
buttonUpdate.Text = ">?<";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// FormArrivalsOfMaterials
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormArrivalsOfMaterials";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Поставки материалов";
|
||||
Load += FormArrivalsOfMaterials_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Button buttonAdd;
|
||||
private Panel panel1;
|
||||
private Button ButtonDel;
|
||||
private Button buttonUpdate;
|
||||
private Button ButtonAdd;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProductionInCehOTP.Forms.ArrivalsMaterials_Forms
|
||||
{
|
||||
public partial class FormArrivalsOfMaterials : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IArrivalMaterialsRepository _arrivalMaterialsRepository;
|
||||
public FormArrivalsOfMaterials(IUnityContainer container, IArrivalMaterialsRepository arrivalmaterialsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_arrivalMaterialsRepository = arrivalmaterialsRepository ??
|
||||
throw new ArgumentNullException(nameof(_arrivalMaterialsRepository));
|
||||
}
|
||||
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormArrivalMaterials>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка добавления элемента", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormArrivalMaterials>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_arrivalMaterialsRepository.DeleteArrivalMaterials(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewData.DataSource = _arrivalMaterialsRepository.GetArrivalMaterials();
|
||||
dataGridViewData.Columns["Id"].Visible = false;
|
||||
|
||||
}
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 0)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FormArrivalsOfMaterials_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
113
ProductionInCehOTP/Forms/FormToReports/FormDirectoryReport.Designer.cs
generated
Normal file
113
ProductionInCehOTP/Forms/FormToReports/FormDirectoryReport.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormDirectoryReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkBoxArrivalReport = new CheckBox();
|
||||
checkBoxProductReport = new CheckBox();
|
||||
checkBoxWorkerReport = new CheckBox();
|
||||
groupBoxTypeReports = new GroupBox();
|
||||
ButtonBuildReport = new Button();
|
||||
groupBoxTypeReports.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkBoxArrivalReport
|
||||
//
|
||||
checkBoxArrivalReport.AutoSize = true;
|
||||
checkBoxArrivalReport.Location = new Point(34, 26);
|
||||
checkBoxArrivalReport.Name = "checkBoxArrivalReport";
|
||||
checkBoxArrivalReport.Size = new Size(152, 24);
|
||||
checkBoxArrivalReport.TabIndex = 0;
|
||||
checkBoxArrivalReport.Text = "Потавки на склад";
|
||||
checkBoxArrivalReport.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxProductReport
|
||||
//
|
||||
checkBoxProductReport.AutoSize = true;
|
||||
checkBoxProductReport.Location = new Point(34, 56);
|
||||
checkBoxProductReport.Name = "checkBoxProductReport";
|
||||
checkBoxProductReport.Size = new Size(108, 24);
|
||||
checkBoxProductReport.TabIndex = 1;
|
||||
checkBoxProductReport.Text = "Продукция";
|
||||
checkBoxProductReport.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxWorkerReport
|
||||
//
|
||||
checkBoxWorkerReport.AutoSize = true;
|
||||
checkBoxWorkerReport.Location = new Point(34, 86);
|
||||
checkBoxWorkerReport.Name = "checkBoxWorkerReport";
|
||||
checkBoxWorkerReport.Size = new Size(105, 24);
|
||||
checkBoxWorkerReport.TabIndex = 2;
|
||||
checkBoxWorkerReport.Text = "Работники";
|
||||
checkBoxWorkerReport.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBoxTypeReports
|
||||
//
|
||||
groupBoxTypeReports.Controls.Add(checkBoxArrivalReport);
|
||||
groupBoxTypeReports.Controls.Add(checkBoxWorkerReport);
|
||||
groupBoxTypeReports.Controls.Add(checkBoxProductReport);
|
||||
groupBoxTypeReports.Location = new Point(12, 12);
|
||||
groupBoxTypeReports.Name = "groupBoxTypeReports";
|
||||
groupBoxTypeReports.Size = new Size(356, 125);
|
||||
groupBoxTypeReports.TabIndex = 3;
|
||||
groupBoxTypeReports.TabStop = false;
|
||||
groupBoxTypeReports.Text = "Справочные отчеты";
|
||||
//
|
||||
// ButtonBuildReport
|
||||
//
|
||||
ButtonBuildReport.Location = new Point(197, 142);
|
||||
ButtonBuildReport.Name = "ButtonBuildReport";
|
||||
ButtonBuildReport.Size = new Size(171, 29);
|
||||
ButtonBuildReport.TabIndex = 4;
|
||||
ButtonBuildReport.Text = "Сформировать";
|
||||
ButtonBuildReport.UseVisualStyleBackColor = true;
|
||||
ButtonBuildReport.Click += ButtonBuildReport_Click;
|
||||
//
|
||||
// FormDirectoryReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(382, 183);
|
||||
Controls.Add(ButtonBuildReport);
|
||||
Controls.Add(groupBoxTypeReports);
|
||||
Name = "FormDirectoryReport";
|
||||
Text = "Формирование отчетов";
|
||||
groupBoxTypeReports.ResumeLayout(false);
|
||||
groupBoxTypeReports.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckBox checkBoxArrivalReport;
|
||||
private CheckBox checkBoxProductReport;
|
||||
private CheckBox checkBoxWorkerReport;
|
||||
private GroupBox groupBoxTypeReports;
|
||||
private Button ButtonBuildReport;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using ProductionInCehOTP.Reports;
|
||||
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 ProductionInCehOTP.Forms
|
||||
{
|
||||
public partial class FormDirectoryReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormDirectoryReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ButtonBuildReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!checkBoxArrivalReport.Checked &&
|
||||
!checkBoxProductReport.Checked && !checkBoxWorkerReport.Checked)
|
||||
{
|
||||
throw new Exception("Не выбран ни один справочникдля выгрузки");
|
||||
}
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Docx Files | *.docx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
throw new Exception("Не выбран файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<DocReport>().CreateDoc(sfd.FileName, checkBoxArrivalReport.Checked, checkBoxProductReport.Checked,checkBoxWorkerReport.Checked))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формированиидокумента.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProductionInCehOTP/Forms/FormToReports/FormDirectoryReport.resx
Normal file
120
ProductionInCehOTP/Forms/FormToReports/FormDirectoryReport.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>
|
178
ProductionInCehOTP/Forms/FormToReports/FormInnerAndOuterOfMaterialsToProductReport.Designer.cs
generated
Normal file
178
ProductionInCehOTP/Forms/FormToReports/FormInnerAndOuterOfMaterialsToProductReport.Designer.cs
generated
Normal file
@ -0,0 +1,178 @@
|
||||
namespace ProductionInCehOTP.Forms.FormToReports
|
||||
{
|
||||
partial class FormInnerAndOuterOfMaterialsToProductReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
groupBox1 = new GroupBox();
|
||||
dateTimePickerEndDate = new DateTimePicker();
|
||||
dateTimePickerStartDate = new DateTimePicker();
|
||||
label4 = new Label();
|
||||
ButtonMakeReport = new Button();
|
||||
textBoxFilePath = new TextBox();
|
||||
ButtonSelectFilePath = new Button();
|
||||
comboBoxMaterial = new ComboBox();
|
||||
groupBox1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 24);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(112, 20);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Путь до файла:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 63);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(81, 20);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Материал:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(6, 40);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(29, 20);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "От:";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(dateTimePickerEndDate);
|
||||
groupBox1.Controls.Add(dateTimePickerStartDate);
|
||||
groupBox1.Controls.Add(label4);
|
||||
groupBox1.Controls.Add(label3);
|
||||
groupBox1.Location = new Point(12, 102);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(524, 80);
|
||||
groupBox1.TabIndex = 3;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Даты отслеживания:";
|
||||
//
|
||||
// dateTimePickerEndDate
|
||||
//
|
||||
dateTimePickerEndDate.Location = new Point(337, 33);
|
||||
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
|
||||
dateTimePickerEndDate.Size = new Size(181, 27);
|
||||
dateTimePickerEndDate.TabIndex = 5;
|
||||
//
|
||||
// dateTimePickerStartDate
|
||||
//
|
||||
dateTimePickerStartDate.Location = new Point(40, 33);
|
||||
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
|
||||
dateTimePickerStartDate.Size = new Size(180, 27);
|
||||
dateTimePickerStartDate.TabIndex = 4;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(300, 40);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(31, 20);
|
||||
label4.TabIndex = 3;
|
||||
label4.Text = "До:";
|
||||
//
|
||||
// ButtonMakeReport
|
||||
//
|
||||
ButtonMakeReport.Location = new Point(165, 188);
|
||||
ButtonMakeReport.Name = "ButtonMakeReport";
|
||||
ButtonMakeReport.Size = new Size(213, 46);
|
||||
ButtonMakeReport.TabIndex = 4;
|
||||
ButtonMakeReport.Text = "Сформировать";
|
||||
ButtonMakeReport.UseVisualStyleBackColor = true;
|
||||
ButtonMakeReport.Click += ButtonMakeReport_Click;
|
||||
//
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Location = new Point(130, 17);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.ReadOnly = true;
|
||||
textBoxFilePath.Size = new Size(335, 27);
|
||||
textBoxFilePath.TabIndex = 5;
|
||||
//
|
||||
// ButtonSelectFilePath
|
||||
//
|
||||
ButtonSelectFilePath.Location = new Point(471, 17);
|
||||
ButtonSelectFilePath.Name = "ButtonSelectFilePath";
|
||||
ButtonSelectFilePath.Size = new Size(35, 27);
|
||||
ButtonSelectFilePath.TabIndex = 6;
|
||||
ButtonSelectFilePath.Text = "...";
|
||||
ButtonSelectFilePath.UseVisualStyleBackColor = true;
|
||||
ButtonSelectFilePath.Click += ButtonSelectFilePath_Click;
|
||||
//
|
||||
// comboBoxMaterial
|
||||
//
|
||||
comboBoxMaterial.FormattingEnabled = true;
|
||||
comboBoxMaterial.Location = new Point(130, 55);
|
||||
comboBoxMaterial.Name = "comboBoxMaterial";
|
||||
comboBoxMaterial.Size = new Size(195, 28);
|
||||
comboBoxMaterial.TabIndex = 7;
|
||||
//
|
||||
// FormInnerAndOuterOfMaterialsToProductReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(542, 241);
|
||||
Controls.Add(comboBoxMaterial);
|
||||
Controls.Add(ButtonSelectFilePath);
|
||||
Controls.Add(textBoxFilePath);
|
||||
Controls.Add(ButtonMakeReport);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormInnerAndOuterOfMaterialsToProductReport";
|
||||
Text = "Отчет приходы и уходы";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private GroupBox groupBox1;
|
||||
private DateTimePicker dateTimePickerEndDate;
|
||||
private DateTimePicker dateTimePickerStartDate;
|
||||
private Label label4;
|
||||
private Button ButtonMakeReport;
|
||||
private TextBox textBoxFilePath;
|
||||
private Button ButtonSelectFilePath;
|
||||
private ComboBox comboBoxMaterial;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using ProductionInCehOTP.Reports;
|
||||
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 ProductionInCehOTP.Forms.FormToReports;
|
||||
|
||||
public partial class FormInnerAndOuterOfMaterialsToProductReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormInnerAndOuterOfMaterialsToProductReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
comboBoxMaterial.DataSource = Enum.GetValues(typeof(NameOfMaterials));
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSelectFilePath_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel Files | *.xlsx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
textBoxFilePath.Text = sfd.FileName;
|
||||
}
|
||||
private void ButtonMakeReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFilePath.Text))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if (comboBoxMaterial.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Не выбран корм");
|
||||
}
|
||||
if (dateTimePickerEndDate.Value <= dateTimePickerStartDate.Value)
|
||||
{
|
||||
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<TableReport>().CreateTable(textBoxFilePath.Text,
|
||||
(NameOfMaterials)comboBoxMaterial.SelectedValue!,
|
||||
dateTimePickerStartDate.Value, dateTimePickerEndDate.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован", "Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах", "Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
107
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.Designer.cs
generated
Normal file
107
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
||||
namespace ProductionInCehOTP.Forms.FormToReports
|
||||
{
|
||||
partial class SetPlansReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
ButtonSelectFileName = new Button();
|
||||
labelFileName = new Label();
|
||||
label2 = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
button2 = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ButtonSelectFileName
|
||||
//
|
||||
ButtonSelectFileName.Location = new Point(4, 25);
|
||||
ButtonSelectFileName.Name = "ButtonSelectFileName";
|
||||
ButtonSelectFileName.Size = new Size(94, 29);
|
||||
ButtonSelectFileName.TabIndex = 0;
|
||||
ButtonSelectFileName.Text = "Выбрать";
|
||||
ButtonSelectFileName.UseVisualStyleBackColor = true;
|
||||
ButtonSelectFileName.Click += ButtonSelectFileName_Click;
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
labelFileName.AutoSize = true;
|
||||
labelFileName.Location = new Point(104, 34);
|
||||
labelFileName.Name = "labelFileName";
|
||||
labelFileName.Size = new Size(45, 20);
|
||||
labelFileName.TabIndex = 1;
|
||||
labelFileName.Text = "Файл";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(4, 79);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(44, 20);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Дата:";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(4, 102);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(304, 27);
|
||||
dateTimePicker.TabIndex = 3;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(165, 135);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(143, 32);
|
||||
button2.TabIndex = 4;
|
||||
button2.Text = "Сформировать";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
button2.Click += ButtonCreate_Click;
|
||||
//
|
||||
// SetPlansReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(316, 176);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(labelFileName);
|
||||
Controls.Add(ButtonSelectFileName);
|
||||
Name = "SetPlansReport";
|
||||
Text = "SetPlansReport";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button ButtonSelectFileName;
|
||||
private Label labelFileName;
|
||||
private Label label2;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Button button2;
|
||||
}
|
||||
}
|
67
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.cs
Normal file
67
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.cs
Normal file
@ -0,0 +1,67 @@
|
||||
using ProductionInCehOTP.Reports;
|
||||
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 ProductionInCehOTP.Forms.FormToReports
|
||||
{
|
||||
public partial class SetPlansReport : Form
|
||||
{
|
||||
private string _fileName = string.Empty;
|
||||
private readonly IUnityContainer _container;
|
||||
public SetPlansReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
private void ButtonSelectFileName_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Pdf Files | *.pdf"
|
||||
};
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_fileName = sfd.FileName;
|
||||
labelFileName.Text = Path.GetFileName(_fileName);
|
||||
}
|
||||
}
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_fileName))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла дляотчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<ChartReport>().CreateChart(_fileName, dateTimePicker.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.resx
Normal file
120
ProductionInCehOTP/Forms/FormToReports/SetPlansReport.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>
|
198
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.Designer.cs
generated
Normal file
198
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.Designer.cs
generated
Normal file
@ -0,0 +1,198 @@
|
||||
namespace ProductionInCehOTP.Forms.Material_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()
|
||||
{
|
||||
buttonSave = new Button();
|
||||
buttonCencel = new Button();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
comboBoxNameOfMaterial = new ComboBox();
|
||||
dataGridViewMaterialToProduct = new DataGridView();
|
||||
ColumnProduct = new DataGridViewComboBoxColumn();
|
||||
ColumnCountMaterial = new DataGridViewTextBoxColumn();
|
||||
groupBoxMaterialToProduct = new GroupBox();
|
||||
label3 = new Label();
|
||||
dateTimePickerDateArrivalToProduct = new DateTimePicker();
|
||||
comboBoxNomberArrials = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterialToProduct).BeginInit();
|
||||
groupBoxMaterialToProduct.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(118, 418);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(166, 57);
|
||||
buttonSave.TabIndex = 0;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCencel
|
||||
//
|
||||
buttonCencel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCencel.Location = new Point(290, 417);
|
||||
buttonCencel.Name = "buttonCencel";
|
||||
buttonCencel.Size = new Size(156, 58);
|
||||
buttonCencel.TabIndex = 1;
|
||||
buttonCencel.Text = "Отмена";
|
||||
buttonCencel.UseVisualStyleBackColor = true;
|
||||
buttonCencel.Click += ButtonCencel_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 21);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(202, 20);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "Наименование материала: ";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 69);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(127, 20);
|
||||
label2.TabIndex = 3;
|
||||
label2.Text = "Номер поставки:";
|
||||
//
|
||||
// comboBoxNameOfMaterial
|
||||
//
|
||||
comboBoxNameOfMaterial.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxNameOfMaterial.FormattingEnabled = true;
|
||||
comboBoxNameOfMaterial.Location = new Point(220, 18);
|
||||
comboBoxNameOfMaterial.Name = "comboBoxNameOfMaterial";
|
||||
comboBoxNameOfMaterial.Size = new Size(220, 28);
|
||||
comboBoxNameOfMaterial.TabIndex = 5;
|
||||
//
|
||||
// dataGridViewMaterialToProduct
|
||||
//
|
||||
dataGridViewMaterialToProduct.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewMaterialToProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewMaterialToProduct.Columns.AddRange(new DataGridViewColumn[] { ColumnProduct, ColumnCountMaterial });
|
||||
dataGridViewMaterialToProduct.Location = new Point(12, 26);
|
||||
dataGridViewMaterialToProduct.Name = "dataGridViewMaterialToProduct";
|
||||
dataGridViewMaterialToProduct.RowHeadersWidth = 51;
|
||||
dataGridViewMaterialToProduct.Size = new Size(416, 215);
|
||||
dataGridViewMaterialToProduct.TabIndex = 7;
|
||||
//
|
||||
// ColumnProduct
|
||||
//
|
||||
ColumnProduct.HeaderText = "Продукт";
|
||||
ColumnProduct.MinimumWidth = 6;
|
||||
ColumnProduct.Name = "ColumnProduct";
|
||||
ColumnProduct.Width = 125;
|
||||
//
|
||||
// ColumnCountMaterial
|
||||
//
|
||||
ColumnCountMaterial.HeaderText = "Количество материала для производства";
|
||||
ColumnCountMaterial.MinimumWidth = 6;
|
||||
ColumnCountMaterial.Name = "ColumnCountMaterial";
|
||||
ColumnCountMaterial.Resizable = DataGridViewTriState.True;
|
||||
ColumnCountMaterial.SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
ColumnCountMaterial.Width = 125;
|
||||
//
|
||||
// groupBoxMaterialToProduct
|
||||
//
|
||||
groupBoxMaterialToProduct.Controls.Add(label3);
|
||||
groupBoxMaterialToProduct.Controls.Add(dateTimePickerDateArrivalToProduct);
|
||||
groupBoxMaterialToProduct.Controls.Add(dataGridViewMaterialToProduct);
|
||||
groupBoxMaterialToProduct.Location = new Point(12, 98);
|
||||
groupBoxMaterialToProduct.Name = "groupBoxMaterialToProduct";
|
||||
groupBoxMaterialToProduct.Size = new Size(434, 314);
|
||||
groupBoxMaterialToProduct.TabIndex = 8;
|
||||
groupBoxMaterialToProduct.TabStop = false;
|
||||
groupBoxMaterialToProduct.Text = "Материалы для продукции";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 244);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(229, 20);
|
||||
label3.TabIndex = 9;
|
||||
label3.Text = "Дата передачи в производство:";
|
||||
//
|
||||
// dateTimePickerDateArrivalToProduct
|
||||
//
|
||||
dateTimePickerDateArrivalToProduct.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerDateArrivalToProduct.Location = new Point(12, 267);
|
||||
dateTimePickerDateArrivalToProduct.Name = "dateTimePickerDateArrivalToProduct";
|
||||
dateTimePickerDateArrivalToProduct.Size = new Size(300, 27);
|
||||
dateTimePickerDateArrivalToProduct.TabIndex = 8;
|
||||
//
|
||||
// comboBoxNomberArrials
|
||||
//
|
||||
comboBoxNomberArrials.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxNomberArrials.FormattingEnabled = true;
|
||||
comboBoxNomberArrials.Location = new Point(219, 61);
|
||||
comboBoxNomberArrials.Name = "comboBoxNomberArrials";
|
||||
comboBoxNomberArrials.Size = new Size(221, 28);
|
||||
comboBoxNomberArrials.TabIndex = 9;
|
||||
//
|
||||
// FormMaterial
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(458, 482);
|
||||
Controls.Add(comboBoxNomberArrials);
|
||||
Controls.Add(groupBoxMaterialToProduct);
|
||||
Controls.Add(comboBoxNameOfMaterial);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonCencel);
|
||||
Controls.Add(buttonSave);
|
||||
Name = "FormMaterial";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Материал";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterialToProduct).EndInit();
|
||||
groupBoxMaterialToProduct.ResumeLayout(false);
|
||||
groupBoxMaterialToProduct.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSave;
|
||||
private Button buttonCencel;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private ComboBox comboBoxNameOfMaterial;
|
||||
private DataGridView dataGridViewMaterialToProduct;
|
||||
private GroupBox groupBoxMaterialToProduct;
|
||||
private DataGridViewComboBoxColumn ColumnProduct;
|
||||
private DataGridViewTextBoxColumn ColumnCountMaterial;
|
||||
private ComboBox comboBoxNomberArrials;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePickerDateArrivalToProduct;
|
||||
}
|
||||
}
|
74
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.cs
Normal file
74
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.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 ProductionInCehOTP.Forms.Material_Forms
|
||||
{
|
||||
public partial class FormMaterial : Form
|
||||
{
|
||||
private readonly IMaterialReposirory _materialRepository;
|
||||
|
||||
private int? _materialID;
|
||||
public FormMaterial(IMaterialReposirory materialRepository, IProductRepository productRepository, IArrivalMaterialsRepository arrivalMaterialsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_materialRepository = materialRepository ??
|
||||
throw new ArgumentNullException(nameof(materialRepository));
|
||||
comboBoxNameOfMaterial.DataSource = Enum.GetValues(typeof(NameOfMaterials));
|
||||
ColumnProduct.DataSource = productRepository.GetProducts();
|
||||
ColumnProduct.DisplayMember = "Name";
|
||||
ColumnProduct.ValueMember = "Id";
|
||||
|
||||
comboBoxNomberArrials.DataSource = arrivalMaterialsRepository.GetArrivalMaterials(dateTimePickerDateArrivalToProduct.Value, DateTime.Today.AddDays(1));
|
||||
comboBoxNomberArrials.DisplayMember = "Id";
|
||||
comboBoxNomberArrials.ValueMember = "Id";
|
||||
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewMaterialToProduct.RowCount < 1 ||
|
||||
comboBoxNameOfMaterial.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_materialRepository.TransferMaterial(Material.TransferMaterial(0, (NameOfMaterials)comboBoxNameOfMaterial.SelectedItem!,
|
||||
(int)comboBoxNomberArrials.SelectedValue!,dateTimePickerDateArrivalToProduct.Value ,CreateListMateriaToProductForGrid() ));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private List<MaterialForProduct> CreateListMateriaToProductForGrid()
|
||||
{
|
||||
var list = new List<MaterialForProduct>();
|
||||
foreach (DataGridViewRow row in dataGridViewMaterialToProduct.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnProduct"].Value == null || row.Cells["ColumnCountMaterial"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(MaterialForProduct.CreateDependenceMaterialsToProduct(0, Convert.ToInt32(row.Cells["ColumnProduct"].Value)
|
||||
, Convert.ToInt32(row.Cells["ColumnCountMaterial"].Value)));
|
||||
}
|
||||
return list.GroupBy(x => x.ProductID, x => x.Count, (id,countes) =>
|
||||
MaterialForProduct.CreateDependenceMaterialsToProduct(0,id,countes.Sum())).ToList();
|
||||
|
||||
}
|
||||
private void ButtonCencel_Click(object sender, EventArgs e) =>Close();
|
||||
}
|
||||
}
|
132
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.resx
Normal file
132
ProductionInCehOTP/Forms/Material_Forms/FormMaterial.resx
Normal file
@ -0,0 +1,132 @@
|
||||
<?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="ColumnProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCountMaterial.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCountMaterial.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
92
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.Designer.cs
generated
Normal file
92
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,92 @@
|
||||
namespace ProductionInCehOTP.Forms.Material_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()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(647, 450);
|
||||
dataGridViewData.TabIndex = 5;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(647, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 450);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(30, 30);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 74);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "+";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// FormMaterials
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormMaterials";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Материалы";
|
||||
Load += FormMaterials_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
53
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.cs
Normal file
53
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProductionInCehOTP.Forms.Material_Forms
|
||||
{
|
||||
public partial class FormMaterials : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IMaterialReposirory _materialRepository;
|
||||
public FormMaterials(IUnityContainer unityContainer, IMaterialReposirory materialRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = unityContainer ??
|
||||
throw new ArgumentNullException(nameof(unityContainer));
|
||||
_materialRepository = materialRepository ??
|
||||
throw new ArgumentNullException(nameof(_materialRepository));
|
||||
}
|
||||
|
||||
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 LoadList()
|
||||
{
|
||||
var materualsAndlinkManyToMany = _materialRepository.GetMaterials();
|
||||
dataGridViewData.DataSource = _materialRepository.GetMaterials();
|
||||
dataGridViewData.Columns["Id"].Visible = false;
|
||||
dataGridViewData.Columns["DateArrivalToProduct"].DefaultCellStyle.Format = "dd MMMM yyyy hh:mm";
|
||||
|
||||
}
|
||||
|
||||
private void FormMaterials_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.resx
Normal file
120
ProductionInCehOTP/Forms/Material_Forms/FormMaterials.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>
|
209
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.Designer.cs
generated
Normal file
209
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.Designer.cs
generated
Normal file
@ -0,0 +1,209 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormPlanWork
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonCencel = new Button();
|
||||
buttonSave = new Button();
|
||||
numericUpDownPlanWork = new NumericUpDown();
|
||||
label2 = new Label();
|
||||
dateTimePickerPlanDate = new DateTimePicker();
|
||||
label1 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
comboBoxName = new ComboBox();
|
||||
groupBox = new GroupBox();
|
||||
dataGridViewDatePlanWork = new DataGridView();
|
||||
ColumnProduct = new DataGridViewComboBoxColumn();
|
||||
ColumnCreatedproduct = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlanWork).BeginInit();
|
||||
groupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewDatePlanWork).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCencel
|
||||
//
|
||||
buttonCencel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCencel.Location = new Point(465, 409);
|
||||
buttonCencel.Name = "buttonCencel";
|
||||
buttonCencel.Size = new Size(148, 45);
|
||||
buttonCencel.TabIndex = 11;
|
||||
buttonCencel.Text = "Отмена";
|
||||
buttonCencel.UseVisualStyleBackColor = true;
|
||||
buttonCencel.Click += buttonCencel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(465, 469);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(148, 45);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// numericUpDownPlanWork
|
||||
//
|
||||
numericUpDownPlanWork.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
numericUpDownPlanWork.Location = new Point(269, 61);
|
||||
numericUpDownPlanWork.Name = "numericUpDownPlanWork";
|
||||
numericUpDownPlanWork.Size = new Size(344, 27);
|
||||
numericUpDownPlanWork.TabIndex = 9;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 112);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(229, 20);
|
||||
label2.TabIndex = 8;
|
||||
label2.Text = "Дата запланированной нормы:";
|
||||
//
|
||||
// dateTimePickerPlanDate
|
||||
//
|
||||
dateTimePickerPlanDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerPlanDate.Location = new Point(269, 107);
|
||||
dateTimePickerPlanDate.Name = "dateTimePickerPlanDate";
|
||||
dateTimePickerPlanDate.Size = new Size(344, 27);
|
||||
dateTimePickerPlanDate.TabIndex = 7;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 68);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(251, 20);
|
||||
label1.TabIndex = 6;
|
||||
label1.Text = "План производство изделий ( шт.):";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(22, 74);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(0, 20);
|
||||
label3.TabIndex = 14;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 20);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(77, 20);
|
||||
label4.TabIndex = 15;
|
||||
label4.Text = "Работник:";
|
||||
//
|
||||
// comboBoxName
|
||||
//
|
||||
comboBoxName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxName.FormattingEnabled = true;
|
||||
comboBoxName.Location = new Point(269, 12);
|
||||
comboBoxName.Name = "comboBoxName";
|
||||
comboBoxName.Size = new Size(344, 28);
|
||||
comboBoxName.TabIndex = 16;
|
||||
//
|
||||
// groupBox
|
||||
//
|
||||
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBox.Controls.Add(dataGridViewDatePlanWork);
|
||||
groupBox.Location = new Point(12, 160);
|
||||
groupBox.Name = "groupBox";
|
||||
groupBox.Size = new Size(433, 357);
|
||||
groupBox.TabIndex = 17;
|
||||
groupBox.TabStop = false;
|
||||
groupBox.Text = "Производственный плановый граффик";
|
||||
//
|
||||
// dataGridViewDatePlanWork
|
||||
//
|
||||
dataGridViewDatePlanWork.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewDatePlanWork.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewDatePlanWork.Columns.AddRange(new DataGridViewColumn[] { ColumnProduct, ColumnCreatedproduct });
|
||||
dataGridViewDatePlanWork.Location = new Point(3, 23);
|
||||
dataGridViewDatePlanWork.Name = "dataGridViewDatePlanWork";
|
||||
dataGridViewDatePlanWork.RowHeadersWidth = 51;
|
||||
dataGridViewDatePlanWork.Size = new Size(427, 331);
|
||||
dataGridViewDatePlanWork.TabIndex = 0;
|
||||
//
|
||||
// ColumnProduct
|
||||
//
|
||||
ColumnProduct.FillWeight = 200F;
|
||||
ColumnProduct.HeaderText = "Продукт";
|
||||
ColumnProduct.MinimumWidth = 6;
|
||||
ColumnProduct.Name = "ColumnProduct";
|
||||
ColumnProduct.Resizable = DataGridViewTriState.True;
|
||||
ColumnProduct.Width = 125;
|
||||
//
|
||||
// ColumnCreatedproduct
|
||||
//
|
||||
ColumnCreatedproduct.HeaderText = "Произведенно продукции";
|
||||
ColumnCreatedproduct.MinimumWidth = 6;
|
||||
ColumnCreatedproduct.Name = "ColumnCreatedproduct";
|
||||
ColumnCreatedproduct.Width = 125;
|
||||
//
|
||||
// FormPlanWork
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(637, 522);
|
||||
Controls.Add(groupBox);
|
||||
Controls.Add(comboBoxName);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(buttonCencel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownPlanWork);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(dateTimePickerPlanDate);
|
||||
Controls.Add(label1);
|
||||
Name = "FormPlanWork";
|
||||
Text = "Производство по установленным планам";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlanWork).EndInit();
|
||||
groupBox.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewDatePlanWork).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCencel;
|
||||
private Button buttonSave;
|
||||
private NumericUpDown numericUpDownPlanWork;
|
||||
private Label label2;
|
||||
private DateTimePicker dateTimePickerPlanDate;
|
||||
private Label label1;
|
||||
private Label label3;
|
||||
public Label label4;
|
||||
private ComboBox comboBoxName;
|
||||
public GroupBox groupBox;
|
||||
private DataGridView dataGridViewDatePlanWork;
|
||||
private DataGridViewComboBoxColumn ColumnProduct;
|
||||
private DataGridViewTextBoxColumn ColumnCreatedproduct;
|
||||
}
|
||||
}
|
76
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.cs
Normal file
76
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.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 ProductionInCehOTP.Forms
|
||||
{
|
||||
public partial class FormPlanWork : Form
|
||||
{
|
||||
private readonly IPlanWorkRepository _planWorkRepository;
|
||||
|
||||
private int? _planWorkID;
|
||||
public FormPlanWork(IPlanWorkRepository planWorkRepository, IProductRepository productRepository, IWorkerRepository workerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_planWorkRepository = planWorkRepository ??
|
||||
throw new ArgumentNullException(nameof(planWorkRepository));
|
||||
ColumnProduct.DataSource = productRepository.GetProducts();
|
||||
ColumnProduct.DisplayMember = "Name";
|
||||
ColumnProduct.ValueMember = "Id";
|
||||
|
||||
comboBoxName.DataSource = workerRepository.GetWorkers();
|
||||
comboBoxName.DisplayMember = "NameClass";
|
||||
comboBoxName.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewDatePlanWork.RowCount < 1 ||
|
||||
comboBoxName.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_planWorkRepository.CreatePlanWork(PlanWork.CreatePlanWork(0, (int)comboBoxName.SelectedValue!,
|
||||
Convert.ToInt32(numericUpDownPlanWork.Value), dateTimePickerPlanDate.Value,
|
||||
CreateListPlanWorkProductForGrid()));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCencel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private List<PlanWorkForProduct> CreateListPlanWorkProductForGrid()
|
||||
{
|
||||
var list = new List<PlanWorkForProduct>();
|
||||
foreach (DataGridViewRow row in dataGridViewDatePlanWork.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnProduct"].Value == null || row.Cells["ColumnCreatedproduct"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(PlanWorkForProduct.CreateDependencePlanWorkToProduct(0,
|
||||
Convert.ToInt32(row.Cells["ColumnProduct"].Value), Convert.
|
||||
ToInt32(row.Cells["ColumnCreatedproduct"].Value)));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
126
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.resx
Normal file
126
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlanWork.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="ColumnProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCreatedproduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
106
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.Designer.cs
generated
Normal file
106
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.Designer.cs
generated
Normal file
@ -0,0 +1,106 @@
|
||||
namespace ProductionInCehOTP.Forms.PlanWork_Forms
|
||||
{
|
||||
partial class FormPlansWork
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttondel = new Button();
|
||||
ButtonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttondel);
|
||||
panel1.Controls.Add(ButtonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(549, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 444);
|
||||
panel1.TabIndex = 6;
|
||||
//
|
||||
// buttondel
|
||||
//
|
||||
buttondel.Location = new Point(30, 131);
|
||||
buttondel.Name = "buttondel";
|
||||
buttondel.Size = new Size(94, 74);
|
||||
buttondel.TabIndex = 1;
|
||||
buttondel.Text = "-";
|
||||
buttondel.UseMnemonic = false;
|
||||
buttondel.UseVisualStyleBackColor = true;
|
||||
buttondel.Click += Buttondel_Click;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(30, 30);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(94, 74);
|
||||
ButtonAdd.TabIndex = 0;
|
||||
ButtonAdd.Text = "+";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(548, 444);
|
||||
dataGridViewData.TabIndex = 7;
|
||||
//
|
||||
// FormPlansWork
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(702, 444);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewData);
|
||||
Name = "FormPlansWork";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Список установленных планов";
|
||||
Load += FormPlansWork_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button ButtonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
private Button buttondel;
|
||||
}
|
||||
}
|
96
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.cs
Normal file
96
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using ProductionInCehOTP.Forms.Material_Forms;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.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 System.Xml.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace ProductionInCehOTP.Forms.PlanWork_Forms
|
||||
{
|
||||
|
||||
public partial class FormPlansWork : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IPlanWorkRepository _planWorkRepository;
|
||||
public FormPlansWork(IUnityContainer container, IPlanWorkRepository planWorkRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_planWorkRepository = planWorkRepository ??
|
||||
throw new ArgumentNullException(nameof(planWorkRepository));
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormPlanWork>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка добавления элемента", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList()
|
||||
{
|
||||
var PlanWorkAndlinkManyToMany = _planWorkRepository.GetPlanWorks();
|
||||
dataGridViewData.DataSource = _planWorkRepository.GetPlanWorks();
|
||||
dataGridViewData.Columns["Id"].Visible = false;
|
||||
dataGridViewData.Columns["Date"].DefaultCellStyle.Format = "dddd.MM.yyyy";
|
||||
|
||||
}
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 0)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Buttondel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_planWorkRepository.DeletePlanWork(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void FormPlansWork_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
120
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.resx
Normal file
120
ProductionInCehOTP/Forms/PlanWork_Forms/FormPlansWork.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>
|
182
ProductionInCehOTP/Forms/Product_Forms/FormProduct.Designer.cs
generated
Normal file
182
ProductionInCehOTP/Forms/Product_Forms/FormProduct.Designer.cs
generated
Normal file
@ -0,0 +1,182 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormProduct
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
Price = new Label();
|
||||
textBoxNameOfProduct = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCensel = new Button();
|
||||
numericUpDownPrice = new NumericUpDown();
|
||||
labelProductName = new Label();
|
||||
comboBoxProductType = new ComboBox();
|
||||
labelProductType = new Label();
|
||||
label1 = new Label();
|
||||
textBoxOficialID = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// Price
|
||||
//
|
||||
Price.AutoSize = true;
|
||||
Price.Font = new Font("Segoe UI", 9F);
|
||||
Price.Location = new Point(12, 144);
|
||||
Price.Name = "Price";
|
||||
Price.Size = new Size(48, 20);
|
||||
Price.TabIndex = 2;
|
||||
Price.Text = "Цена:";
|
||||
//
|
||||
// textBoxNameOfProduct
|
||||
//
|
||||
textBoxNameOfProduct.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxNameOfProduct.Location = new Point(373, 13);
|
||||
textBoxNameOfProduct.Name = "textBoxNameOfProduct";
|
||||
textBoxNameOfProduct.Size = new Size(191, 27);
|
||||
textBoxNameOfProduct.TabIndex = 6;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSave.Font = new Font("Segoe UI", 10.8F);
|
||||
buttonSave.Location = new Point(301, 191);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(137, 36);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCensel
|
||||
//
|
||||
buttonCensel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCensel.Font = new Font("Segoe UI", 10.8F);
|
||||
buttonCensel.Location = new Point(444, 191);
|
||||
buttonCensel.Name = "buttonCensel";
|
||||
buttonCensel.Size = new Size(136, 36);
|
||||
buttonCensel.TabIndex = 11;
|
||||
buttonCensel.Text = "Отмена";
|
||||
buttonCensel.UseVisualStyleBackColor = true;
|
||||
buttonCensel.Click += ButtonCensel_Click;
|
||||
//
|
||||
// numericUpDownPrice
|
||||
//
|
||||
numericUpDownPrice.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
numericUpDownPrice.Location = new Point(373, 137);
|
||||
numericUpDownPrice.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 });
|
||||
numericUpDownPrice.Name = "numericUpDownPrice";
|
||||
numericUpDownPrice.Size = new Size(191, 27);
|
||||
numericUpDownPrice.TabIndex = 13;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
labelProductName.AutoSize = true;
|
||||
labelProductName.Font = new Font("Segoe UI", 9F);
|
||||
labelProductName.Location = new Point(12, 20);
|
||||
labelProductName.Name = "labelProductName";
|
||||
labelProductName.Size = new Size(183, 20);
|
||||
labelProductName.TabIndex = 16;
|
||||
labelProductName.Text = "Наименование продукта";
|
||||
//
|
||||
// comboBoxProductType
|
||||
//
|
||||
comboBoxProductType.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxProductType.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxProductType.FormattingEnabled = true;
|
||||
comboBoxProductType.Location = new Point(373, 94);
|
||||
comboBoxProductType.Name = "comboBoxProductType";
|
||||
comboBoxProductType.Size = new Size(191, 28);
|
||||
comboBoxProductType.TabIndex = 19;
|
||||
//
|
||||
// labelProductType
|
||||
//
|
||||
labelProductType.AutoSize = true;
|
||||
labelProductType.Font = new Font("Segoe UI", 9F);
|
||||
labelProductType.Location = new Point(12, 102);
|
||||
labelProductType.Name = "labelProductType";
|
||||
labelProductType.Size = new Size(96, 20);
|
||||
labelProductType.TabIndex = 20;
|
||||
labelProductType.Text = "Тип изделия";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Segoe UI", 9F);
|
||||
label1.Location = new Point(12, 57);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(315, 20);
|
||||
label1.TabIndex = 21;
|
||||
label1.Text = "Официальный идентификационный номер:";
|
||||
//
|
||||
// textBoxOficialID
|
||||
//
|
||||
textBoxOficialID.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxOficialID.Location = new Point(373, 50);
|
||||
textBoxOficialID.Name = "textBoxOficialID";
|
||||
textBoxOficialID.Size = new Size(191, 27);
|
||||
textBoxOficialID.TabIndex = 22;
|
||||
//
|
||||
// FormProduct
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(589, 239);
|
||||
Controls.Add(textBoxOficialID);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(labelProductType);
|
||||
Controls.Add(comboBoxProductType);
|
||||
Controls.Add(labelProductName);
|
||||
Controls.Add(numericUpDownPrice);
|
||||
Controls.Add(buttonCensel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxNameOfProduct);
|
||||
Controls.Add(Price);
|
||||
Name = "FormProduct";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Продукт";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
private Label Price;
|
||||
private Label label4;
|
||||
private Label label5;
|
||||
private TextBox textBoxNameOfProduct;
|
||||
private TextBox textBox4;
|
||||
private TextBox textBox5;
|
||||
private Button buttonSave;
|
||||
private Button buttonCensel;
|
||||
private NumericUpDown numericUpDownPrice;
|
||||
private Label labelProductName;
|
||||
private ComboBox comboBoxProductType;
|
||||
private Label labelProductType;
|
||||
private Label label1;
|
||||
private TextBox textBoxOficialID;
|
||||
}
|
||||
}
|
92
ProductionInCehOTP/Forms/Product_Forms/FormProduct.cs
Normal file
92
ProductionInCehOTP/Forms/Product_Forms/FormProduct.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.VisualStyles;
|
||||
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
|
||||
public partial class FormProduct : Form
|
||||
{
|
||||
private readonly IProductRepository _productRepository;
|
||||
|
||||
private int? _productID;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var product = _productRepository.GetProductById(value);
|
||||
if (product == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(product));
|
||||
}
|
||||
textBoxNameOfProduct.Text = product.Name;
|
||||
numericUpDownPrice.Value = product.Price;
|
||||
comboBoxProductType.SelectedItem = product.ProductionTypeID;
|
||||
textBoxOficialID.Text = product.ProductionId;
|
||||
|
||||
_productID = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormProduct(IProductRepository productRepository)
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
_productRepository = productRepository ??
|
||||
throw new ArgumentNullException(nameof(productRepository));
|
||||
|
||||
comboBoxProductType.DataSource = Enum.GetValues(typeof(NameOfProductTypes));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameOfProduct.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
|
||||
}
|
||||
if (_productID.HasValue)
|
||||
{
|
||||
_productRepository.UpdateProduct(CreateProducts(_productID.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_productRepository.CreateProduct(CreateProducts(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private Product CreateProducts(int id) => Product.CreateProducts(id, textBoxNameOfProduct.Text,Convert.ToInt32(numericUpDownPrice.Value), textBoxOficialID.Text,(NameOfProductTypes)comboBoxProductType.SelectedItem!);
|
||||
|
||||
private void ButtonCensel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
120
ProductionInCehOTP/Forms/Product_Forms/FormProduct.resx
Normal file
120
ProductionInCehOTP/Forms/Product_Forms/FormProduct.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>
|
132
ProductionInCehOTP/Forms/Product_Forms/FormProducts.Designer.cs
generated
Normal file
132
ProductionInCehOTP/Forms/Product_Forms/FormProducts.Designer.cs
generated
Normal file
@ -0,0 +1,132 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormProducts
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
panel1 = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
productRepositoryBindingSource = new BindingSource(components);
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)productRepositoryBindingSource).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(632, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 425);
|
||||
panel1.TabIndex = 0;
|
||||
panel1.Paint += panel1_Paint;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(30, 237);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 74);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.Text = "-";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(30, 136);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(94, 74);
|
||||
buttonUpdate.TabIndex = 1;
|
||||
buttonUpdate.Text = ">?<";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(30, 30);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 74);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "+";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(632, 425);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// productRepositoryBindingSource
|
||||
//
|
||||
productRepositoryBindingSource.DataSource = typeof(Repositories.Implementations.ProductRepository);
|
||||
//
|
||||
// FormProducts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(785, 425);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormProducts";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Список продукции";
|
||||
Load += FormProduct_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)productRepositoryBindingSource).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
private BindingSource productRepositoryBindingSource;
|
||||
}
|
||||
}
|
117
ProductionInCehOTP/Forms/Product_Forms/FormProducts.cs
Normal file
117
ProductionInCehOTP/Forms/Product_Forms/FormProducts.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
public partial class FormProducts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IProductRepository _productRepository;
|
||||
public FormProducts(IUnityContainer container, IProductRepository productRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_productRepository = productRepository ??
|
||||
throw new ArgumentNullException(nameof(productRepository));
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProduct>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка добавления элемента", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormProduct>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_productRepository.DeleteProduct(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormProduct_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewData.DataSource = _productRepository.GetProducts();
|
||||
dataGridViewData.Columns["Id"].Visible = false;
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
if (dataGridViewData.SelectedRows.Count < 0)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void panel1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
123
ProductionInCehOTP/Forms/Product_Forms/FormProducts.resx
Normal file
123
ProductionInCehOTP/Forms/Product_Forms/FormProducts.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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="productRepositoryBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
185
ProductionInCehOTP/Forms/ProductionInIndustrial.Designer.cs
generated
Normal file
185
ProductionInCehOTP/Forms/ProductionInIndustrial.Designer.cs
generated
Normal file
@ -0,0 +1,185 @@
|
||||
namespace ProductionInCehOTP
|
||||
{
|
||||
partial class ProductionInIndustrial
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
ListsToolStripMenuItem = new ToolStripMenuItem();
|
||||
WorkerToolStripMenuItem = new ToolStripMenuItem();
|
||||
ProductToolStripMenuItem = new ToolStripMenuItem();
|
||||
ArrivalToCaseToolStripMenuItem = new ToolStripMenuItem();
|
||||
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ArrivalMaterialsToProductToolStripMenuItem = new ToolStripMenuItem();
|
||||
PlanWorkToolStripMenuItem = new ToolStripMenuItem();
|
||||
ReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
DirectoryReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
MooveMaterialToProductReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
ReportSetplansOfProductToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.BackColor = Color.Turquoise;
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { ListsToolStripMenuItem, OperationsToolStripMenuItem, ReportToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1082, 33);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// ListsToolStripMenuItem
|
||||
//
|
||||
ListsToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
ListsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { WorkerToolStripMenuItem, ProductToolStripMenuItem, ArrivalToCaseToolStripMenuItem });
|
||||
ListsToolStripMenuItem.Font = new Font("Segoe UI", 10.8F);
|
||||
ListsToolStripMenuItem.Name = "ListsToolStripMenuItem";
|
||||
ListsToolStripMenuItem.Size = new Size(137, 29);
|
||||
ListsToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// WorkerToolStripMenuItem
|
||||
//
|
||||
WorkerToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
WorkerToolStripMenuItem.Name = "WorkerToolStripMenuItem";
|
||||
WorkerToolStripMenuItem.Size = new Size(262, 30);
|
||||
WorkerToolStripMenuItem.Text = "Работники";
|
||||
WorkerToolStripMenuItem.Click += WorkerToolStripMenuItem_Click;
|
||||
//
|
||||
// ProductToolStripMenuItem
|
||||
//
|
||||
ProductToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
ProductToolStripMenuItem.Name = "ProductToolStripMenuItem";
|
||||
ProductToolStripMenuItem.Size = new Size(262, 30);
|
||||
ProductToolStripMenuItem.Text = "Продукция";
|
||||
ProductToolStripMenuItem.Click += ProductToolStripMenuItem_Click;
|
||||
//
|
||||
// ArrivalToCaseToolStripMenuItem
|
||||
//
|
||||
ArrivalToCaseToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
ArrivalToCaseToolStripMenuItem.Name = "ArrivalToCaseToolStripMenuItem";
|
||||
ArrivalToCaseToolStripMenuItem.Size = new Size(262, 30);
|
||||
ArrivalToCaseToolStripMenuItem.Text = "Поставки на склады";
|
||||
ArrivalToCaseToolStripMenuItem.Click += ArrivalToCaseToolStripMenuItem_Click;
|
||||
//
|
||||
// OperationsToolStripMenuItem
|
||||
//
|
||||
OperationsToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ArrivalMaterialsToProductToolStripMenuItem, PlanWorkToolStripMenuItem });
|
||||
OperationsToolStripMenuItem.Font = new Font("Segoe UI", 10.8F);
|
||||
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||
OperationsToolStripMenuItem.Size = new Size(110, 29);
|
||||
OperationsToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// ArrivalMaterialsToProductToolStripMenuItem
|
||||
//
|
||||
ArrivalMaterialsToProductToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
ArrivalMaterialsToProductToolStripMenuItem.Name = "ArrivalMaterialsToProductToolStripMenuItem";
|
||||
ArrivalMaterialsToProductToolStripMenuItem.Size = new Size(424, 30);
|
||||
ArrivalMaterialsToProductToolStripMenuItem.Text = "Поставки материалов на производство";
|
||||
ArrivalMaterialsToProductToolStripMenuItem.Click += ArrivalMaterialsToProductToolStripMenuItem_Click;
|
||||
//
|
||||
// PlanWorkToolStripMenuItem
|
||||
//
|
||||
PlanWorkToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
PlanWorkToolStripMenuItem.Name = "PlanWorkToolStripMenuItem";
|
||||
PlanWorkToolStripMenuItem.Size = new Size(424, 30);
|
||||
PlanWorkToolStripMenuItem.Text = "Контроль производства";
|
||||
PlanWorkToolStripMenuItem.Click += PlanWorkToolStripMenuItem_Click;
|
||||
//
|
||||
// ReportToolStripMenuItem
|
||||
//
|
||||
ReportToolStripMenuItem.BackColor = Color.Turquoise;
|
||||
ReportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DirectoryReportToolStripMenuItem, MooveMaterialToProductReportToolStripMenuItem, ReportSetplansOfProductToolStripMenuItem });
|
||||
ReportToolStripMenuItem.Font = new Font("Segoe UI", 10.8F);
|
||||
ReportToolStripMenuItem.Name = "ReportToolStripMenuItem";
|
||||
ReportToolStripMenuItem.Size = new Size(86, 29);
|
||||
ReportToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// DirectoryReportToolStripMenuItem
|
||||
//
|
||||
DirectoryReportToolStripMenuItem.Name = "DirectoryReportToolStripMenuItem";
|
||||
DirectoryReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
||||
DirectoryReportToolStripMenuItem.Size = new Size(518, 30);
|
||||
DirectoryReportToolStripMenuItem.Text = "Документ со спарвочниками";
|
||||
DirectoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
||||
//
|
||||
// MooveMaterialToProductReportToolStripMenuItem
|
||||
//
|
||||
MooveMaterialToProductReportToolStripMenuItem.Name = "MooveMaterialToProductReportToolStripMenuItem";
|
||||
MooveMaterialToProductReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.M;
|
||||
MooveMaterialToProductReportToolStripMenuItem.Size = new Size(518, 30);
|
||||
MooveMaterialToProductReportToolStripMenuItem.Text = "Передвижения материалов производства";
|
||||
MooveMaterialToProductReportToolStripMenuItem.Click += MooveMaterialToProductReportToolStripMenuItem_Click;
|
||||
//
|
||||
// ReportSetplansOfProductToolStripMenuItem
|
||||
//
|
||||
ReportSetplansOfProductToolStripMenuItem.Name = "ReportSetplansOfProductToolStripMenuItem";
|
||||
ReportSetplansOfProductToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.P;
|
||||
ReportSetplansOfProductToolStripMenuItem.Size = new Size(518, 30);
|
||||
ReportSetplansOfProductToolStripMenuItem.Text = "Отчет установленных планов производства";
|
||||
ReportSetplansOfProductToolStripMenuItem.Click += ReportSetplansOfProductToolStripMenuItem_Click;
|
||||
//
|
||||
// ProductionInIndustrial
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoSize = true;
|
||||
BackColor = Color.Turquoise;
|
||||
BackgroundImage = Properties.Resources.background;
|
||||
ClientSize = new Size(1082, 523);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "ProductionInIndustrial";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Производство";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem ListsToolStripMenuItem;
|
||||
private ToolStripMenuItem WorkerToolStripMenuItem;
|
||||
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||
private ToolStripMenuItem ReportToolStripMenuItem;
|
||||
private ToolStripMenuItem ProductToolStripMenuItem;
|
||||
private ToolStripMenuItem PlansToolStripMenuItem;
|
||||
private ToolStripMenuItem типыПродукцииToolStripMenuItem;
|
||||
private ToolStripMenuItem ArrivalMaterialsToProductToolStripMenuItem;
|
||||
private ToolStripMenuItem PlanWorkToolStripMenuItem;
|
||||
private ToolStripMenuItem ArrivalToCaseToolStripMenuItem;
|
||||
private ToolStripMenuItem DirectoryReportToolStripMenuItem;
|
||||
private ToolStripMenuItem InnerAndOuterMaterialToProductRepositoryToolStripMenuItem;
|
||||
private ToolStripMenuItem MooveMaterialToProductReportToolStripMenuItem;
|
||||
private ToolStripMenuItem ReportSetplansOfProductToolStripMenuItem;
|
||||
}
|
||||
}
|
136
ProductionInCehOTP/Forms/ProductionInIndustrial.cs
Normal file
136
ProductionInCehOTP/Forms/ProductionInIndustrial.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Forms;
|
||||
using ProductionInCehOTP.Forms.ArrivalsMaterials_Forms;
|
||||
using ProductionInCehOTP.Forms.FormToReports;
|
||||
using ProductionInCehOTP.Forms.Material_Forms;
|
||||
using ProductionInCehOTP.Forms.PlanWork_Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace ProductionInCehOTP
|
||||
{
|
||||
public partial class ProductionInIndustrial : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public ProductionInIndustrial(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void WorkerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormWorkers>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ArrivalToCaseToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormArrivalsOfMaterials>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProductToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProducts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ArrivalMaterialsToProductToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMaterials>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void PlanWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormPlansWork>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DirectoryReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDirectoryReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void MooveMaterialToProductReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormInnerAndOuterOfMaterialsToProductReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportSetplansOfProductToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<SetPlansReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
126
ProductionInCehOTP/Forms/ProductionInIndustrial.resx
Normal file
126
ProductionInCehOTP/Forms/ProductionInIndustrial.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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>53</value>
|
||||
</metadata>
|
||||
</root>
|
171
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.Designer.cs
generated
Normal file
171
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormWorker
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label2 = new Label();
|
||||
textBoxName = new TextBox();
|
||||
label5 = new Label();
|
||||
label6 = new Label();
|
||||
numericUpDownClassOfWorker = new NumericUpDown();
|
||||
numericUpDownPlan = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCensel = new Button();
|
||||
dateTimePickerExp = new DateTimePicker();
|
||||
label4 = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownClassOfWorker).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlan).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 19);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(45, 20);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "ФИО:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(93, 12);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(336, 27);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(12, 59);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(60, 20);
|
||||
label5.TabIndex = 7;
|
||||
label5.Text = "Разряд:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new Point(12, 102);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(203, 20);
|
||||
label6.TabIndex = 8;
|
||||
label6.Text = "Дневная норма выроботки:";
|
||||
//
|
||||
// numericUpDownClassOfWorker
|
||||
//
|
||||
numericUpDownClassOfWorker.Location = new Point(288, 52);
|
||||
numericUpDownClassOfWorker.Maximum = new decimal(new int[] { 8, 0, 0, 0 });
|
||||
numericUpDownClassOfWorker.Name = "numericUpDownClassOfWorker";
|
||||
numericUpDownClassOfWorker.Size = new Size(141, 27);
|
||||
numericUpDownClassOfWorker.TabIndex = 10;
|
||||
//
|
||||
// numericUpDownPlan
|
||||
//
|
||||
numericUpDownPlan.Location = new Point(288, 95);
|
||||
numericUpDownPlan.Name = "numericUpDownPlan";
|
||||
numericUpDownPlan.Size = new Size(141, 27);
|
||||
numericUpDownPlan.TabIndex = 12;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 212);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(209, 59);
|
||||
buttonSave.TabIndex = 13;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCensel
|
||||
//
|
||||
buttonCensel.Location = new Point(227, 212);
|
||||
buttonCensel.Name = "buttonCensel";
|
||||
buttonCensel.Size = new Size(202, 59);
|
||||
buttonCensel.TabIndex = 14;
|
||||
buttonCensel.Text = "Отмена";
|
||||
buttonCensel.UseVisualStyleBackColor = true;
|
||||
buttonCensel.Click += ButtonCensel_Click;
|
||||
//
|
||||
// dateTimePickerExp
|
||||
//
|
||||
dateTimePickerExp.Location = new Point(227, 142);
|
||||
dateTimePickerExp.Name = "dateTimePickerExp";
|
||||
dateTimePickerExp.Size = new Size(202, 27);
|
||||
dateTimePickerExp.TabIndex = 15;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 147);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(163, 20);
|
||||
label4.TabIndex = 16;
|
||||
label4.Text = "Дата трудоустройства:";
|
||||
//
|
||||
// FormWorker
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(441, 280);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(dateTimePickerExp);
|
||||
Controls.Add(buttonCensel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownPlan);
|
||||
Controls.Add(label6);
|
||||
Controls.Add(numericUpDownClassOfWorker);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(label2);
|
||||
Name = "FormWorker";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Рабочий";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownClassOfWorker).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlan).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private TextBox textBoxFirstName;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxLastName;
|
||||
private Label label5;
|
||||
private Label label6;
|
||||
private NumericUpDown numericUpDownClassOfWorker;
|
||||
private NumericUpDown numericUpDownPlan;
|
||||
private Button buttonSave;
|
||||
private Button buttonCensel;
|
||||
private DateTimePicker dateTimePickerExp;
|
||||
private Label label4;
|
||||
}
|
||||
}
|
82
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.cs
Normal file
82
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.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 ProductionInCehOTP.Forms
|
||||
{
|
||||
|
||||
public partial class FormWorker : Form
|
||||
{
|
||||
private readonly IWorkerRepository _workerRepository;
|
||||
private int? _workerID;
|
||||
public FormWorker(IWorkerRepository workerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_workerRepository = workerRepository ??
|
||||
throw new ArgumentNullException(nameof(workerRepository));
|
||||
}
|
||||
|
||||
public int WorkerID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var worker = _workerRepository.GetWorkerById(value);
|
||||
if (worker == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(worker));
|
||||
}
|
||||
textBoxName.Text = worker.Name;
|
||||
dateTimePickerExp.Value = worker.Experience;
|
||||
numericUpDownClassOfWorker.Value = worker.Class;
|
||||
numericUpDownPlan.Value = worker.PlanWork;
|
||||
|
||||
_workerID = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_workerID.HasValue)
|
||||
{
|
||||
_workerRepository.UpdateWorker(CreateWorker(_workerID.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_workerRepository.CreateWorker(CreateWorker(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCensel_Click(object sender, EventArgs e) => Close();
|
||||
private Worker CreateWorker(int workerID) =>
|
||||
Worker.CreateWorker(workerID, textBoxName.Text,dateTimePickerExp.Value, Convert.ToInt32(numericUpDownClassOfWorker.Value), Convert.ToInt32(numericUpDownPlan.Value));
|
||||
}
|
||||
}
|
120
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.resx
Normal file
120
ProductionInCehOTP/Forms/Worker_Forms/FormWorker.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>
|
118
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.Designer.cs
generated
Normal file
118
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
namespace ProductionInCehOTP.Forms
|
||||
{
|
||||
partial class FormWorkers
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
ButtonDel = new Button();
|
||||
ButtonUpdate = new Button();
|
||||
ButtonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(647, 450);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(ButtonDel);
|
||||
panel1.Controls.Add(ButtonUpdate);
|
||||
panel1.Controls.Add(ButtonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(647, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 450);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(30, 237);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(94, 74);
|
||||
ButtonDel.TabIndex = 2;
|
||||
ButtonDel.Text = "-";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonUpdate
|
||||
//
|
||||
ButtonUpdate.Location = new Point(30, 136);
|
||||
ButtonUpdate.Name = "ButtonUpdate";
|
||||
ButtonUpdate.Size = new Size(94, 74);
|
||||
ButtonUpdate.TabIndex = 1;
|
||||
ButtonUpdate.Text = ">?<";
|
||||
ButtonUpdate.UseVisualStyleBackColor = true;
|
||||
ButtonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(30, 30);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(94, 74);
|
||||
ButtonAdd.TabIndex = 0;
|
||||
ButtonAdd.Text = "+";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// FormWorkers
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormWorkers";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Рабочие";
|
||||
Load += FormWorkers_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button ButtonDel;
|
||||
private Button ButtonUpdate;
|
||||
private Button ButtonAdd;
|
||||
}
|
||||
}
|
116
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.cs
Normal file
116
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.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 ProductionInCehOTP.Forms
|
||||
{
|
||||
public partial class FormWorkers : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IWorkerRepository _workerRepository;
|
||||
public FormWorkers(IUnityContainer container, IWorkerRepository workerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_workerRepository = workerRepository ??
|
||||
throw new ArgumentNullException(nameof(_workerRepository));
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormWorker>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка добавления элемента", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormWorker>();
|
||||
form.WorkerID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_workerRepository.DeleteWorker(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void LoadList()
|
||||
{
|
||||
|
||||
dataGridViewData.DataSource = _workerRepository.GetWorkers();
|
||||
dataGridViewData.Columns["Id"].Visible = false;
|
||||
dataGridViewData.Columns["Experience"].DefaultCellStyle.Format = "dd MMMM yyyy";
|
||||
|
||||
}
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 0)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FormWorkers_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
120
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.resx
Normal file
120
ProductionInCehOTP/Forms/Worker_Forms/FormWorkers.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>
|
@ -8,4 +8,43 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.1" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</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>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,3 +1,12 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.Repositories.Implementations;
|
||||
using Serilog;
|
||||
using System.Configuration;
|
||||
using Unity;
|
||||
using Unity.Microsoft.Logging;
|
||||
|
||||
namespace ProductionInCehOTP
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +20,33 @@ namespace ProductionInCehOTP
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(CreateContainer().Resolve<ProductionInIndustrial>());
|
||||
}
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
||||
container.RegisterType<IConnectionString, ConnectionString>();
|
||||
container.RegisterType<IArrivalMaterialsRepository, ArrivalMaterialsRepository>();
|
||||
container.RegisterType<IMaterialReposirory, MaterialRepository>();
|
||||
container.RegisterType<IProductRepository, ProductRepository>();
|
||||
container.RegisterType<IPlanWorkRepository, PlanWorkRepository>();
|
||||
container.RegisterType<IWorkerRepository, WorkerRepository>();
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
private static LoggerFactory CreateLoggerFactory()
|
||||
{
|
||||
var loggerFactory = new LoggerFactory();
|
||||
loggerFactory.AddSerilog(new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build())
|
||||
.CreateLogger());
|
||||
return loggerFactory;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
93
ProductionInCehOTP/Properties/Resources.Designer.cs
generated
Normal file
93
ProductionInCehOTP/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,93 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProductionInCehOTP.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("ProductionInCehOTP.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 background {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("background", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap BackGroundOTP {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("BackGroundOTP", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap OTP {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("OTP", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
130
ProductionInCehOTP/Properties/Resources.resx
Normal file
130
ProductionInCehOTP/Properties/Resources.resx
Normal file
@ -0,0 +1,130 @@
|
||||
<?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="BackGroundOTP" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\BackGroundOTP.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="OTP" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\OTP.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="background" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\background.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
54
ProductionInCehOTP/Reports/ChartReport.cs
Normal file
54
ProductionInCehOTP/Reports/ChartReport.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Reports;
|
||||
|
||||
internal class ChartReport
|
||||
{
|
||||
private readonly IArrivalMaterialsRepository _arrivalmaterialsRepository;
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
public ChartReport(IArrivalMaterialsRepository arrivalmaterialsRepository,
|
||||
ILogger<ChartReport> logger)
|
||||
{
|
||||
_arrivalmaterialsRepository = arrivalmaterialsRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(arrivalmaterialsRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Планы производств")
|
||||
.AddPieChart($"Дата плана: { dateTime: dd.MM.yyyy}", GetData(dateTime))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||
{
|
||||
return _arrivalmaterialsRepository
|
||||
.GetArrivalMaterials(StartDate: dateTime.Date, EndDate: dateTime.Date.AddDays(1))
|
||||
.GroupBy(x => x.Id, (key, group) => new {
|
||||
id = key,
|
||||
Count = group.Sum(x => x.Count)
|
||||
})
|
||||
.Select(x => (x.id.ToString(), (double)x.Count))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
}
|
84
ProductionInCehOTP/Reports/DocReport.cs
Normal file
84
ProductionInCehOTP/Reports/DocReport.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Reports;
|
||||
|
||||
internal class DocReport
|
||||
{
|
||||
private readonly IArrivalMaterialsRepository _ArrivalMaterialsrepository;
|
||||
private readonly IProductRepository _productRepository;
|
||||
private readonly IWorkerRepository _workerRepository;
|
||||
|
||||
private readonly ILogger<DocReport> _logger;
|
||||
public DocReport(IArrivalMaterialsRepository arrivalMaterialsRepository, IProductRepository productRepository, IWorkerRepository workerRepository, ILogger<DocReport> logger)
|
||||
{
|
||||
_ArrivalMaterialsrepository = arrivalMaterialsRepository ?? throw new ArgumentNullException(nameof(arrivalMaterialsRepository));
|
||||
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
|
||||
_workerRepository = workerRepository ?? throw new ArgumentNullException(nameof(workerRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
public bool CreateDoc(string filepath, bool includeArrivalsMaterial, bool includeProduct, bool includeWorker)
|
||||
{
|
||||
try
|
||||
{
|
||||
var wordBuilder = new WordBuilder(filepath)
|
||||
.AddHeader("Документ со справочниками ");
|
||||
if (includeArrivalsMaterial)
|
||||
{
|
||||
wordBuilder.AddParagraph("Поставки")
|
||||
.AddTable([2400, 2400, 1200], GetArrivals());
|
||||
}
|
||||
if (includeProduct)
|
||||
{
|
||||
wordBuilder.AddParagraph("Продукты")
|
||||
.AddTable([2400, 2400, 1200, 1200], GetProducts());
|
||||
}
|
||||
if (includeWorker)
|
||||
{
|
||||
wordBuilder.AddParagraph("Работники")
|
||||
.AddTable([2400, 2400, 1200, 1200], GetWorkers());
|
||||
}
|
||||
wordBuilder.Build();
|
||||
return true;
|
||||
}
|
||||
catch ( Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string[]> GetArrivals(DateTime? Startdate = null, DateTime? EndDate = null)
|
||||
{
|
||||
return [
|
||||
["Материалы в поставке", "Общее количество (кг)", " Дата поставки"],
|
||||
.. _ArrivalMaterialsrepository
|
||||
.GetArrivalMaterials(Startdate, EndDate)
|
||||
.Select(x => new string[] {x.Name.ToString(), x.Count.ToString(), x.Date.ToString()}),
|
||||
];
|
||||
}
|
||||
private List<string[]> GetProducts()
|
||||
{
|
||||
return [
|
||||
["Наименование продукта", "Официальный UID", "Тип продукции", "Цена"],
|
||||
.. _productRepository
|
||||
.GetProducts()
|
||||
.Select(x => new string[] {x.Name, x.ProductionId.ToString(), x.ProductionTypeID.ToString(), x.Price.ToString()}),
|
||||
|
||||
];
|
||||
}
|
||||
private List<string[]> GetWorkers()
|
||||
{
|
||||
return [
|
||||
["ФИО", "Разряд", "Норма выработки", "Дата трудоустройства"],
|
||||
.. _workerRepository
|
||||
.GetWorkers()
|
||||
.Select(x => new string[] {x.Name, x.Class.ToString(), x.PlanWork.ToString(), x.Experience.ToString()}),
|
||||
];
|
||||
}
|
||||
}
|
322
ProductionInCehOTP/Reports/ExcelBuilder.cs
Normal file
322
ProductionInCehOTP/Reports/ExcelBuilder.cs
Normal file
@ -0,0 +1,322 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Color = DocumentFormat.OpenXml.Spreadsheet.Color;
|
||||
|
||||
namespace ProductionInCehOTP.Reports
|
||||
{
|
||||
internal class ExcelBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly SheetData _sheetData;
|
||||
private readonly MergeCells _mergeCells;
|
||||
private readonly Columns _columns;
|
||||
private uint _rowIndex = 0;
|
||||
public ExcelBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_sheetData = new SheetData();
|
||||
_mergeCells = new MergeCells();
|
||||
_columns = new Columns();
|
||||
_rowIndex = 1;
|
||||
}
|
||||
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
||||
{
|
||||
CreateCell(startIndex, _rowIndex, header,StyleIndex.BoldTextWithoutBorder);
|
||||
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
||||
{
|
||||
CreateCell(i, _rowIndex, "",
|
||||
StyleIndex.BoldTextWithoutBorder);
|
||||
}
|
||||
_mergeCells.Append(new MergeCell()
|
||||
{
|
||||
Reference =
|
||||
new
|
||||
StringValue($"{GetExcelColumnName(startIndex)}{_rowIndex}:{GetExcelColumnName(startIndex + count - 1)}{_rowIndex}")});
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
public ExcelBuilder AddParagraph(string text, int columnIndex)
|
||||
{
|
||||
CreateCell(columnIndex, _rowIndex++, text,
|
||||
StyleIndex.SimpleTextWithoutBorder);
|
||||
return this;
|
||||
}
|
||||
public ExcelBuilder AddTable(int[] columnsWidths, List<string[]> data)
|
||||
{
|
||||
if (columnsWidths == null || columnsWidths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(columnsWidths));
|
||||
}
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
if (data.Any(x => x.Length != columnsWidths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length !=data.Length");
|
||||
}
|
||||
uint counter = 1;
|
||||
int coef = 2;
|
||||
_columns.Append(columnsWidths.Select(x => new Column
|
||||
{
|
||||
Min = counter,
|
||||
Max = counter++,
|
||||
Width = x * coef,
|
||||
CustomWidth = true
|
||||
}));
|
||||
for (var j = 0; j < data.First().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.First()[j],
|
||||
StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
for (var i = 1; i < data.Count - 1; ++i)
|
||||
{
|
||||
for (var j = 0; j < data[i].Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data[i][j],
|
||||
StyleIndex.SimpleTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
}
|
||||
for (var j = 0; j < data.Last().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.Last()[j],
|
||||
StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
public void Build()
|
||||
{
|
||||
using var spreadsheetDocument = SpreadsheetDocument.Create(_filePath,SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
|
||||
GenerateStyle(workbookpart);
|
||||
|
||||
workbookpart.Workbook = new Workbook();
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
|
||||
worksheetPart.Worksheet = new Worksheet();
|
||||
if (_columns.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.Append(_columns);
|
||||
}
|
||||
|
||||
worksheetPart.Worksheet.Append(_sheetData);
|
||||
var sheets = spreadsheetDocument.WorkbookPart!.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id =
|
||||
spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист 1"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
if (_mergeCells.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.InsertAfter(_mergeCells,
|
||||
worksheetPart.Worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
private static void GenerateStyle(WorkbookPart workbookPart)
|
||||
{
|
||||
var workbookStylesPart =workbookPart.AddNewPart<WorkbookStylesPart>();
|
||||
workbookStylesPart.Stylesheet = new Stylesheet();
|
||||
var fonts = new Fonts()
|
||||
{
|
||||
Count = 2,
|
||||
KnownFonts = BooleanValue.FromBoolean(true)
|
||||
};
|
||||
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
// TODO добавить шрифт с жирным | Сomplited
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
Bold = new Bold(),
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
// Default Fill
|
||||
var fills = new Fills() { Count = 1 };
|
||||
fills.Append(new Fill
|
||||
{
|
||||
PatternFill = new PatternFill()
|
||||
{
|
||||
PatternType = new
|
||||
EnumValue<PatternValues>(PatternValues.None)
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fills);
|
||||
// Default Border
|
||||
var borders = new Borders() { Count = 2 };
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder(),
|
||||
RightBorder = new RightBorder(),
|
||||
TopBorder = new TopBorder(),
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
// TODO добавить настройку с границами | Сomplited
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin, Color = new Color() { Auto = true } },
|
||||
RightBorder = new RightBorder() { Style = BorderStyleValues.Thin, Color = new Color() { Auto = true } },
|
||||
TopBorder = new TopBorder() { Style = BorderStyleValues.Thin, Color = new Color() { Auto = true } },
|
||||
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin, Color = new Color() { Auto = true } },
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
// Default cell format and a Date cell format
|
||||
var cellFormats = new CellFormats() { Count = 4 };
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
// TODO дополнить форматы | Сomplited
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 1,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 1,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 1,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
private enum StyleIndex
|
||||
{
|
||||
SimpleTextWithoutBorder = 0,
|
||||
BoldTextWithBorder = 1,
|
||||
BoldTextWithoutBorder = 2,
|
||||
SimpleTextWithBorder = 3,
|
||||
}
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text,
|
||||
StyleIndex styleIndex)
|
||||
{
|
||||
var columnName = GetExcelColumnName(columnIndex);
|
||||
var cellReference = columnName + rowIndex;
|
||||
var row = _sheetData.Elements<Row>().FirstOrDefault(r => r.RowIndex! == rowIndex);
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = rowIndex };
|
||||
_sheetData.Append(row);
|
||||
}
|
||||
var newCell = row.Elements<Cell>().FirstOrDefault(c => c.CellReference != null && c.CellReference.Value == columnName + rowIndex);
|
||||
if (newCell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell cell in row.Elements<Cell>())
|
||||
{
|
||||
if (cell.CellReference?.Value != null && cell.CellReference.Value.Length == cellReference.Length)
|
||||
{
|
||||
if (string.Compare(cell.CellReference.Value,
|
||||
cellReference, true) > 0)
|
||||
{
|
||||
refCell = cell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
newCell = new Cell() { CellReference = cellReference };
|
||||
row.InsertBefore(newCell, refCell);
|
||||
}
|
||||
newCell.CellValue = new CellValue(text);
|
||||
newCell.DataType = CellValues.String;
|
||||
newCell.StyleIndex = (uint)styleIndex;
|
||||
}
|
||||
private static string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
columnNumber += 1;
|
||||
int dividend = columnNumber;
|
||||
string columnName = string.Empty;
|
||||
int modulo;
|
||||
while (dividend > 0)
|
||||
{
|
||||
modulo = (dividend - 1) % 26;
|
||||
columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
|
||||
dividend = (dividend - modulo) / 26;
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
}
|
||||
}
|
85
ProductionInCehOTP/Reports/PdfBuilder.cs
Normal file
85
ProductionInCehOTP/Reports/PdfBuilder.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
namespace ProductionInCehOTP.Reports;
|
||||
|
||||
internal class PdfBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
public PdfBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
DefineStyles();
|
||||
}
|
||||
public PdfBuilder AddHeader(string header)
|
||||
{
|
||||
_document.AddSection().AddParagraph(header, "NormalBold");
|
||||
return this;
|
||||
}
|
||||
public PdfBuilder AddPieChart(string title, List<(string Caption, double
|
||||
Value)> data)
|
||||
{
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
var chart = new Chart(ChartType.Pie2D);
|
||||
var series = chart.SeriesCollection.AddSeries();
|
||||
series.Add(data.Select(x => x.Value).ToArray());
|
||||
var xseries = chart.XValues.AddXSeries();
|
||||
xseries.Add(data.Select(x => x.Caption).ToArray());
|
||||
chart.DataLabel.Type = DataLabelType.Percent;
|
||||
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
|
||||
chart.Width = Unit.FromCentimeter(16);
|
||||
chart.Height = Unit.FromCentimeter(12);
|
||||
chart.TopArea.AddParagraph(title);
|
||||
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.HasMajorGridlines = true;
|
||||
chart.PlotArea.LineFormat.Width = 1;
|
||||
chart.PlotArea.LineFormat.Visible = true;
|
||||
chart.TopArea.AddLegend();
|
||||
_document.LastSection.Add(chart);
|
||||
return this;
|
||||
}
|
||||
public void Build()
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(_filePath);
|
||||
}
|
||||
private void DefineStyles()
|
||||
{
|
||||
// TODO задать стиль для заголовка (жирный)
|
||||
Style style;
|
||||
style = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||
style.Font.Name = "Arial";
|
||||
style.Font.Size = 12;
|
||||
style.Font.Color = Colors.Black;
|
||||
style.Font.Bold = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
72
ProductionInCehOTP/Reports/TableReport.cs
Normal file
72
ProductionInCehOTP/Reports/TableReport.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.PerformanceData;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Reports;
|
||||
|
||||
internal class TableReport
|
||||
{
|
||||
private readonly IMaterialReposirory _materialRepository;
|
||||
private readonly IArrivalMaterialsRepository _arrivalMaterialRepository;
|
||||
private readonly ILogger<TableReport> _logger;
|
||||
|
||||
// private readonly MaterialForProduct _materialForProduct;
|
||||
internal static readonly string[] item = ["Продукт", "Дата", "Материалов трубуется", "Количество передано в производство"];
|
||||
public TableReport(IMaterialReposirory materialReposirory, IArrivalMaterialsRepository arrivalMaterialsRepository,
|
||||
ILogger<TableReport> logger, MaterialForProduct materialForProduct)
|
||||
{
|
||||
_materialRepository = materialReposirory ??
|
||||
throw new ArgumentNullException(nameof(materialReposirory));
|
||||
_arrivalMaterialRepository = arrivalMaterialsRepository ??
|
||||
throw new ArgumentNullException(nameof(_arrivalMaterialRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
// _materialForProduct = materialForProduct ?? throw new ArgumentNullException(nameof(materialForProduct));
|
||||
|
||||
}
|
||||
public bool CreateTable(string filePath, NameOfMaterials materialName, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader("Сводка по передаче материалов на производство", 0, 4)
|
||||
.AddParagraph($"за период c {startDate:dd.MM.yyyy} по {endDate: dd.MM.yyyy} ",0 )
|
||||
.AddTable([10, 10, 15, 15], GetData(materialName, startDate, endDate))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
MessageBox.Show(ex.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<string[]> GetData(NameOfMaterials materialName, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var tmp = _materialRepository
|
||||
.GetMaterials(StartDate:startDate, EndDate:endDate)
|
||||
.Select(x => new
|
||||
{ x.Name, Date = x.DateArrivalToProduct, CountIn = (int?)null,
|
||||
CountOut = x.MaterialForProducts.FirstOrDefault(y => y.MaterialID == x.Id)?.Count});
|
||||
|
||||
var data = _arrivalMaterialRepository
|
||||
.GetArrivalMaterials(StartDate: startDate,EndDate:endDate)
|
||||
.Select(x => new { x.Name, x.Date, CountIn = (int?)x.Count, CountOut = (int?)null})
|
||||
.Union(tmp)
|
||||
.OrderBy(x => x.Date);
|
||||
return new List<string[]>() { item }
|
||||
.Union(
|
||||
data
|
||||
.Select(x => new string[] { materialName.ToString(), x.Date.ToString("dd.MM.yyyy"), x.CountIn?.ToString("N0") ?? string.Empty, x.CountOut?.ToString("N0") ?? string.Empty}))
|
||||
.Union(
|
||||
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString("N0"), data.Sum(x => x.CountOut ?? 0).ToString("N0")]]).ToList();
|
||||
|
||||
}
|
||||
}
|
132
ProductionInCehOTP/Reports/WordBuilder.cs
Normal file
132
ProductionInCehOTP/Reports/WordBuilder.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
|
||||
namespace ProductionInCehOTP.Reports;
|
||||
|
||||
public class WordBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
private readonly Body _body;
|
||||
|
||||
public WordBuilder(string filePath)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(filePath))
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
if(File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
_body = _document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
public WordBuilder AddHeader(string header)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new Text(header));
|
||||
return this;
|
||||
}
|
||||
public WordBuilder AddParagraph(string text)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new Text(text));
|
||||
|
||||
return this;
|
||||
}
|
||||
public WordBuilder AddTable(int[] widths, List<string[]> data)
|
||||
{
|
||||
//1. Границы
|
||||
//2. Колонки или grid
|
||||
//3. Строчки
|
||||
if (widths == null || widths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(widths));
|
||||
}
|
||||
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
if (data.Any(x => x.Length != widths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length !=data.Length");
|
||||
}
|
||||
|
||||
var table = new Table();
|
||||
table.AppendChild(new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder()
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new BottomBorder()
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new LeftBorder()
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new RightBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideHorizontalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideVerticalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
}
|
||||
)
|
||||
));
|
||||
|
||||
// Заголовок
|
||||
var tr = new TableRow();
|
||||
for (var j = 0; j < widths.Length; ++j)
|
||||
{
|
||||
tr.Append(new TableCell(
|
||||
new TableCellProperties(new TableCellWidth()
|
||||
{
|
||||
Width = widths[j].ToString()
|
||||
}),
|
||||
new Paragraph(new Run(new RunProperties(new Bold()), new Text(data.First()[j])))));
|
||||
}
|
||||
table.Append(tr);
|
||||
|
||||
|
||||
// Данные
|
||||
table.Append(data.Skip(1).Select(x => new TableRow(x.Select(y => new TableCell(new Paragraph(new Run(new Text(y))))))));
|
||||
_body.Append(table);
|
||||
return this;
|
||||
}
|
||||
public void Build()
|
||||
{
|
||||
using var wordDocument = WordprocessingDocument.Create(_filePath,WordprocessingDocumentType.Document);
|
||||
var mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = _document;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IArrivalMaterialsRepository
|
||||
{
|
||||
IEnumerable<ArrivalMaterials> GetArrivalMaterials(DateTime? StartDate = null, DateTime? EndDate = null);
|
||||
void CreateArrivalMaterials(ArrivalMaterials material);
|
||||
void DeleteArrivalMaterials(int id);
|
||||
ArrivalMaterials GetArrivalMaterialsById(int id);
|
||||
|
||||
void UpdateArrivalMaterials(ArrivalMaterials material);
|
||||
}
|
12
ProductionInCehOTP/Repositories/IConnectionString.cs
Normal file
12
ProductionInCehOTP/Repositories/IConnectionString.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IConnectionString
|
||||
{
|
||||
public string ConnectionString { get;}
|
||||
}
|
11
ProductionInCehOTP/Repositories/IMaterialReposirory.cs
Normal file
11
ProductionInCehOTP/Repositories/IMaterialReposirory.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IMaterialReposirory
|
||||
{
|
||||
IEnumerable<Material> GetMaterials(DateTime? StartDate = null, DateTime? EndDate = null);
|
||||
Material GetMaterialById(int id);
|
||||
void TransferMaterial (Material material);
|
||||
}
|
10
ProductionInCehOTP/Repositories/IPlanWorkRepository.cs
Normal file
10
ProductionInCehOTP/Repositories/IPlanWorkRepository.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IPlanWorkRepository
|
||||
{
|
||||
IEnumerable<PlanWork> GetPlanWorks(DateTime? StartDate = null, DateTime? EndDate = null);
|
||||
void CreatePlanWork(PlanWork planWork);
|
||||
void DeletePlanWork(int planId);
|
||||
}
|
11
ProductionInCehOTP/Repositories/IProductRepository.cs
Normal file
11
ProductionInCehOTP/Repositories/IProductRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IProductRepository
|
||||
{
|
||||
IEnumerable<Product> GetProducts();
|
||||
Product GetProductById(int productId);
|
||||
void CreateProduct(Product product);
|
||||
void UpdateProduct(Product product);
|
||||
void DeleteProduct(int productId);
|
||||
}
|
14
ProductionInCehOTP/Repositories/IWorkerRepository.cs
Normal file
14
ProductionInCehOTP/Repositories/IWorkerRepository.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using ProductionInCehOTP.Entities;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IWorkerRepository
|
||||
{
|
||||
IEnumerable<Worker> GetWorkers();
|
||||
Worker GetWorkerById(int WorkerID);
|
||||
|
||||
void CreateWorker (Worker worker);
|
||||
void UpdateWorker (Worker worker);
|
||||
void DeleteWorker (int WorkerID);
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class ArrivalMaterialsRepository : IArrivalMaterialsRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
||||
private readonly ILogger<ArrivalMaterialsRepository> _logger;
|
||||
public ArrivalMaterialsRepository(IConnectionString connectionString , ILogger<ArrivalMaterialsRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateArrivalMaterials(ArrivalMaterials material)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Оъект: {json}", JsonConvert.SerializeObject(material));
|
||||
try
|
||||
{
|
||||
using var connecntion = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connecntion.Open();
|
||||
var queryInsert = @"
|
||||
INSERT INTO ARRIVAL_MATERIALS (DATE, NAME, COUNT)
|
||||
VALUES (@DATE, @NAME, @COUNT)";
|
||||
connecntion.Execute(queryInsert, material);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteArrivalMaterials(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
|
||||
var deleteChildQuery = "DELETE FROM MATERIAL WHERE arrivalmaterialid = @id";
|
||||
connection.Execute(deleteChildQuery, new { id }, transaction);
|
||||
|
||||
var deleteParentQuery = "DELETE FROM ARRIVAL_MATERIALS WHERE id = @id";
|
||||
connection.Execute(deleteParentQuery, new { id }, transaction);
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<ArrivalMaterials> GetArrivalMaterials(DateTime? StartDate = null, DateTime? EndDate = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
QueryBuilder queryBuilder = new QueryBuilder();
|
||||
if(StartDate.HasValue)
|
||||
{
|
||||
queryBuilder.AddCondition("awm.Date >= @StartDate");
|
||||
}
|
||||
if(EndDate.HasValue)
|
||||
{
|
||||
queryBuilder.AddCondition("awm.Date <= @EndDate");
|
||||
}
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * from arrival_materials as awm" ;
|
||||
var materials = connection.Query<ArrivalMaterials>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(materials));
|
||||
return materials;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ArrivalMaterials GetArrivalMaterialsById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"
|
||||
SELECT * FROM ARRIVAL_MATERIALS
|
||||
WHERE Id=@id";
|
||||
var material = connection.QueryFirst<ArrivalMaterials>(querySelect, new
|
||||
{
|
||||
id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(material));
|
||||
return material;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void UpdateArrivalMaterials(ArrivalMaterials material)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(material));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"
|
||||
UPDATE ARRIVAL_MATERIALS
|
||||
SET
|
||||
DATE=@DATE,
|
||||
NAME=@NAME,
|
||||
COUNT=@COUNT
|
||||
WHERE Id=@Id";
|
||||
connection.Execute(queryUpdate, material);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class ConnectionString : IConnectionString
|
||||
{
|
||||
string IConnectionString.ConnectionString => "Host=127.0.0.1;Port=5432;Username=postgres;Password=daa200513dr;Database=labsto_otp";
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProductionInCehOTP.Entities;
|
||||
using ProductionInCehOTP.Entities.Enums;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class MaterialRepository : IMaterialReposirory
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
||||
private readonly ILogger<MaterialRepository> _logger;
|
||||
public MaterialRepository(IConnectionString connectionString, ILogger<MaterialRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public Material GetMaterialById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Material> GetMaterials(DateTime? StartDate = null, DateTime? EndDate = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов материалов");
|
||||
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var builder = new QueryBuilder();
|
||||
if (StartDate.HasValue)
|
||||
{
|
||||
builder.AddCondition("mat.Datearrivaltoproduct >= @StartDate");
|
||||
}
|
||||
if (EndDate.HasValue)
|
||||
{
|
||||
builder.AddCondition("mat.Datearrivaltoproduct <= @EndDate");
|
||||
}
|
||||
|
||||
var query = @$"
|
||||
SELECT
|
||||
mat.Id AS Id,
|
||||
mat.Name AS Name,
|
||||
mat.ArrivalMaterialiD AS ArrivalMaterialID,
|
||||
mat.DateArrivalToProduct AS DateArrivalToProduct,
|
||||
mfp.MaterialID AS MaterialID,
|
||||
mfp.ProductID AS ProductId,
|
||||
mfp.Count AS Count
|
||||
FROM material mat
|
||||
LEFT JOIN material_product mfp ON mat.Id = mfp.MaterialID
|
||||
{builder.Build()}";
|
||||
|
||||
var MaterialForProductCountDict = new Dictionary<int, List<MaterialForProduct>>();
|
||||
|
||||
var materials = connection.Query<Material, MaterialForProduct, Material>(
|
||||
query,
|
||||
(material, materialForProduct) =>
|
||||
{
|
||||
if (!MaterialForProductCountDict.TryGetValue(material.Id, out var forProduct))
|
||||
{
|
||||
forProduct = [];
|
||||
MaterialForProductCountDict.Add(material.Id, forProduct);
|
||||
}
|
||||
forProduct.Add(materialForProduct);
|
||||
return material;
|
||||
},
|
||||
splitOn: "MaterialID", param: new { StartDate, EndDate });
|
||||
_logger.LogDebug("Полученные объекты материалов: {json}", JsonConvert.SerializeObject(materials));
|
||||
return MaterialForProductCountDict.Select(x =>
|
||||
{
|
||||
var fr = materials.First(y => y.Id == x.Key);
|
||||
fr.SetMaterialForProduct(x.Value);
|
||||
return fr;
|
||||
}).ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при получении объектов материалов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void TransferMaterial(Material material)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(material));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
|
||||
|
||||
var queryInsert = @"
|
||||
INSERT INTO MATERIAL (NAME, ARRIVALMATERIALID, DateArrivalToProduct)
|
||||
VALUES (@NAME, @ARRIVALMATERIALID, @DateArrivalToProduct);
|
||||
SELECT MAX(Id) FROM MATERIAL";
|
||||
var materialID = connection.QueryFirst<int>(queryInsert, material, transaction);
|
||||
|
||||
var querySubInsert = @"
|
||||
INSERT INTO MATERIAL_PRODUCT (PRODUCTID, MATERIALID, COUNT)
|
||||
VALUES (@PRODUCTID,@MATERIALID, @COUNT)";
|
||||
foreach (var elem in material.MaterialForProducts)
|
||||
{
|
||||
connection.Execute(querySubInsert, new
|
||||
{
|
||||
materialID,
|
||||
elem.ProductID,
|
||||
elem.Count
|
||||
}, transaction);
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
using Dapper;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProductionInCehOTP.Entities;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class PlanWorkRepository : IPlanWorkRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
||||
private readonly ILogger<PlanWorkRepository> _logger;
|
||||
public PlanWorkRepository(IConnectionString connectionString, ILogger<PlanWorkRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreatePlanWork(PlanWork planWork)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(planWork));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert = @"
|
||||
INSERT INTO PLANWORK (Plan,Date,WorkerID)
|
||||
VALUES (@Plan, @Date, @WorkerID);
|
||||
SELECT MAX(Id) FROM PLANWORK";
|
||||
var PlanWorkID =
|
||||
connection.QueryFirst<int>(queryInsert, planWork, transaction);
|
||||
var querySubInsert = @"
|
||||
INSERT INTO PLANWORK_PRODUCT (PLANWORKID, PRODUCTID, COUNT)
|
||||
VALUES (@PLANWORKID,@PRODUCTID, @COUNT)";
|
||||
foreach (var elem in planWork.PlanWorkForProducts)
|
||||
{
|
||||
connection.Execute(querySubInsert, new
|
||||
{
|
||||
PlanWorkID,
|
||||
elem.PlanWorkId,
|
||||
elem.ProductId,
|
||||
elem.Count
|
||||
}, transaction);
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeletePlanWork(int planId)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", planId);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"
|
||||
DELETE FROM PlanWork
|
||||
WHERE Id=@planId";
|
||||
connection.Execute(queryDelete, new { planId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<PlanWork> GetPlanWorks(DateTime? StartDate = null, DateTime? EndDate = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов материалов");
|
||||
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var builder = new QueryBuilder();
|
||||
if (StartDate.HasValue)
|
||||
{
|
||||
builder.AddCondition("plw.Date >= @StartDate");
|
||||
}
|
||||
if (EndDate.HasValue)
|
||||
{
|
||||
builder.AddCondition("plw.Date <= @EndDate");
|
||||
}
|
||||
|
||||
var query = @$"
|
||||
SELECT plw.*,
|
||||
plwfp.planworkid as PlanworkId,
|
||||
plwfp.productid as ProductId,
|
||||
plwfp.count as Count
|
||||
FROM planwork plw
|
||||
LEFT JOIN planwork_product plwfp ON plw.id = plwfp.planworkid
|
||||
{builder.Build()}";
|
||||
|
||||
var PlanWorkForProductDict = new Dictionary<int, List<PlanWorkForProduct>>();
|
||||
|
||||
var planwork = connection.Query<PlanWork, PlanWorkForProduct, PlanWork>(
|
||||
query,
|
||||
(planwork, planWorkForProduct) =>
|
||||
{
|
||||
if (!PlanWorkForProductDict.TryGetValue(planwork.Id, out var forProduct))
|
||||
{
|
||||
forProduct = [];
|
||||
PlanWorkForProductDict.Add(planwork.Id, forProduct);
|
||||
}
|
||||
forProduct.Add(planWorkForProduct);
|
||||
return planwork;
|
||||
},
|
||||
splitOn: "PlanworkId", param: new { StartDate, EndDate });
|
||||
_logger.LogDebug("Полученные объекты материалов: {json}", JsonConvert.SerializeObject(planwork));
|
||||
return PlanWorkForProductDict.Select(x =>
|
||||
{
|
||||
var fr = planwork.First(y => y.Id == x.Key);
|
||||
fr.SetPlanWorkForProduct(x.Value);
|
||||
return fr;
|
||||
}).ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при получении объектов материалов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,132 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProductionInCehOTP.Entities;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class ProductRepository : IProductRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
||||
private readonly ILogger<ProductRepository> _logger;
|
||||
|
||||
public ProductRepository(IConnectionString connectionString, ILogger<ProductRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreateProduct(Product product)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Оъект: {json}", JsonConvert.SerializeObject(product));
|
||||
try
|
||||
{
|
||||
using var connecntion = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connecntion.Open();
|
||||
var queryInsert = @"
|
||||
INSERT INTO PRODUCT (NAME,PRICE,PRODUCTIONID, PRODUCTIONTYPEID)
|
||||
VALUES (@NAME, @PRICE, @PRODUCTIONID, @PRODUCTIONTYPEID)";
|
||||
connecntion.Execute(queryInsert, product);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteProduct(int Id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", Id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"
|
||||
DELETE FROM PRODUCT
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryDelete, new { Id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Product GetProductById(int Id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", Id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"
|
||||
SELECT * FROM PRODUCT
|
||||
WHERE Id=@id";
|
||||
var product = connection.QueryFirst<Product>(querySelect, new
|
||||
{
|
||||
Id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(product));
|
||||
return product;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Product> GetProducts()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM PRODUCT";
|
||||
var product = connection.Query<Product>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(product));
|
||||
return product;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateProduct(Product product)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(product));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"
|
||||
UPDATE PRODUCT
|
||||
SET
|
||||
ID=@Id,
|
||||
NAME=@Name,
|
||||
PRICE=@Price,
|
||||
PRODUCTIONID=@ProductionId,
|
||||
PRODUCTIONTYPEID=@ProductionTypeID
|
||||
WHERE Id=@Id";
|
||||
connection.Execute(queryUpdate, product);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProductionInCehOTP.Entities;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class WorkerRepository : IWorkerRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
||||
private readonly ILogger<ProductRepository> _logger;
|
||||
|
||||
public WorkerRepository(IConnectionString connectionString, ILogger<ProductRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreateWorker(Worker worker)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Оъект: {json}", JsonConvert.SerializeObject(worker));
|
||||
try
|
||||
{
|
||||
using var connecntion = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connecntion.Open();
|
||||
var queryInsert = @"
|
||||
INSERT INTO WORKER (NAME,EXPERIENCE, CLASS, PLANWORK)
|
||||
VALUES (@NAME, @EXPERIENCE, @CLASS, @PLANWORK)";
|
||||
connecntion.Execute(queryInsert, worker);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteWorker(int Id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", Id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
|
||||
|
||||
var queryDeletePlanwork = "DELETE FROM planwork WHERE workerid = @Id";
|
||||
connection.Execute(queryDeletePlanwork, new { Id });
|
||||
|
||||
|
||||
var queryDeleteWorker = "DELETE FROM worker WHERE id = @Id";
|
||||
connection.Execute(queryDeleteWorker, new { Id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Worker GetWorkerById(int Id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", Id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"
|
||||
SELECT * FROM WORKER
|
||||
WHERE ID=@Id";
|
||||
var worker = connection.QueryFirstOrDefault<Worker>(querySelect, new
|
||||
{
|
||||
Id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(worker));
|
||||
return worker;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Worker> GetWorkers()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM WORKER";
|
||||
var worker = connection.Query<Worker>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(worker));
|
||||
return worker;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateWorker(Worker worker)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(worker));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"
|
||||
UPDATE WORKER
|
||||
SET
|
||||
NAME=@NAME,
|
||||
EXPERIENCE=@Experience,
|
||||
CLASS=@Class,
|
||||
PLANWORK=@PlanWork
|
||||
WHERE ID=@Id";
|
||||
connection.Execute(queryUpdate, worker);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
ProductionInCehOTP/Resources/BackGroundOTP.jpg
Normal file
BIN
ProductionInCehOTP/Resources/BackGroundOTP.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 KiB |
BIN
ProductionInCehOTP/Resources/OTP.jpg
Normal file
BIN
ProductionInCehOTP/Resources/OTP.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 401 KiB |
BIN
ProductionInCehOTP/Resources/background.jpg
Normal file
BIN
ProductionInCehOTP/Resources/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
16
ProductionInCehOTP/appsettings.json
Normal file
16
ProductionInCehOTP/appsettings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/factory_log.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user