Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9128e2ae93 | ||
|
454452c84b | ||
|
f20d17f212 | ||
|
0b515dc8c4 | ||
|
69b21488e6 | ||
|
295edcaaa9 | ||
|
105c89cda0 | ||
|
93ffc24a90 | ||
|
c3d19cda92 | ||
|
c44012c58c | ||
|
256d37d5d3 | ||
|
c4a1c3a46d | ||
|
173f299f93 | ||
|
1f2abc1e93 | ||
|
bfa38fafb0 | ||
|
35bc837d82 | ||
|
42b90c4d90 | ||
|
543925e6fe | ||
|
d302d4644b | ||
|
9431261a10 | ||
|
8364484ce7 | ||
|
a6a79d0213 | ||
|
37fe5deca9 | ||
|
1d0c82bfb4 | ||
|
71fa6549fb | ||
|
9834f67584 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,6 +4,8 @@
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
*.dll
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
|
@ -3,7 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32825.248
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbazovViewComponents", "AbazovViewComponents\AbazovViewComponents.csproj", "{070AAA71-3C9B-4E19-A89D-83372C630C6E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountsApp", "AccountsApp\AccountsApp.csproj", "{AFCB57A0-4332-4C32-9FB1-60548F7D7276}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountsDataModels", "AccountsDataModels\AccountsDataModels.csproj", "{31DEDC68-889D-427B-ADDE-60F2ADE2C596}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountsContracts", "AccountsContracts\AccountsContracts.csproj", "{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountsBusinessLogic", "AccountsBusinessLogic\AccountsBusinessLogic.csproj", "{D98A5D9F-A491-4A4B-A4A3-B1F388BAD18D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccountsDataBaseImplement", "AccountsDataBaseImplement\AccountsDataBaseImplement.csproj", "{ACF95C0D-CEB3-41B9-8B7F-149BEEEE53CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{B97362C6-7FB3-4696-BE00-7E42C4E40274}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountAppPlugins", "AccountAppPlugins\AccountAppPlugins.csproj", "{0FE49AC5-A83A-46D6-8590-DD06DC9E34A0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -15,6 +31,38 @@ Global
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D98A5D9F-A491-4A4B-A4A3-B1F388BAD18D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D98A5D9F-A491-4A4B-A4A3-B1F388BAD18D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D98A5D9F-A491-4A4B-A4A3-B1F388BAD18D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D98A5D9F-A491-4A4B-A4A3-B1F388BAD18D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ACF95C0D-CEB3-41B9-8B7F-149BEEEE53CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ACF95C0D-CEB3-41B9-8B7F-149BEEEE53CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ACF95C0D-CEB3-41B9-8B7F-149BEEEE53CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ACF95C0D-CEB3-41B9-8B7F-149BEEEE53CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B97362C6-7FB3-4696-BE00-7E42C4E40274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B97362C6-7FB3-4696-BE00-7E42C4E40274}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B97362C6-7FB3-4696-BE00-7E42C4E40274}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B97362C6-7FB3-4696-BE00-7E42C4E40274}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0FE49AC5-A83A-46D6-8590-DD06DC9E34A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0FE49AC5-A83A-46D6-8590-DD06DC9E34A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FE49AC5-A83A-46D6-8590-DD06DC9E34A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FE49AC5-A83A-46D6-8590-DD06DC9E34A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -6,6 +6,11 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>$(VersionPrefix)</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AbazovViewComponents\AbazovViewComponents.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
20
AbazovApp/AbazovAppView/Department.cs
Normal file
20
AbazovApp/AbazovAppView/Department.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public class Department
|
||||
{
|
||||
public string name;
|
||||
public int sells;
|
||||
|
||||
public Department(string name, int sells)
|
||||
{
|
||||
this.name = name;
|
||||
this.sells = sells;
|
||||
}
|
||||
}
|
||||
}
|
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
282
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
Normal file
282
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
Normal file
@ -0,0 +1,282 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
partial class FormTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.abazovCheckedListBox = new AbazovViewComponents.Components.AbazovCheckedListBox();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonClear = new System.Windows.Forms.Button();
|
||||
this.buttonSelected = new System.Windows.Forms.Button();
|
||||
this.abazovDatePicker = new AbazovViewComponents.Components.AbazovDatePicker();
|
||||
this.buttonBoundries = new System.Windows.Forms.Button();
|
||||
this.buttonSetDate = new System.Windows.Forms.Button();
|
||||
this.buttonGetDate = new System.Windows.Forms.Button();
|
||||
this.abazovTreeView = new AbazovViewComponents.Components.AbazovTreeView();
|
||||
this.buttonSetHierarchy = new System.Windows.Forms.Button();
|
||||
this.buttonAddWorkers = new System.Windows.Forms.Button();
|
||||
this.buttonGetValue = new System.Windows.Forms.Button();
|
||||
this.buttonGetIndex = new System.Windows.Forms.Button();
|
||||
this.buttonSetIndex = new System.Windows.Forms.Button();
|
||||
this.excelImagesComponent = new AbazovViewComponents.LogicalComponents.ExcelImagesComponent(this.components);
|
||||
this.buttonExcelImages = new System.Windows.Forms.Button();
|
||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.buttonExcelTable = new System.Windows.Forms.Button();
|
||||
this.excelTableComponent = new AbazovViewComponents.LogicalComponents.ExcelTableComponent(this.components);
|
||||
this.excelDiagramComponent = new AbazovViewComponents.LogicalComponents.ExcelDiagramComponent(this.components);
|
||||
this.buttonExcelDiagram = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// abazovCheckedListBox
|
||||
//
|
||||
this.abazovCheckedListBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.abazovCheckedListBox.Name = "abazovCheckedListBox";
|
||||
this.abazovCheckedListBox.selectedItem = null;
|
||||
this.abazovCheckedListBox.Size = new System.Drawing.Size(170, 134);
|
||||
this.abazovCheckedListBox.TabIndex = 0;
|
||||
this.abazovCheckedListBox.SelectedItemChange += new System.Action<string>(this.abazovCheckedListBox_SelectedItemChange);
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(12, 143);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(150, 29);
|
||||
this.buttonAdd.TabIndex = 1;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||
//
|
||||
// buttonClear
|
||||
//
|
||||
this.buttonClear.Location = new System.Drawing.Point(12, 178);
|
||||
this.buttonClear.Name = "buttonClear";
|
||||
this.buttonClear.Size = new System.Drawing.Size(150, 29);
|
||||
this.buttonClear.TabIndex = 2;
|
||||
this.buttonClear.Text = "Очистить";
|
||||
this.buttonClear.UseVisualStyleBackColor = true;
|
||||
this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
|
||||
//
|
||||
// buttonSelected
|
||||
//
|
||||
this.buttonSelected.Location = new System.Drawing.Point(12, 213);
|
||||
this.buttonSelected.Name = "buttonSelected";
|
||||
this.buttonSelected.Size = new System.Drawing.Size(150, 48);
|
||||
this.buttonSelected.TabIndex = 3;
|
||||
this.buttonSelected.Text = "Выбранный элемент";
|
||||
this.buttonSelected.UseVisualStyleBackColor = true;
|
||||
this.buttonSelected.Click += new System.EventHandler(this.buttonSelected_Click);
|
||||
//
|
||||
// abazovDatePicker
|
||||
//
|
||||
this.abazovDatePicker.dateFrom = null;
|
||||
this.abazovDatePicker.dateTo = null;
|
||||
this.abazovDatePicker.Location = new System.Drawing.Point(188, 12);
|
||||
this.abazovDatePicker.Name = "abazovDatePicker";
|
||||
this.abazovDatePicker.Size = new System.Drawing.Size(275, 48);
|
||||
this.abazovDatePicker.TabIndex = 4;
|
||||
this.abazovDatePicker.Value = null;
|
||||
this.abazovDatePicker.DateChange += new System.Action<System.DateTime>(this.abazovDatePicker_DateChange);
|
||||
this.abazovDatePicker.AutoSizeChanged += new System.EventHandler(this.abazovDatePicker_DateChange);
|
||||
//
|
||||
// buttonBoundries
|
||||
//
|
||||
this.buttonBoundries.Location = new System.Drawing.Point(188, 143);
|
||||
this.buttonBoundries.Name = "buttonBoundries";
|
||||
this.buttonBoundries.Size = new System.Drawing.Size(254, 29);
|
||||
this.buttonBoundries.TabIndex = 5;
|
||||
this.buttonBoundries.Text = "Установить границы";
|
||||
this.buttonBoundries.UseVisualStyleBackColor = true;
|
||||
this.buttonBoundries.Click += new System.EventHandler(this.buttonBoundries_Click);
|
||||
//
|
||||
// buttonSetDate
|
||||
//
|
||||
this.buttonSetDate.Location = new System.Drawing.Point(188, 178);
|
||||
this.buttonSetDate.Name = "buttonSetDate";
|
||||
this.buttonSetDate.Size = new System.Drawing.Size(254, 29);
|
||||
this.buttonSetDate.TabIndex = 6;
|
||||
this.buttonSetDate.Text = "Установить значение";
|
||||
this.buttonSetDate.UseVisualStyleBackColor = true;
|
||||
this.buttonSetDate.Click += new System.EventHandler(this.buttonSetDate_Click);
|
||||
//
|
||||
// buttonGetDate
|
||||
//
|
||||
this.buttonGetDate.Location = new System.Drawing.Point(188, 213);
|
||||
this.buttonGetDate.Name = "buttonGetDate";
|
||||
this.buttonGetDate.Size = new System.Drawing.Size(254, 29);
|
||||
this.buttonGetDate.TabIndex = 7;
|
||||
this.buttonGetDate.Text = "Получить значение";
|
||||
this.buttonGetDate.UseVisualStyleBackColor = true;
|
||||
this.buttonGetDate.Click += new System.EventHandler(this.buttonGetDate_Click);
|
||||
//
|
||||
// abazovTreeView
|
||||
//
|
||||
this.abazovTreeView.Location = new System.Drawing.Point(469, 12);
|
||||
this.abazovTreeView.Name = "abazovTreeView";
|
||||
this.abazovTreeView.SelectedNodeIndex = -1;
|
||||
this.abazovTreeView.Size = new System.Drawing.Size(369, 249);
|
||||
this.abazovTreeView.TabIndex = 8;
|
||||
//
|
||||
// buttonSetHierarchy
|
||||
//
|
||||
this.buttonSetHierarchy.Location = new System.Drawing.Point(469, 257);
|
||||
this.buttonSetHierarchy.Name = "buttonSetHierarchy";
|
||||
this.buttonSetHierarchy.Size = new System.Drawing.Size(296, 29);
|
||||
this.buttonSetHierarchy.TabIndex = 9;
|
||||
this.buttonSetHierarchy.Text = "Установить иерархию";
|
||||
this.buttonSetHierarchy.UseVisualStyleBackColor = true;
|
||||
this.buttonSetHierarchy.Click += new System.EventHandler(this.buttonSetHierarchy_Click);
|
||||
//
|
||||
// buttonAddWorkers
|
||||
//
|
||||
this.buttonAddWorkers.Location = new System.Drawing.Point(469, 292);
|
||||
this.buttonAddWorkers.Name = "buttonAddWorkers";
|
||||
this.buttonAddWorkers.Size = new System.Drawing.Size(296, 29);
|
||||
this.buttonAddWorkers.TabIndex = 10;
|
||||
this.buttonAddWorkers.Text = "Добавить рабочих";
|
||||
this.buttonAddWorkers.UseVisualStyleBackColor = true;
|
||||
this.buttonAddWorkers.Click += new System.EventHandler(this.buttonAddWorkers_Click);
|
||||
//
|
||||
// buttonGetValue
|
||||
//
|
||||
this.buttonGetValue.Location = new System.Drawing.Point(469, 327);
|
||||
this.buttonGetValue.Name = "buttonGetValue";
|
||||
this.buttonGetValue.Size = new System.Drawing.Size(296, 29);
|
||||
this.buttonGetValue.TabIndex = 11;
|
||||
this.buttonGetValue.Text = "Получить значение";
|
||||
this.buttonGetValue.UseVisualStyleBackColor = true;
|
||||
this.buttonGetValue.Click += new System.EventHandler(this.buttonGetValue_Click);
|
||||
//
|
||||
// buttonGetIndex
|
||||
//
|
||||
this.buttonGetIndex.Location = new System.Drawing.Point(469, 362);
|
||||
this.buttonGetIndex.Name = "buttonGetIndex";
|
||||
this.buttonGetIndex.Size = new System.Drawing.Size(296, 29);
|
||||
this.buttonGetIndex.TabIndex = 12;
|
||||
this.buttonGetIndex.Text = "Получить индекс";
|
||||
this.buttonGetIndex.UseVisualStyleBackColor = true;
|
||||
this.buttonGetIndex.Click += new System.EventHandler(this.buttonGetIndex_Click);
|
||||
//
|
||||
// buttonSetIndex
|
||||
//
|
||||
this.buttonSetIndex.Location = new System.Drawing.Point(469, 397);
|
||||
this.buttonSetIndex.Name = "buttonSetIndex";
|
||||
this.buttonSetIndex.Size = new System.Drawing.Size(296, 29);
|
||||
this.buttonSetIndex.TabIndex = 13;
|
||||
this.buttonSetIndex.Text = "Установить индекс";
|
||||
this.buttonSetIndex.UseVisualStyleBackColor = true;
|
||||
this.buttonSetIndex.Click += new System.EventHandler(this.buttonSetIndex_Click);
|
||||
//
|
||||
// buttonExcelImages
|
||||
//
|
||||
this.buttonExcelImages.Location = new System.Drawing.Point(12, 327);
|
||||
this.buttonExcelImages.Name = "buttonExcelImages";
|
||||
this.buttonExcelImages.Size = new System.Drawing.Size(150, 29);
|
||||
this.buttonExcelImages.TabIndex = 14;
|
||||
this.buttonExcelImages.Text = "Excel (картинки)";
|
||||
this.buttonExcelImages.UseVisualStyleBackColor = true;
|
||||
this.buttonExcelImages.Click += new System.EventHandler(this.buttonExcelImages_Click);
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
this.openFileDialog.Filter = "Изображения|*.png;*.jpg;";
|
||||
this.openFileDialog.Multiselect = true;
|
||||
this.openFileDialog.Title = "Выберте изображения";
|
||||
//
|
||||
// buttonExcelTable
|
||||
//
|
||||
this.buttonExcelTable.Location = new System.Drawing.Point(168, 327);
|
||||
this.buttonExcelTable.Name = "buttonExcelTable";
|
||||
this.buttonExcelTable.Size = new System.Drawing.Size(128, 29);
|
||||
this.buttonExcelTable.TabIndex = 15;
|
||||
this.buttonExcelTable.Text = "Excel (Таблица)";
|
||||
this.buttonExcelTable.UseVisualStyleBackColor = true;
|
||||
this.buttonExcelTable.Click += new System.EventHandler(this.buttonExcelTable_Click);
|
||||
//
|
||||
// buttonExcelDiagram
|
||||
//
|
||||
this.buttonExcelDiagram.Location = new System.Drawing.Point(12, 372);
|
||||
this.buttonExcelDiagram.Name = "buttonExcelDiagram";
|
||||
this.buttonExcelDiagram.Size = new System.Drawing.Size(150, 29);
|
||||
this.buttonExcelDiagram.TabIndex = 16;
|
||||
this.buttonExcelDiagram.Text = "Excel (Диаграмма)";
|
||||
this.buttonExcelDiagram.UseVisualStyleBackColor = true;
|
||||
this.buttonExcelDiagram.Click += new System.EventHandler(this.buttonExcelDiagram_Click);
|
||||
//
|
||||
// FormTest
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(850, 450);
|
||||
this.Controls.Add(this.buttonExcelDiagram);
|
||||
this.Controls.Add(this.buttonExcelTable);
|
||||
this.Controls.Add(this.buttonExcelImages);
|
||||
this.Controls.Add(this.buttonSetIndex);
|
||||
this.Controls.Add(this.buttonGetIndex);
|
||||
this.Controls.Add(this.buttonGetValue);
|
||||
this.Controls.Add(this.buttonAddWorkers);
|
||||
this.Controls.Add(this.buttonSetHierarchy);
|
||||
this.Controls.Add(this.abazovTreeView);
|
||||
this.Controls.Add(this.buttonGetDate);
|
||||
this.Controls.Add(this.buttonSetDate);
|
||||
this.Controls.Add(this.buttonBoundries);
|
||||
this.Controls.Add(this.abazovDatePicker);
|
||||
this.Controls.Add(this.buttonSelected);
|
||||
this.Controls.Add(this.buttonClear);
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Controls.Add(this.abazovCheckedListBox);
|
||||
this.Name = "FormTest";
|
||||
this.Text = "FormTest";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AbazovViewComponents.Components.AbazovCheckedListBox abazovCheckedListBox;
|
||||
private Button buttonAdd;
|
||||
private Button buttonClear;
|
||||
private Button buttonSelected;
|
||||
private AbazovViewComponents.Components.AbazovDatePicker abazovDatePicker;
|
||||
private Button buttonBoundries;
|
||||
private Button buttonSetDate;
|
||||
private Button buttonGetDate;
|
||||
private AbazovViewComponents.Components.AbazovTreeView abazovTreeView;
|
||||
private Button buttonSetHierarchy;
|
||||
private Button buttonAddWorkers;
|
||||
private Button buttonGetValue;
|
||||
private Button buttonGetIndex;
|
||||
private Button buttonSetIndex;
|
||||
private AbazovViewComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
||||
private Button buttonExcelImages;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private Button buttonExcelTable;
|
||||
private AbazovViewComponents.LogicalComponents.ExcelTableComponent excelTableComponent;
|
||||
private AbazovViewComponents.LogicalComponents.ExcelDiagramComponent excelDiagramComponent;
|
||||
private Button buttonExcelDiagram;
|
||||
}
|
||||
}
|
180
AbazovApp/AbazovAppView/FormTest.cs
Normal file
180
AbazovApp/AbazovAppView/FormTest.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using AbazovViewComponents.Components;
|
||||
using AbazovViewComponents.Exceptions;
|
||||
using AbazovViewComponents.LogicalComponents;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public partial class FormTest : Form
|
||||
{
|
||||
public FormTest()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
List<string> items = new List<string>();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
items.Add("item" + random.Next(0, 10000));
|
||||
}
|
||||
abazovCheckedListBox.addItems(items);
|
||||
abazovCheckedListBox.selectedItem = items[1];
|
||||
}
|
||||
|
||||
private void abazovCheckedListBox_SelectedItemChange(string obj)
|
||||
{
|
||||
MessageBox.Show(obj, "Select event");
|
||||
}
|
||||
|
||||
private void buttonClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovCheckedListBox.clear();
|
||||
}
|
||||
|
||||
private void buttonSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(abazovCheckedListBox.selectedItem ?? "null", "By getter");
|
||||
}
|
||||
|
||||
private void buttonBoundries_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovDatePicker.dateFrom = new DateTime(1970, 01, 01);
|
||||
abazovDatePicker.dateTo = new DateTime(2010, 01, 01);
|
||||
}
|
||||
|
||||
private void buttonSetDate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show("Установить значение в границах?", "Выбор", MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
abazovDatePicker.Value = new DateTime(2000, 01, 01);
|
||||
}
|
||||
else
|
||||
{
|
||||
abazovDatePicker.Value = new DateTime(1900, 01, 01);
|
||||
}
|
||||
}
|
||||
|
||||
private void abazovDatePicker_DateChange(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("ok");
|
||||
}
|
||||
|
||||
private void abazovDatePicker_DateChange(DateTime obj)
|
||||
{
|
||||
MessageBox.Show(obj.ToShortDateString(), "Date change event");
|
||||
}
|
||||
|
||||
private void buttonGetDate_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime? date = abazovDatePicker.Value;
|
||||
MessageBox.Show(date.ToString(), "Через свойство");
|
||||
}
|
||||
catch (DateBoundsNotSetException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
catch (DateOutOfBoundsException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSetHierarchy_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovTreeView.setHierarchy(new List<(string, bool)>() { ("department", false), ("groupNumber", false), ("name", true) });
|
||||
}
|
||||
|
||||
private void buttonAddWorkers_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Worker> workers = new List<Worker>();
|
||||
workers.Add(new Worker("Отдел 1", 1, "Иванов"));
|
||||
workers.Add(new Worker("Отдел 1", 1, "Петров"));
|
||||
workers.Add(new Worker("Отдел 1", 1, "Иванов"));
|
||||
workers.Add(new Worker("Отдел 1", 2, "Иванов"));
|
||||
workers.Add(new Worker("Отдел 2", 1, "Иванов"));
|
||||
workers.Add(new Worker("Отдел 2", 1, "Иванов"));
|
||||
workers.Add(new Worker("Отдел 2", 1, "Петров"));
|
||||
workers.Add(new Worker("Отдел 2", 2, "Иванов"));
|
||||
abazovTreeView.addItems(workers);
|
||||
}
|
||||
|
||||
private void buttonGetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
Worker? worker = abazovTreeView.getSelecetedNodeValue<Worker>();
|
||||
if (worker == null) return;
|
||||
MessageBox.Show(worker.department + ", номер группы: " + worker.groupNumber + ", " + worker.name);
|
||||
}
|
||||
|
||||
private void buttonGetIndex_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(abazovTreeView.SelectedNodeIndex.ToString());
|
||||
}
|
||||
|
||||
private void buttonSetIndex_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovTreeView.SelectedNodeIndex = 0;
|
||||
}
|
||||
|
||||
private void buttonExcelImages_Click(object sender, EventArgs e)
|
||||
{
|
||||
var res = openFileDialog.ShowDialog(this);
|
||||
if (res != DialogResult.OK) return;
|
||||
var files = openFileDialog.FileNames;
|
||||
openFileDialog.Dispose();
|
||||
List<Bitmap> images = new List<Bitmap>();
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test.xlsx";
|
||||
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Header", files))) MessageBox.Show("Успех!");
|
||||
else MessageBox.Show("Ошибка, проверьте консоль");
|
||||
}
|
||||
|
||||
private void buttonExcelTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<OfficeWorker> workers = new List<OfficeWorker>();
|
||||
|
||||
workers.Add(new OfficeWorker(1, "Иванов", "Иван", 20, "Отдел продаж", "Бухгалтер", 25, "+7(834)234-03-49"));
|
||||
workers.Add(new OfficeWorker(1, "Петров", "Петр", 25, "Отдел продаж", "Менеджер", 20, "+7(834)123-03-49"));
|
||||
workers.Add(new OfficeWorker(1, "Сидоров", "Сергей", 27, "Отдел кадров", "HR", 2, "+7(834)593-03-49", true));
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test2.xlsx";
|
||||
List<(int, int)> merges = new List<(int, int)>();
|
||||
merges.Add((1, 3));
|
||||
merges.Add((4, 6));
|
||||
List<int> heights = Enumerable.Repeat(20, 9).ToList();
|
||||
|
||||
List<(string, string)> headers = new List<(string, string)> { ("id", "id"), ("", "Личные данные"),
|
||||
("lastName", "Фамилия"), ("firstName", "Имя"),
|
||||
("age", "Возраст"), ("", "Работа"),
|
||||
("department", "Отдел"), ("position", "Должность"),
|
||||
("boxNumber", "Номер бокса"), ("phoneNumber", "Телефон"),
|
||||
("isInVacation", "В отпуске"), };
|
||||
|
||||
if (excelTableComponent.createWithTable(path, "test2", merges, heights, headers, workers)) MessageBox.Show("Успех");
|
||||
}
|
||||
|
||||
private void buttonExcelDiagram_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Department> departments = new List<Department>();
|
||||
|
||||
departments.Add(new Department("Dep 1", 330));
|
||||
departments.Add(new Department("Dep 2", 500));
|
||||
departments.Add(new Department("Dep 3", 170));
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test3.xlsx";
|
||||
if (excelDiagramComponent.createWithDiagram(path, "test3", "Продажи", DiagramLegendEnum.TopRight, departments, "name", "sells")) MessageBox.Show("Успех");
|
||||
else MessageBox.Show("Fail :(");
|
||||
}
|
||||
}
|
||||
}
|
72
AbazovApp/AbazovAppView/FormTest.resx
Normal file
72
AbazovApp/AbazovAppView/FormTest.resx
Normal file
@ -0,0 +1,72 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="excelImagesComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>233, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelTableComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>392, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelDiagramComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>596, 17</value>
|
||||
</metadata>
|
||||
</root>
|
34
AbazovApp/AbazovAppView/OfficeWorker.cs
Normal file
34
AbazovApp/AbazovAppView/OfficeWorker.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public class OfficeWorker
|
||||
{
|
||||
public OfficeWorker(int id, string lastName, string firstName, int age, string department, string position, int boxNumber, string phoneNumber, bool isInVacation = false)
|
||||
{
|
||||
this.id = id;
|
||||
this.lastName = lastName;
|
||||
this.firstName = firstName;
|
||||
this.age = age;
|
||||
this.department = department;
|
||||
this.position = position;
|
||||
this.boxNumber = boxNumber;
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.isInVacation = isInVacation;
|
||||
}
|
||||
|
||||
public int id;
|
||||
public string lastName;
|
||||
public string firstName;
|
||||
public int age;
|
||||
public string department;
|
||||
public string position;
|
||||
public int boxNumber;
|
||||
public string phoneNumber;
|
||||
public bool isInVacation;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace AbazovAppView
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormTest());
|
||||
}
|
||||
}
|
||||
}
|
22
AbazovApp/AbazovAppView/Worker.cs
Normal file
22
AbazovApp/AbazovAppView/Worker.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public class Worker
|
||||
{
|
||||
public Worker(string department, int groupNumber, string name)
|
||||
{
|
||||
this.department = department;
|
||||
this.groupNumber = groupNumber;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public string department;
|
||||
public int groupNumber;
|
||||
public string name;
|
||||
}
|
||||
}
|
35
AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
Normal file
35
AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
Normal file
@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>5.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="Microsoft.Office.Core">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>8</VersionMinor>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<Guid>2df8d04c-5bfa-101b-bde5-00aa0044de52</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<Private>true</Private>
|
||||
</COMReference>
|
||||
<COMReference Include="Microsoft.Office.Interop.Excel">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>9</VersionMinor>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<Guid>00020813-0000-0000-c000-000000000046</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<Private>true</Private>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
58
AbazovApp/AbazovViewComponents/Components/AbazovCheckedListBox.Designer.cs
generated
Normal file
58
AbazovApp/AbazovViewComponents/Components/AbazovCheckedListBox.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovCheckedListBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.checkedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkedListBox
|
||||
//
|
||||
this.checkedListBox.FormattingEnabled = true;
|
||||
this.checkedListBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.checkedListBox.Name = "checkedListBox";
|
||||
this.checkedListBox.Size = new System.Drawing.Size(150, 114);
|
||||
this.checkedListBox.TabIndex = 0;
|
||||
this.checkedListBox.SelectedIndexChanged += new System.EventHandler(this.checkedListBox_SelectedIndexChanged);
|
||||
//
|
||||
// AbazovCheckedListBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.checkedListBox);
|
||||
this.Name = "AbazovCheckedListBox";
|
||||
this.Size = new System.Drawing.Size(150, 115);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBox;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovCheckedListBox : UserControl
|
||||
{
|
||||
public AbazovCheckedListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string? selectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkedListBox.SelectedItem is null ? null : checkedListBox.SelectedItem.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null && checkedListBox.Items.Contains(value)) checkedListBox.SelectedItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<string?> SelectedItemChange;
|
||||
|
||||
public void addItems(List<string> items)
|
||||
{
|
||||
foreach (string item in items)
|
||||
{
|
||||
checkedListBox.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
checkedListBox.Items.Clear();
|
||||
}
|
||||
|
||||
private void checkedListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||
{
|
||||
checkedListBox.SetItemChecked(i, false);
|
||||
}
|
||||
checkedListBox.SetItemChecked(checkedListBox.SelectedIndex, true);
|
||||
SelectedItemChange?.Invoke(checkedListBox.SelectedItem.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
57
AbazovApp/AbazovViewComponents/Components/AbazovDatePicker.Designer.cs
generated
Normal file
57
AbazovApp/AbazovViewComponents/Components/AbazovDatePicker.Designer.cs
generated
Normal file
@ -0,0 +1,57 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovDatePicker
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
this.dateTimePicker.Location = new System.Drawing.Point(3, 3);
|
||||
this.dateTimePicker.Name = "dateTimePicker";
|
||||
this.dateTimePicker.Size = new System.Drawing.Size(250, 27);
|
||||
this.dateTimePicker.TabIndex = 0;
|
||||
this.dateTimePicker.ValueChanged += new System.EventHandler(this.dateTimePicker_ValueChanged);
|
||||
//
|
||||
// AbazovDatePicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.dateTimePicker);
|
||||
this.Name = "AbazovDatePicker";
|
||||
this.Size = new System.Drawing.Size(257, 38);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AbazovViewComponents.Exceptions;
|
||||
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovDatePicker : UserControl
|
||||
{
|
||||
public AbazovDatePicker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public event Action<DateTime> DateChange;
|
||||
private bool lowBoundrySet = false;
|
||||
private bool highBoundrySet = false;
|
||||
|
||||
public bool BoundriesSet { get { return lowBoundrySet && highBoundrySet; } }
|
||||
|
||||
public DateTime? dateFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return lowBoundrySet ? dateTimePicker.MinDate : null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
dateTimePicker.MinDate = value.Value;
|
||||
lowBoundrySet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public DateTime? dateTo
|
||||
{
|
||||
get
|
||||
{
|
||||
return highBoundrySet ? dateTimePicker.MaxDate : null; }
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
dateTimePicker.MaxDate = value.Value;
|
||||
highBoundrySet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!lowBoundrySet || !highBoundrySet || dateTimePicker.Value < dateFrom || dateTimePicker.Value > dateTo) return null;
|
||||
return dateTimePicker.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (lowBoundrySet && highBoundrySet && value.HasValue && value.Value >= dateFrom && value.Value <= dateTo) dateTimePicker.Value = value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
DateChange?.Invoke(dateTimePicker.Value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
56
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.Designer.cs
generated
Normal file
56
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovTreeView
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.treeView = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeView
|
||||
//
|
||||
this.treeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView.Name = "treeView";
|
||||
this.treeView.Size = new System.Drawing.Size(295, 212);
|
||||
this.treeView.TabIndex = 0;
|
||||
//
|
||||
// AbazovTreeView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.treeView);
|
||||
this.Name = "AbazovTreeView";
|
||||
this.Size = new System.Drawing.Size(295, 212);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TreeView treeView;
|
||||
}
|
||||
}
|
96
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.cs
Normal file
96
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovTreeView : UserControl
|
||||
{
|
||||
public AbazovTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private List<(string, bool)> hierarchy = new List<(string, bool)>();
|
||||
|
||||
public int SelectedNodeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return treeView.SelectedNode?.Index ?? -1;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (treeView.SelectedNode == null) treeView.SelectedNode = value >= 0 && value < treeView.Nodes.Count ? treeView.Nodes[value] : treeView.SelectedNode;
|
||||
else treeView.SelectedNode = value >= 0 && value < treeView.SelectedNode.Nodes.Count ? treeView.SelectedNode.Nodes[value] : treeView.SelectedNode;
|
||||
}
|
||||
}
|
||||
|
||||
public T? getSelecetedNodeValue<T>()
|
||||
{
|
||||
if (treeView.SelectedNode == null || treeView.SelectedNode.Nodes.Count > 0) return default(T);
|
||||
|
||||
TreeNode? node = treeView.SelectedNode;
|
||||
|
||||
var type = typeof(T);
|
||||
var properties = type.GetProperties();
|
||||
|
||||
var item = Activator.CreateInstance(type);
|
||||
|
||||
while (node != null)
|
||||
{
|
||||
var property = properties.FirstOrDefault(x => x.Name == node.Name);
|
||||
if (property != null)
|
||||
{
|
||||
Type typeOfField = property.PropertyType;
|
||||
property.SetValue(item, Convert.ChangeType(node.Text, typeOfField));
|
||||
}
|
||||
node = node.Parent;
|
||||
}
|
||||
|
||||
return item != null ? (T) item : default(T);
|
||||
}
|
||||
|
||||
public void setHierarchy(List<(string, bool)> fields)
|
||||
{
|
||||
hierarchy = fields;
|
||||
}
|
||||
|
||||
public void addItems<T>(List<T> items)
|
||||
{
|
||||
var type = typeof(T);
|
||||
var properties = type.GetProperties();
|
||||
foreach (T item in items)
|
||||
{
|
||||
TreeNodeCollection nodes = treeView.Nodes;
|
||||
for (int i = 0; i < hierarchy.Count; i++)
|
||||
{
|
||||
var property = properties.FirstOrDefault(x => x.Name.Equals(hierarchy[i].Item1));
|
||||
if (property is not null)
|
||||
{
|
||||
var node = nodes.Find(property.Name, false).FirstOrDefault(x => x.Text == property.GetValue(item).ToString());
|
||||
if (node is not null && !hierarchy[i].Item2)
|
||||
{
|
||||
nodes = node.Nodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeNode newNode = nodes.Add(property.Name, property.GetValue(item).ToString());
|
||||
nodes = newNode.Nodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
treeView.Nodes.Clear();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class DateBoundsNotSetException: ApplicationException
|
||||
{
|
||||
public DateBoundsNotSetException() : base() { }
|
||||
public DateBoundsNotSetException(string message) : base(message) { }
|
||||
public DateBoundsNotSetException(string message, Exception exception) : base(message, exception){ }
|
||||
protected DateBoundsNotSetException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.Exceptions
|
||||
{
|
||||
public class DateOutOfBoundsException : ApplicationException
|
||||
{
|
||||
public DateOutOfBoundsException() : base() { }
|
||||
public DateOutOfBoundsException(string message) : base(message) { }
|
||||
public DateOutOfBoundsException(string message, Exception exception) : base(message, exception) { }
|
||||
protected DateOutOfBoundsException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
public enum DiagramLegendEnum
|
||||
{
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
BottomRight = 2,
|
||||
BottomLeft = 3,
|
||||
}
|
||||
}
|
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelDiagramComponent.Designer.cs
generated
Normal file
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelDiagramComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
partial class ExcelDiagramComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
public partial class ExcelDiagramComponent : Component
|
||||
{
|
||||
public ExcelDiagramComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelDiagramComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool createWithDiagram<T>(string path, string title, string diagramTitle, DiagramLegendEnum diagramLegendAnchor, List<T> data, string seriesNameField, string valueField)
|
||||
{
|
||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
||||
try
|
||||
{
|
||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
||||
|
||||
PropertyInfo? seriesName = typeof(T).GetProperty(seriesNameField);
|
||||
PropertyInfo? value = typeof(T).GetProperty(valueField);
|
||||
if (seriesName == null || value == null) throw new ArgumentException("Переданного поля не существует");
|
||||
int columnCount = 2;
|
||||
foreach(var item in data)
|
||||
{
|
||||
var cell = worksheet.get_Range("A" + columnCount, "A" + columnCount);
|
||||
cell.Font.Size = 14;
|
||||
cell.Font.Name = "Times New Roman";
|
||||
cell.ColumnWidth = 8;
|
||||
cell.RowHeight = 25;
|
||||
cell.HorizontalAlignment = Constants.xlCenter;
|
||||
cell.VerticalAlignment = Constants.xlCenter;
|
||||
cell.Value2 = seriesName.GetValue(item);
|
||||
|
||||
cell = worksheet.get_Range("B" + columnCount, "B" + columnCount);
|
||||
cell.Font.Size = 14;
|
||||
cell.Font.Name = "Times New Roman";
|
||||
cell.ColumnWidth = 8;
|
||||
cell.RowHeight = 25;
|
||||
cell.HorizontalAlignment = Constants.xlCenter;
|
||||
cell.VerticalAlignment = Constants.xlCenter;
|
||||
cell.Value2 = value.GetValue(item);
|
||||
|
||||
columnCount++;
|
||||
}
|
||||
|
||||
//header
|
||||
var excelcells = worksheet.get_Range("A1", "A1");
|
||||
excelcells.Font.Bold = true;
|
||||
excelcells.Font.Size = 14;
|
||||
excelcells.Font.Name = "Times New Roman";
|
||||
excelcells.ColumnWidth = 8;
|
||||
excelcells.RowHeight = 25;
|
||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
||||
excelcells.Value2 = title;
|
||||
|
||||
var charts = worksheet.ChartObjects() as ChartObjects;
|
||||
int chartWidth = 300;
|
||||
int chartHeight = 300;
|
||||
var chartObject = charts.Add(250, 10, chartWidth, chartHeight);
|
||||
var chart = chartObject.Chart;
|
||||
var range = worksheet.get_Range($"A2", $"B{columnCount - 1}");
|
||||
chart.SetSourceData(range);
|
||||
chart.ChartType = XlChartType.xlPie;
|
||||
switch (diagramLegendAnchor)
|
||||
{
|
||||
case DiagramLegendEnum.TopLeft:
|
||||
chart.Legend.Top = 0;
|
||||
chart.Legend.Left = 0;
|
||||
break;
|
||||
case DiagramLegendEnum.TopRight:
|
||||
chart.Legend.Top = 0;
|
||||
chart.Legend.Left = chartWidth - chart.Legend.Width;
|
||||
break;
|
||||
case DiagramLegendEnum.BottomLeft:
|
||||
chart.Legend.Top = chartHeight - chart.Legend.Height;
|
||||
chart.Legend.Left = 0;
|
||||
break;
|
||||
case DiagramLegendEnum.BottomRight:
|
||||
chart.Legend.Top = chartHeight - chart.Legend.Height;
|
||||
chart.Legend.Left = chartWidth - chart.Legend.Width;
|
||||
break;
|
||||
}
|
||||
chart.ChartWizard(Source: range, Title: diagramTitle);
|
||||
|
||||
object missing = System.Reflection.Missing.Value;
|
||||
workbook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
public class ExcelImageInfo
|
||||
{
|
||||
public ExcelImageInfo(string path, string title, string[] imagePaths)
|
||||
{
|
||||
this.path = path;
|
||||
this.title = title;
|
||||
this.imagePaths = imagePaths;
|
||||
}
|
||||
|
||||
public string path;
|
||||
public string title;
|
||||
public string[] imagePaths;
|
||||
}
|
||||
}
|
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelImagesComponent.Designer.cs
generated
Normal file
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelImagesComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
partial class ExcelImagesComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using Microsoft.Office.Core;
|
||||
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
public partial class ExcelImagesComponent : Component
|
||||
{
|
||||
public ExcelImagesComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelImagesComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool createWithImages(ExcelImageInfo info)
|
||||
{
|
||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
||||
try
|
||||
{
|
||||
//create
|
||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
||||
|
||||
//header
|
||||
var excelcells = worksheet.get_Range("A1", "D1");
|
||||
excelcells.Merge(Type.Missing);
|
||||
excelcells.Font.Bold = true;
|
||||
excelcells.Font.Size = 14;
|
||||
excelcells.Font.Name = "Times New Roman";
|
||||
excelcells.ColumnWidth = 8;
|
||||
excelcells.RowHeight = 25;
|
||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
||||
excelcells.Value2 = info.title;
|
||||
|
||||
int topOffset = 25;
|
||||
foreach (string path in info.imagePaths)
|
||||
{
|
||||
Bitmap bm = new Bitmap(path);
|
||||
worksheet.Shapes.AddPicture2(path, MsoTriState.msoFalse, MsoTriState.msoCTrue, 0, topOffset, bm.Width, bm.Height, MsoPictureCompress.msoPictureCompressFalse);
|
||||
topOffset += bm.Height;
|
||||
bm.Dispose();
|
||||
}
|
||||
|
||||
//save
|
||||
object missing = System.Reflection.Missing.Value;
|
||||
workbook.SaveAs(info.path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelTableComponent.Designer.cs
generated
Normal file
36
AbazovApp/AbazovViewComponents/LogicalComponents/ExcelTableComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
partial class ExcelTableComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
using Microsoft.Office.Core;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data.Common;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.LogicalComponents
|
||||
{
|
||||
public partial class ExcelTableComponent : Component
|
||||
{
|
||||
public ExcelTableComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelTableComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
string columnName = "";
|
||||
|
||||
while (columnNumber > 0)
|
||||
{
|
||||
int modulo = (columnNumber - 1) % 26;
|
||||
columnName = Convert.ToChar('A' + modulo) + columnName;
|
||||
columnNumber = (columnNumber - modulo) / 26;
|
||||
}
|
||||
|
||||
return columnName;
|
||||
}
|
||||
|
||||
public bool createWithTable<T>(string path, string title, List<(int, int)> merges, List<int> heights, List<(string, string)> headers, List<T> items)
|
||||
{
|
||||
if (merges.Count == 0 || heights.Count == 0 || headers.Count == 0 || items.Count == 0) throw new ArgumentException("Недостаточно данных");
|
||||
int[] cellsArray = new int[heights.Count];
|
||||
foreach (var merge in merges)
|
||||
{
|
||||
if (merge.Item1 >= merge.Item2) throw new ArgumentException("Неправильно заполнены объединения строк");
|
||||
for (int i = merge.Item1; i < merge.Item2; i++)
|
||||
{
|
||||
cellsArray[i]++;
|
||||
}
|
||||
}
|
||||
foreach (int cell in cellsArray)
|
||||
{
|
||||
if (cell > 1) throw new ArgumentException("Объединения заходят друг на друга");
|
||||
}
|
||||
|
||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
||||
try
|
||||
{
|
||||
//create
|
||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
||||
|
||||
//header
|
||||
var excelcells = worksheet.get_Range("A1", "A1");
|
||||
excelcells.Font.Bold = true;
|
||||
excelcells.Font.Size = 14;
|
||||
excelcells.Font.Name = "Times New Roman";
|
||||
excelcells.ColumnWidth = 8;
|
||||
excelcells.RowHeight = 25;
|
||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
||||
excelcells.Value2 = title;
|
||||
|
||||
//checks
|
||||
List<Microsoft.Office.Interop.Excel.Range> ranges = new List<Microsoft.Office.Interop.Excel.Range>();
|
||||
foreach (var merge in merges)
|
||||
{
|
||||
ranges.Add(worksheet.get_Range("A" + (merge.Item1 + 2), "A" + (merge.Item2 + 2)));
|
||||
}
|
||||
|
||||
int rangeIndex = 0;
|
||||
int headerIndex = 0;
|
||||
List<FieldInfo> cellFields = new List<FieldInfo>();
|
||||
var type = typeof(T);
|
||||
for (int i = 0; i < heights.Count; i++)
|
||||
{
|
||||
if (cellsArray[i] == 1)
|
||||
{
|
||||
//work with merge
|
||||
if (!string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
||||
|
||||
var groupRange = ranges[rangeIndex];
|
||||
groupRange.Merge(Type.Missing);
|
||||
groupRange.Font.Bold = true;
|
||||
groupRange.Font.Size = 14;
|
||||
groupRange.Font.Name = "Times New Roman";
|
||||
groupRange.ColumnWidth = 20;
|
||||
groupRange.HorizontalAlignment = Constants.xlCenter;
|
||||
groupRange.VerticalAlignment = Constants.xlCenter;
|
||||
groupRange.Value2 = headers[headerIndex].Item2;
|
||||
headerIndex++;
|
||||
|
||||
//work with cells in merge
|
||||
for (; i <= merges[rangeIndex].Item2; i++)
|
||||
{
|
||||
//work with cell
|
||||
if (string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
||||
var field = type.GetField(headers[headerIndex].Item1);
|
||||
if (field == null) throw new ArgumentException("В заголовках указано поле, которого нет в переданном классе");
|
||||
//format header
|
||||
var range = worksheet.get_Range("B" + (i + 2), "B" + (i + 2));
|
||||
range.Font.Bold = true;
|
||||
range.Font.Size = 14;
|
||||
range.Font.Name = "Times New Roman";
|
||||
range.ColumnWidth = 20;
|
||||
range.RowHeight = heights[i];
|
||||
range.HorizontalAlignment = Constants.xlCenter;
|
||||
range.VerticalAlignment = Constants.xlCenter;
|
||||
range.Value2 = headers[headerIndex].Item2;
|
||||
|
||||
cellFields.Add(field);
|
||||
headerIndex++;
|
||||
}
|
||||
i--;
|
||||
rangeIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//work with cell
|
||||
if (string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
||||
var field = type.GetField(headers[headerIndex].Item1);
|
||||
if (field == null) throw new ArgumentException("В заголовках указано поле, которого нет в переданном классе");
|
||||
//format header
|
||||
var range = worksheet.get_Range("A" + (i + 2), "B" + (i + 2));
|
||||
range.Merge(Type.Missing);
|
||||
range.Font.Bold = true;
|
||||
range.Font.Size = 14;
|
||||
range.Font.Name = "Times New Roman";
|
||||
range.ColumnWidth = 40;
|
||||
range.RowHeight = heights[i];
|
||||
range.HorizontalAlignment = Constants.xlCenter;
|
||||
range.VerticalAlignment = Constants.xlCenter;
|
||||
range.Value2 = headers[headerIndex].Item2;
|
||||
|
||||
cellFields.Add(field);
|
||||
headerIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
int columnNum = 3;
|
||||
foreach (T item in items)
|
||||
{
|
||||
string column = GetExcelColumnName(columnNum);
|
||||
int rowNum = 2;
|
||||
foreach (var cellField in cellFields)
|
||||
{
|
||||
var range = worksheet.get_Range(column + rowNum, column + rowNum);
|
||||
range.Font.Size = 14;
|
||||
range.Font.Name = "Times New Roman";
|
||||
range.ColumnWidth = 20;
|
||||
range.HorizontalAlignment = Constants.xlCenter;
|
||||
range.VerticalAlignment = Constants.xlCenter;
|
||||
range.Value2 = cellField.FieldType == typeof(bool) ? ((bool) cellField.GetValue(item) ? "Да" : "Нет") : cellField.GetValue(item);
|
||||
|
||||
rowNum++;
|
||||
}
|
||||
columnNum++;
|
||||
}
|
||||
var borderRange = worksheet.get_Range("A2", GetExcelColumnName(columnNum-1) + (headerIndex - 1));
|
||||
borderRange.Borders.LineStyle = XlLineStyle.xlContinuous;
|
||||
borderRange.Borders.Weight = 2d;
|
||||
|
||||
//save
|
||||
object missing = System.Reflection.Missing.Value;
|
||||
workbook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
workbook.Close();
|
||||
excelApp.Quit();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
AbazovApp/AccountAppPlugins/AccountAppPlugins.csproj
Normal file
21
AbazovApp/AccountAppPlugins/AccountAppPlugins.csproj
Normal file
@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
184
AbazovApp/AccountAppPlugins/FormMain.Designer.cs
generated
Normal file
184
AbazovApp/AccountAppPlugins/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,184 @@
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AccountAppPlugins
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.ControlsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ActionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ThesaurusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UpdElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DelElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DocsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SimpleDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.TableDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ChartDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panelControl = new System.Windows.Forms.Panel();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ControlsStripMenuItem,
|
||||
this.ActionsToolStripMenuItem,
|
||||
this.DocsToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
|
||||
this.menuStrip.Size = new System.Drawing.Size(914, 30);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "Меню";
|
||||
//
|
||||
// ControlsStripMenuItem
|
||||
//
|
||||
this.ControlsStripMenuItem.Name = "ControlsStripMenuItem";
|
||||
this.ControlsStripMenuItem.Size = new System.Drawing.Size(113, 24);
|
||||
this.ControlsStripMenuItem.Text = "Компоненты";
|
||||
//
|
||||
// ActionsToolStripMenuItem
|
||||
//
|
||||
this.ActionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ThesaurusToolStripMenuItem,
|
||||
this.AddElementToolStripMenuItem,
|
||||
this.UpdElementToolStripMenuItem,
|
||||
this.DelElementToolStripMenuItem});
|
||||
this.ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
|
||||
this.ActionsToolStripMenuItem.Size = new System.Drawing.Size(88, 24);
|
||||
this.ActionsToolStripMenuItem.Text = "Действия";
|
||||
//
|
||||
// ThesaurusToolStripMenuItem
|
||||
//
|
||||
this.ThesaurusToolStripMenuItem.Name = "ThesaurusToolStripMenuItem";
|
||||
this.ThesaurusToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
|
||||
this.ThesaurusToolStripMenuItem.Size = new System.Drawing.Size(223, 26);
|
||||
this.ThesaurusToolStripMenuItem.Text = "Справочник";
|
||||
//
|
||||
// AddElementToolStripMenuItem
|
||||
//
|
||||
this.AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
|
||||
this.AddElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.AddElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26);
|
||||
this.AddElementToolStripMenuItem.Text = "Добавить";
|
||||
//
|
||||
// UpdElementToolStripMenuItem
|
||||
//
|
||||
this.UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
|
||||
this.UpdElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
||||
this.UpdElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26);
|
||||
this.UpdElementToolStripMenuItem.Text = "Изменить";
|
||||
//
|
||||
// DelElementToolStripMenuItem
|
||||
//
|
||||
this.DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
|
||||
this.DelElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||
this.DelElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26);
|
||||
this.DelElementToolStripMenuItem.Text = "Удалить";
|
||||
//
|
||||
// DocsToolStripMenuItem
|
||||
//
|
||||
this.DocsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SimpleDocToolStripMenuItem,
|
||||
this.TableDocToolStripMenuItem,
|
||||
this.ChartDocToolStripMenuItem});
|
||||
this.DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
|
||||
this.DocsToolStripMenuItem.Size = new System.Drawing.Size(101, 24);
|
||||
this.DocsToolStripMenuItem.Text = "Документы";
|
||||
//
|
||||
// SimpleDocToolStripMenuItem
|
||||
//
|
||||
this.SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem";
|
||||
this.SimpleDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.SimpleDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.SimpleDocToolStripMenuItem.Text = "Простой документ";
|
||||
//
|
||||
// TableDocToolStripMenuItem
|
||||
//
|
||||
this.TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
|
||||
this.TableDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
|
||||
this.TableDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.TableDocToolStripMenuItem.Text = "Документ с таблицой";
|
||||
//
|
||||
// ChartDocToolStripMenuItem
|
||||
//
|
||||
this.ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
|
||||
this.ChartDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.ChartDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.ChartDocToolStripMenuItem.Text = "Документ с диаграммой";
|
||||
//
|
||||
// panelControl
|
||||
//
|
||||
this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelControl.Location = new System.Drawing.Point(0, 30);
|
||||
this.panelControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelControl.Name = "panelControl";
|
||||
this.panelControl.Size = new System.Drawing.Size(914, 570);
|
||||
this.panelControl.TabIndex = 1;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(914, 600);
|
||||
this.Controls.Add(this.panelControl);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Главная форма";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem ControlsStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DocsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SimpleDocToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem TableDocToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ChartDocToolStripMenuItem;
|
||||
private System.Windows.Forms.Panel panelControl;
|
||||
private System.Windows.Forms.ToolStripMenuItem ActionsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ThesaurusToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AddElementToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem UpdElementToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DelElementToolStripMenuItem;
|
||||
}
|
||||
}
|
241
AbazovApp/AccountAppPlugins/FormMain.cs
Normal file
241
AbazovApp/AccountAppPlugins/FormMain.cs
Normal file
@ -0,0 +1,241 @@
|
||||
using PluginsConventionLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AccountAppPlugins
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly Dictionary<string, IPluginsConvention> _plugins;
|
||||
private string _selectedPlugin;
|
||||
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
_plugins = new();
|
||||
LoadPlugins();
|
||||
_selectedPlugin = string.Empty;
|
||||
}
|
||||
|
||||
private void LoadPlugins()
|
||||
{
|
||||
List<IPluginsConvention> pluginsList = GetPlugins();
|
||||
|
||||
foreach (var plugin in pluginsList)
|
||||
{
|
||||
_plugins[plugin.PluginName] = plugin;
|
||||
CreateMenuItem(plugin.PluginName);
|
||||
}
|
||||
}
|
||||
|
||||
private List<IPluginsConvention> GetPlugins()
|
||||
{
|
||||
string currentDir = Environment.CurrentDirectory;
|
||||
string pluginsDir = Directory.GetParent(currentDir).Parent.Parent.Parent.FullName + "\\Plugins";
|
||||
string[] dllFiles = Directory.GetFiles(
|
||||
pluginsDir,
|
||||
"*.dll",
|
||||
SearchOption.AllDirectories
|
||||
);
|
||||
List<IPluginsConvention> plugins = new();
|
||||
foreach (string dllFile in dllFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFrom(dllFile);
|
||||
Type[] types = assembly.GetTypes();
|
||||
foreach (Type type in types)
|
||||
{
|
||||
if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface)
|
||||
{
|
||||
if (Activator.CreateInstance(type) is IPluginsConvention plugin)
|
||||
{
|
||||
plugins.Add(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
ex.Message
|
||||
);
|
||||
}
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
|
||||
private void CreateMenuItem(string pluginName)
|
||||
{
|
||||
ToolStripMenuItem menuItem = new(pluginName);
|
||||
menuItem.Click += (object? sender, EventArgs e) =>
|
||||
{
|
||||
UserControl userControl = _plugins[pluginName].GetControl;
|
||||
if (userControl != null)
|
||||
{
|
||||
panelControl.Controls.Clear();
|
||||
userControl.Dock = DockStyle.Fill;
|
||||
_plugins[pluginName].ReloadData();
|
||||
_selectedPlugin = pluginName;
|
||||
panelControl.Controls.Add(userControl);
|
||||
}
|
||||
};
|
||||
ControlsStripMenuItem.DropDownItems.Add(menuItem);
|
||||
}
|
||||
|
||||
private void FormMain_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_selectedPlugin) ||
|
||||
!_plugins.ContainsKey(_selectedPlugin))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!e.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.I:
|
||||
ShowThesaurus();
|
||||
break;
|
||||
case Keys.A:
|
||||
AddNewElement();
|
||||
break;
|
||||
case Keys.U:
|
||||
UpdateElement();
|
||||
break;
|
||||
case Keys.D:
|
||||
DeleteElement();
|
||||
break;
|
||||
case Keys.S:
|
||||
CreateSimpleDoc();
|
||||
break;
|
||||
case Keys.T:
|
||||
CreateTableDoc();
|
||||
break;
|
||||
case Keys.C:
|
||||
CreateChartDoc();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowThesaurus()
|
||||
{
|
||||
_plugins[_selectedPlugin].GetThesaurus()?.Show();
|
||||
}
|
||||
|
||||
private void AddNewElement()
|
||||
{
|
||||
var form = _plugins[_selectedPlugin].GetForm(null);
|
||||
if (form != null && form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateElement()
|
||||
{
|
||||
var element = _plugins[_selectedPlugin].GetElement;
|
||||
if (element == null)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Не выбран элемент для обновления",
|
||||
"Ошибка",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
return;
|
||||
}
|
||||
var form = _plugins[_selectedPlugin].GetForm(element);
|
||||
if (form != null && form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteElement()
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Удалить выбранный элемент?",
|
||||
"Удаление",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var element = _plugins[_selectedPlugin].GetElement;
|
||||
if (element == null)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Не выбран элемент для удаления",
|
||||
"Ошибка",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (_plugins[_selectedPlugin].DeleteElement(element))
|
||||
{
|
||||
_plugins[_selectedPlugin].ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateSimpleDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Excel Files|*.xlsx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
|
||||
}
|
||||
}
|
||||
private void CreateTableDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Word Files|*.docx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
|
||||
}
|
||||
}
|
||||
private void CreateChartDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "PDF Files|*.pdf"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
}
|
||||
}
|
||||
|
||||
private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
|
||||
private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();
|
||||
private void UpdElementToolStripMenuItem_Click(object sender, EventArgs e) => UpdateElement();
|
||||
private void DelElementToolStripMenuItem_Click(object sender, EventArgs e) => DeleteElement();
|
||||
private void SimpleDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateSimpleDoc();
|
||||
private void TableDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateTableDoc();
|
||||
private void ChartDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateChartDoc();
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
63
AbazovApp/AccountAppPlugins/FormMain.resx
Normal file
63
AbazovApp/AccountAppPlugins/FormMain.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
17
AbazovApp/AccountAppPlugins/Program.cs
Normal file
17
AbazovApp/AccountAppPlugins/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace AccountAppPlugins
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
}
|
||||
}
|
52
AbazovApp/AccountsApp/AccountsApp.csproj
Normal file
52
AbazovApp/AccountsApp/AccountsApp.csproj
Normal file
@ -0,0 +1,52 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NevaevaLibrary" Version="2.0.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AbazovViewComponents\AbazovViewComponents.csproj" />
|
||||
<ProjectReference Include="..\AccountsBusinessLogic\AccountsBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\AccountsDataBaseImplement\AccountsDataBaseImplement.csproj" />
|
||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CreatePluginsFolder" BeforeTargets="PreBuildEvent" Condition="!Exists('$(SolutionDir)Plugins')">
|
||||
<MakeDir Directories="$(SolutionDir)Plugins" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CopyPlugins" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)Plugins\*.dll"" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
193
AbazovApp/AccountsApp/FormAccount.Designer.cs
generated
Normal file
193
AbazovApp/AccountsApp/FormAccount.Designer.cs
generated
Normal file
@ -0,0 +1,193 @@
|
||||
namespace AccountsApp
|
||||
{
|
||||
partial class FormAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBoxLogin = new System.Windows.Forms.TextBox();
|
||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.mailControl = new NevaevaLibrary.MailControl();
|
||||
this.abazovCheckedListBox = new AbazovViewComponents.Components.AbazovCheckedListBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.buttonAvatar = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(52, 20);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Логин";
|
||||
//
|
||||
// textBoxLogin
|
||||
//
|
||||
this.textBoxLogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxLogin.Location = new System.Drawing.Point(12, 32);
|
||||
this.textBoxLogin.Name = "textBoxLogin";
|
||||
this.textBoxLogin.Size = new System.Drawing.Size(389, 27);
|
||||
this.textBoxLogin.TabIndex = 1;
|
||||
//
|
||||
// textBoxPassword
|
||||
//
|
||||
this.textBoxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxPassword.Location = new System.Drawing.Point(12, 86);
|
||||
this.textBoxPassword.Name = "textBoxPassword";
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(389, 27);
|
||||
this.textBoxPassword.TabIndex = 3;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 63);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(62, 20);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Пароль";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 116);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(51, 20);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Почта";
|
||||
//
|
||||
// mailControl
|
||||
//
|
||||
this.mailControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.mailControl.Email = null;
|
||||
this.mailControl.Location = new System.Drawing.Point(12, 139);
|
||||
this.mailControl.Name = "mailControl";
|
||||
this.mailControl.Size = new System.Drawing.Size(389, 42);
|
||||
this.mailControl.TabIndex = 5;
|
||||
this.mailControl.validateEmailRegex = null;
|
||||
//
|
||||
// abazovCheckedListBox
|
||||
//
|
||||
this.abazovCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.abazovCheckedListBox.Location = new System.Drawing.Point(12, 207);
|
||||
this.abazovCheckedListBox.Name = "abazovCheckedListBox";
|
||||
this.abazovCheckedListBox.selectedItem = null;
|
||||
this.abazovCheckedListBox.Size = new System.Drawing.Size(389, 130);
|
||||
this.abazovCheckedListBox.TabIndex = 6;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 184);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(78, 20);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "Интересы";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(12, 420);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonSave.TabIndex = 8;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(307, 420);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonCancel.TabIndex = 9;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
this.openFileDialog.FileName = "openFileDialog1";
|
||||
//
|
||||
// buttonAvatar
|
||||
//
|
||||
this.buttonAvatar.Location = new System.Drawing.Point(12, 343);
|
||||
this.buttonAvatar.Name = "buttonAvatar";
|
||||
this.buttonAvatar.Size = new System.Drawing.Size(389, 29);
|
||||
this.buttonAvatar.TabIndex = 10;
|
||||
this.buttonAvatar.Text = "Выбрать аватар";
|
||||
this.buttonAvatar.UseVisualStyleBackColor = true;
|
||||
this.buttonAvatar.Click += new System.EventHandler(this.buttonAvatar_Click);
|
||||
//
|
||||
// FormAccount
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(413, 461);
|
||||
this.Controls.Add(this.buttonAvatar);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.abazovCheckedListBox);
|
||||
this.Controls.Add(this.mailControl);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.textBoxPassword);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBoxLogin);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "FormAccount";
|
||||
this.Text = "Аккаунт";
|
||||
this.Load += new System.EventHandler(this.FormAccount_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private TextBox textBoxLogin;
|
||||
private TextBox textBoxPassword;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private NevaevaLibrary.MailControl mailControl;
|
||||
private AbazovViewComponents.Components.AbazovCheckedListBox abazovCheckedListBox;
|
||||
private Label label4;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private Button buttonAvatar;
|
||||
}
|
||||
}
|
130
AbazovApp/AccountsApp/FormAccount.cs
Normal file
130
AbazovApp/AccountsApp/FormAccount.cs
Normal file
@ -0,0 +1,130 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AccountsApp
|
||||
{
|
||||
public partial class FormAccount : Form
|
||||
{
|
||||
private int? _id;
|
||||
private readonly IAccountLogic _logic;
|
||||
private readonly IInterestLogic _interestLogic;
|
||||
private List<InterestViewModel> _interests;
|
||||
private string? avatar = null;
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
public FormAccount(IAccountLogic logic, IInterestLogic interestLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
_interestLogic = interestLogic;
|
||||
_interests = new List<InterestViewModel>();
|
||||
}
|
||||
|
||||
private void FormAccount_Load(object sender, EventArgs e)
|
||||
{
|
||||
_interests = _interestLogic.ReadList(null);
|
||||
abazovCheckedListBox.addItems(_interests.Select(x => x.Name).ToList());
|
||||
mailControl.validateEmailRegex = new System.Text.RegularExpressions.Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
|
||||
mailControl.setTooltipText("name@example.com");
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new AccountSearchModel { Id = _id.Value });
|
||||
if (view != null)
|
||||
{
|
||||
textBoxLogin.Text = view.Login;
|
||||
textBoxPassword.Text = view.Password;
|
||||
mailControl.Email = view.Email;
|
||||
avatar = view.Avatar;
|
||||
|
||||
abazovCheckedListBox.selectedItem = view.InterestName;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxLogin.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxPassword.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(mailControl.Email))
|
||||
{
|
||||
MessageBox.Show("Заполните почту или исправьте написание почты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (abazovCheckedListBox.selectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Заполните интересы", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (avatar == null)
|
||||
{
|
||||
MessageBox.Show("Выберите аватар", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var model = new AccountBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
Login = textBoxLogin.Text,
|
||||
Password = textBoxPassword.Text,
|
||||
Email = mailControl.Email,
|
||||
InterestId = _interests.First(x => x.Name == abazovCheckedListBox.selectedItem).Id,
|
||||
Avatar = avatar
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAvatar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() != DialogResult.Cancel)
|
||||
{
|
||||
avatar = openFileDialog.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
63
AbazovApp/AccountsApp/FormAccount.resx
Normal file
63
AbazovApp/AccountsApp/FormAccount.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
90
AbazovApp/AccountsApp/FormInterests.Designer.cs
generated
Normal file
90
AbazovApp/AccountsApp/FormInterests.Designer.cs
generated
Normal file
@ -0,0 +1,90 @@
|
||||
namespace AccountsApp
|
||||
{
|
||||
partial class FormInterests
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.NameCol = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.NameCol,
|
||||
this.Id});
|
||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dataGridView.Location = new System.Drawing.Point(0, 0);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(613, 304);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
this.dataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellValueChanged);
|
||||
this.dataGridView.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.dataGridView_UserDeletingRow);
|
||||
this.dataGridView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.dataGridView_KeyUp);
|
||||
//
|
||||
// NameCol
|
||||
//
|
||||
this.NameCol.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.NameCol.HeaderText = "Название";
|
||||
this.NameCol.MinimumWidth = 6;
|
||||
this.NameCol.Name = "NameCol";
|
||||
//
|
||||
// Id
|
||||
//
|
||||
this.Id.HeaderText = "Id";
|
||||
this.Id.MinimumWidth = 6;
|
||||
this.Id.Name = "Id";
|
||||
this.Id.Visible = false;
|
||||
this.Id.Width = 125;
|
||||
//
|
||||
// FormInterests
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(613, 304);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormInterests";
|
||||
this.Text = "Интересы";
|
||||
this.Load += new System.EventHandler(this.FormInterests_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn NameCol;
|
||||
private DataGridViewTextBoxColumn Id;
|
||||
}
|
||||
}
|
104
AbazovApp/AccountsApp/FormInterests.cs
Normal file
104
AbazovApp/AccountsApp/FormInterests.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AccountsApp
|
||||
{
|
||||
public partial class FormInterests : Form
|
||||
{
|
||||
private readonly IInterestLogic _logic;
|
||||
private bool loading = false;
|
||||
|
||||
public FormInterests(IInterestLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormInterests_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
loading = true;
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var interest in list)
|
||||
{
|
||||
int rowIndex = dataGridView.Rows.Add();
|
||||
dataGridView.Rows[rowIndex].Cells[0].Value = interest.Name;
|
||||
dataGridView.Rows[rowIndex].Cells[1].Value = interest.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (loading || e.RowIndex < 0 || e.ColumnIndex != 0) return;
|
||||
if (dataGridView.Rows[e.RowIndex].Cells[1].Value != null && !string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()))
|
||||
{
|
||||
var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if (name is null) return;
|
||||
_logic.Update(new InterestBindingModel { Id = Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells[1].Value), Name = name.ToString() });
|
||||
}
|
||||
else
|
||||
{
|
||||
var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if (name is null) return;
|
||||
_logic.Create(new InterestBindingModel { Id = 0, Name = name.ToString() });
|
||||
int newInterestId = _logic.ReadList(null).ToList().Last().Id;
|
||||
dataGridView.Rows[e.RowIndex].Cells[1].Value = newInterestId;
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Insert:
|
||||
dataGridView.Rows.Add();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteRows(DataGridViewSelectedRowCollection rows)
|
||||
{
|
||||
for (int i = 0; i < rows.Count; i++)
|
||||
{
|
||||
DataGridViewRow row = rows[i];
|
||||
if (!_logic.Delete(new InterestBindingModel { Id = Convert.ToInt32(row.Cells[1].Value) })) continue;
|
||||
dataGridView.Rows.Remove(row);
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
if (dataGridView.SelectedRows == null) return;
|
||||
if (MessageBox.Show("Удалить записи?", "Подтвердите действие", MessageBoxButtons.YesNo) == DialogResult.No) return;
|
||||
deleteRows(dataGridView.SelectedRows);
|
||||
}
|
||||
}
|
||||
}
|
66
AbazovApp/AccountsApp/FormInterests.resx
Normal file
66
AbazovApp/AccountsApp/FormInterests.resx
Normal file
@ -0,0 +1,66 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="NameCol.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
181
AbazovApp/AccountsApp/FormMain.Designer.cs
generated
Normal file
181
AbazovApp/AccountsApp/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,181 @@
|
||||
namespace AccountsApp
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.аккаунтыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.создатьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.редактироватьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.удалитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.документToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.документСТаблицейToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.документСДиаграммойToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.интересыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.controlDataTable = new ControlsLibraryNet60.Data.ControlDataTableTable();
|
||||
this.excelImagesComponent = new AbazovViewComponents.LogicalComponents.ExcelImagesComponent(this.components);
|
||||
this.wordTableComponentAccount = new NevaevaLibrary.LogicalComponents.WordTableComponent(this.components);
|
||||
this.componentDocumentWithChartBarPdf = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarPdf(this.components);
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.аккаунтыToolStripMenuItem,
|
||||
this.отчётыToolStripMenuItem,
|
||||
this.интересыToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(800, 28);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// аккаунтыToolStripMenuItem
|
||||
//
|
||||
this.аккаунтыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.создатьToolStripMenuItem,
|
||||
this.редактироватьToolStripMenuItem,
|
||||
this.удалитьToolStripMenuItem});
|
||||
this.аккаунтыToolStripMenuItem.Name = "аккаунтыToolStripMenuItem";
|
||||
this.аккаунтыToolStripMenuItem.Size = new System.Drawing.Size(88, 24);
|
||||
this.аккаунтыToolStripMenuItem.Text = "Аккаунты";
|
||||
//
|
||||
// создатьToolStripMenuItem
|
||||
//
|
||||
this.создатьToolStripMenuItem.Name = "создатьToolStripMenuItem";
|
||||
this.создатьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.создатьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
|
||||
this.создатьToolStripMenuItem.Text = "Создать";
|
||||
this.создатьToolStripMenuItem.Click += new System.EventHandler(this.создатьToolStripMenuItem_Click);
|
||||
//
|
||||
// редактироватьToolStripMenuItem
|
||||
//
|
||||
this.редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
|
||||
this.редактироватьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
||||
this.редактироватьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
|
||||
this.редактироватьToolStripMenuItem.Text = "Редактировать";
|
||||
this.редактироватьToolStripMenuItem.Click += new System.EventHandler(this.редактироватьToolStripMenuItem_Click);
|
||||
//
|
||||
// удалитьToolStripMenuItem
|
||||
//
|
||||
this.удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
|
||||
this.удалитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||
this.удалитьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
|
||||
this.удалитьToolStripMenuItem.Text = "Удалить";
|
||||
this.удалитьToolStripMenuItem.Click += new System.EventHandler(this.удалитьToolStripMenuItem_Click);
|
||||
//
|
||||
// отчётыToolStripMenuItem
|
||||
//
|
||||
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.документToolStripMenuItem,
|
||||
this.документСТаблицейToolStripMenuItem,
|
||||
this.документСДиаграммойToolStripMenuItem});
|
||||
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
||||
this.отчётыToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// документToolStripMenuItem
|
||||
//
|
||||
this.документToolStripMenuItem.Name = "документToolStripMenuItem";
|
||||
this.документToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.документToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.документToolStripMenuItem.Text = "Документ";
|
||||
this.документToolStripMenuItem.Click += new System.EventHandler(this.документToolStripMenuItem_Click);
|
||||
//
|
||||
// документСТаблицейToolStripMenuItem
|
||||
//
|
||||
this.документСТаблицейToolStripMenuItem.Name = "документСТаблицейToolStripMenuItem";
|
||||
this.документСТаблицейToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
|
||||
this.документСТаблицейToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.документСТаблицейToolStripMenuItem.Text = "Документ с таблицей";
|
||||
this.документСТаблицейToolStripMenuItem.Click += new System.EventHandler(this.документСТаблицейToolStripMenuItem_Click);
|
||||
//
|
||||
// документСДиаграммойToolStripMenuItem
|
||||
//
|
||||
this.документСДиаграммойToolStripMenuItem.Name = "документСДиаграммойToolStripMenuItem";
|
||||
this.документСДиаграммойToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.документСДиаграммойToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
|
||||
this.документСДиаграммойToolStripMenuItem.Text = "Документ с диаграммой";
|
||||
this.документСДиаграммойToolStripMenuItem.Click += new System.EventHandler(this.документСДиаграммойToolStripMenuItem_Click);
|
||||
//
|
||||
// интересыToolStripMenuItem
|
||||
//
|
||||
this.интересыToolStripMenuItem.Name = "интересыToolStripMenuItem";
|
||||
this.интересыToolStripMenuItem.Size = new System.Drawing.Size(92, 24);
|
||||
this.интересыToolStripMenuItem.Text = "Интересы";
|
||||
this.интересыToolStripMenuItem.Click += new System.EventHandler(this.интересыToolStripMenuItem_Click);
|
||||
//
|
||||
// controlDataTable
|
||||
//
|
||||
this.controlDataTable.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.controlDataTable.Location = new System.Drawing.Point(0, 28);
|
||||
this.controlDataTable.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.controlDataTable.Name = "controlDataTable";
|
||||
this.controlDataTable.SelectedRowIndex = -1;
|
||||
this.controlDataTable.Size = new System.Drawing.Size(800, 422);
|
||||
this.controlDataTable.TabIndex = 2;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.controlDataTable);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Аккаунты";
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem аккаунтыToolStripMenuItem;
|
||||
private ToolStripMenuItem создатьToolStripMenuItem;
|
||||
private ToolStripMenuItem редактироватьToolStripMenuItem;
|
||||
private ToolStripMenuItem удалитьToolStripMenuItem;
|
||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||
private ToolStripMenuItem документToolStripMenuItem;
|
||||
private ToolStripMenuItem документСТаблицейToolStripMenuItem;
|
||||
private ToolStripMenuItem документСДиаграммойToolStripMenuItem;
|
||||
private ToolStripMenuItem интересыToolStripMenuItem;
|
||||
private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTable;
|
||||
private AbazovViewComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
||||
private NevaevaLibrary.LogicalComponents.WordTableComponent wordTableComponentAccount;
|
||||
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarPdf componentDocumentWithChartBarPdf;
|
||||
}
|
||||
}
|
162
AbazovApp/AccountsApp/FormMain.cs
Normal file
162
AbazovApp/AccountsApp/FormMain.cs
Normal file
@ -0,0 +1,162 @@
|
||||
using AbazovViewComponents.LogicalComponents;
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using ComponentsLibraryNet60.Models;
|
||||
using ControlsLibraryNet60.Core;
|
||||
using ControlsLibraryNet60.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AccountsApp
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private IAccountLogic _logic;
|
||||
|
||||
public FormMain(IAccountLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
controlDataTable.LoadColumns(new List<DataTableColumnConfig> {
|
||||
new DataTableColumnConfig { ColumnHeader = "", PropertyName = "Id", Visible = false, Width = 10},
|
||||
new DataTableColumnConfig { ColumnHeader = "Логин", PropertyName = "Login", Visible = true, Width = 200},
|
||||
new DataTableColumnConfig { ColumnHeader = "Выбранный интерес", PropertyName = "InterestName", Visible = true, Width = 200},
|
||||
new DataTableColumnConfig { ColumnHeader = "Email", PropertyName = "Email", Visible = true, Width = 200},
|
||||
});
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
}
|
||||
|
||||
private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormAccount));
|
||||
if (service is FormAccount form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void интересыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormInterests));
|
||||
if (service is FormInterests form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
controlDataTable.Clear();
|
||||
var accounts = _logic.ReadList(null);
|
||||
if (accounts != null)
|
||||
{
|
||||
controlDataTable.AddTable(accounts);
|
||||
}
|
||||
}
|
||||
|
||||
private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormAccount));
|
||||
if (service is FormAccount form)
|
||||
{
|
||||
form.Id = controlDataTable.GetSelectedObject<AccountViewModel>().Id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
if (_logic.Delete(new AccountBindingModel { Id = controlDataTable.GetSelectedObject<AccountViewModel>().Id }))
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void документToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Excel Files|*.xlsx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
|
||||
List<string> avatars = new List<string>();
|
||||
foreach (var account in _logic.ReadList(null))
|
||||
{
|
||||
avatars.Add(account.Avatar);
|
||||
}
|
||||
string path = saveFileDialog.FileName;
|
||||
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Аватары", avatars.ToArray()))) MessageBox.Show("Документ создан");
|
||||
}
|
||||
|
||||
private void документСДиаграммойToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "PDF Files|*.pdf"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
|
||||
string path = saveFileDialog.FileName;
|
||||
Dictionary<string, List<(int, double)>> data = new Dictionary<string, List<(int, double)>>();
|
||||
|
||||
data = _logic
|
||||
.ReadList(null)
|
||||
.GroupBy(x => x.InterestName)
|
||||
.ToDictionary(x => x.Key, x => new List<(int, double)> { (0, x.Count())});
|
||||
|
||||
componentDocumentWithChartBarPdf.CreateDoc(new ComponentDocumentWithChartConfig
|
||||
{
|
||||
Header = "Интересы",
|
||||
FilePath = path,
|
||||
ChartTitle = "Интересы",
|
||||
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
|
||||
Data = data,
|
||||
});
|
||||
|
||||
MessageBox.Show("Успех");
|
||||
}
|
||||
|
||||
private void документСТаблицейToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Word Files|*.docx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
|
||||
string path = saveFileDialog.FileName;
|
||||
List<(int, int)> merges = new List<(int, int)> { (1, 2) };
|
||||
List<int> widths = new List<int> { 100, 100, 100, 100 };
|
||||
List<(string, string)> headers = new List<(string, string)> {
|
||||
("Id", "Идентификатор"),
|
||||
("", "Личные данные"),
|
||||
("Login", "Логин"),
|
||||
("Email", "Эл. почта"),
|
||||
("InterestName", "Выбранный интерес")
|
||||
};
|
||||
|
||||
wordTableComponentAccount.createWithTable(path, "Список аккаунтов", merges, widths, headers, _logic.ReadList(null));
|
||||
MessageBox.Show("Успех");
|
||||
}
|
||||
}
|
||||
}
|
75
AbazovApp/AccountsApp/FormMain.resx
Normal file
75
AbazovApp/AccountsApp/FormMain.resx
Normal file
@ -0,0 +1,75 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelImagesComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>162, 27</value>
|
||||
</metadata>
|
||||
<metadata name="wordTableComponentAccount.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>378, 27</value>
|
||||
</metadata>
|
||||
<metadata name="componentDocumentWithChartBarPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>639, 27</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>137</value>
|
||||
</metadata>
|
||||
</root>
|
175
AbazovApp/AccountsApp/PluginsConvention.cs
Normal file
175
AbazovApp/AccountsApp/PluginsConvention.cs
Normal file
@ -0,0 +1,175 @@
|
||||
using AbazovViewComponents.LogicalComponents;
|
||||
using AccountsBusinessLogic.BusinessLogics;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataBaseImplement.Implements;
|
||||
using ComponentsLibraryNet60.DocumentWithChart;
|
||||
using ComponentsLibraryNet60.Models;
|
||||
using ControlsLibraryNet60.Core;
|
||||
using ControlsLibraryNet60.Data;
|
||||
using ControlsLibraryNet60.Models;
|
||||
using NevaevaLibrary.LogicalComponents;
|
||||
using PluginsConventionLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsApp
|
||||
{
|
||||
public class PluginsConvention : IPluginsConvention
|
||||
{
|
||||
private readonly IAccountLogic _accountLogic;
|
||||
private readonly IInterestLogic _interestLogic;
|
||||
private readonly ControlDataTableTable _controlDataTable;
|
||||
private readonly ExcelImagesComponent _excelImagesComponent;
|
||||
private readonly WordTableComponent _wordTableComponent;
|
||||
private readonly ComponentDocumentWithChartBarPdf _chartBar;
|
||||
public string PluginName { get; set; } = "LabWork_03_plugin";
|
||||
|
||||
public UserControl GetControl
|
||||
{
|
||||
get { return _controlDataTable; }
|
||||
}
|
||||
|
||||
public PluginsConvention()
|
||||
{
|
||||
_accountLogic = new AccountLogic(new AccountStorage());
|
||||
_interestLogic = new InterestLogic(new InterestStorage());
|
||||
_excelImagesComponent = new();
|
||||
_wordTableComponent = new();
|
||||
_chartBar = new();
|
||||
_controlDataTable = new();
|
||||
}
|
||||
|
||||
public PluginsConventionElement GetElement
|
||||
{
|
||||
get
|
||||
{
|
||||
int Id = _controlDataTable.GetSelectedObject<AccountViewModel>()!.Id;
|
||||
byte[] bytes = new byte[16];
|
||||
BitConverter.GetBytes(Id).CopyTo(bytes, 0);
|
||||
Guid guid = new Guid(bytes);
|
||||
return new PluginsConventionElement() { Id = guid };
|
||||
}
|
||||
}
|
||||
|
||||
public Form GetForm(PluginsConventionElement element)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
return new FormAccount(_accountLogic, _interestLogic);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormAccount form = new FormAccount(_accountLogic, _interestLogic);
|
||||
form.Id = element.Id.GetHashCode();
|
||||
return form;
|
||||
}
|
||||
}
|
||||
|
||||
public Form GetThesaurus()
|
||||
{
|
||||
return new FormInterests(_interestLogic);
|
||||
}
|
||||
|
||||
public bool DeleteElement(PluginsConventionElement element)
|
||||
{
|
||||
_accountLogic.Delete(
|
||||
new AccountsContracts.BindingModels.AccountBindingModel { Id = element.Id.GetHashCode()}
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ReloadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var account = _accountLogic.ReadList(null);
|
||||
if (account != null)
|
||||
{
|
||||
_controlDataTable.Clear();
|
||||
|
||||
_controlDataTable.LoadColumns(new List<DataTableColumnConfig> {
|
||||
new DataTableColumnConfig { ColumnHeader = "", PropertyName = "Id", Visible = false, Width = 10},
|
||||
new DataTableColumnConfig { ColumnHeader = "Логин", PropertyName = "Login", Visible = true, Width = 200},
|
||||
new DataTableColumnConfig { ColumnHeader = "Выбранный интерес", PropertyName = "InterestName", Visible = true, Width = 200},
|
||||
new DataTableColumnConfig { ColumnHeader = "Email", PropertyName = "Email", Visible = true, Width = 200},
|
||||
});
|
||||
|
||||
_controlDataTable.AddTable(account);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
ex.Message,
|
||||
"Ошибка",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
List<string> avatars = new List<string>();
|
||||
foreach (var account in _accountLogic.ReadList(null))
|
||||
{
|
||||
avatars.Add(account.Avatar);
|
||||
}
|
||||
string path = saveDocument.FileName;
|
||||
if (_excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Аватары", avatars.ToArray())))
|
||||
{
|
||||
MessageBox.Show("Документ создан");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
string path = saveDocument.FileName;
|
||||
List<(int, int)> merges = new List<(int, int)> { (1, 2) };
|
||||
List<int> widths = new List<int> { 100, 100, 100, 100 };
|
||||
List<(string, string)> headers = new List<(string, string)> {
|
||||
("Id", "Идентификатор"),
|
||||
("", "Личные данные"),
|
||||
("Login", "Логин"),
|
||||
("Email", "Эл. почта"),
|
||||
("InterestName", "Выбранный интерес")
|
||||
};
|
||||
|
||||
_wordTableComponent.createWithTable(path, "Список аккаунтов", merges, widths, headers, _accountLogic.ReadList(null));
|
||||
MessageBox.Show("Документ создан");
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
||||
string path = saveDocument.FileName;
|
||||
Dictionary<string, List<(int, double)>> data = new Dictionary<string, List<(int, double)>>();
|
||||
|
||||
data = _accountLogic
|
||||
.ReadList(null)
|
||||
.GroupBy(x => x.InterestName)
|
||||
.ToDictionary(x => x.Key, x => new List<(int, double)> { (0, x.Count()) });
|
||||
|
||||
_chartBar.CreateDoc(new ComponentDocumentWithChartConfig
|
||||
{
|
||||
Header = "Интересы",
|
||||
FilePath = path,
|
||||
ChartTitle = "Интересы",
|
||||
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
|
||||
Data = data,
|
||||
});
|
||||
|
||||
MessageBox.Show("Успех");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
41
AbazovApp/AccountsApp/Program.cs
Normal file
41
AbazovApp/AccountsApp/Program.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using AccountsBusinessLogic.BusinessLogics;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsDataBaseImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace AccountsApp
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddTransient<IInterestStorage, InterestStorage>();
|
||||
services.AddTransient<IAccountStorage, AccountStorage>();
|
||||
services.AddTransient<IInterestLogic, InterestLogic>();
|
||||
services.AddTransient<IAccountLogic, AccountLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormAccount>();
|
||||
services.AddTransient<FormInterests>();
|
||||
}
|
||||
}
|
||||
}
|
63
AbazovApp/AccountsApp/Properties/Resources.Designer.cs
generated
Normal file
63
AbazovApp/AccountsApp/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AccountsApp.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AccountsApp.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
AbazovApp/AccountsBusinessLogic/AccountsBusinessLogic.csproj
Normal file
13
AbazovApp/AccountsBusinessLogic/AccountsBusinessLogic.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AccountsContracts\AccountsContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
100
AbazovApp/AccountsBusinessLogic/BusinessLogics/AccountLogic.cs
Normal file
100
AbazovApp/AccountsBusinessLogic/BusinessLogics/AccountLogic.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class AccountLogic : IAccountLogic
|
||||
{
|
||||
private readonly IAccountStorage _accountStorage;
|
||||
|
||||
public AccountLogic(IAccountStorage accountStorage)
|
||||
{
|
||||
_accountStorage = accountStorage;
|
||||
}
|
||||
|
||||
public List<AccountViewModel>? ReadList(AccountSearchModel? model)
|
||||
{
|
||||
var list = model == null ? _accountStorage.GetFullList() : _accountStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public AccountViewModel? ReadElement(AccountSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _accountStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(AccountBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_accountStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(AccountBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_accountStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(AccountBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_accountStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(AccountBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина пользователя", nameof(model.Login));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
throw new ArgumentNullException("Нет электронной почты пользователя", nameof(model.Email));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.BusinessLogicContracts;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class InterestLogic : IInterestLogic
|
||||
{
|
||||
private readonly IInterestStorage _interestStorage;
|
||||
|
||||
public InterestLogic(IInterestStorage interestStorage)
|
||||
{
|
||||
_interestStorage = interestStorage;
|
||||
}
|
||||
|
||||
public List<InterestViewModel>? ReadList(InterestSearchModel? model)
|
||||
{
|
||||
var list = model == null ? _interestStorage.GetFullList() : _interestStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public InterestViewModel? ReadElement(InterestSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _interestStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_interestStorage.Insert(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_interestStorage.Update(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_interestStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(InterestBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия интереса", nameof(model.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
AbazovApp/AccountsContracts/AccountsContracts.csproj
Normal file
13
AbazovApp/AccountsContracts/AccountsContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AccountsDataModels\AccountsDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,24 @@
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.BindingModels
|
||||
{
|
||||
public class AccountBindingModel : IAccountModel
|
||||
{
|
||||
public string Login { get; set; } = string.Empty;
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public int InterestId { get; set; }
|
||||
|
||||
public string Avatar { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.BindingModels
|
||||
{
|
||||
public class InterestBindingModel : IInterestModel
|
||||
{
|
||||
public string Name { get; set;} = String.Empty;
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IAccountLogic
|
||||
{
|
||||
List<AccountViewModel>? ReadList(AccountSearchModel? model);
|
||||
AccountViewModel? ReadElement(AccountSearchModel model);
|
||||
bool Create(AccountBindingModel model);
|
||||
bool Update(AccountBindingModel model);
|
||||
bool Delete(AccountBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IInterestLogic
|
||||
{
|
||||
List<InterestViewModel>? ReadList(InterestSearchModel? model);
|
||||
InterestViewModel? ReadElement(InterestSearchModel model);
|
||||
bool Create(InterestBindingModel model);
|
||||
bool Update(InterestBindingModel model);
|
||||
bool Delete(InterestBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.SearchModels
|
||||
{
|
||||
public class AccountSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.SearchModels
|
||||
{
|
||||
public class InterestSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.StorageContracts
|
||||
{
|
||||
public interface IAccountStorage
|
||||
{
|
||||
List<AccountViewModel> GetFullList();
|
||||
List<AccountViewModel> GetFilteredList(AccountSearchModel model);
|
||||
AccountViewModel? GetElement(AccountSearchModel model);
|
||||
AccountViewModel? Insert(AccountBindingModel model);
|
||||
AccountViewModel? Update(AccountBindingModel model);
|
||||
AccountViewModel? Delete(AccountBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.StorageContracts
|
||||
{
|
||||
public interface IInterestStorage
|
||||
{
|
||||
List<InterestViewModel> GetFullList();
|
||||
List<InterestViewModel> GetFilteredList(InterestSearchModel model);
|
||||
InterestViewModel? GetElement(InterestSearchModel model);
|
||||
InterestViewModel? Insert(InterestBindingModel model);
|
||||
InterestViewModel? Update(InterestBindingModel model);
|
||||
InterestViewModel? Delete(InterestBindingModel model);
|
||||
}
|
||||
}
|
24
AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs
Normal file
24
AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.ViewModels
|
||||
{
|
||||
public class AccountViewModel : IAccountModel
|
||||
{
|
||||
[DisplayName("Почта")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Электронная почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
public int InterestId { get; set; }
|
||||
public string InterestName { get; set; } = string.Empty;
|
||||
public string Avatar { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
17
AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs
Normal file
17
AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsContracts.ViewModels
|
||||
{
|
||||
public class InterestViewModel : IInterestModel
|
||||
{
|
||||
[DisplayName("Название")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AccountsContracts\AccountsContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
19
AbazovApp/AccountsDataBaseImplement/AccountsDatabase.cs
Normal file
19
AbazovApp/AccountsDataBaseImplement/AccountsDatabase.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using AccountsDataBaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataBaseImplement
|
||||
{
|
||||
public class AccountsDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
=> optionsBuilder.UseNpgsql("Host=localhost;Database=AccountsDB;Username=postgres;Password=postgres");
|
||||
|
||||
public virtual DbSet<Account> Accounts { set; get; }
|
||||
public virtual DbSet<Interest> Interests { set; get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataBaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataBaseImplement.Implements
|
||||
{
|
||||
public class AccountStorage : IAccountStorage
|
||||
{
|
||||
public List<AccountViewModel> GetFullList()
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Accounts
|
||||
.Include(x => x.Interest)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<AccountViewModel> GetFilteredList(AccountSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Accounts
|
||||
.Include(x => x.Interest)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public AccountViewModel? GetElement(AccountSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Accounts
|
||||
.Include(x => x.Interest)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
public AccountViewModel? Insert(AccountBindingModel model)
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
var newAccount = Account.Create(context, model);
|
||||
if (newAccount == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Accounts.Add(newAccount);
|
||||
context.SaveChanges();
|
||||
return newAccount.GetViewModel;
|
||||
}
|
||||
public AccountViewModel? Update(AccountBindingModel model)
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
var account = context.Accounts.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (account == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
account.Update(model, context);
|
||||
context.SaveChanges();
|
||||
return account.GetViewModel;
|
||||
}
|
||||
public AccountViewModel? Delete(AccountBindingModel model)
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
var element = context.Accounts
|
||||
.Include(x => x.Interest)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Accounts.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.SearchModels;
|
||||
using AccountsContracts.StorageContracts;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataBaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataBaseImplement.Implements
|
||||
{
|
||||
public class InterestStorage : IInterestStorage
|
||||
{
|
||||
public List<InterestViewModel> GetFullList()
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Interests
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<InterestViewModel> GetFilteredList(InterestSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Interests
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public InterestViewModel? GetElement(InterestSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AccountsDatabase();
|
||||
return context.Interests
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
public InterestViewModel? Insert(InterestBindingModel model)
|
||||
{
|
||||
var newInterest = Interest.Create(model);
|
||||
if (newInterest == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AccountsDatabase();
|
||||
context.Interests.Add(newInterest);
|
||||
context.SaveChanges();
|
||||
return newInterest.GetViewModel;
|
||||
}
|
||||
public InterestViewModel? Update(InterestBindingModel model)
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
var component = context.Interests.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (component == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
component.Update(model);
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
public InterestViewModel? Delete(InterestBindingModel model)
|
||||
{
|
||||
using var context = new AccountsDatabase();
|
||||
var element = context.Interests.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Interests.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
87
AbazovApp/AccountsDataBaseImplement/Migrations/20231129182743_InitialCreate.Designer.cs
generated
Normal file
87
AbazovApp/AccountsDataBaseImplement/Migrations/20231129182743_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,87 @@
|
||||
// <auto-generated />
|
||||
using AccountsDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountsDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AccountsDatabase))]
|
||||
[Migration("20231129182743_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Interests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("AccountsDataBaseImplement.Models.Interest", "Interest")
|
||||
.WithMany()
|
||||
.HasForeignKey("InterestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Interest");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountsDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Interests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Interests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
InterestId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_Interests_InterestId",
|
||||
column: x => x.InterestId,
|
||||
principalTable: "Interests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_InterestId",
|
||||
table: "Accounts",
|
||||
column: "InterestId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Interests");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
// <auto-generated />
|
||||
using AccountsDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountsDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AccountsDatabase))]
|
||||
[Migration("20231129200602_AddColumnAvatarToAccountTable")]
|
||||
partial class AddColumnAvatarToAccountTable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Avatar")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Interests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("AccountsDataBaseImplement.Models.Interest", "Interest")
|
||||
.WithMany()
|
||||
.HasForeignKey("InterestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Interest");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountsDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddColumnAvatarToAccountTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Avatar",
|
||||
table: "Accounts",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Avatar",
|
||||
table: "Accounts");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
// <auto-generated />
|
||||
using AccountsDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountsDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AccountsDatabase))]
|
||||
partial class AccountsDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Avatar")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Interests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("AccountsDataBaseImplement.Models.Interest", "Interest")
|
||||
.WithMany()
|
||||
.HasForeignKey("InterestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Interest");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
74
AbazovApp/AccountsDataBaseImplement/Models/Account.cs
Normal file
74
AbazovApp/AccountsDataBaseImplement/Models/Account.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataBaseImplement.Models
|
||||
{
|
||||
public class Account : IAccountModel
|
||||
{
|
||||
[Required]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int InterestId { get; set; }
|
||||
|
||||
public virtual Interest Interest { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public string Avatar { get; set; } = string.Empty;
|
||||
|
||||
public static Account? Create(AccountsDatabase context, AccountBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Account()
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
Password = model.Password,
|
||||
Email = model.Email,
|
||||
InterestId = model.InterestId,
|
||||
Interest = context.Interests.First(x => x.Id == model.InterestId),
|
||||
Avatar = model.Avatar,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(AccountBindingModel? model, AccountsDatabase context)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
Password = model.Password;
|
||||
InterestId = model.InterestId;
|
||||
Interest = context.Interests.First(x => x.Id == model.InterestId);
|
||||
Avatar = model.Avatar;
|
||||
}
|
||||
|
||||
public AccountViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
Email = Email,
|
||||
InterestId = InterestId,
|
||||
InterestName = Interest.Name,
|
||||
Avatar = Avatar,
|
||||
};
|
||||
}
|
||||
}
|
53
AbazovApp/AccountsDataBaseImplement/Models/Interest.cs
Normal file
53
AbazovApp/AccountsDataBaseImplement/Models/Interest.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using AccountsContracts.BindingModels;
|
||||
using AccountsContracts.ViewModels;
|
||||
using AccountsDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataBaseImplement.Models
|
||||
{
|
||||
public class Interest : IInterestModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public static Interest? Create(InterestBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Interest()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public static Interest? Create(InterestViewModel? model)
|
||||
{
|
||||
return new Interest()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public void Update(InterestBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
}
|
||||
public InterestViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
}
|
9
AbazovApp/AccountsDataModels/AccountsDataModels.csproj
Normal file
9
AbazovApp/AccountsDataModels/AccountsDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
13
AbazovApp/AccountsDataModels/IId.cs
Normal file
13
AbazovApp/AccountsDataModels/IId.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
17
AbazovApp/AccountsDataModels/Models/IAccountModel.cs
Normal file
17
AbazovApp/AccountsDataModels/Models/IAccountModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataModels.Models
|
||||
{
|
||||
public interface IAccountModel : IId
|
||||
{
|
||||
string Login { get; }
|
||||
string Password { get; }
|
||||
string Email { get; }
|
||||
public int InterestId { get; }
|
||||
public string Avatar { get; }
|
||||
}
|
||||
}
|
13
AbazovApp/AccountsDataModels/Models/IInterestModel.cs
Normal file
13
AbazovApp/AccountsDataModels/Models/IInterestModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AccountsDataModels.Models
|
||||
{
|
||||
public interface IInterestModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
65
AbazovApp/PluginsConventionLibrary/IPluginsConvention.cs
Normal file
65
AbazovApp/PluginsConventionLibrary/IPluginsConvention.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace PluginsConventionLibrary
|
||||
{
|
||||
public interface IPluginsConvention
|
||||
{
|
||||
/// <summary>
|
||||
/// Название плагина
|
||||
/// </summary>
|
||||
string PluginName { get; }
|
||||
/// <summary>
|
||||
/// Получение контрола для вывода набора данных
|
||||
/// </summary>
|
||||
UserControl GetControl { get; }
|
||||
/// <summary>
|
||||
/// Получение элемента, выбранного в контроле
|
||||
/// </summary>
|
||||
PluginsConventionElement GetElement { get; }
|
||||
/// <summary>
|
||||
/// Получение формы для создания/редактирования объекта
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
Form GetForm(PluginsConventionElement element);
|
||||
/// <summary>
|
||||
/// Получение формы для работы со справочником
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Form GetThesaurus();
|
||||
/// <summary>
|
||||
/// Удаление элемента
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
bool DeleteElement(PluginsConventionElement element);
|
||||
/// <summary>
|
||||
/// Обновление набора данных в контроле
|
||||
/// </summary>
|
||||
void ReloadData();
|
||||
/// <summary>
|
||||
/// Создание простого документа
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateSimpleDocument(PluginsConventionSaveDocument
|
||||
saveDocument);
|
||||
/// <summary>
|
||||
/// Создание простого документа
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
|
||||
/// <summary>
|
||||
/// Создание документа с диаграммой
|
||||
/// </summary>
|
||||
/// <param name="saveDocument"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PluginsConventionLibrary
|
||||
{
|
||||
public class PluginsConventionElement
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PluginsConventionLibrary
|
||||
{
|
||||
public class PluginsConventionSaveDocument
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user