небольшой дроп
This commit is contained in:
parent
84c92c2d38
commit
32e651c219
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
@ -31,6 +31,7 @@ namespace ChubykinaComponents.Components
|
|||||||
else treeView.SelectedNode = value >= 0 && value < treeView.SelectedNode.Nodes.Count ? treeView.SelectedNode.Nodes[value] : treeView.SelectedNode;
|
else treeView.SelectedNode = value >= 0 && value < treeView.SelectedNode.Nodes.Count ? treeView.SelectedNode.Nodes[value] : treeView.SelectedNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? getSelecetedNodeValue<T>()
|
public T? getSelecetedNodeValue<T>()
|
||||||
{
|
{
|
||||||
if (treeView.SelectedNode == null || treeView.SelectedNode.Nodes.Count > 0) return default(T);
|
if (treeView.SelectedNode == null || treeView.SelectedNode.Nodes.Count > 0) return default(T);
|
||||||
@ -83,5 +84,9 @@ namespace ChubykinaComponents.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
treeView.Nodes.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,9 +31,9 @@ namespace ChubykinaComponents.LogicalComponents
|
|||||||
{
|
{
|
||||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
||||||
|
|
||||||
FieldInfo? seriesName = typeof(T).GetField(seriesNameField);
|
PropertyInfo? seriesName = typeof(T).GetProperty(seriesNameField);
|
||||||
FieldInfo? value = typeof(T).GetField(valueField);
|
PropertyInfo? value = typeof(T).GetProperty(valueField);
|
||||||
if (seriesName == null || value == null) throw new ArgumentException("Переданного поля не существует");
|
if (seriesName == null || value == null) throw new ArgumentException("Переданного свойства не существует");
|
||||||
int columnCount = 2;
|
int columnCount = 2;
|
||||||
foreach (var item in data)
|
foreach (var item in data)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ClientsContracts\ClientsContracts.csproj" />
|
<ProjectReference Include="..\ClientsContracts\ClientsContracts.csproj" />
|
||||||
<ProjectReference Include="..\ClientsDataModels\ClientsDataModels.csproj" />
|
<ProjectReference Include="..\ClientsDataModels\ClientsDataModels.csproj" />
|
||||||
<ProjectReference Include="..\Components\Components.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -65,14 +65,14 @@ namespace ClientDataBaseImplement.Implements
|
|||||||
public ClientViewModel? Update(ClientBindingModel model)
|
public ClientViewModel? Update(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ClientsDatabase();
|
using var context = new ClientsDatabase();
|
||||||
var account = context.Clients.FirstOrDefault(x => x.Id == model.Id);
|
var client = context.Clients.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (account == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
account.Update(model, context);
|
client.Update(model, context);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return account.GetViewModel;
|
return client.GetViewModel;
|
||||||
}
|
}
|
||||||
public ClientViewModel? Delete(ClientBindingModel model)
|
public ClientViewModel? Delete(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,4 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Components\Components.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
50
COP/WinFormsTest/FormClient.Designer.cs
generated
50
COP/WinFormsTest/FormClient.Designer.cs
generated
@ -29,12 +29,12 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.textBoxLogin = new System.Windows.Forms.TextBox();
|
this.textBoxFio = new System.Windows.Forms.TextBox();
|
||||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.mailControl = new BulatovaComponents.Components.UserEmailTextBox();
|
this.mailControl = new BulatovaComponents.MailControl();
|
||||||
this.UserCheckedListBox = new Components.Components.UserCheckedListBox();
|
this.userCheckedListBox = new ChubykinaComponents.Components.UserCheckedListBox();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
@ -50,15 +50,15 @@
|
|||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(52, 20);
|
this.label1.Size = new System.Drawing.Size(52, 20);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Логин";
|
this.label1.Text = "ФИО";
|
||||||
//
|
//
|
||||||
// textBoxLogin
|
// textBoxFio
|
||||||
//
|
//
|
||||||
this.textBoxLogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
this.textBoxFio.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.textBoxFio.Location = new System.Drawing.Point(12, 32);
|
||||||
this.textBoxLogin.Name = "textBoxLogin";
|
this.textBoxFio.Name = "textBoxFio";
|
||||||
this.textBoxLogin.Size = new System.Drawing.Size(389, 27);
|
this.textBoxFio.Size = new System.Drawing.Size(389, 27);
|
||||||
this.textBoxLogin.TabIndex = 1;
|
this.textBoxFio.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// textBoxPassword
|
// textBoxPassword
|
||||||
//
|
//
|
||||||
@ -98,14 +98,14 @@
|
|||||||
this.mailControl.TabIndex = 5;
|
this.mailControl.TabIndex = 5;
|
||||||
this.mailControl.validateEmailRegex = null;
|
this.mailControl.validateEmailRegex = null;
|
||||||
//
|
//
|
||||||
// UserCheckedListBox
|
// userCheckedListBox
|
||||||
//
|
//
|
||||||
this.UserCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
this.userCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.UserCheckedListBox.Location = new System.Drawing.Point(12, 207);
|
this.userCheckedListBox.Location = new System.Drawing.Point(12, 207);
|
||||||
this.UserCheckedListBox.Name = "UserCheckedListBox";
|
this.userCheckedListBox.Name = "UserCheckedListBox";
|
||||||
this.UserCheckedListBox.selectedItem = null;
|
this.userCheckedListBox.selectedItem = null;
|
||||||
this.UserCheckedListBox.Size = new System.Drawing.Size(389, 130);
|
this.userCheckedListBox.Size = new System.Drawing.Size(389, 130);
|
||||||
this.UserCheckedListBox.TabIndex = 6;
|
this.userCheckedListBox.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
@ -147,11 +147,11 @@
|
|||||||
this.buttonAvatar.Name = "buttonAvatar";
|
this.buttonAvatar.Name = "buttonAvatar";
|
||||||
this.buttonAvatar.Size = new System.Drawing.Size(389, 29);
|
this.buttonAvatar.Size = new System.Drawing.Size(389, 29);
|
||||||
this.buttonAvatar.TabIndex = 10;
|
this.buttonAvatar.TabIndex = 10;
|
||||||
this.buttonAvatar.Text = "Выбрать аватар";
|
this.buttonAvatar.Text = "Выбрать фото";
|
||||||
this.buttonAvatar.UseVisualStyleBackColor = true;
|
this.buttonAvatar.UseVisualStyleBackColor = true;
|
||||||
this.buttonAvatar.Click += new System.EventHandler(this.buttonAvatar_Click);
|
this.buttonAvatar.Click += new System.EventHandler(this.buttonAvatar_Click);
|
||||||
//
|
//
|
||||||
// FormAccount
|
// FormClient
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
@ -160,15 +160,15 @@
|
|||||||
this.Controls.Add(this.buttonCancel);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.buttonSave);
|
this.Controls.Add(this.buttonSave);
|
||||||
this.Controls.Add(this.label4);
|
this.Controls.Add(this.label4);
|
||||||
this.Controls.Add(this.UserCheckedListBox);
|
this.Controls.Add(this.userCheckedListBox);
|
||||||
this.Controls.Add(this.mailControl);
|
this.Controls.Add(this.mailControl);
|
||||||
this.Controls.Add(this.label3);
|
this.Controls.Add(this.label3);
|
||||||
this.Controls.Add(this.textBoxPassword);
|
this.Controls.Add(this.textBoxPassword);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.textBoxLogin);
|
this.Controls.Add(this.textBoxFio);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Name = "FormClient";
|
this.Name = "FormClient";
|
||||||
this.Text = "Аккаунт";
|
this.Text = "Клиент";
|
||||||
this.Load += new System.EventHandler(this.FormClient_Load);
|
this.Load += new System.EventHandler(this.FormClient_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
@ -178,12 +178,12 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private TextBox textBoxLogin;
|
private TextBox textBoxFio;
|
||||||
private TextBox textBoxPassword;
|
private TextBox textBoxPassword;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private Label label3;
|
private Label label3;
|
||||||
private BulatovaComponents.Components.UserEmailTextBox mailControl;
|
private BulatovaComponents.MailControl mailControl;
|
||||||
private Components.Components.UserCheckedListBox UserCheckedListBox;
|
private ChubykinaComponents.Components.UserCheckedListBox userCheckedListBox;
|
||||||
private Label label4;
|
private Label label4;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
|
@ -10,7 +10,7 @@ using System.Windows.Forms;
|
|||||||
using ClientsContracts.BusinessLogicContracts;
|
using ClientsContracts.BusinessLogicContracts;
|
||||||
using ClientsContracts.ViewModels;
|
using ClientsContracts.ViewModels;
|
||||||
using ClientsContracts.SearchModels;
|
using ClientsContracts.SearchModels;
|
||||||
using Components.Components;
|
using ChubykinaComponents.Components;
|
||||||
using ClientsContracts.BindingModels;
|
using ClientsContracts.BindingModels;
|
||||||
|
|
||||||
namespace WinFormsTest
|
namespace WinFormsTest
|
||||||
@ -35,7 +35,7 @@ namespace WinFormsTest
|
|||||||
private void FormClient_Load(object sender, EventArgs e)
|
private void FormClient_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_categories = _categoryLogic.ReadList(null);
|
_categories = _categoryLogic.ReadList(null);
|
||||||
UserCheckedListBox.addItems(_categories.Select(x => x.Name).ToList());
|
userCheckedListBox.addItems(_categories.Select(x => x.Name).ToList());
|
||||||
mailControl.validateEmailRegex = new System.Text.RegularExpressions.Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
|
mailControl.validateEmailRegex = new System.Text.RegularExpressions.Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
|
||||||
mailControl.setTooltipText("name@example.com");
|
mailControl.setTooltipText("name@example.com");
|
||||||
if (_id.HasValue)
|
if (_id.HasValue)
|
||||||
@ -45,11 +45,11 @@ namespace WinFormsTest
|
|||||||
var view = _logic.ReadElement(new ClientSearchModel { Id = _id.Value });
|
var view = _logic.ReadElement(new ClientSearchModel { Id = _id.Value });
|
||||||
if (view != null)
|
if (view != null)
|
||||||
{
|
{
|
||||||
textBoxLogin.Text = view.Fio;
|
textBoxFio.Text = view.Fio;
|
||||||
mailControl.Email = view.Email;
|
mailControl.Email = view.Email;
|
||||||
photo = view.Photo;
|
photo = view.Photo;
|
||||||
|
|
||||||
UserCheckedListBox.selectedItem = view.CategoryName;
|
userCheckedListBox.selectedItem = view.CategoryName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -67,7 +67,7 @@ namespace WinFormsTest
|
|||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(textBoxLogin.Text))
|
if (string.IsNullOrEmpty(textBoxFio.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
@ -77,14 +77,14 @@ namespace WinFormsTest
|
|||||||
MessageBox.Show("Заполните почту или исправьте написание почты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Заполните почту или исправьте написание почты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (UserCheckedListBox.selectedItem == null)
|
if (userCheckedListBox.selectedItem == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Заполните интересы", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Заполните категории", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (photo == null)
|
if (photo == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Выберите аватар", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Выберите фото", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@ -92,9 +92,9 @@ namespace WinFormsTest
|
|||||||
var model = new ClientBindingModel
|
var model = new ClientBindingModel
|
||||||
{
|
{
|
||||||
Id = _id ?? 0,
|
Id = _id ?? 0,
|
||||||
Fio = textBoxLogin.Text,
|
Fio = textBoxFio.Text,
|
||||||
Email = mailControl.Email,
|
Email = mailControl.Email,
|
||||||
CategoryId = _categories.First(x => x.Name == UserCheckedListBox.selectedItem).Id,
|
CategoryId = _categories.First(x => x.Name == userCheckedListBox.selectedItem).Id,
|
||||||
Photo = photo
|
Photo = photo
|
||||||
};
|
};
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
144
COP/WinFormsTest/FormMain.Designer.cs
generated
144
COP/WinFormsTest/FormMain.Designer.cs
generated
@ -29,11 +29,153 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
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 ChubykinaComponents.LogicalComponents.ExcelImagesComponent(this.components);
|
||||||
|
this.wordTableComponentClient = new BulatovaComponents.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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
this.Text = "FormMain";
|
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
|
#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 ChubykinaComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
||||||
|
private BulatovaComponents.LogicalComponents.WordTableComponent wordTableComponentClient;
|
||||||
|
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarPdf componentDocumentWithChartBarPdf;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,12 @@
|
|||||||
using System;
|
using ComponentsLibraryNet60.DocumentWithChart;
|
||||||
|
using ComponentsLibraryNet60.Models;
|
||||||
|
using ControlsLibraryNet60.Core;
|
||||||
|
using ControlsLibraryNet60.Models;
|
||||||
|
using ClientsContracts.BusinessLogicContracts;
|
||||||
|
using ClientsContracts.BindingModels;
|
||||||
|
using ClientsContracts.ViewModels;
|
||||||
|
using ChubykinaComponents.LogicalComponents;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -12,9 +20,129 @@ namespace WinFormsTest
|
|||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
public FormMain()
|
private IClientLogic _logic;
|
||||||
|
|
||||||
|
public FormMain(IClientLogic logic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_logic = logic;
|
||||||
|
controlDataTable.LoadColumns(new List<DataTableColumnConfig> {
|
||||||
|
new DataTableColumnConfig { ColumnHeader = "", PropertyName = "Id", Visible = false, Width = 10},
|
||||||
|
new DataTableColumnConfig { ColumnHeader = "ФИО", PropertyName = "Fio", Visible = true, Width = 200},
|
||||||
|
new DataTableColumnConfig { ColumnHeader = "Выбранная категория", PropertyName = "CategoryName", 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(FormClient));
|
||||||
|
if (service is FormClient form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void категорииToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCategories));
|
||||||
|
if (service is FormCategories form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
controlDataTable.Clear();
|
||||||
|
var clients = _logic.ReadList(null);
|
||||||
|
if (clients != null)
|
||||||
|
{
|
||||||
|
controlDataTable.AddTable(clients);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormClient));
|
||||||
|
if (service is FormClient form)
|
||||||
|
{
|
||||||
|
form.Id = controlDataTable.GetSelectedObject<ClientViewModel>().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 ClientBindingModel { Id = controlDataTable.GetSelectedObject<ClientViewModel>().Id }))
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void документToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
List<string> photos = new List<string>();
|
||||||
|
foreach (var client in _logic.ReadList(null))
|
||||||
|
{
|
||||||
|
photos.Add(client.Photo);
|
||||||
|
}
|
||||||
|
string path = AppDomain.CurrentDomain.BaseDirectory + "Фото.xlsx";
|
||||||
|
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Фото", photos.ToArray()))) MessageBox.Show("Документ создан");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void документСДиаграммойToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string path = AppDomain.CurrentDomain.BaseDirectory + "Интересы.pdf";
|
||||||
|
Dictionary<string, List<(int, double)>> data = new Dictionary<string, List<(int, double)>>();
|
||||||
|
|
||||||
|
data = _logic
|
||||||
|
.ReadList(null)
|
||||||
|
.GroupBy(x => x.CategoryName)
|
||||||
|
.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)
|
||||||
|
{
|
||||||
|
string path = AppDomain.CurrentDomain.BaseDirectory + "Клиенты.docx";
|
||||||
|
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", "Идентификатор"),
|
||||||
|
("", "Личные данные"),
|
||||||
|
("Fio", "ФИО"),
|
||||||
|
("Email", "Эл. почта"),
|
||||||
|
("CategoryName", "Выбранная категория")
|
||||||
|
};
|
||||||
|
|
||||||
|
wordTableComponentClient.createWithTable(path, "Список клиентов", merges, widths, headers, _logic.ReadList(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
24
COP/WinFormsTest/FormTest.Designer.cs
generated
24
COP/WinFormsTest/FormTest.Designer.cs
generated
@ -29,15 +29,15 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.userCheckedListBox = new Components.Components.UserCheckedListBox();
|
this.userCheckedListBox = new ChubykinaComponents.Components.UserCheckedListBox();
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
this.buttonClear = new System.Windows.Forms.Button();
|
this.buttonClear = new System.Windows.Forms.Button();
|
||||||
this.buttonSelected = new System.Windows.Forms.Button();
|
this.buttonSelected = new System.Windows.Forms.Button();
|
||||||
this.userDatePicker = new Components.Components.UserDatePicker();
|
this.userDatePicker = new ChubykinaComponents.Components.UserDatePicker();
|
||||||
this.buttonBoundries = new System.Windows.Forms.Button();
|
this.buttonBoundries = new System.Windows.Forms.Button();
|
||||||
this.buttonSetDate = new System.Windows.Forms.Button();
|
this.buttonSetDate = new System.Windows.Forms.Button();
|
||||||
this.buttonGetDate = new System.Windows.Forms.Button();
|
this.buttonGetDate = new System.Windows.Forms.Button();
|
||||||
this.userTreeView = new Components.Components.UserTreeView();
|
this.userTreeView = new ChubykinaComponents.Components.UserTreeView();
|
||||||
this.buttonSetHierarchy = new System.Windows.Forms.Button();
|
this.buttonSetHierarchy = new System.Windows.Forms.Button();
|
||||||
this.buttonAddWorkers = new System.Windows.Forms.Button();
|
this.buttonAddWorkers = new System.Windows.Forms.Button();
|
||||||
this.buttonGetValue = new System.Windows.Forms.Button();
|
this.buttonGetValue = new System.Windows.Forms.Button();
|
||||||
@ -47,9 +47,9 @@
|
|||||||
this.buttonExcelTable = new System.Windows.Forms.Button();
|
this.buttonExcelTable = new System.Windows.Forms.Button();
|
||||||
this.buttonExcelImages = new System.Windows.Forms.Button();
|
this.buttonExcelImages = new System.Windows.Forms.Button();
|
||||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
this.excelTableComponent = new Components.LogicalComponents.ExcelTableComponent(this.components);
|
this.excelTableComponent = new ChubykinaComponents.LogicalComponents.ExcelTableComponent(this.components);
|
||||||
this.excelDiagramComponent = new Components.LogicalComponents.ExcelDiagramComponent(this.components);
|
this.excelDiagramComponent = new ChubykinaComponents.LogicalComponents.ExcelDiagramComponent(this.components);
|
||||||
this.excelImagesComponent = new Components.LogicalComponents.ExcelImagesComponent(this.components);
|
this.excelImagesComponent = new ChubykinaComponents.LogicalComponents.ExcelImagesComponent(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// userCheckedListBox
|
// userCheckedListBox
|
||||||
@ -255,15 +255,15 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Components.Components.UserCheckedListBox userCheckedListBox;
|
private ChubykinaComponents.Components.UserCheckedListBox userCheckedListBox;
|
||||||
private Button buttonAdd;
|
private Button buttonAdd;
|
||||||
private Button buttonClear;
|
private Button buttonClear;
|
||||||
private Button buttonSelected;
|
private Button buttonSelected;
|
||||||
private Components.Components.UserDatePicker userDatePicker;
|
private ChubykinaComponents.Components.UserDatePicker userDatePicker;
|
||||||
private Button buttonBoundries;
|
private Button buttonBoundries;
|
||||||
private Button buttonSetDate;
|
private Button buttonSetDate;
|
||||||
private Button buttonGetDate;
|
private Button buttonGetDate;
|
||||||
private Components.Components.UserTreeView userTreeView;
|
private ChubykinaComponents.Components.UserTreeView userTreeView;
|
||||||
private Button buttonSetHierarchy;
|
private Button buttonSetHierarchy;
|
||||||
private Button buttonAddWorkers;
|
private Button buttonAddWorkers;
|
||||||
private Button buttonGetValue;
|
private Button buttonGetValue;
|
||||||
@ -273,8 +273,8 @@
|
|||||||
private Button buttonExcelTable;
|
private Button buttonExcelTable;
|
||||||
private Button buttonExcelImages;
|
private Button buttonExcelImages;
|
||||||
private OpenFileDialog openFileDialog;
|
private OpenFileDialog openFileDialog;
|
||||||
private Components.LogicalComponents.ExcelTableComponent excelTableComponent;
|
private ChubykinaComponents.LogicalComponents.ExcelTableComponent excelTableComponent;
|
||||||
private Components.LogicalComponents.ExcelDiagramComponent excelDiagramComponent;
|
private ChubykinaComponents.LogicalComponents.ExcelDiagramComponent excelDiagramComponent;
|
||||||
private Components.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
private ChubykinaComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
using Components.Exceptions;
|
using ChubykinaComponents.Exceptions;
|
||||||
using Components.LogicalComponents;
|
using ChubykinaComponents.LogicalComponents;
|
||||||
using Microsoft.Office.Core;
|
using Microsoft.Office.Core;
|
||||||
using Microsoft.VisualBasic.ApplicationServices;
|
using Microsoft.VisualBasic.ApplicationServices;
|
||||||
using System;
|
using System;
|
||||||
|
@ -22,7 +22,7 @@ namespace WinFormsTest
|
|||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(new FormTest());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ChubykinaComponents\ChubykinaComponents.csproj" />
|
||||||
<ProjectReference Include="..\ClientDataBaseImplement\ClientDataBaseImplement.csproj" />
|
<ProjectReference Include="..\ClientDataBaseImplement\ClientDataBaseImplement.csproj" />
|
||||||
<ProjectReference Include="..\ClientsBusinessLogics\ClientsBusinessLogics.csproj" />
|
<ProjectReference Include="..\ClientsBusinessLogics\ClientsBusinessLogics.csproj" />
|
||||||
<ProjectReference Include="..\Components\Components.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user