lab8
This commit is contained in:
parent
9679a01937
commit
aecb2bdf42
@ -15,11 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairListImplement
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairFileImplement", "PlumpingRepairFileImplement\PlumbingRepairFileImplement.csproj", "{BA7E2CE6-7797-42C7-931C-40C48EA521C7}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairFileImplement", "PlumpingRepairFileImplement\PlumbingRepairFileImplement.csproj", "{BA7E2CE6-7797-42C7-931C-40C48EA521C7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairDatabaseImplement", "PlumbingRepairDatabaseImplement\PlumbingRepairDatabaseImplement.csproj", "{1E4DDF78-14D2-498B-9A17-473F156DBE11}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairRestApi", "PlumbingRepairRestApi\PlumbingRepairRestApi.csproj", "{96133F01-9E2F-4767-8CD8-811D8806E930}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairRestApi", "PlumbingRepairRestApi\PlumbingRepairRestApi.csproj", "{96133F01-9E2F-4767-8CD8-811D8806E930}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairClientApp", "PlumbingRepairClientApp\PlumbingRepairClientApp.csproj", "{C8A5024D-9529-452F-AAF3-9EDEEFED6758}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairClientApp", "PlumbingRepairClientApp\PlumbingRepairClientApp.csproj", "{C8A5024D-9529-452F-AAF3-9EDEEFED6758}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairDatabaseImplement", "PlumbingRepairDatabaseImplement\PlumbingRepairDatabaseImplement.csproj", "{A7874FFC-162B-4B6E-92CD-EA265B9E35F1}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -51,10 +51,6 @@ Global
|
|||||||
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{BA7E2CE6-7797-42C7-931C-40C48EA521C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1E4DDF78-14D2-498B-9A17-473F156DBE11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{1E4DDF78-14D2-498B-9A17-473F156DBE11}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{1E4DDF78-14D2-498B-9A17-473F156DBE11}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{1E4DDF78-14D2-498B-9A17-473F156DBE11}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{96133F01-9E2F-4767-8CD8-811D8806E930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{96133F01-9E2F-4767-8CD8-811D8806E930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{96133F01-9E2F-4767-8CD8-811D8806E930}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{96133F01-9E2F-4767-8CD8-811D8806E930}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{96133F01-9E2F-4767-8CD8-811D8806E930}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{96133F01-9E2F-4767-8CD8-811D8806E930}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@ -63,6 +59,10 @@ Global
|
|||||||
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C8A5024D-9529-452F-AAF3-9EDEEFED6758}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A7874FFC-162B-4B6E-92CD-EA265B9E35F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A7874FFC-162B-4B6E-92CD-EA265B9E35F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A7874FFC-162B-4B6E-92CD-EA265B9E35F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A7874FFC-162B-4B6E-92CD-EA265B9E35F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<add key="SmtpClientPort" value="587" />
|
<add key="SmtpClientPort" value="587" />
|
||||||
<add key="PopHost" value="pop.gmail.com" />
|
<add key="PopHost" value="pop.gmail.com" />
|
||||||
<add key="PopPort" value="995" />
|
<add key="PopPort" value="995" />
|
||||||
<add key="MailLogin" value="sevenknee5073@gmail.com" />
|
<add key="MailLogin" value="labwork7turner@gmail.com" />
|
||||||
<add key="MailPassword" value="tkhr rren pidn eyqa" />
|
<add key="MailPassword" value="daxm gvdc qdza sfza" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
53
PlumbingRepair/DataGridViewExtension.cs
Normal file
53
PlumbingRepair/DataGridViewExtension.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
|
||||||
|
namespace PlumbingRepair
|
||||||
|
{
|
||||||
|
public static class DataGridViewExtension
|
||||||
|
{
|
||||||
|
public static void FillandConfigGrid<T>(this DataGridView grid, List<T>? data)
|
||||||
|
{
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
grid.DataSource = data;
|
||||||
|
|
||||||
|
var type = typeof(T);
|
||||||
|
var properties = type.GetProperties();
|
||||||
|
|
||||||
|
foreach (DataGridViewColumn column in grid.Columns)
|
||||||
|
{
|
||||||
|
var property = properties.FirstOrDefault(x => x.Name == column.Name);
|
||||||
|
|
||||||
|
if (property == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем {column.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault();
|
||||||
|
|
||||||
|
if (attribute == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства {property.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ищем нужный нам атрибут
|
||||||
|
if (attribute is ColumnAttribute columnAttr)
|
||||||
|
{
|
||||||
|
column.HeaderText = columnAttr.Title;
|
||||||
|
column.Visible = columnAttr.Visible;
|
||||||
|
|
||||||
|
if (columnAttr.IsUseAutoSize)
|
||||||
|
{
|
||||||
|
column.AutoSizeMode = (DataGridViewAutoSizeColumnMode)Enum.Parse(typeof(DataGridViewAutoSizeColumnMode), columnAttr.GridViewAutoSize.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
column.Width = columnAttr.Width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,13 +22,7 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
_logger.LogInformation("Загрузка клиентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.DI;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace PlumbingRepair
|
namespace PlumbingRepair
|
||||||
{
|
{
|
||||||
@ -25,15 +27,7 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
DataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
|
||||||
DataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -46,31 +40,24 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
||||||
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
||||||
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
67
PlumbingRepair/FormCreateOrder.Designer.cs
generated
67
PlumbingRepair/FormCreateOrder.Designer.cs
generated
@ -36,66 +36,68 @@
|
|||||||
this.SumTextBox = new System.Windows.Forms.TextBox();
|
this.SumTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
this.SaveButton = new System.Windows.Forms.Button();
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.comboBoxClient = new System.Windows.Forms.ComboBox();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// WorkNameLabel
|
// WorkNameLabel
|
||||||
//
|
//
|
||||||
this.WorkNameLabel.AutoSize = true;
|
this.WorkNameLabel.AutoSize = true;
|
||||||
this.WorkNameLabel.Location = new System.Drawing.Point(12, 9);
|
this.WorkNameLabel.Location = new System.Drawing.Point(14, 12);
|
||||||
this.WorkNameLabel.Name = "WorkNameLabel";
|
this.WorkNameLabel.Name = "WorkNameLabel";
|
||||||
this.WorkNameLabel.Size = new System.Drawing.Size(51, 15);
|
this.WorkNameLabel.Size = new System.Drawing.Size(75, 20);
|
||||||
this.WorkNameLabel.TabIndex = 0;
|
this.WorkNameLabel.TabIndex = 0;
|
||||||
this.WorkNameLabel.Text = "Работа: ";
|
this.WorkNameLabel.Text = "Изделие: ";
|
||||||
//
|
//
|
||||||
// CountLabel
|
// CountLabel
|
||||||
//
|
//
|
||||||
this.CountLabel.AutoSize = true;
|
this.CountLabel.AutoSize = true;
|
||||||
this.CountLabel.Location = new System.Drawing.Point(12, 40);
|
this.CountLabel.Location = new System.Drawing.Point(14, 53);
|
||||||
this.CountLabel.Name = "CountLabel";
|
this.CountLabel.Name = "CountLabel";
|
||||||
this.CountLabel.Size = new System.Drawing.Size(78, 15);
|
this.CountLabel.Size = new System.Drawing.Size(97, 20);
|
||||||
this.CountLabel.TabIndex = 1;
|
this.CountLabel.TabIndex = 1;
|
||||||
this.CountLabel.Text = "Количество: ";
|
this.CountLabel.Text = "Количество: ";
|
||||||
//
|
//
|
||||||
// SumLabel
|
// SumLabel
|
||||||
//
|
//
|
||||||
this.SumLabel.AutoSize = true;
|
this.SumLabel.AutoSize = true;
|
||||||
this.SumLabel.Location = new System.Drawing.Point(12, 72);
|
this.SumLabel.Location = new System.Drawing.Point(14, 96);
|
||||||
this.SumLabel.Name = "SumLabel";
|
this.SumLabel.Name = "SumLabel";
|
||||||
this.SumLabel.Size = new System.Drawing.Size(51, 15);
|
this.SumLabel.Size = new System.Drawing.Size(62, 20);
|
||||||
this.SumLabel.TabIndex = 2;
|
this.SumLabel.TabIndex = 2;
|
||||||
this.SumLabel.Text = "Сумма: ";
|
this.SumLabel.Text = "Сумма: ";
|
||||||
//
|
//
|
||||||
// WorkComboBox
|
// WorkComboBox
|
||||||
//
|
//
|
||||||
this.WorkComboBox.FormattingEnabled = true;
|
this.WorkComboBox.FormattingEnabled = true;
|
||||||
this.WorkComboBox.Location = new System.Drawing.Point(93, 6);
|
this.WorkComboBox.Location = new System.Drawing.Point(106, 8);
|
||||||
|
this.WorkComboBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.WorkComboBox.Name = "WorkComboBox";
|
this.WorkComboBox.Name = "WorkComboBox";
|
||||||
this.WorkComboBox.Size = new System.Drawing.Size(201, 23);
|
this.WorkComboBox.Size = new System.Drawing.Size(229, 28);
|
||||||
this.WorkComboBox.TabIndex = 3;
|
this.WorkComboBox.TabIndex = 3;
|
||||||
this.WorkComboBox.SelectedIndexChanged += new System.EventHandler(this.WorkComboBox_SelectedIndexChanged);
|
this.WorkComboBox.SelectedIndexChanged += new System.EventHandler(this.WorkComboBox_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// CountTextBox
|
// CountTextBox
|
||||||
//
|
//
|
||||||
this.CountTextBox.Location = new System.Drawing.Point(93, 37);
|
this.CountTextBox.Location = new System.Drawing.Point(106, 49);
|
||||||
|
this.CountTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.CountTextBox.Name = "CountTextBox";
|
this.CountTextBox.Name = "CountTextBox";
|
||||||
this.CountTextBox.Size = new System.Drawing.Size(201, 23);
|
this.CountTextBox.Size = new System.Drawing.Size(229, 27);
|
||||||
this.CountTextBox.TabIndex = 4;
|
this.CountTextBox.TabIndex = 4;
|
||||||
this.CountTextBox.TextChanged += new System.EventHandler(this.CountTextBox_TextChanged);
|
this.CountTextBox.TextChanged += new System.EventHandler(this.CountTextBox_TextChanged);
|
||||||
//
|
//
|
||||||
// SumTextBox
|
// SumTextBox
|
||||||
//
|
//
|
||||||
this.SumTextBox.Location = new System.Drawing.Point(93, 69);
|
this.SumTextBox.Location = new System.Drawing.Point(106, 92);
|
||||||
|
this.SumTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.SumTextBox.Name = "SumTextBox";
|
this.SumTextBox.Name = "SumTextBox";
|
||||||
this.SumTextBox.Size = new System.Drawing.Size(201, 23);
|
this.SumTextBox.Size = new System.Drawing.Size(229, 27);
|
||||||
this.SumTextBox.TabIndex = 5;
|
this.SumTextBox.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// ButtonCancel
|
// ButtonCancel
|
||||||
//
|
//
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(222, 191);
|
this.ButtonCancel.Location = new System.Drawing.Point(250, 151);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
this.ButtonCancel.TabIndex = 6;
|
this.ButtonCancel.TabIndex = 6;
|
||||||
this.ButtonCancel.Text = "Отменить";
|
this.ButtonCancel.Text = "Отменить";
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
@ -103,38 +105,20 @@
|
|||||||
//
|
//
|
||||||
// SaveButton
|
// SaveButton
|
||||||
//
|
//
|
||||||
this.SaveButton.Location = new System.Drawing.Point(130, 191);
|
this.SaveButton.Location = new System.Drawing.Point(147, 151);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.SaveButton.Name = "SaveButton";
|
this.SaveButton.Name = "SaveButton";
|
||||||
this.SaveButton.Size = new System.Drawing.Size(85, 23);
|
this.SaveButton.Size = new System.Drawing.Size(97, 31);
|
||||||
this.SaveButton.TabIndex = 7;
|
this.SaveButton.TabIndex = 7;
|
||||||
this.SaveButton.Text = "Сохранить";
|
this.SaveButton.Text = "Сохранить";
|
||||||
this.SaveButton.UseVisualStyleBackColor = true;
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
//
|
//
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(12, 106);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(49, 15);
|
|
||||||
this.label1.TabIndex = 8;
|
|
||||||
this.label1.Text = "Клиент:";
|
|
||||||
//
|
|
||||||
// comboBoxClient
|
|
||||||
//
|
|
||||||
this.comboBoxClient.FormattingEnabled = true;
|
|
||||||
this.comboBoxClient.Location = new System.Drawing.Point(93, 106);
|
|
||||||
this.comboBoxClient.Name = "comboBoxClient";
|
|
||||||
this.comboBoxClient.Size = new System.Drawing.Size(201, 23);
|
|
||||||
this.comboBoxClient.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// FormCreateOrder
|
// FormCreateOrder
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(309, 226);
|
this.ClientSize = new System.Drawing.Size(353, 204);
|
||||||
this.Controls.Add(this.comboBoxClient);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.SaveButton);
|
this.Controls.Add(this.SaveButton);
|
||||||
this.Controls.Add(this.ButtonCancel);
|
this.Controls.Add(this.ButtonCancel);
|
||||||
this.Controls.Add(this.SumTextBox);
|
this.Controls.Add(this.SumTextBox);
|
||||||
@ -143,6 +127,7 @@
|
|||||||
this.Controls.Add(this.SumLabel);
|
this.Controls.Add(this.SumLabel);
|
||||||
this.Controls.Add(this.CountLabel);
|
this.Controls.Add(this.CountLabel);
|
||||||
this.Controls.Add(this.WorkNameLabel);
|
this.Controls.Add(this.WorkNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.Name = "FormCreateOrder";
|
this.Name = "FormCreateOrder";
|
||||||
this.Text = "Заказ";
|
this.Text = "Заказ";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@ -160,7 +145,5 @@
|
|||||||
private TextBox SumTextBox;
|
private TextBox SumTextBox;
|
||||||
private Button ButtonCancel;
|
private Button ButtonCancel;
|
||||||
private Button SaveButton;
|
private Button SaveButton;
|
||||||
private Label label1;
|
|
||||||
private ComboBox comboBoxClient;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,26 +10,23 @@ namespace PlumbingRepair
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IWorkLogic _logicW;
|
private readonly IWorkLogic _logicW;
|
||||||
private readonly IOrderLogic _logicO;
|
private readonly IOrderLogic _logicO;
|
||||||
private readonly IClientLogic _logicC;
|
|
||||||
|
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IWorkLogic logicW, IOrderLogic logicO, IClientLogic logicC)
|
public FormCreateOrder(ILogger<FormCreateOrder> logger, IWorkLogic logicW, IOrderLogic logicO)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logicW = logicW;
|
_logicW = logicW;
|
||||||
_logicO = logicO;
|
_logicO = logicO;
|
||||||
_logicC = logicC;
|
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка Работ для заказа");
|
_logger.LogInformation("Загрузка изделий для заказа");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logicW.ReadList(null);
|
var list = _logicW.ReadList(null);
|
||||||
var listClients = _logicC.ReadList(null);
|
|
||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
WorkComboBox.DisplayMember = "WorkName";
|
WorkComboBox.DisplayMember = "WorkName";
|
||||||
@ -37,18 +34,11 @@ namespace PlumbingRepair
|
|||||||
WorkComboBox.DataSource = list;
|
WorkComboBox.DataSource = list;
|
||||||
WorkComboBox.SelectedItem = null;
|
WorkComboBox.SelectedItem = null;
|
||||||
}
|
}
|
||||||
if(listClients != null)
|
|
||||||
{
|
|
||||||
comboBoxClient.DisplayMember = "ClientFIO";
|
|
||||||
comboBoxClient.ValueMember = "Id";
|
|
||||||
comboBoxClient.DataSource = listClients;
|
|
||||||
comboBoxClient.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка Работ");
|
_logger.LogError(ex, "Ошибка загрузки списка изделий");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,12 +93,7 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
if (WorkComboBox.SelectedValue == null)
|
if (WorkComboBox.SelectedValue == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Выберите Работа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxClient.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите заказчика", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +106,7 @@ namespace PlumbingRepair
|
|||||||
WorkId = Convert.ToInt32(WorkComboBox.SelectedValue),
|
WorkId = Convert.ToInt32(WorkComboBox.SelectedValue),
|
||||||
WorkName = WorkComboBox.Text,
|
WorkName = WorkComboBox.Text,
|
||||||
Count = Convert.ToInt32(CountTextBox.Text),
|
Count = Convert.ToInt32(CountTextBox.Text),
|
||||||
Sum = Convert.ToDouble(SumTextBox.Text),
|
Sum = Convert.ToDouble(SumTextBox.Text)
|
||||||
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.DI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -26,24 +27,18 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||||
|
|
||||||
if (service is FormImplementer form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||||
if (service is FormImplementer form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -51,7 +46,6 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -98,14 +92,7 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
DataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
|
||||||
DataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка исполнителей");
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,7 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
DataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
DataGridView.Columns["MessageId"].Visible = false;
|
|
||||||
DataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка писем");
|
_logger.LogInformation("Загрузка писем");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
95
PlumbingRepair/FormMain.Designer.cs
generated
95
PlumbingRepair/FormMain.Designer.cs
generated
@ -30,7 +30,7 @@
|
|||||||
{
|
{
|
||||||
MenuStrip = new MenuStrip();
|
MenuStrip = new MenuStrip();
|
||||||
СправочникиToolStripMenuItem = new ToolStripMenuItem();
|
СправочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
РаботыToolStripMenuItem = new ToolStripMenuItem();
|
ИзделияToolStripMenuItem = new ToolStripMenuItem();
|
||||||
КомпонентыToolStripMenuItem = new ToolStripMenuItem();
|
КомпонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
КлиентыToolStripMenuItem = new ToolStripMenuItem();
|
КлиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
исполнителиToolStripMenuItem = new ToolStripMenuItem();
|
исполнителиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
@ -39,11 +39,12 @@
|
|||||||
WorkComponentToolStripMenuItem = new ToolStripMenuItem();
|
WorkComponentToolStripMenuItem = new ToolStripMenuItem();
|
||||||
OrdersToolStripMenuItem = new ToolStripMenuItem();
|
OrdersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
запускРаботToolStripMenuItem = new ToolStripMenuItem();
|
запускРаботToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
письмаToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
создатьБэкапToolStripMenuItem = new ToolStripMenuItem();
|
||||||
CreateOrderButton = new Button();
|
CreateOrderButton = new Button();
|
||||||
IssuedOrderButton = new Button();
|
IssuedOrderButton = new Button();
|
||||||
UpdateListButton = new Button();
|
UpdateListButton = new Button();
|
||||||
DataGridView = new DataGridView();
|
DataGridView = new DataGridView();
|
||||||
почтаToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
MenuStrip.SuspendLayout();
|
MenuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -51,45 +52,46 @@
|
|||||||
// MenuStrip
|
// MenuStrip
|
||||||
//
|
//
|
||||||
MenuStrip.ImageScalingSize = new Size(20, 20);
|
MenuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
MenuStrip.Items.AddRange(new ToolStripItem[] { СправочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem, почтаToolStripMenuItem });
|
MenuStrip.Items.AddRange(new ToolStripItem[] { СправочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem, письмаToolStripMenuItem, создатьБэкапToolStripMenuItem });
|
||||||
MenuStrip.Location = new Point(0, 0);
|
MenuStrip.Location = new Point(0, 0);
|
||||||
MenuStrip.Name = "MenuStrip";
|
MenuStrip.Name = "MenuStrip";
|
||||||
MenuStrip.Size = new Size(865, 24);
|
MenuStrip.Padding = new Padding(7, 3, 0, 3);
|
||||||
|
MenuStrip.Size = new Size(989, 30);
|
||||||
MenuStrip.TabIndex = 0;
|
MenuStrip.TabIndex = 0;
|
||||||
MenuStrip.Text = "menuStrip1";
|
MenuStrip.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// СправочникиToolStripMenuItem
|
// СправочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
СправочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { РаботыToolStripMenuItem, КомпонентыToolStripMenuItem, КлиентыToolStripMenuItem, исполнителиToolStripMenuItem });
|
СправочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ИзделияToolStripMenuItem, КомпонентыToolStripMenuItem, КлиентыToolStripMenuItem, исполнителиToolStripMenuItem });
|
||||||
СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
|
СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
|
||||||
СправочникиToolStripMenuItem.Size = new Size(94, 20);
|
СправочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||||
СправочникиToolStripMenuItem.Text = "Cправочники";
|
СправочникиToolStripMenuItem.Text = "Cправочники";
|
||||||
//
|
//
|
||||||
// РаботыToolStripMenuItem
|
// ИзделияToolStripMenuItem
|
||||||
//
|
//
|
||||||
РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
|
ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem";
|
||||||
РаботыToolStripMenuItem.Size = new Size(149, 22);
|
ИзделияToolStripMenuItem.Size = new Size(185, 26);
|
||||||
РаботыToolStripMenuItem.Text = "Работы";
|
ИзделияToolStripMenuItem.Text = "Изделия";
|
||||||
РаботыToolStripMenuItem.Click += РаботыToolStripMenuItem_Click;
|
ИзделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// КомпонентыToolStripMenuItem
|
// КомпонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
|
КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
|
||||||
КомпонентыToolStripMenuItem.Size = new Size(149, 22);
|
КомпонентыToolStripMenuItem.Size = new Size(185, 26);
|
||||||
КомпонентыToolStripMenuItem.Text = "Компоненты";
|
КомпонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// КлиентыToolStripMenuItem
|
// КлиентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
КлиентыToolStripMenuItem.Name = "КлиентыToolStripMenuItem";
|
КлиентыToolStripMenuItem.Name = "КлиентыToolStripMenuItem";
|
||||||
КлиентыToolStripMenuItem.Size = new Size(149, 22);
|
КлиентыToolStripMenuItem.Size = new Size(185, 26);
|
||||||
КлиентыToolStripMenuItem.Text = "Клиенты";
|
КлиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
КлиентыToolStripMenuItem.Click += КлиентыToolStripMenuItem_Click;
|
КлиентыToolStripMenuItem.Click += КлиентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// исполнителиToolStripMenuItem
|
// исполнителиToolStripMenuItem
|
||||||
//
|
//
|
||||||
исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||||
исполнителиToolStripMenuItem.Size = new Size(149, 22);
|
исполнителиToolStripMenuItem.Size = new Size(185, 26);
|
||||||
исполнителиToolStripMenuItem.Text = "Исполнители";
|
исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||||
исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click;
|
исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@ -97,42 +99,57 @@
|
|||||||
//
|
//
|
||||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { WorksToolStripMenuItem, WorkComponentToolStripMenuItem, OrdersToolStripMenuItem });
|
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { WorksToolStripMenuItem, WorkComponentToolStripMenuItem, OrdersToolStripMenuItem });
|
||||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
//
|
//
|
||||||
// WorksToolStripMenuItem
|
// WorksToolStripMenuItem
|
||||||
//
|
//
|
||||||
WorksToolStripMenuItem.Name = "WorksToolStripMenuItem";
|
WorksToolStripMenuItem.Name = "WorksToolStripMenuItem";
|
||||||
WorksToolStripMenuItem.Size = new Size(211, 22);
|
WorksToolStripMenuItem.Size = new Size(273, 26);
|
||||||
WorksToolStripMenuItem.Text = "Список Работ";
|
WorksToolStripMenuItem.Text = "Список изделий";
|
||||||
WorksToolStripMenuItem.Click += WorksToolStripMenuItem_Click;
|
WorksToolStripMenuItem.Click += WorksToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// WorkComponentToolStripMenuItem
|
// WorkComponentToolStripMenuItem
|
||||||
//
|
//
|
||||||
WorkComponentToolStripMenuItem.Name = "WorkComponentToolStripMenuItem";
|
WorkComponentToolStripMenuItem.Name = "WorkComponentToolStripMenuItem";
|
||||||
WorkComponentToolStripMenuItem.Size = new Size(211, 22);
|
WorkComponentToolStripMenuItem.Size = new Size(273, 26);
|
||||||
WorkComponentToolStripMenuItem.Text = "Работы по компонентам";
|
WorkComponentToolStripMenuItem.Text = "Изделия по компонентам";
|
||||||
WorkComponentToolStripMenuItem.Click += WorkComponentToolStripMenuItem_Click;
|
WorkComponentToolStripMenuItem.Click += WorkComponentToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// OrdersToolStripMenuItem
|
// OrdersToolStripMenuItem
|
||||||
//
|
//
|
||||||
OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
|
OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
|
||||||
OrdersToolStripMenuItem.Size = new Size(211, 22);
|
OrdersToolStripMenuItem.Size = new Size(273, 26);
|
||||||
OrdersToolStripMenuItem.Text = "Список заказов";
|
OrdersToolStripMenuItem.Text = "Список заказов";
|
||||||
OrdersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
OrdersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// запускРаботToolStripMenuItem
|
// запускРаботToolStripMenuItem
|
||||||
//
|
//
|
||||||
запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
||||||
запускРаботToolStripMenuItem.Size = new Size(92, 20);
|
запускРаботToolStripMenuItem.Size = new Size(114, 24);
|
||||||
запускРаботToolStripMenuItem.Text = "Запуск работ";
|
запускРаботToolStripMenuItem.Text = "Запуск работ";
|
||||||
запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click;
|
запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// письмаToolStripMenuItem
|
||||||
|
//
|
||||||
|
письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
|
||||||
|
письмаToolStripMenuItem.Size = new Size(77, 24);
|
||||||
|
письмаToolStripMenuItem.Text = "Письма";
|
||||||
|
письмаToolStripMenuItem.Click += письмаToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// создатьБэкапToolStripMenuItem
|
||||||
|
//
|
||||||
|
создатьБэкапToolStripMenuItem.Name = "создатьБэкапToolStripMenuItem";
|
||||||
|
создатьБэкапToolStripMenuItem.Size = new Size(122, 24);
|
||||||
|
создатьБэкапToolStripMenuItem.Text = "Создать бэкап";
|
||||||
|
создатьБэкапToolStripMenuItem.Click += создатьБэкапToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// CreateOrderButton
|
// CreateOrderButton
|
||||||
//
|
//
|
||||||
CreateOrderButton.Location = new Point(728, 28);
|
CreateOrderButton.Location = new Point(832, 37);
|
||||||
|
CreateOrderButton.Margin = new Padding(3, 4, 3, 4);
|
||||||
CreateOrderButton.Name = "CreateOrderButton";
|
CreateOrderButton.Name = "CreateOrderButton";
|
||||||
CreateOrderButton.Size = new Size(125, 33);
|
CreateOrderButton.Size = new Size(143, 44);
|
||||||
CreateOrderButton.TabIndex = 2;
|
CreateOrderButton.TabIndex = 2;
|
||||||
CreateOrderButton.Text = "Создать заказ";
|
CreateOrderButton.Text = "Создать заказ";
|
||||||
CreateOrderButton.UseVisualStyleBackColor = true;
|
CreateOrderButton.UseVisualStyleBackColor = true;
|
||||||
@ -140,9 +157,10 @@
|
|||||||
//
|
//
|
||||||
// IssuedOrderButton
|
// IssuedOrderButton
|
||||||
//
|
//
|
||||||
IssuedOrderButton.Location = new Point(727, 112);
|
IssuedOrderButton.Location = new Point(831, 149);
|
||||||
|
IssuedOrderButton.Margin = new Padding(3, 4, 3, 4);
|
||||||
IssuedOrderButton.Name = "IssuedOrderButton";
|
IssuedOrderButton.Name = "IssuedOrderButton";
|
||||||
IssuedOrderButton.Size = new Size(125, 33);
|
IssuedOrderButton.Size = new Size(143, 44);
|
||||||
IssuedOrderButton.TabIndex = 5;
|
IssuedOrderButton.TabIndex = 5;
|
||||||
IssuedOrderButton.Text = "Заказ выдан";
|
IssuedOrderButton.Text = "Заказ выдан";
|
||||||
IssuedOrderButton.UseVisualStyleBackColor = true;
|
IssuedOrderButton.UseVisualStyleBackColor = true;
|
||||||
@ -150,9 +168,10 @@
|
|||||||
//
|
//
|
||||||
// UpdateListButton
|
// UpdateListButton
|
||||||
//
|
//
|
||||||
UpdateListButton.Location = new Point(727, 202);
|
UpdateListButton.Location = new Point(831, 269);
|
||||||
|
UpdateListButton.Margin = new Padding(3, 4, 3, 4);
|
||||||
UpdateListButton.Name = "UpdateListButton";
|
UpdateListButton.Name = "UpdateListButton";
|
||||||
UpdateListButton.Size = new Size(125, 33);
|
UpdateListButton.Size = new Size(143, 44);
|
||||||
UpdateListButton.TabIndex = 6;
|
UpdateListButton.TabIndex = 6;
|
||||||
UpdateListButton.Text = "Обновить список";
|
UpdateListButton.Text = "Обновить список";
|
||||||
UpdateListButton.UseVisualStyleBackColor = true;
|
UpdateListButton.UseVisualStyleBackColor = true;
|
||||||
@ -161,31 +180,26 @@
|
|||||||
// DataGridView
|
// DataGridView
|
||||||
//
|
//
|
||||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
DataGridView.Location = new Point(0, 27);
|
DataGridView.Location = new Point(0, 36);
|
||||||
|
DataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
DataGridView.Name = "DataGridView";
|
DataGridView.Name = "DataGridView";
|
||||||
DataGridView.RowHeadersWidth = 51;
|
DataGridView.RowHeadersWidth = 51;
|
||||||
DataGridView.RowTemplate.Height = 25;
|
DataGridView.RowTemplate.Height = 25;
|
||||||
DataGridView.Size = new Size(722, 421);
|
DataGridView.Size = new Size(825, 561);
|
||||||
DataGridView.TabIndex = 1;
|
DataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// почтаToolStripMenuItem
|
|
||||||
//
|
|
||||||
почтаToolStripMenuItem.Name = "почтаToolStripMenuItem";
|
|
||||||
почтаToolStripMenuItem.Size = new Size(53, 20);
|
|
||||||
почтаToolStripMenuItem.Text = "Почта";
|
|
||||||
почтаToolStripMenuItem.Click += почтаToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(865, 450);
|
ClientSize = new Size(989, 600);
|
||||||
Controls.Add(UpdateListButton);
|
Controls.Add(UpdateListButton);
|
||||||
Controls.Add(IssuedOrderButton);
|
Controls.Add(IssuedOrderButton);
|
||||||
Controls.Add(CreateOrderButton);
|
Controls.Add(CreateOrderButton);
|
||||||
Controls.Add(DataGridView);
|
Controls.Add(DataGridView);
|
||||||
Controls.Add(MenuStrip);
|
Controls.Add(MenuStrip);
|
||||||
MainMenuStrip = MenuStrip;
|
MainMenuStrip = MenuStrip;
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Ремонт сантехники";
|
Text = "Ремонт сантехники";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
@ -200,7 +214,7 @@
|
|||||||
|
|
||||||
private MenuStrip MenuStrip;
|
private MenuStrip MenuStrip;
|
||||||
private ToolStripMenuItem СправочникиToolStripMenuItem;
|
private ToolStripMenuItem СправочникиToolStripMenuItem;
|
||||||
private ToolStripMenuItem РаботыToolStripMenuItem;
|
private ToolStripMenuItem ИзделияToolStripMenuItem;
|
||||||
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
||||||
private ToolStripMenuItem КлиентыToolStripMenuItem;
|
private ToolStripMenuItem КлиентыToolStripMenuItem;
|
||||||
private Button CreateOrderButton;
|
private Button CreateOrderButton;
|
||||||
@ -213,6 +227,7 @@
|
|||||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
||||||
private DataGridView DataGridView;
|
private DataGridView DataGridView;
|
||||||
private ToolStripMenuItem почтаToolStripMenuItem;
|
private ToolStripMenuItem письмаToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem создатьБэкапToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,7 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlumbingRepairBusinessLogic.BusinessLogic;
|
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
using PlumbingRepairDataModels.Enums;
|
using PlumbingRepairContracts.DI;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace PlumbingRepair
|
namespace PlumbingRepair
|
||||||
{
|
{
|
||||||
@ -14,13 +12,15 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
private readonly IWorkProcess _workProcess;
|
private readonly IWorkProcess _workProcess;
|
||||||
public FormMain(ILogger<FormMain> logger, IWorkProcess workProcess, IOrderLogic orderLogic, IReportLogic reportLogic)
|
private readonly IBackUpLogic _backUpLogic;
|
||||||
|
public FormMain(ILogger<FormMain> logger, IBackUpLogic backUpLogic, IWorkProcess workProcess, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
_workProcess = workProcess;
|
_workProcess = workProcess;
|
||||||
|
_backUpLogic = backUpLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -34,16 +34,7 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _orderLogic.ReadList(null);
|
DataGridView.FillandConfigGrid(_orderLogic.ReadList(null));
|
||||||
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["WorkId"].Visible = false;
|
|
||||||
DataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
DataGridView.Columns["ImplementerId"].Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -55,42 +46,27 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
var form = DependencyManager.Instance.Resolve<FormComponents>();
|
||||||
|
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void РаботыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorks));
|
|
||||||
|
|
||||||
if (service is FormWorks form)
|
|
||||||
{
|
{
|
||||||
|
var form = DependencyManager.Instance.Resolve<FormWorks>();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
var form = DependencyManager.Instance.Resolve<FormClients>();
|
||||||
if (service is FormClients form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateOrderButton_Click(object sender, EventArgs e)
|
private void CreateOrderButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
||||||
|
|
||||||
if (service is FormCreateOrder form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void IssuedOrderButton_Click(object sender, EventArgs e)
|
private void IssuedOrderButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -142,44 +118,55 @@ namespace PlumbingRepair
|
|||||||
|
|
||||||
private void WorkComponentToolStripMenuItem_Click(object sender, EventArgs e)
|
private void WorkComponentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportWorkComponents));
|
var form = DependencyManager.Instance.Resolve<FormReportWorkComponents>();
|
||||||
if (service is FormReportWorkComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
|
||||||
if (service is FormReportOrders form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void запускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
private void запускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic);
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
var form = DependencyManager.Instance.Resolve<FormImplementers>();
|
||||||
|
|
||||||
if (service is FormImplementers form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var form = DependencyManager.Instance.Resolve<FormMails>();
|
||||||
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void почтаToolStripMenuItem_Click(object sender, EventArgs e)
|
private void создатьБэкапToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
|
try
|
||||||
if (service is FormMails form)
|
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
if (_backUpLogic != null)
|
||||||
|
{
|
||||||
|
var fbd = new FolderBrowserDialog();
|
||||||
|
if (fbd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
_backUpLogic.CreateBackUp(new BackUpSaveBindingModel
|
||||||
|
{
|
||||||
|
FolderName = fbd.SelectedPath
|
||||||
|
});
|
||||||
|
MessageBox.Show("Бекап создан", "Сообщение",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
// work
|
// work
|
||||||
//
|
//
|
||||||
this.work.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
this.work.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.work.HeaderText = "Работа";
|
this.work.HeaderText = "Изделие";
|
||||||
this.work.Name = "work";
|
this.work.Name = "work";
|
||||||
//
|
//
|
||||||
// component
|
// component
|
||||||
@ -83,7 +83,7 @@
|
|||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Controls.Add(this.ButtonSave);
|
this.Controls.Add(this.ButtonSave);
|
||||||
this.Name = "FormReportWorkComponents";
|
this.Name = "FormReportWorkComponents";
|
||||||
this.Text = "Работы по компонентам";
|
this.Text = "Изделия по компонентам";
|
||||||
this.Load += new System.EventHandler(this.FormReportWorkComponents_Load);
|
this.Load += new System.EventHandler(this.FormReportWorkComponents_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -32,13 +32,13 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
FileName = dialog.FileName
|
FileName = dialog.FileName
|
||||||
});
|
});
|
||||||
_logger.LogInformation("Сохранение списка Работ по компонентам");
|
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка Работ по компонентам");
|
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
@ -65,11 +65,11 @@ namespace PlumbingRepair
|
|||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
dataGridView.Rows.Add(Array.Empty<object>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузки списка Работ по компонентам");
|
_logger.LogInformation("Загрузки списка изделий по компонентам");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка Работ по компонентам");
|
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
2
PlumbingRepair/FormWork.Designer.cs
generated
2
PlumbingRepair/FormWork.Designer.cs
generated
@ -223,7 +223,7 @@
|
|||||||
this.Controls.Add(this.PriceLabel);
|
this.Controls.Add(this.PriceLabel);
|
||||||
this.Controls.Add(this.WorkNameLabel);
|
this.Controls.Add(this.WorkNameLabel);
|
||||||
this.Name = "FormWork";
|
this.Name = "FormWork";
|
||||||
this.Text = "Работа";
|
this.Text = "Изделие";
|
||||||
this.ComponentsGroupBox.ResumeLayout(false);
|
this.ComponentsGroupBox.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -4,6 +4,7 @@ using PlumbingRepairContracts.SearchModels;
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using PlumbingRepairContracts.DI;
|
||||||
|
|
||||||
namespace PlumbingRepair
|
namespace PlumbingRepair
|
||||||
{
|
{
|
||||||
@ -29,7 +30,7 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
if (_id.HasValue)
|
if (_id.HasValue)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка Работы");
|
_logger.LogInformation("Загрузка изделия");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -48,14 +49,14 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки Работы");
|
_logger.LogError(ex, "Ошибка загрузки изделия");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка компонент Работы");
|
_logger.LogInformation("Загрузка компонент изделия");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -71,16 +72,13 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонент Работы");
|
_logger.LogError(ex, "Ошибка загрузки компонент изделия");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorkComponent));
|
var form = DependencyManager.Instance.Resolve<FormWorkComponent>();
|
||||||
|
|
||||||
if (service is FormWorkComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.ComponentModel == null)
|
if (form.ComponentModel == null)
|
||||||
@ -103,16 +101,12 @@ namespace PlumbingRepair
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorkComponent));
|
var form = DependencyManager.Instance.Resolve<FormWorkComponent>();
|
||||||
|
|
||||||
if (service is FormWorkComponent form)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells[0].Value);
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells[0].Value);
|
||||||
form.Id = id;
|
form.Id = id;
|
||||||
form.Count = _workComponents[id].Item2;
|
form.Count = _workComponents[id].Item2;
|
||||||
@ -130,7 +124,6 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -178,7 +171,7 @@ namespace PlumbingRepair
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Сохранение Работы");
|
_logger.LogInformation("Сохранение изделия");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -203,7 +196,7 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка сохранения Работы");
|
_logger.LogError(ex, "Ошибка сохранения изделия");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
PlumbingRepair/FormWorkComponent.Designer.cs
generated
2
PlumbingRepair/FormWorkComponent.Designer.cs
generated
@ -106,7 +106,7 @@
|
|||||||
this.Controls.Add(this.ComponentSelectLabel);
|
this.Controls.Add(this.ComponentSelectLabel);
|
||||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.Name = "FormWorkComponent";
|
this.Name = "FormWorkComponent";
|
||||||
this.Text = "Компонент Работы";
|
this.Text = "Компонент изделия";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
2
PlumbingRepair/FormWorks.Designer.cs
generated
2
PlumbingRepair/FormWorks.Designer.cs
generated
@ -103,7 +103,7 @@
|
|||||||
this.Controls.Add(this.DataGridView);
|
this.Controls.Add(this.DataGridView);
|
||||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.Name = "FormWorks";
|
this.Name = "FormWorks";
|
||||||
this.Text = "Работы";
|
this.Text = "Изделия";
|
||||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
this.Load += new System.EventHandler(this.FormComponents_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.DI;
|
||||||
|
|
||||||
namespace PlumbingRepair
|
namespace PlumbingRepair
|
||||||
{
|
{
|
||||||
@ -25,55 +26,37 @@ namespace PlumbingRepair
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
DataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
|
_logger.LogInformation("Загрузка изделий");
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
|
||||||
DataGridView.Columns["WorkName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
DataGridView.Columns["WorkComponents"].Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка Работ");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки Работ");
|
_logger.LogError(ex, "Ошибка загрузки изделий");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormWork));
|
var form = DependencyManager.Instance.Resolve<FormWork>();
|
||||||
|
|
||||||
if (service is FormWork form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormWork));
|
var form = DependencyManager.Instance.Resolve<FormWork>();
|
||||||
|
|
||||||
if (service is FormWork form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
@ -81,7 +64,7 @@ namespace PlumbingRepair
|
|||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Удаление Работы");
|
_logger.LogInformation("Удаление изделия");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -97,7 +80,7 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка удаления Работы");
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj" />
|
<ProjectReference Include="..\PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\PlumbingRepairContracts\PlumbingRepairContracts.csproj" />
|
<ProjectReference Include="..\PlumbingRepairContracts\PlumbingRepairContracts.csproj" />
|
||||||
<ProjectReference Include="..\PlumbingRepairDatabaseImplement\PlumbingRepairDatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\PlumbingRepairListImplement\PlumbingRepairListImplement.csproj" />
|
<ProjectReference Include="..\PlumbingRepairListImplement\PlumbingRepairListImplement.csproj" />
|
||||||
<ProjectReference Include="..\PlumpingRepairFileImplement\PlumbingRepairFileImplement.csproj" />
|
<ProjectReference Include="..\PlumpingRepairFileImplement\PlumbingRepairFileImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
using PlumbingRepairContracts.StoragesContracts;
|
|
||||||
using PlumbingRepairDatabaseImplement.Implements;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using PlumbingRepairBusinessLogic.BusinessLogic;
|
using PlumbingRepairBusinessLogic.BusinessLogic;
|
||||||
@ -9,28 +6,23 @@ using PlumbingRepairBusinessLogic.OfficePackage;
|
|||||||
using PlumbingRepairBusinessLogic.OfficePackage.Implements;
|
using PlumbingRepairBusinessLogic.OfficePackage.Implements;
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairBusinessLogic.MailWorker;
|
using PlumbingRepairBusinessLogic.MailWorker;
|
||||||
|
using PlumbingRepairContracts.DI;
|
||||||
|
|
||||||
namespace PlumbingRepair
|
namespace PlumbingRepair
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
private static ServiceProvider? _serviceProvider;
|
|
||||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
var services = new ServiceCollection();
|
InitDependency();
|
||||||
ConfigureServices(services);
|
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
|
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
||||||
mailSender?.MailConfig(new MailConfigBindingModel
|
mailSender?.MailConfig(new MailConfigBindingModel
|
||||||
{
|
{
|
||||||
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
||||||
@ -45,51 +37,51 @@ namespace PlumbingRepair
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var logger = _serviceProvider.GetService<ILogger>();
|
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
||||||
logger?.LogError(ex, "Error");
|
logger?.LogError(ex, "Error");
|
||||||
}
|
}
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void InitDependency()
|
||||||
{
|
{
|
||||||
services.AddLogging(option =>
|
DependencyManager.InitDependency();
|
||||||
|
DependencyManager.Instance.AddLogging(option =>
|
||||||
{
|
{
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
option.AddNLog("nlog.config");
|
option.AddNLog("nlog.config");
|
||||||
});
|
});
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IWorkStorage, WorkStorage>();
|
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
DependencyManager.Instance.RegisterType<IWorkLogic, WorkLogic>();
|
||||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
||||||
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
services.AddTransient<IWorkLogic, WorkLogic>();
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
|
||||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
||||||
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
|
||||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
DependencyManager.Instance.RegisterType<FormMain>();
|
||||||
services.AddTransient<FormMain>();
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
||||||
services.AddTransient<FormComponent>();
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
||||||
services.AddTransient<FormComponents>();
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
||||||
services.AddTransient<FormCreateOrder>();
|
DependencyManager.Instance.RegisterType<FormWork>();
|
||||||
services.AddTransient<FormWork>();
|
DependencyManager.Instance.RegisterType<FormWorkComponent>();
|
||||||
services.AddTransient<FormWorkComponent>();
|
DependencyManager.Instance.RegisterType<FormWorks>();
|
||||||
services.AddTransient<FormWorks>();
|
DependencyManager.Instance.RegisterType<FormReportWorkComponents>();
|
||||||
services.AddTransient<FormReportWorkComponents>();
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
||||||
services.AddTransient<FormReportOrders>();
|
DependencyManager.Instance.RegisterType<FormClients>();
|
||||||
services.AddTransient<FormClients>();
|
DependencyManager.Instance.RegisterType<FormImplementers>();
|
||||||
services.AddTransient<FormImplementer>();
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
||||||
services.AddTransient<FormImplementers>();
|
DependencyManager.Instance.RegisterType<FormMails>();
|
||||||
services.AddTransient<FormMails>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -212,7 +212,7 @@
|
|||||||
<Paragraph>
|
<Paragraph>
|
||||||
<TextRuns>
|
<TextRuns>
|
||||||
<TextRun>
|
<TextRun>
|
||||||
<Value>Работа</Value>
|
<Value>Изделие</Value>
|
||||||
<Style>
|
<Style>
|
||||||
<FontWeight>Bold</FontWeight>
|
<FontWeight>Bold</FontWeight>
|
||||||
</Style>
|
</Style>
|
||||||
|
112
PlumbingRepairBusinessLogic/BusinessLogic/BackUpLogic.cs
Normal file
112
PlumbingRepairBusinessLogic/BusinessLogic/BackUpLogic.cs
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairDataModels;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Serialization.Json;
|
||||||
|
|
||||||
|
namespace PlumbingRepairBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
public class BackUpLogic : IBackUpLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IBackUpInfo _backUpInfo;
|
||||||
|
|
||||||
|
public BackUpLogic(ILogger<BackUpLogic> logger, IBackUpInfo backUpInfo)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_backUpInfo = backUpInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateBackUp(BackUpSaveBindingModel model)
|
||||||
|
{
|
||||||
|
if (_backUpInfo == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Clear folder");
|
||||||
|
// зачистка папки и удаление старого архива
|
||||||
|
var dirInfo = new DirectoryInfo(model.FolderName);
|
||||||
|
|
||||||
|
if (dirInfo.Exists)
|
||||||
|
{
|
||||||
|
foreach (var file in dirInfo.GetFiles())
|
||||||
|
{
|
||||||
|
file.Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogDebug("Delete archive");
|
||||||
|
string fileName = $"{model.FolderName}.zip";
|
||||||
|
|
||||||
|
if (File.Exists(fileName))
|
||||||
|
{
|
||||||
|
File.Delete(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// берем метод для сохранения
|
||||||
|
_logger.LogDebug("Get assembly");
|
||||||
|
var typeIId = typeof(IId);
|
||||||
|
var assembly = typeIId.Assembly;
|
||||||
|
|
||||||
|
if (assembly == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Сборка не найдена", nameof(assembly));
|
||||||
|
}
|
||||||
|
|
||||||
|
var types = assembly.GetTypes();
|
||||||
|
var method = GetType().GetMethod("SaveToFile", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
_logger.LogDebug("Find {count} types", types.Length);
|
||||||
|
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
if (type.IsInterface && type.GetInterface(typeIId.Name) != null)
|
||||||
|
{
|
||||||
|
var modelType = _backUpInfo.GetTypeByModelInterface(type.Name);
|
||||||
|
|
||||||
|
if (modelType == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Не найден класс-модель для {type.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogDebug("Call SaveToFile method for {name} type", type.Name);
|
||||||
|
|
||||||
|
method?.MakeGenericMethod(modelType).Invoke(this, new object[] { model.FolderName });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogDebug("Create zip and remove folder");
|
||||||
|
|
||||||
|
ZipFile.CreateFromDirectory(model.FolderName, fileName);
|
||||||
|
|
||||||
|
dirInfo.Delete(true);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveToFile<T>(string folderName) where T : class, new()
|
||||||
|
{
|
||||||
|
var records = _backUpInfo.GetList<T>();
|
||||||
|
|
||||||
|
if (records == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("{type} type get null list", typeof(T).Name);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonFormatter = new DataContractJsonSerializer(typeof(List<T>));
|
||||||
|
using var fs = new FileStream(string.Format("{0}/{1}.json", folderName, typeof(T).Name), FileMode.OpenOrCreate);
|
||||||
|
jsonFormatter.WriteObject(fs, records);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -76,7 +76,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
|
|||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список Работ",
|
Title = "Список изделий",
|
||||||
Works = _workStorage.GetFullList()
|
Works = _workStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
|
|||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список Работ",
|
Title = "Список изделий",
|
||||||
Works = GetWork()
|
Works = GetWork()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,12 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(model.WorkName))
|
if (string.IsNullOrEmpty(model.WorkName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет названия Работы", nameof(model.WorkName));
|
throw new ArgumentNullException("Нет названия изделия", nameof(model.WorkName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.Price <= 0)
|
if (model.Price <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Цена Работы должна быть больше 0", nameof(model.Price));
|
throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.Price));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Work. WorkName:{WorkName}.Price:{ Cost}. Id: { Id}", model.WorkName, model.Price, model.Id);
|
_logger.LogInformation("Work. WorkName:{WorkName}.Price:{ Cost}. Id: { Id}", model.WorkName, model.Price, model.Id);
|
||||||
@ -130,7 +130,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Работа с таким названием уже есть");
|
throw new InvalidOperationException("Изделие с таким названием уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace PlumbingRepairBusinessLogic.OfficePackage
|
|||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "2cm", "3cm" });
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "2cm", "3cm" });
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Номер", "Дата создания", "Работа", "Статус", "Стоимость" },
|
Texts = new List<string> { "Номер", "Дата создания", "Изделие", "Статус", "Стоимость" },
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<None Include="Views\Home\Create.cshtml" />
|
<None Include="Views\Home\Create.cshtml" />
|
||||||
<None Include="Views\Home\Enter.cshtml" />
|
<None Include="Views\Home\Enter.cshtml" />
|
||||||
<None Include="Views\Home\Index.cshtml" />
|
<None Include="Views\Home\Index.cshtml" />
|
||||||
|
<None Include="Views\Home\Mails.cshtml" />
|
||||||
<None Include="Views\Home\Privacy.cshtml" />
|
<None Include="Views\Home\Privacy.cshtml" />
|
||||||
<None Include="Views\Home\Register.cshtml" />
|
<None Include="Views\Home\Register.cshtml" />
|
||||||
<None Include="Views\Shared\Error.cshtml" />
|
<None Include="Views\Shared\Error.cshtml" />
|
||||||
|
20
PlumbingRepairContracts/Attributes/ColumnAttribute.cs
Normal file
20
PlumbingRepairContracts/Attributes/ColumnAttribute.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace PlumbingRepairContracts.Attributes
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ColumnAttribute : Attribute
|
||||||
|
{
|
||||||
|
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Visible = visible;
|
||||||
|
Width = width;
|
||||||
|
GridViewAutoSize = gridViewAutoSize;
|
||||||
|
IsUseAutoSize = isUseAutoSize;
|
||||||
|
}
|
||||||
|
public string Title { get; private set; }
|
||||||
|
public bool Visible { get; private set; }
|
||||||
|
public int Width { get; private set; }
|
||||||
|
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
||||||
|
public bool IsUseAutoSize { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
14
PlumbingRepairContracts/Attributes/GridViewAutoSize.cs
Normal file
14
PlumbingRepairContracts/Attributes/GridViewAutoSize.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace PlumbingRepairContracts.Attributes
|
||||||
|
{
|
||||||
|
public enum GridViewAutoSize
|
||||||
|
{
|
||||||
|
NotSet = 0,
|
||||||
|
None = 1,
|
||||||
|
ColumnHeader = 2,
|
||||||
|
AllCellsExceptHeader = 4,
|
||||||
|
AllCells = 6,
|
||||||
|
DisplayedCellsExceptHeader = 8,
|
||||||
|
DisplayedCells = 10,
|
||||||
|
Fill = 16
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace PlumbingRepairContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class BackUpSaveBindingModel
|
||||||
|
{
|
||||||
|
public string FolderName { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -10,5 +10,7 @@ namespace PlumbingRepairContracts.BindingModels
|
|||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IBackUpLogic
|
||||||
|
{
|
||||||
|
void CreateBackUp(BackUpSaveBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
38
PlumbingRepairContracts/DI/DependencyManager.cs
Normal file
38
PlumbingRepairContracts/DI/DependencyManager.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public class DependencyManager
|
||||||
|
{
|
||||||
|
private readonly IDependencyContainer _dependencyManager;
|
||||||
|
private static DependencyManager? _manager;
|
||||||
|
private static readonly object _locjObject = new();
|
||||||
|
|
||||||
|
private DependencyManager()
|
||||||
|
{
|
||||||
|
_dependencyManager = new ServiceDependencyContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DependencyManager Instance { get { if (_manager == null) { lock (_locjObject) { _manager = new DependencyManager(); } } return _manager; } }
|
||||||
|
|
||||||
|
public static void InitDependency()
|
||||||
|
{
|
||||||
|
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
||||||
|
if (ext == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
||||||
|
}
|
||||||
|
|
||||||
|
// регистрируем зависимости
|
||||||
|
ext.RegisterServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLogging(Action<ILoggingBuilder> configure) => _dependencyManager.AddLogging(configure);
|
||||||
|
|
||||||
|
public void RegisterType<T, U>(bool isSingle = false) where U : class, T where T : class => _dependencyManager.RegisterType<T, U>(isSingle);
|
||||||
|
|
||||||
|
public void RegisterType<T>(bool isSingle = false) where T : class => _dependencyManager.RegisterType<T>(isSingle);
|
||||||
|
|
||||||
|
public T Resolve<T>() => _dependencyManager.Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
12
PlumbingRepairContracts/DI/IDependencyContainer.cs
Normal file
12
PlumbingRepairContracts/DI/IDependencyContainer.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public interface IDependencyContainer
|
||||||
|
{
|
||||||
|
void AddLogging(Action<ILoggingBuilder> configure);
|
||||||
|
void RegisterType<T, U>(bool isSingle) where U : class, T where T : class;
|
||||||
|
void RegisterType<T>(bool isSingle) where T : class;
|
||||||
|
T Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
8
PlumbingRepairContracts/DI/IImplementationExtension.cs
Normal file
8
PlumbingRepairContracts/DI/IImplementationExtension.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public interface IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority { get; }
|
||||||
|
public void RegisterServices();
|
||||||
|
}
|
||||||
|
}
|
59
PlumbingRepairContracts/DI/ServiceDependencyContainer.cs
Normal file
59
PlumbingRepairContracts/DI/ServiceDependencyContainer.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public class ServiceDependencyContainer : IDependencyContainer
|
||||||
|
{
|
||||||
|
private ServiceProvider? _serviceProvider;
|
||||||
|
private readonly ServiceCollection _serviceCollection;
|
||||||
|
|
||||||
|
public ServiceDependencyContainer()
|
||||||
|
{
|
||||||
|
_serviceCollection = new ServiceCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||||
|
{
|
||||||
|
_serviceCollection.AddLogging(configure);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterType<T, U>(bool isSingle) where U : class, T where T : class
|
||||||
|
{
|
||||||
|
if (isSingle)
|
||||||
|
{
|
||||||
|
_serviceCollection.AddSingleton<T, U>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_serviceCollection.AddTransient<T, U>();
|
||||||
|
}
|
||||||
|
|
||||||
|
_serviceProvider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterType<T>(bool isSingle) where T : class
|
||||||
|
{
|
||||||
|
if (isSingle)
|
||||||
|
{
|
||||||
|
_serviceCollection.AddSingleton<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_serviceCollection.AddTransient<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
_serviceProvider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Resolve<T>()
|
||||||
|
{
|
||||||
|
if (_serviceProvider == null)
|
||||||
|
{
|
||||||
|
_serviceProvider = _serviceCollection.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _serviceProvider.GetService<T>()!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
PlumbingRepairContracts/DI/ServiceProviderLoader.cs
Normal file
52
PlumbingRepairContracts/DI/ServiceProviderLoader.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public class ServiceProviderLoader
|
||||||
|
{
|
||||||
|
public static IImplementationExtension? GetImplementationExtensions()
|
||||||
|
{
|
||||||
|
IImplementationExtension? source = null;
|
||||||
|
var files = Directory.GetFiles(TryGetImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
foreach (var file in files.Distinct())
|
||||||
|
{
|
||||||
|
Assembly asm = Assembly.LoadFrom(file);
|
||||||
|
|
||||||
|
foreach (var t in asm.GetExportedTypes())
|
||||||
|
{
|
||||||
|
if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t))
|
||||||
|
{
|
||||||
|
if (source == null)
|
||||||
|
{
|
||||||
|
source = (IImplementationExtension)Activator.CreateInstance(t)!;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newSource = (IImplementationExtension)Activator.CreateInstance(t)!;
|
||||||
|
|
||||||
|
if (newSource.Priority > source.Priority)
|
||||||
|
{
|
||||||
|
source = newSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string TryGetImplementationExtensionsFolder()
|
||||||
|
{
|
||||||
|
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||||
|
|
||||||
|
while (directory != null && !directory.GetDirectories("ImplementationExtensions", SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions"))
|
||||||
|
{
|
||||||
|
directory = directory.Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{directory?.FullName}\\ImplementationExtensions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
PlumbingRepairContracts/DI/UnityDependencyContainer.cs
Normal file
38
PlumbingRepairContracts/DI/UnityDependencyContainer.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Unity.Microsoft.Logging;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.DI
|
||||||
|
{
|
||||||
|
public class UnityDependencyContainer : IDependencyContainer
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
public UnityDependencyContainer()
|
||||||
|
{
|
||||||
|
_container = new UnityContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||||
|
{
|
||||||
|
var factory = LoggerFactory.Create(configure);
|
||||||
|
_container.AddExtension(new LoggingExtension(factory));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterType<T>(bool isSingle) where T : class
|
||||||
|
{
|
||||||
|
_container.RegisterType<T>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Resolve<T>()
|
||||||
|
{
|
||||||
|
return _container.Resolve<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDependencyContainer.RegisterType<T, U>(bool isSingle)
|
||||||
|
{
|
||||||
|
_container.RegisterType<T, U>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,12 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PlumbingRepairDataModels\PlumbingRepairDataModels.csproj" />
|
<ProjectReference Include="..\PlumbingRepairDataModels\PlumbingRepairDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
8
PlumbingRepairContracts/StoragesContracts/IBackUpInfo.cs
Normal file
8
PlumbingRepairContracts/StoragesContracts/IBackUpInfo.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace PlumbingRepairContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IBackUpInfo
|
||||||
|
{
|
||||||
|
List<T>? GetList<T>() where T : class, new();
|
||||||
|
Type? GetTypeByModelInterface(string modelInterfaceName);
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,18 @@
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace PlumbingRepairContracts.ViewModels
|
namespace PlumbingRepairContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ClientViewModel : IClientModel
|
public class ClientViewModel : IClientModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("ФИО клиента")]
|
[Column("ФИО клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[DisplayName("Логин (эл. почта)")]
|
[Column("Логин (эл. почта)", width: 150)]
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
[DisplayName("Пароль")]
|
[Column("Пароль", width: 150)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace PlumbingRepairContracts.ViewModels
|
namespace PlumbingRepairContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ComponentViewModel : IComponentModel
|
public class ComponentViewModel : IComponentModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("Название компонента")]
|
[Column("Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string ComponentName { get; set; } = string.Empty;
|
||||||
[DisplayName("Цена")]
|
[Column("Цена", width: 80)]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace PlumbingRepairContracts.ViewModels
|
namespace PlumbingRepairContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ImplementerViewModel : IImplementerModel
|
public class ImplementerViewModel : IImplementerModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[DisplayName("ФИО исполнителя")]
|
[Column("ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Пароль")]
|
[Column("Пароль", width: 150)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Стаж работы")]
|
[Column("Стаж работы", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
|
|
||||||
[DisplayName("Квалификация")]
|
[Column("Квалификация", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace PlumbingRepairContracts.ViewModels
|
namespace PlumbingRepairContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class MessageInfoViewModel : IMessageInfoModel
|
public class MessageInfoViewModel : IMessageInfoModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
[DisplayName("Имя отправителя")]
|
[Column("Имя отправителя", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Дата отправления")]
|
[Column("Дата отправления", width: 100)]
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
|
|
||||||
[DisplayName("Тема")]
|
[Column("Тема", width: 150)]
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Содержание")]
|
[Column("Содержание", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using PlumbingRepairDataModels.Enums;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Enums;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
@ -6,26 +7,29 @@ namespace PlumbingRepairContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[DisplayName("Номер")]
|
[Column("Номер", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
[Column(visible: false)]
|
||||||
public int WorkId { get; set; }
|
public int WorkId { get; set; }
|
||||||
[DisplayName("Название изделия")]
|
[Column("Название изделия", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public string WorkName { get; set; } = string.Empty;
|
public string WorkName { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
[DisplayName("Клиент")]
|
[Column("ФИО клиента", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
public int? ImplementerId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
[DisplayName("Исполнитель")]
|
[Column("ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
[DisplayName("Количество")]
|
[Column("Количество", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[DisplayName("Сумма")]
|
[Column("Сумма", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
[DisplayName("Статус")]
|
[Column("Статус", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
[DisplayName("Дата создания")]
|
[Column("Дата создания", width: 130)]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[DisplayName("Дата выполнения")]
|
[Column("Дата выполнения", width: 130)]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairContracts.Attributes;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace PlumbingRepairContracts.ViewModels
|
namespace PlumbingRepairContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class WorkViewModel : IWorkModel
|
public class WorkViewModel : IWorkModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("Название изделия")]
|
[Column("Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string WorkName { get; set; } = string.Empty;
|
public string WorkName { get; set; } = string.Empty;
|
||||||
[DisplayName("Цена")]
|
[Column("Цена", width: 100)]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
|
[Column(visible: false)]
|
||||||
public Dictionary<int, (IComponentModel, int)> WorkComponents { get; set; } = new();
|
public Dictionary<int, (IComponentModel, int)> WorkComponents { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj" />
|
<ProjectReference Include="..\PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\PlumbingRepairDatabaseImplement\PlumbingRepairDatabaseImplement.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -12,12 +12,14 @@ namespace PlumbingRepairFileImplement
|
|||||||
private readonly string WorkFileName = "Work.xml";
|
private readonly string WorkFileName = "Work.xml";
|
||||||
private readonly string ClientFileName = "Client.xml";
|
private readonly string ClientFileName = "Client.xml";
|
||||||
private readonly string ImplementerFileName = "Implementer.xml";
|
private readonly string ImplementerFileName = "Implementer.xml";
|
||||||
|
private readonly string MessageFileName = "Message.xml";
|
||||||
|
|
||||||
public List<Component> Components { get; private set; }
|
public List<Component> Components { get; private set; }
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
public List<Work> Works { get; private set; }
|
public List<Work> Works { get; private set; }
|
||||||
public List<Client> Clients { get; private set; }
|
public List<Client> Clients { get; private set; }
|
||||||
public List<Implementer> Implementers { get; private set; }
|
public List<Implementer> Implementers { get; private set; }
|
||||||
|
public List<Message> Messages { get; private set; }
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
@ -33,6 +35,7 @@ namespace PlumbingRepairFileImplement
|
|||||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||||
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
||||||
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
||||||
|
public void SaveMessages() => SaveData(Messages, MessageFileName, "Messages", x => x.GetXElement);
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
@ -41,6 +44,7 @@ namespace PlumbingRepairFileImplement
|
|||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||||
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
||||||
|
Messages = LoadData(MessageFileName, "Message", x => Message.Create(x)!)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
22
PlumpingRepairFileImplement/FileImplementationExtension.cs
Normal file
22
PlumpingRepairFileImplement/FileImplementationExtension.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using PlumbingRepairContracts.DI;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairFileImplement.Implements;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement
|
||||||
|
{
|
||||||
|
public class FileImplementationExtension : IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority => 1;
|
||||||
|
|
||||||
|
public void RegisterServices()
|
||||||
|
{
|
||||||
|
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IWorkStorage, WorkStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
PlumpingRepairFileImplement/Implements/BackUpInfo.cs
Normal file
32
PlumpingRepairFileImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class BackUpInfo : IBackUpInfo
|
||||||
|
{
|
||||||
|
public List<T>? GetList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
|
||||||
|
return (List<T>?)source.GetType().GetProperties()
|
||||||
|
.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == typeof(T))
|
||||||
|
?.GetValue(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
||||||
|
{
|
||||||
|
var assembly = typeof(BackUpInfo).Assembly;
|
||||||
|
var types = assembly.GetTypes();
|
||||||
|
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
if (type.IsClass && type.GetInterface(modelInterfaceName) != null)
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
PlumpingRepairFileImplement/Implements/MessageInfoStorage.cs
Normal file
52
PlumpingRepairFileImplement/Implements/MessageInfoStorage.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairFileImplement.Models;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class MessageInfoStorage : IMessageInfoStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
public MessageInfoStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
if (model.MessageId == null)
|
||||||
|
return null;
|
||||||
|
return source.Messages.FirstOrDefault(x => x.MessageId == model.MessageId)?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.ClientId.HasValue)
|
||||||
|
return new();
|
||||||
|
return source.Messages
|
||||||
|
.Where(x => x.ClientId == model.ClientId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Messages
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
var newMessage = Message.Create(model);
|
||||||
|
if (newMessage == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Messages.Add(newMessage);
|
||||||
|
source.SaveMessages();
|
||||||
|
return newMessage.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,21 @@
|
|||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PlumbingRepairFileImplement.Models
|
namespace PlumbingRepairFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Client : IClientModel
|
public class Client : IClientModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string ClientFIO { get; private set; } = string.Empty;
|
public string ClientFIO { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Email { get; private set; } = string.Empty;
|
public string Email { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Password { get; private set; } = string.Empty;
|
public string Password { get; private set; } = string.Empty;
|
||||||
public static Client? Create(ClientBindingModel? model)
|
public static Client? Create(ClientBindingModel? model)
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PlumbingRepairFileImplement.Models
|
namespace PlumbingRepairFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Component : IComponentModel
|
public class Component : IComponentModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string ComponentName { get; private set; } = string.Empty;
|
public string ComponentName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
|
|
||||||
public static Component? Create(ComponentBindingModel model)
|
public static Component? Create(ComponentBindingModel model)
|
||||||
|
@ -1,20 +1,23 @@
|
|||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PlumbingRepairFileImplement.Models
|
namespace PlumbingRepairFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Implementer : IImplementerModel
|
public class Implementer : IImplementerModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
|
[DataMember]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
|
[DataMember]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public static Implementer? Create(ImplementerBindingModel? model)
|
public static Implementer? Create(ImplementerBindingModel? model)
|
||||||
|
80
PlumpingRepairFileImplement/Models/Message.cs
Normal file
80
PlumpingRepairFileImplement/Models/Message.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement.Models
|
||||||
|
{
|
||||||
|
[DataContract]
|
||||||
|
public class Message : IMessageInfoModel
|
||||||
|
{
|
||||||
|
[DataMember]
|
||||||
|
public string MessageId { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
|
public int? ClientId { get; private set; }
|
||||||
|
[DataMember]
|
||||||
|
public string SenderName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
|
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
||||||
|
[DataMember]
|
||||||
|
public string Subject { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
|
public string Body { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public static Message? Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Body = model.Body,
|
||||||
|
Subject = model.Subject,
|
||||||
|
DateDelivery = model.DateDelivery,
|
||||||
|
SenderName = model.SenderName,
|
||||||
|
ClientId = model.ClientId,
|
||||||
|
MessageId = model.MessageId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Body = element.Attribute("Body")!.Value,
|
||||||
|
Subject = element.Attribute("Subject")!.Value,
|
||||||
|
DateDelivery = Convert.ToDateTime(element.Attribute("DateDelivery")!.Value),
|
||||||
|
SenderName = element.Attribute("SenderName")!.Value,
|
||||||
|
ClientId = Convert.ToInt32(element.Attribute("ClientId")!.Value),
|
||||||
|
MessageId = element.Attribute("MessageId")!.Value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Body = Body,
|
||||||
|
Subject = Subject,
|
||||||
|
DateDelivery = DateDelivery,
|
||||||
|
SenderName = SenderName,
|
||||||
|
ClientId = ClientId,
|
||||||
|
MessageId = MessageId
|
||||||
|
};
|
||||||
|
|
||||||
|
public XElement GetXElement => new("MessageInfo",
|
||||||
|
new XAttribute("Subject", Subject),
|
||||||
|
new XAttribute("Body", Body),
|
||||||
|
new XAttribute("ClientId", ClientId.ToString()),
|
||||||
|
new XAttribute("MessageId", MessageId),
|
||||||
|
new XAttribute("SenderName", SenderName),
|
||||||
|
new XAttribute("DateDelivery", DateDelivery.ToString())
|
||||||
|
);
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
@ -2,21 +2,33 @@
|
|||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Enums;
|
using PlumbingRepairDataModels.Enums;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PlumbingRepairFileImplement.Models
|
namespace PlumbingRepairFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public int WorkId { get; private set; }
|
public int WorkId { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public int? ImplementerId { get; private set; }
|
public int? ImplementerId { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string WorkName { get; private set; } = string.Empty;
|
public string WorkName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||||
|
[DataMember]
|
||||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||||
|
[DataMember]
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel model)
|
public static Order? Create(OrderBindingModel model)
|
||||||
@ -47,6 +59,8 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl);
|
||||||
|
|
||||||
var order = new Order()
|
var order = new Order()
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
@ -56,13 +70,11 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
|
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
Status = (OrderStatus)Convert.ToInt32(element.Element("Status")!.Value),
|
||||||
DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null)
|
DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null),
|
||||||
|
DateImplement = dateImpl
|
||||||
};
|
};
|
||||||
|
|
||||||
DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl);
|
|
||||||
order.DateImplement = dateImpl;
|
|
||||||
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PlumbingRepairFileImplement.Models
|
namespace PlumbingRepairFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Work : IWorkModel
|
public class Work : IWorkModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string WorkName { get; private set; } = string.Empty;
|
public string WorkName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public double Price { get; private set; }
|
public double Price { get; private set; }
|
||||||
|
|
||||||
public Dictionary<int, int> Components { get; private set; } = new();
|
public Dictionary<int, int> Components { get; private set; } = new();
|
||||||
|
|
||||||
public Dictionary<int, (IComponentModel, int)> _workComponents = null;
|
public Dictionary<int, (IComponentModel, int)> _workComponents = null;
|
||||||
|
[DataMember]
|
||||||
public Dictionary<int, (IComponentModel, int)> WorkComponents
|
public Dictionary<int, (IComponentModel, int)> WorkComponents
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -11,4 +11,8 @@
|
|||||||
<ProjectReference Include="..\PlumbingRepairDataModels\PlumbingRepairDataModels.csproj" />
|
<ProjectReference Include="..\PlumbingRepairDataModels\PlumbingRepairDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user