Compare commits
2 Commits
7c88edeef3
...
03e39f6b13
Author | SHA1 | Date | |
---|---|---|---|
|
03e39f6b13 | ||
|
79a181b789 |
34
COP/COP.sln
34
COP/COP.sln
@ -3,9 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.11.35222.181
|
VisualStudioVersion = 17.11.35222.181
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RodionovLibrary", "RodionovLibrary\RodionovLibrary.csproj", "{F586414D-01E1-499C-A77B-C6A4B0882B0E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RodionovLibrary", "RodionovLibrary\RodionovLibrary.csproj", "{F586414D-01E1-499C-A77B-C6A4B0882B0E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinForms", "WinForms\WinForms.csproj", "{E160EBCF-4BD1-4049-ADD6-597332133952}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForms", "WinForms\WinForms.csproj", "{E160EBCF-4BD1-4049-ADD6-597332133952}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortalAccountsContracts", "PortalAccountsContracts\PortalAccountsContracts.csproj", "{F18747FB-607B-42E4-AA8E-86A7E2FFBD28}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortalAccountsDataModels", "PortalAccountsDataModels\PortalAccountsDataModels.csproj", "{4DFB6049-FCE4-42F3-B611-BAEE5156EA9C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortalAccountsBusinessLogic", "PortalAccountsBusinessLogic\PortalAccountsBusinessLogic.csproj", "{06D98752-0805-4CE4-AE5A-0EC14694D7D9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortalAccountsDatabaseImplement", "PortalAccountsDatabaseImplement\PortalAccountsDatabaseImplement.csproj", "{0D3E5B70-5816-4AF6-AA94-95EA34EEC9FE}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortalAccountsView", "PortalAccountsView\PortalAccountsView.csproj", "{0304D12E-0F97-4C82-BB88-4E4784DEC81C}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -21,6 +31,26 @@ Global
|
|||||||
{E160EBCF-4BD1-4049-ADD6-597332133952}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E160EBCF-4BD1-4049-ADD6-597332133952}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E160EBCF-4BD1-4049-ADD6-597332133952}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E160EBCF-4BD1-4049-ADD6-597332133952}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E160EBCF-4BD1-4049-ADD6-597332133952}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E160EBCF-4BD1-4049-ADD6-597332133952}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F18747FB-607B-42E4-AA8E-86A7E2FFBD28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F18747FB-607B-42E4-AA8E-86A7E2FFBD28}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F18747FB-607B-42E4-AA8E-86A7E2FFBD28}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F18747FB-607B-42E4-AA8E-86A7E2FFBD28}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4DFB6049-FCE4-42F3-B611-BAEE5156EA9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DFB6049-FCE4-42F3-B611-BAEE5156EA9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4DFB6049-FCE4-42F3-B611-BAEE5156EA9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4DFB6049-FCE4-42F3-B611-BAEE5156EA9C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{06D98752-0805-4CE4-AE5A-0EC14694D7D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{06D98752-0805-4CE4-AE5A-0EC14694D7D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{06D98752-0805-4CE4-AE5A-0EC14694D7D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{06D98752-0805-4CE4-AE5A-0EC14694D7D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0D3E5B70-5816-4AF6-AA94-95EA34EEC9FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0D3E5B70-5816-4AF6-AA94-95EA34EEC9FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0D3E5B70-5816-4AF6-AA94-95EA34EEC9FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0D3E5B70-5816-4AF6-AA94-95EA34EEC9FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0304D12E-0F97-4C82-BB88-4E4784DEC81C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0304D12E-0F97-4C82-BB88-4E4784DEC81C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0304D12E-0F97-4C82-BB88-4E4784DEC81C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0304D12E-0F97-4C82-BB88-4E4784DEC81C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.StoragesContracts;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class AccountLogic : IAccountLogic
|
||||||
|
{
|
||||||
|
private readonly IAccountStorage _accountStorage;
|
||||||
|
|
||||||
|
public AccountLogic(IAccountStorage AccountStorage)
|
||||||
|
{
|
||||||
|
_accountStorage = AccountStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AccountViewModel>? ReadList(AccountSearchModel? model)
|
||||||
|
{
|
||||||
|
return model == null ? _accountStorage.GetFullList() : _accountStorage.GetFilteredList(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel? ReadElement(AccountSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
return _accountStorage.GetElement(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
return _accountStorage.Insert(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
return _accountStorage.Update(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
return _accountStorage.Delete(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (model.RoleId <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Некорректный идентификатор роли", nameof(model.RoleId));
|
||||||
|
}
|
||||||
|
var element = _accountStorage.GetElement(new AccountSearchModel
|
||||||
|
{
|
||||||
|
Login = model.Login
|
||||||
|
});
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Аккаунт с таким логином уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
74
COP/PortalAccountsBusinessLogic/BusinessLogics/RoleLogic.cs
Normal file
74
COP/PortalAccountsBusinessLogic/BusinessLogics/RoleLogic.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.StoragesContracts;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class RoleLogic : IRoleLogic
|
||||||
|
{
|
||||||
|
private readonly IRoleStorage _roleStorage;
|
||||||
|
|
||||||
|
public RoleLogic(IRoleStorage RoleStorage)
|
||||||
|
{
|
||||||
|
_roleStorage = RoleStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RoleViewModel>? ReadList(RoleSearchModel? model)
|
||||||
|
{
|
||||||
|
return model == null ? _roleStorage.GetFullList() : _roleStorage.GetFilteredList(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel? ReadElement(RoleSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
return _roleStorage.GetElement(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
return _roleStorage.Insert(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
return _roleStorage.Update(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
return _roleStorage.Delete(model) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckModel(RoleBindingModel 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));
|
||||||
|
}
|
||||||
|
var element = _roleStorage.GetElement(new RoleSearchModel
|
||||||
|
{
|
||||||
|
Name = model.Name
|
||||||
|
});
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Роль с таким названием уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PortalAccountsContracts\PortalAccountsContracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,17 @@
|
|||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class AccountBindingModel : IAccountModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string? Warnings { get; set; }
|
||||||
|
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
|
||||||
|
public double? Rating { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class RoleBindingModel : IRoleModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
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,19 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IRoleLogic
|
||||||
|
{
|
||||||
|
List<RoleViewModel>? ReadList(RoleSearchModel? model);
|
||||||
|
|
||||||
|
RoleViewModel? ReadElement(RoleSearchModel model);
|
||||||
|
|
||||||
|
bool Create(RoleBindingModel model);
|
||||||
|
|
||||||
|
bool Update(RoleBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(RoleBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
13
COP/PortalAccountsContracts/PortalAccountsContracts.csproj
Normal file
13
COP/PortalAccountsContracts/PortalAccountsContracts.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="..\PortalAccountsDataModels\PortalAccountsDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace PortalAccountsContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class AccountSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public string? Login { get; set; }
|
||||||
|
|
||||||
|
public int? RoleId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace PortalAccountsContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class RoleSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
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 PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IRoleStorage
|
||||||
|
{
|
||||||
|
List<RoleViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<RoleViewModel> GetFilteredList(RoleSearchModel model);
|
||||||
|
|
||||||
|
RoleViewModel? GetElement(RoleSearchModel model);
|
||||||
|
|
||||||
|
RoleViewModel? Insert(RoleBindingModel model);
|
||||||
|
|
||||||
|
RoleViewModel? Update(RoleBindingModel model);
|
||||||
|
|
||||||
|
RoleViewModel? Delete(RoleBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
26
COP/PortalAccountsContracts/ViewModels/AccountViewModel.cs
Normal file
26
COP/PortalAccountsContracts/ViewModels/AccountViewModel.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class AccountViewModel : IAccountModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Логин")]
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Предупреждения")]
|
||||||
|
public string? Warnings { get; set; }
|
||||||
|
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Роль")]
|
||||||
|
public string RoleName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Рейтинг")]
|
||||||
|
public double? Rating { get; set; }
|
||||||
|
|
||||||
|
public string OutputRating { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
13
COP/PortalAccountsContracts/ViewModels/RoleViewModel.cs
Normal file
13
COP/PortalAccountsContracts/ViewModels/RoleViewModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace PortalAccountsContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class RoleViewModel : IRoleModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Название роли")]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
7
COP/PortalAccountsDataModels/IId.cs
Normal file
7
COP/PortalAccountsDataModels/IId.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace PortalAccountsDataModels
|
||||||
|
{
|
||||||
|
public interface IId
|
||||||
|
{
|
||||||
|
int Id { get; }
|
||||||
|
}
|
||||||
|
}
|
13
COP/PortalAccountsDataModels/Models/IAccountModel.cs
Normal file
13
COP/PortalAccountsDataModels/Models/IAccountModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace PortalAccountsDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IAccountModel : IId
|
||||||
|
{
|
||||||
|
string Login { get; }
|
||||||
|
|
||||||
|
string? Warnings { get; }
|
||||||
|
|
||||||
|
int RoleId { get; }
|
||||||
|
|
||||||
|
double? Rating { get; }
|
||||||
|
}
|
||||||
|
}
|
7
COP/PortalAccountsDataModels/Models/IRoleModel.cs
Normal file
7
COP/PortalAccountsDataModels/Models/IRoleModel.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace PortalAccountsDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IRoleModel : IId
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,98 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.StoragesContracts;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using PortalAccountsDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace PortalAccountsDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class AccountStorage : IAccountStorage
|
||||||
|
{
|
||||||
|
public List<AccountViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
return context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AccountViewModel> GetFilteredList(AccountSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
if (model.RoleId.HasValue)
|
||||||
|
{
|
||||||
|
return context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.Where(x => x.RoleId == model.RoleId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel? GetElement(AccountSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Login) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
return context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.FirstOrDefault(x => !string.IsNullOrEmpty(model.Login) && x.Login == model.Login ||
|
||||||
|
model.Id.HasValue && x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel? Insert(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
var newAccount = Account.Create(model);
|
||||||
|
if (newAccount == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
context.Accounts.Add(newAccount);
|
||||||
|
context.SaveChanges();
|
||||||
|
return context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.FirstOrDefault(x => x.Id == newAccount.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel? Update(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
var account = context.Accounts.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
account.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel? Delete(AccountBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
var element = context.Accounts.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
var deletedElement = context.Accounts
|
||||||
|
.Include(x => x.Role)
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
context.Accounts.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return deletedElement;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.StoragesContracts;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using PortalAccountsDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace PortalAccountsDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class RoleStorage : IRoleStorage
|
||||||
|
{
|
||||||
|
public List<RoleViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
return context.Roles
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RoleViewModel> GetFilteredList(RoleSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
return context.Roles
|
||||||
|
.Where(x => x.Name.Contains(model.Name))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel? GetElement(RoleSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
return context.Roles
|
||||||
|
.FirstOrDefault(x => !string.IsNullOrEmpty(model.Name) && x.Name == model.Name ||
|
||||||
|
model.Id.HasValue && x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel? Insert(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
var newRole = Role.Create(model);
|
||||||
|
if (newRole == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
context.Roles.Add(newRole);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newRole.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel? Update(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
var role = context.Roles.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (role == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
role.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return role.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel? Delete(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PortalAccountsDatabase();
|
||||||
|
var element = context.Roles.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Roles.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
COP/PortalAccountsDatabaseImplement/Models/Account.cs
Normal file
62
COP/PortalAccountsDatabaseImplement/Models/Account.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PortalAccountsDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Account : IAccountModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string? Warnings { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
|
||||||
|
public double? Rating { get; set; }
|
||||||
|
|
||||||
|
public virtual Role Role { get; set; }
|
||||||
|
|
||||||
|
public static Account? Create(AccountBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Account()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Login = model.Login,
|
||||||
|
Warnings = model.Warnings,
|
||||||
|
RoleId = model.RoleId,
|
||||||
|
Rating = model.Rating
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(AccountBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Login = model.Login;
|
||||||
|
Warnings = model.Warnings;
|
||||||
|
RoleId = model.RoleId;
|
||||||
|
Rating = model.Rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Login = Login,
|
||||||
|
Warnings = Warnings,
|
||||||
|
RoleId = RoleId,
|
||||||
|
RoleName = Role.Name ?? string.Empty,
|
||||||
|
Rating = Rating
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
48
COP/PortalAccountsDatabaseImplement/Models/Role.cs
Normal file
48
COP/PortalAccountsDatabaseImplement/Models/Role.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using PortalAccountsDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace PortalAccountsDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Role : IRoleModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Name { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[ForeignKey("RoleId")]
|
||||||
|
public virtual List<Account> Accounts { get; set; } = new();
|
||||||
|
|
||||||
|
public static Role? Create(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Role()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Name = model.Name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(RoleBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Name = model.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Name = Name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
using PortalAccountsDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace PortalAccountsDatabaseImplement
|
||||||
|
{
|
||||||
|
public class PortalAccountsDatabase : DbContext
|
||||||
|
{
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
if (optionsBuilder.IsConfigured == false)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=portal_accounts_database;Username=postgres;Password=bythop423956");
|
||||||
|
}
|
||||||
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<Account> Accounts { set; get; }
|
||||||
|
|
||||||
|
public virtual DbSet<Role> Roles { set; get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<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.11" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PortalAccountsContracts\PortalAccountsContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\PortalAccountsDataModels\PortalAccountsDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
178
COP/PortalAccountsView/FormAccount.Designer.cs
generated
Normal file
178
COP/PortalAccountsView/FormAccount.Designer.cs
generated
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
controlInputRating = new ControlsLibraryNet60.Input.ControlInputNullableDouble();
|
||||||
|
textBoxLogin = new TextBox();
|
||||||
|
textBoxWarnings = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
labelLogin = new Label();
|
||||||
|
labelWarnings = new Label();
|
||||||
|
labelRating = new Label();
|
||||||
|
labelRole = new Label();
|
||||||
|
comboBoxControlRole = new RodionovLibrary.VisualComponents.ComboBoxControl();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// controlInputRating
|
||||||
|
//
|
||||||
|
controlInputRating.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
controlInputRating.Location = new Point(8, 197);
|
||||||
|
controlInputRating.Margin = new Padding(4, 6, 4, 6);
|
||||||
|
controlInputRating.Name = "controlInputRating";
|
||||||
|
controlInputRating.Size = new Size(329, 27);
|
||||||
|
controlInputRating.TabIndex = 0;
|
||||||
|
controlInputRating.Value = null;
|
||||||
|
//
|
||||||
|
// textBoxLogin
|
||||||
|
//
|
||||||
|
textBoxLogin.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
textBoxLogin.Location = new Point(15, 86);
|
||||||
|
textBoxLogin.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxLogin.Name = "textBoxLogin";
|
||||||
|
textBoxLogin.Size = new Size(323, 23);
|
||||||
|
textBoxLogin.TabIndex = 2;
|
||||||
|
textBoxLogin.TextChanged += TextBoxLogin_TextChanged;
|
||||||
|
//
|
||||||
|
// textBoxWarnings
|
||||||
|
//
|
||||||
|
textBoxWarnings.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
textBoxWarnings.Location = new Point(15, 143);
|
||||||
|
textBoxWarnings.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxWarnings.Name = "textBoxWarnings";
|
||||||
|
textBoxWarnings.Size = new Size(323, 23);
|
||||||
|
textBoxWarnings.TabIndex = 3;
|
||||||
|
textBoxWarnings.TextChanged += TextBoxWarnings_TextChanged;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(25, 232);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(92, 27);
|
||||||
|
buttonSave.TabIndex = 8;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// labelLogin
|
||||||
|
//
|
||||||
|
labelLogin.AutoSize = true;
|
||||||
|
labelLogin.Location = new Point(15, 64);
|
||||||
|
labelLogin.Name = "labelLogin";
|
||||||
|
labelLogin.Size = new Size(41, 15);
|
||||||
|
labelLogin.TabIndex = 4;
|
||||||
|
labelLogin.Text = "Логин";
|
||||||
|
//
|
||||||
|
// labelWarnings
|
||||||
|
//
|
||||||
|
labelWarnings.AutoSize = true;
|
||||||
|
labelWarnings.Location = new Point(15, 120);
|
||||||
|
labelWarnings.Name = "labelWarnings";
|
||||||
|
labelWarnings.Size = new Size(102, 15);
|
||||||
|
labelWarnings.TabIndex = 5;
|
||||||
|
labelWarnings.Text = "Предупреждения";
|
||||||
|
//
|
||||||
|
// labelRating
|
||||||
|
//
|
||||||
|
labelRating.AutoSize = true;
|
||||||
|
labelRating.Location = new Point(19, 174);
|
||||||
|
labelRating.Name = "labelRating";
|
||||||
|
labelRating.Size = new Size(51, 15);
|
||||||
|
labelRating.TabIndex = 6;
|
||||||
|
labelRating.Text = "Рейтинг";
|
||||||
|
//
|
||||||
|
// labelRole
|
||||||
|
//
|
||||||
|
labelRole.AutoSize = true;
|
||||||
|
labelRole.Location = new Point(18, 12);
|
||||||
|
labelRole.Name = "labelRole";
|
||||||
|
labelRole.Size = new Size(34, 15);
|
||||||
|
labelRole.TabIndex = 7;
|
||||||
|
labelRole.Text = "Роль";
|
||||||
|
//
|
||||||
|
// comboBoxControlRole
|
||||||
|
//
|
||||||
|
comboBoxControlRole.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
comboBoxControlRole.Location = new Point(15, 33);
|
||||||
|
comboBoxControlRole.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
comboBoxControlRole.Name = "comboBoxControlRole";
|
||||||
|
comboBoxControlRole.SelectedValue = "";
|
||||||
|
comboBoxControlRole.Size = new Size(327, 26);
|
||||||
|
comboBoxControlRole.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(147, 232);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(92, 27);
|
||||||
|
buttonCancel.TabIndex = 9;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormAccount
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(357, 272);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(comboBoxControlRole);
|
||||||
|
Controls.Add(labelRole);
|
||||||
|
Controls.Add(labelRating);
|
||||||
|
Controls.Add(labelWarnings);
|
||||||
|
Controls.Add(labelLogin);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxWarnings);
|
||||||
|
Controls.Add(textBoxLogin);
|
||||||
|
Controls.Add(controlInputRating);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormAccount";
|
||||||
|
Text = "Аккаунт";
|
||||||
|
FormClosing += FormAccount_FormClosing;
|
||||||
|
Load += FormAccount_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ControlsLibraryNet60.Input.ControlInputNullableDouble controlInputRating;
|
||||||
|
private TextBox textBoxLogin;
|
||||||
|
private TextBox textBoxWarnings;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Label labelLogin;
|
||||||
|
private Label labelWarnings;
|
||||||
|
private Label labelRating;
|
||||||
|
private Label labelRole;
|
||||||
|
private RodionovLibrary.VisualComponents.ComboBoxControl comboBoxControlRole;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
139
COP/PortalAccountsView/FormAccount.cs
Normal file
139
COP/PortalAccountsView/FormAccount.cs
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
using PortalAccountsContracts.SearchModels;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
public partial class FormAccount : Form
|
||||||
|
{
|
||||||
|
private int? _id;
|
||||||
|
|
||||||
|
private bool _isModified = false;
|
||||||
|
|
||||||
|
private readonly IAccountLogic _logic;
|
||||||
|
|
||||||
|
private readonly IRoleLogic _roleLogic;
|
||||||
|
|
||||||
|
private List<RoleViewModel> _roles;
|
||||||
|
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormAccount(IAccountLogic logic, IRoleLogic roleLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logic = logic;
|
||||||
|
_roleLogic = roleLogic;
|
||||||
|
_roles = new List<RoleViewModel>();
|
||||||
|
comboBoxControlRole.ValueChanged += (_, _) => _isModified = true;
|
||||||
|
controlInputRating.ElementChanged += (_, _) => _isModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormAccount_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_roles = _roleLogic.ReadList(null) ?? throw new Exception("Не удалось получить список ролей");
|
||||||
|
comboBoxControlRole.AddItems(_roles.Select(x => x.Name).ToList());
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var account = _logic.ReadElement(new AccountSearchModel { Id = _id.Value });
|
||||||
|
if (account != null)
|
||||||
|
{
|
||||||
|
textBoxLogin.Text = account.Login;
|
||||||
|
textBoxWarnings.Text = account.Warnings;
|
||||||
|
controlInputRating.Value = account.Rating;
|
||||||
|
comboBoxControlRole.SelectedValue = account.RoleName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_isModified)
|
||||||
|
{
|
||||||
|
var result = MessageBox.Show(
|
||||||
|
"У вас есть несохранённые изменения. Вы действительно хотите закрыть форму?",
|
||||||
|
"Предупреждение",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == DialogResult.No)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(comboBoxControlRole.SelectedValue))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите роль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new AccountBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
Login = textBoxLogin.Text,
|
||||||
|
Warnings = textBoxWarnings.Text,
|
||||||
|
Rating = controlInputRating.Value,
|
||||||
|
RoleId = _roles.First(x => x.Name == comboBoxControlRole.SelectedValue).Id,
|
||||||
|
};
|
||||||
|
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 TextBoxLogin_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_isModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TextBoxWarnings_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_isModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormAccount_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
if (!_isModified)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var result = MessageBox.Show(
|
||||||
|
"У вас есть несохранённые изменения. Вы действительно хотите закрыть форму?",
|
||||||
|
"Предупреждение",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == DialogResult.No)
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
COP/PortalAccountsView/FormAccount.resx
Normal file
120
COP/PortalAccountsView/FormAccount.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
179
COP/PortalAccountsView/FormMain.Designer.cs
generated
Normal file
179
COP/PortalAccountsView/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
|
||||||
|
wordLongTextComponent = new RodionovLibrary.NonVisualComponents.WordLongTextComponent(components);
|
||||||
|
componentDocumentWithTableMultiHeaderPdf = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf(components);
|
||||||
|
componentDocumentWithChartPieExcel = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieExcel(components);
|
||||||
|
menuStrip = new MenuStrip();
|
||||||
|
аккаунтыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
создатьToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
редактироватьToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
удалитьToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
документСТекстомToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
документСТаблицейToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
документСДиаграммойToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
ролиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
menuStrip.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// controlDataTreeTable
|
||||||
|
//
|
||||||
|
this.controlDataTreeTable.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.controlDataTreeTable.Location = new System.Drawing.Point(0, 28);
|
||||||
|
this.controlDataTreeTable.Name = "controlDataTreeTable";
|
||||||
|
this.controlDataTreeTable.Size = new System.Drawing.Size(800, 422);
|
||||||
|
this.controlDataTreeTable.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.аккаунтыToolStripMenuItem,
|
||||||
|
this.отчётыToolStripMenuItem,
|
||||||
|
this.ролиToolStripMenuItem});
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(800, 28);
|
||||||
|
this.menuStrip.TabIndex = 0;
|
||||||
|
this.menuStrip.Text = "Контекстное меню";
|
||||||
|
//
|
||||||
|
// аккаунты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(57, 24);
|
||||||
|
this.ролиToolStripMenuItem.Text = "Роли";
|
||||||
|
this.ролиToolStripMenuItem.Click += new System.EventHandler(this.РолиToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// 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.controlDataTreeTable);
|
||||||
|
this.Controls.Add(this.menuStrip);
|
||||||
|
this.MainMenuStrip = this.menuStrip;
|
||||||
|
this.Name = "FormMain";
|
||||||
|
this.Text = "Основная форма (аккаунты)";
|
||||||
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
|
this.menuStrip.ResumeLayout(false);
|
||||||
|
this.menuStrip.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
|
||||||
|
private RodionovLibrary.NonVisualComponents.WordLongTextComponent wordLongTextComponent;
|
||||||
|
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf componentDocumentWithTableMultiHeaderPdf;
|
||||||
|
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieExcel componentDocumentWithChartPieExcel;
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem аккаунтыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem создатьToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem редактироватьToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem удалитьToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem документСТекстомToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem документСТаблицейToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem документСДиаграммойToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ролиToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
215
COP/PortalAccountsView/FormMain.cs
Normal file
215
COP/PortalAccountsView/FormMain.cs
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
using ComponentsLibraryNet60.Models;
|
||||||
|
using ControlsLibraryNet60.Models;
|
||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
using PortalAccountsContracts.ViewModels;
|
||||||
|
using RodionovLibrary.NonVisualComponents.HelperModels;
|
||||||
|
|
||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
public partial class FormMain : Form
|
||||||
|
{
|
||||||
|
private readonly IAccountLogic _logic;
|
||||||
|
|
||||||
|
public FormMain(IAccountLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_logic = logic;
|
||||||
|
|
||||||
|
var nodeNames = new Queue<string>();
|
||||||
|
nodeNames.Enqueue("RoleName");
|
||||||
|
nodeNames.Enqueue("OutputRating");
|
||||||
|
nodeNames.Enqueue("Id");
|
||||||
|
nodeNames.Enqueue("Login");
|
||||||
|
controlDataTreeTable.LoadConfig(new DataTreeNodeConfig { NodeNames = nodeNames });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ÐîëèToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoles));
|
||||||
|
if (service is FormRoles form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
controlDataTreeTable.Clear();
|
||||||
|
var accounts = _logic.ReadList(null);
|
||||||
|
if (accounts != null)
|
||||||
|
{
|
||||||
|
foreach (var account in accounts)
|
||||||
|
{
|
||||||
|
account.OutputRating = account.Rating?.ToString() ?? "Îòñóòñòâóåò";
|
||||||
|
}
|
||||||
|
controlDataTreeTable.AddTable(accounts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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(FormAccount));
|
||||||
|
if (service is FormAccount form)
|
||||||
|
{
|
||||||
|
var selected = controlDataTreeTable.GetSelectedObject<AccountViewModel>();
|
||||||
|
if (selected == null)
|
||||||
|
return;
|
||||||
|
form.Id = selected.Id;
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ÓäàëèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var selected = controlDataTreeTable.GetSelectedObject<AccountViewModel>();
|
||||||
|
if (selected == null)
|
||||||
|
return;
|
||||||
|
if (MessageBox.Show("Óäàëèòü çàïèñü?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
if (_logic.Delete(new AccountBindingModel { Id = selected.Id }))
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ÄîêóìåíòÑÒåêñòîìToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "docx|*.docx"
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var accounts = _logic.ReadList(null) ?? throw new Exception("Íå óäàëîñü ïîëó÷èòü ñïèñîê àêêàóíòîâ");
|
||||||
|
List<string> paragraphs = new();
|
||||||
|
foreach (var account in accounts)
|
||||||
|
{
|
||||||
|
if (account.Rating == null)
|
||||||
|
{
|
||||||
|
paragraphs.Add($"{account.Login}: {(string.IsNullOrWhiteSpace(account.Warnings) ? "Ïðåäóïðåæäåíèÿ îòñóòñòâóþò" : account.Warnings)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wordLongTextComponent.CreateWordText(new WordLongTextInfo()
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName,
|
||||||
|
Title = "Àêêàóíòû áåç ðåéòèíãà",
|
||||||
|
Paragraphs = paragraphs.ToArray()
|
||||||
|
});
|
||||||
|
MessageBox.Show("Ãîòîâî!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ïðîèçîøëà îøèáêà: " + ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ÄîêóìåíòÑÄèàãðàììîéToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "Excel Files|*.xlsx"
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var accounts = _logic.ReadList(null) ?? throw new Exception("Íå óäàëîñü ïîëó÷èòü ñïèñîê àêêàóíòîâ");
|
||||||
|
var roleMapping = new List<string>();
|
||||||
|
var data = new Dictionary<string, List<(int Date, double Value)>>
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"Àêêàóíòû",
|
||||||
|
accounts
|
||||||
|
.Where(x => x.Rating != null)
|
||||||
|
.GroupBy(x => x.RoleName)
|
||||||
|
.Select((group, index) =>
|
||||||
|
{
|
||||||
|
roleMapping.Add($"{group.Key} - {index + 1}");
|
||||||
|
|
||||||
|
return (Date: index + 1, Value: (double)group.Count());
|
||||||
|
})
|
||||||
|
.ToList()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
componentDocumentWithChartPieExcel.CreateDoc(new ComponentDocumentWithChartConfig
|
||||||
|
{
|
||||||
|
FilePath = dialog.FileName,
|
||||||
|
Header = $"Àêêàóíòû ñ ðåéòèíãîì ïî ðîëÿì ({string.Join(", ", roleMapping)})",
|
||||||
|
ChartTitle = "Êðóãîâàÿ äèàãðàììà",
|
||||||
|
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
|
||||||
|
Data = data
|
||||||
|
});
|
||||||
|
MessageBox.Show("Ãîòîâî!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ïðîèçîøëà îøèáêà: " + ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ÄîêóìåíòÑÒàáëèöåéToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "PDF Files|*.pdf"
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var accounts = _logic.ReadList(null) ?? throw new Exception("Íå óäàëîñü ïîëó÷èòü ñïèñîê àêêàóíòîâ");
|
||||||
|
foreach (var account in accounts)
|
||||||
|
{
|
||||||
|
account.OutputRating = account.Rating?.ToString() ?? "íåò";
|
||||||
|
}
|
||||||
|
componentDocumentWithTableMultiHeaderPdf.CreateDoc(new ComponentDocumentWithTableHeaderDataConfig<AccountViewModel>
|
||||||
|
{
|
||||||
|
FilePath = dialog.FileName,
|
||||||
|
Header = "Àêêàóíòû ïîðòàëà",
|
||||||
|
ColumnsRowsWidth = new List<(int, int)> { (10, 10), (10, 10), (10, 10), (10, 10)}, // øèðèíà ñòîëáöîâ è âûñîòà ñòðîê
|
||||||
|
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
|
||||||
|
{
|
||||||
|
(0, 0, "Id", "Id"),
|
||||||
|
(1, 0, "Ëîãèí", "Login"),
|
||||||
|
(2, 0, "Ðîëü", "RoleName"),
|
||||||
|
(3, 0, "Ðåéòèíã", "OutputRating")
|
||||||
|
},
|
||||||
|
Data = accounts
|
||||||
|
});
|
||||||
|
MessageBox.Show("Ãîòîâî!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ïðîèçîøëà îøèáêà: " + ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
132
COP/PortalAccountsView/FormMain.resx
Normal file
132
COP/PortalAccountsView/FormMain.resx
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="wordLongTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="componentDocumentWithTableMultiHeaderPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>210, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="componentDocumentWithChartPieExcel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>518, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>787, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
87
COP/PortalAccountsView/FormRoles.Designer.cs
generated
Normal file
87
COP/PortalAccountsView/FormRoles.Designer.cs
generated
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
partial class FormRoles
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
Id = new DataGridViewTextBoxColumn();
|
||||||
|
NameCol = new DataGridViewTextBoxColumn();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Id, NameCol });
|
||||||
|
dataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
dataGridView.Location = new System.Drawing.Point(0, 0);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new System.Drawing.Size(800, 450);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
dataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellValueChanged);
|
||||||
|
dataGridView.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.DataGridView_UserDeletingRow);
|
||||||
|
dataGridView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DataGridView_KeyUp);
|
||||||
|
//
|
||||||
|
// Id
|
||||||
|
//
|
||||||
|
Id.HeaderText = "Id";
|
||||||
|
Id.MinimumWidth = 6;
|
||||||
|
Id.Name = "Id";
|
||||||
|
Id.Visible = false;
|
||||||
|
Id.Width = 125;
|
||||||
|
//
|
||||||
|
// Name
|
||||||
|
//
|
||||||
|
NameCol.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
NameCol.HeaderText = "Название";
|
||||||
|
NameCol.MinimumWidth = 6;
|
||||||
|
NameCol.Name = "Name";
|
||||||
|
//
|
||||||
|
// FormRoles
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormRoles";
|
||||||
|
Text = "FormRoles";
|
||||||
|
Load += new System.EventHandler(this.FormRoles_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(dataGridView)).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private DataGridViewTextBoxColumn Id;
|
||||||
|
private DataGridViewTextBoxColumn NameCol;
|
||||||
|
}
|
||||||
|
}
|
99
COP/PortalAccountsView/FormRoles.cs
Normal file
99
COP/PortalAccountsView/FormRoles.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using PortalAccountsContracts.BindingModels;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
public partial class FormRoles : Form
|
||||||
|
{
|
||||||
|
private readonly IRoleLogic _logic;
|
||||||
|
|
||||||
|
private bool dataLoading = false;
|
||||||
|
|
||||||
|
public FormRoles(IRoleLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormRoles_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
dataLoading = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
foreach (var role in list)
|
||||||
|
{
|
||||||
|
int rowIndex = dataGridView.Rows.Add();
|
||||||
|
dataGridView.Rows[rowIndex].Cells[0].Value = role.Name;
|
||||||
|
dataGridView.Rows[rowIndex].Cells[1].Value = role.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dataLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
if (dataLoading || 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 RoleBindingModel { 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 RoleBindingModel { Id = 0, Name = name.ToString() });
|
||||||
|
var list = _logic.ReadList(null) ?? throw new Exception("Не удалось получить список ролей");
|
||||||
|
int newRoleId = list.Last().Id;
|
||||||
|
dataGridView.Rows[e.RowIndex].Cells[1].Value = newRoleId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 RoleBindingModel { 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
COP/PortalAccountsView/FormRoles.resx
Normal file
126
COP/PortalAccountsView/FormRoles.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="Id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
29
COP/PortalAccountsView/PortalAccountsView.csproj
Normal file
29
COP/PortalAccountsView/PortalAccountsView.csproj
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<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.11">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PortalAccountsBusinessLogic\PortalAccountsBusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\PortalAccountsContracts\PortalAccountsContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\PortalAccountsDatabaseImplement\PortalAccountsDatabaseImplement.csproj" />
|
||||||
|
<ProjectReference Include="..\RodionovLibrary\RodionovLibrary.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
41
COP/PortalAccountsView/Program.cs
Normal file
41
COP/PortalAccountsView/Program.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using PortalAccountsBusinessLogic.BusinessLogics;
|
||||||
|
using PortalAccountsContracts.BusinessLogicsContracts;
|
||||||
|
using PortalAccountsContracts.StoragesContracts;
|
||||||
|
using PortalAccountsDatabaseImplement.Implements;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace PortalAccountsView
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
private static ServiceProvider? _serviceProvider;
|
||||||
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||||
|
[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<IRoleStorage, RoleStorage>();
|
||||||
|
services.AddTransient<IAccountStorage, AccountStorage>();
|
||||||
|
services.AddTransient<IRoleLogic, RoleLogic>();
|
||||||
|
services.AddTransient<IAccountLogic, AccountLogic>();
|
||||||
|
services.AddTransient<FormMain>();
|
||||||
|
services.AddTransient<FormAccount>();
|
||||||
|
services.AddTransient<FormRoles>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
//
|
//
|
||||||
// comboBox
|
// comboBox
|
||||||
//
|
//
|
||||||
|
comboBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
comboBox.FormattingEnabled = true;
|
comboBox.FormattingEnabled = true;
|
||||||
comboBox.Location = new Point(1, 0);
|
comboBox.Location = new Point(1, 0);
|
||||||
comboBox.Name = "comboBox";
|
comboBox.Name = "comboBox";
|
||||||
comboBox.Size = new Size(181, 23);
|
comboBox.Size = new Size(323, 23);
|
||||||
comboBox.TabIndex = 0;
|
comboBox.TabIndex = 0;
|
||||||
comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
@ -44,11 +45,9 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
AutoSize = true;
|
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
Controls.Add(comboBox);
|
Controls.Add(comboBox);
|
||||||
Name = "ComboBoxControl";
|
Name = "ComboBoxControl";
|
||||||
Size = new Size(185, 26);
|
Size = new Size(327, 26);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,22 +33,21 @@
|
|||||||
//
|
//
|
||||||
// listBox
|
// listBox
|
||||||
//
|
//
|
||||||
|
listBox.Dock = DockStyle.Fill;
|
||||||
listBox.FormattingEnabled = true;
|
listBox.FormattingEnabled = true;
|
||||||
listBox.ItemHeight = 15;
|
listBox.ItemHeight = 15;
|
||||||
listBox.Location = new Point(0, 0);
|
listBox.Location = new Point(0, 0);
|
||||||
listBox.Name = "listBox";
|
listBox.Name = "listBox";
|
||||||
listBox.Size = new Size(564, 364);
|
listBox.Size = new Size(567, 367);
|
||||||
listBox.TabIndex = 0;
|
listBox.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// ListBoxControl
|
// ListBoxControl
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
AutoSize = true;
|
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
Controls.Add(listBox);
|
Controls.Add(listBox);
|
||||||
Name = "ListBoxControl";
|
Name = "ListBoxControl";
|
||||||
Size = new Size(564, 150);
|
Size = new Size(567, 367);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
//
|
//
|
||||||
// textBox
|
// textBox
|
||||||
//
|
//
|
||||||
|
textBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
textBox.Location = new Point(0, 0);
|
textBox.Location = new Point(0, 0);
|
||||||
textBox.Name = "textBox";
|
textBox.Name = "textBox";
|
||||||
textBox.Size = new Size(213, 23);
|
textBox.Size = new Size(213, 23);
|
||||||
@ -46,8 +47,6 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
AutoSize = true;
|
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
Controls.Add(textBox);
|
Controls.Add(textBox);
|
||||||
Name = "TextBoxControl";
|
Name = "TextBoxControl";
|
||||||
Size = new Size(216, 26);
|
Size = new Size(216, 26);
|
||||||
|
Loading…
Reference in New Issue
Block a user