diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs index 13453e7..e4996a6 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs @@ -1,5 +1,6 @@ using ModuleTools.Attributes; using ModuleTools.Enums; +using ModuleTools.Interfaces; using System; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; @@ -12,7 +13,7 @@ namespace DatabaseCore.Models.Security [DataContract] [EntityDescription("Access", "Доступные действия для ролей")] [EntityDependency("Role", "RoleId", "Доступные дейсвтиия создаются под конкретную роль")] - public class Access : BaseEntity + public class Access : BaseEntity, IEntitySecurityExtenstion { [Required] [DataMember] @@ -33,6 +34,15 @@ namespace DatabaseCore.Models.Security public virtual Role Role { get; set; } - //------------------------------------------------------------------------- - } + public Access SecurityCheck(Access entity, bool allowFullData) + { + if (!allowFullData) + { + entity.AccessType = AccessType.View; + } + return entity; + } + + //------------------------------------------------------------------------- + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs index 2eaa615..2c33a05 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs @@ -1,4 +1,5 @@ using ModuleTools.Attributes; +using ModuleTools.Interfaces; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; @@ -9,7 +10,7 @@ namespace DatabaseCore.Models.Security /// [DataContract] [EntityDescription("EnviromentSetting", "Общие настройки системы")] - public class EnviromentSetting : IdEntity + public class EnviromentSetting : IdEntity, IEntitySecurityExtenstion { [DataMember] [MapConfiguration("Key")] @@ -24,5 +25,14 @@ namespace DatabaseCore.Models.Security [DataMember] [MapConfiguration("Description")] public string Description { get; set; } + + public EnviromentSetting SecurityCheck(EnviromentSetting entity, bool allowFullData) + { + if (!allowFullData) + { + entity.Value = "скрыто"; + } + return entity; + } } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs index 15585a9..e9a51e9 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs @@ -1,4 +1,5 @@ using ModuleTools.Attributes; +using ModuleTools.Interfaces; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; @@ -10,7 +11,7 @@ namespace DatabaseCore.Models.Security /// [DataContract] [EntityDescription("Role", "Роли в системе")] - public class Role : BaseEntity + public class Role : BaseEntity, IEntitySecurityExtenstion { [DataMember] [MapConfiguration("RoleName")] @@ -29,5 +30,8 @@ namespace DatabaseCore.Models.Security [ForeignKey("RoleId")] public virtual List UserRoles { get; set; } + + public Role SecurityCheck(Role entity, bool allowFullData) => entity; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs index 9309785..ec105ef 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs @@ -1,4 +1,5 @@ using ModuleTools.Attributes; +using ModuleTools.Interfaces; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; @@ -11,7 +12,7 @@ namespace DatabaseCore.Models.Security /// [DataContract] [EntityDescription("User", "Пользователи системы")] - public class User : BaseEntity + public class User : BaseEntity, IEntitySecurityExtenstion { [DataMember] [MapConfiguration("Login")] @@ -47,5 +48,20 @@ namespace DatabaseCore.Models.Security [ForeignKey("UserId")] public virtual List UserRoles { get; set; } - } + + public User SecurityCheck(User entity, bool allowFullData) + { + if (!allowFullData) + { + entity.PasswordHash = SecurityManager.GetPasswordHash("qwerty"); + entity.Avatar = null; + entity.IsBanned = false; + entity.DateBanned = null; + entity.CountAttempt = 0; + entity.DateLastVisit = null; + } + + return entity; + } + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs index f182630..0b81721 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs @@ -1,4 +1,5 @@ using ModuleTools.Attributes; +using ModuleTools.Interfaces; using System; using System.Runtime.Serialization; @@ -11,7 +12,7 @@ namespace DatabaseCore.Models.Security [EntityDescription("UserRole", "Связь пользователей системы с ролями, которые им назначены")] [EntityDependency("Role", "RoleId", "К какой роли относится пользователь")] [EntityDependency("User", "UserId", "К какой роли относится пользователь")] - public class UserRole : BaseEntity + public class UserRole : BaseEntity, IEntitySecurityExtenstion { [DataMember] [MapConfiguration("RoleId")] @@ -27,6 +28,8 @@ namespace DatabaseCore.Models.Security public virtual User User { get; set; } - //------------------------------------------------------------------------- - } + public UserRole SecurityCheck(UserRole entity, bool allowFullData) => entity; + + //------------------------------------------------------------------------- + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs b/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs index a47e9dc..1338538 100644 --- a/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs +++ b/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs @@ -188,7 +188,7 @@ namespace DatabaseCore /// /// /// - private static string GetPasswordHash(string password) => Encoding.ASCII.GetString((new MD5CryptoServiceProvider()).ComputeHash(Encoding.ASCII.GetBytes(password))); + public static string GetPasswordHash(string password) => Encoding.ASCII.GetString((new MD5CryptoServiceProvider()).ComputeHash(Encoding.ASCII.GetBytes(password))); /// /// Проверка пользователя при авторизации и при смене пароля diff --git a/DepartmentPortal/Common/DesktopTools/Interfaces/IWindowDesktopExtension.cs b/DepartmentPortal/Common/DesktopTools/Interfaces/IWindowDesktopExtension.cs index 4a65857..5be9890 100644 --- a/DepartmentPortal/Common/DesktopTools/Interfaces/IWindowDesktopExtension.cs +++ b/DepartmentPortal/Common/DesktopTools/Interfaces/IWindowDesktopExtension.cs @@ -9,9 +9,15 @@ namespace DesktopTools.Interfaces public interface IWindowDesktopExtension { /// - /// Получение списка контролов модуля, доступных для работы по авторизованному пользователю + /// Получение списка контролов модуля для работсы с сущностями, доступных для работы по авторизованному пользователю /// /// List GetListControlEntityList(); + + /// + /// Получение списка контролов модуля для особой работы, доступных для работы по авторизованному пользователю + /// + /// + List GetListControlSpecialList(); } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs index 2a64c48..f49ffcb 100644 --- a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -17,6 +17,8 @@ НастройкиСреды = 4, ПользователиРоли = 5, + + РаботасБекапом = 10, #endregion #region База diff --git a/DepartmentPortal/Common/ModuleTools/Interfaces/IEntitySecurityExtenstion.cs b/DepartmentPortal/Common/ModuleTools/Interfaces/IEntitySecurityExtenstion.cs new file mode 100644 index 0000000..0bb43e8 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Interfaces/IEntitySecurityExtenstion.cs @@ -0,0 +1,18 @@ +namespace ModuleTools.Interfaces +{ + /// + /// Работа с сущностями с применением скрытности для полей + /// + /// Сущность + public interface IEntitySecurityExtenstion + where T: new() + { + /// + /// Обработка сущности для сокрытия важных полей + /// + /// + /// + /// + T SecurityCheck(T entity, bool allowFullData); + } +} \ No newline at end of file diff --git a/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs b/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs index f3c4b61..2def963 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs @@ -28,10 +28,11 @@ namespace DepartmentPortalDesctop var extensions = DesktopLoader.GetWindowDesktopExtensions(); foreach (var extens in extensions) { + ToolStripMenuItem menu = null; var list = extens?.GetListControlEntityList()?.ToList(); if (list != null && list.Count > 0) { - var menu = new ToolStripMenuItem { Text = list[0].Title }; + menu = new ToolStripMenuItem { Text = list[0].Title }; for (int i = 0; i < list.Count; i++) { if (list[i].Control is IControl control) @@ -51,17 +52,54 @@ namespace DepartmentPortalDesctop } } + } + list = extens?.GetListControlSpecialList()?.ToList(); + if (list != null && list.Count > 0) + { + if (menu == null) + { + menu = new ToolStripMenuItem { Text = list[0].Title }; + } + else if (menu.Text != list[0].Title) + { + menuMain.Items.Add(menu); + menu = new ToolStripMenuItem { Text = list[0].Title }; + } + menu.DropDownItems.Add(new ToolStripSeparator()); + + for (int i = 0; i < list.Count; i++) + { + if (list[i].Control is IControl control) + { + if (_baseControls.ContainsKey(list[i].Id)) + { + continue; + } + + _baseControls.Add(list[i].Id, control); + var submenu = new ToolStripMenuItem { Text = list[i].Title, Tag = list[i].Id }; + submenu.Click += (object sender, EventArgs e) => + { + OpenControl(new Guid((sender as ToolStripMenuItem).Tag.ToString())); + }; + menu.DropDownItems.Add(submenu); + } + } + } + + if (menu != null) + { menuMain.Items.Add(menu); } } - if(File.Exists(_fileForXmlConfig)) + if (File.Exists(_fileForXmlConfig)) { var xml = XDocument.Load(_fileForXmlConfig).Element("Controls"); Guid? id = null; if (xml != null) { - foreach(XElement node in xml.Elements("Control")) + foreach (XElement node in xml.Elements("Control")) { var type = node.Attribute("Type").Value.ToString(); var control = _baseControls.Values.FirstOrDefault(x => x.GetType().FullName == type); @@ -177,7 +215,7 @@ namespace DepartmentPortalDesctop private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { var xml = new XElement("Controls"); - foreach(var cntrl in _controls) + foreach (var cntrl in _controls) { xml.AddFirst(XElement.Parse(cntrl.Value.SaveToXml())); } diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/BackupBindingModel.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/BackupBindingModel.cs new file mode 100644 index 0000000..36bc449 --- /dev/null +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/BackupBindingModel.cs @@ -0,0 +1,23 @@ +namespace SecurityBusinessLogic.BindingModels +{ + /// + /// Информация по выгрузки/загрузки данных + /// + public class BackupBindingModel + { + /// + /// Путь до папки, куда выгружать бекап + /// + public string FolderName { get; set; } + + /// + /// Выгрузка всех данных, либо только общедоступных + /// + public bool FullData { get; set; } + + /// + /// Создать архив с выгрузкой + /// + public bool CreateArchive { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/BackupBusinessLogic.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/BackupBusinessLogic.cs new file mode 100644 index 0000000..fed97cf --- /dev/null +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/BackupBusinessLogic.cs @@ -0,0 +1,68 @@ +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Interfaces; +using ModuleTools.Models; +using SecurityBusinessLogic.BindingModels; +using SecurityBusinessLogic.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityBusinessLogic.BusinessLogics +{ + /// + /// Логика работы с бекапом + /// + public class BackupBusinessLogic + { + private IBackupService _service; + + /// + /// Менеджер безопасности + /// + private ISecurityManager _security; + + /// + /// Перечень ошибок при выполнении операции + /// + public List<(string Title, string Message)> Errors { get; protected set; } + + public BackupBusinessLogic(IBackupService service) + { + _service = service; + _security = DependencyManager.Instance.Resolve(); + Errors = new(); + } + + public bool CreateBackUp(BackupBindingModel model) + { + if (NoAccess()) + { + return false; + } + var result = _service.CreateBackUp(model); + if (!result.IsSucceeded) + { + Errors.AddRange(result.Errors); + return false; + } + return true; + } + + /// + /// Проверка доступности операции для пользователя + /// + /// + private bool NoAccess() + { + if (_security.CheckAccess(new SecurityManagerCheckAccessModel(null, AccessOperation.РаботасБекапом, AccessType.View, "бекап"))) + { + return false; + } + Errors.Add(("Ошибка безопасности", _security.ErrorMessage)); + return true; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IBackupService.cs b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IBackupService.cs new file mode 100644 index 0000000..4eb339d --- /dev/null +++ b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IBackupService.cs @@ -0,0 +1,13 @@ +using ModuleTools.Models; +using SecurityBusinessLogic.BindingModels; + +namespace SecurityBusinessLogic.Interfaces +{ + /// + /// Сервис работы по выгрузке и загрузке данных + /// + public interface IBackupService + { + OperationResultModel CreateBackUp(BackupBindingModel model); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/BackupService.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/BackupService.cs new file mode 100644 index 0000000..a7f799b --- /dev/null +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/BackupService.cs @@ -0,0 +1,54 @@ +using DatabaseCore; +using ModuleTools.Interfaces; +using ModuleTools.Models; +using SecurityBusinessLogic.BindingModels; +using SecurityBusinessLogic.Interfaces; +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization.Json; + +namespace SecurityDatabaseImplementation.Implementations +{ + public class BackupService : IBackupService + { + public OperationResultModel CreateBackUp(BackupBindingModel model) + { + try + { + var asm = typeof(DatabaseManager).Assembly; + MethodInfo method = GetType().GetTypeInfo().GetDeclaredMethod("SaveToFile"); + foreach (var t in asm.GetExportedTypes()) + { + if (t.IsClass && t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEntitySecurityExtenstion<>))) + { + var elem = asm.CreateInstance(t.FullName); + MethodInfo generic = method.MakeGenericMethod(elem.GetType()); + generic.Invoke(this, new object[] { model.FolderName, model.FullData, t }); + } + } + if (model.CreateArchive) + { + ZipFile.CreateFromDirectory(model.FolderName, $"{model.FolderName}.zip"); + } + } + catch (Exception ex) + { + return OperationResultModel.Error(ex); + } + return OperationResultModel.Success(null); + } + + private void SaveToFile(string folderName, bool allowFullData, Type t) where T : class, IEntitySecurityExtenstion, new() + { + using var context = DatabaseManager.GetContext; + var records = context.Set().Select(x => x.SecurityCheck(x, allowFullData)); + DataContractJsonSerializer jsonFormatter = new(typeof(List)); + using FileStream fs = new(string.Format("{0}/{1}.json", folderName, t.Name), FileMode.OpenOrCreate); + jsonFormatter.WriteObject(fs, records); + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs index bcf3a23..4c12d2b 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs @@ -14,6 +14,8 @@ namespace SecurityDatabaseImplementation DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } } \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.Designer.cs index c70d2dc..5452095 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlAccessElement { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.cs similarity index 93% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.cs index 9c14792..5fed30a 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.cs @@ -5,7 +5,7 @@ using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; using System; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { public partial class ControlAccessElement : GenericControlEntityElement, diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessElement.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessElement.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.Designer.cs index d3d8631..726b594 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlAccessList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.cs similarity index 97% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.cs index 1f97b75..9aba467 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.Data; using System.Linq; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка доступов diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlAccessList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.Designer.cs index 9b2780b..0bd9ee9 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlEnviromentSettingElement { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.cs similarity index 94% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.cs index caa1df6..587d129 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.cs @@ -5,7 +5,7 @@ using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; using System; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { public partial class ControlEnviromentSettingElement : GenericControlEntityElement, diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingElement.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingElement.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.Designer.cs index 05cc0b6..104563d 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlEnviromentSettingList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.cs similarity index 97% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.cs index 9f285fc..0ebdc73 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.cs @@ -9,7 +9,7 @@ using SecurityBusinessLogic.ViewModels; using System; using System.Collections.Generic; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка настроек среды diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlEnviromentSettingList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlEnviromentSettingList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.Designer.cs index 4c188ba..55f87f8 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlRoleElement { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.cs similarity index 93% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.cs index b4917f4..9d96fca 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.cs @@ -5,7 +5,7 @@ using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; using System; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { public partial class ControlRoleElement : GenericControlEntityElement, diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleElement.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleElement.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.Designer.cs index 5484e2f..d43ed41 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlRoleList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.cs similarity index 97% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.cs index ceccd5c..feb6cdb 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.cs @@ -9,7 +9,7 @@ using SecurityBusinessLogic.ViewModels; using System; using System.Collections.Generic; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка ролей diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.Designer.cs index 47aa328..c397bc4 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlRoleUserList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.cs similarity index 97% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.cs index 70b96dc..1378d28 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.cs @@ -9,7 +9,7 @@ using SecurityBusinessLogic.ViewModels; using System; using System.Collections.Generic; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка пользователей роли diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlRoleUserList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlRoleUserList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.Designer.cs index 8bc3be1..cf24207 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlUserElement { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.cs similarity index 93% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.cs index db4cdec..7481507 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.cs @@ -5,7 +5,7 @@ using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; using System; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { public partial class ControlUserElement : GenericControlEntityElement, diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserElement.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserElement.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.Designer.cs index 2bf01f9..178e570 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlUserList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.cs similarity index 98% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.cs index 2c080c9..8e97a98 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.cs @@ -10,7 +10,7 @@ using System; using System.Linq; using System.Windows.Forms; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка пользователей diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.Designer.cs index bda771b..b27dabd 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlUserRoleElement { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.cs similarity index 94% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.cs index 47ac18a..1019f08 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.cs @@ -5,7 +5,7 @@ using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; using System; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { public partial class ControlUserRoleElement : GenericControlEntityElement, diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleElement.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleElement.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.Designer.cs similarity index 95% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.Designer.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.Designer.cs index 30fbfb2..54b3d87 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.Designer.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.Designer.cs @@ -1,5 +1,5 @@  -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { partial class ControlUserRoleList { diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.cs similarity index 97% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.cs rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.cs index 8120be4..51ff9f7 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.cs @@ -9,7 +9,7 @@ using SecurityBusinessLogic.ViewModels; using System; using System.Collections.Generic; -namespace SecurityWindowsDesktop.Controls +namespace SecurityWindowsDesktop.EntityControls { /// /// Реализация контрола для списка ролей пользователя diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.resx similarity index 100% rename from DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlUserRoleList.resx rename to DepartmentPortal/Security/SecurityWindowsDesktop/EntityControls/ControlUserRoleList.resx diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e874f9e --- /dev/null +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace SecurityWindowsDesktop.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SecurityWindowsDesktop.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Close { + get { + object obj = ResourceManager.GetObject("Close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.resx new file mode 100644 index 0000000..d77aec4 --- /dev/null +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Resources/Close.png b/DepartmentPortal/Security/SecurityWindowsDesktop/Resources/Close.png new file mode 100644 index 0000000..d88c7a0 Binary files /dev/null and b/DepartmentPortal/Security/SecurityWindowsDesktop/Resources/Close.png differ diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs index 8c12a43..f4dc9e2 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs @@ -5,7 +5,8 @@ using ModuleTools.BusinessLogics; using ModuleTools.Enums; using ModuleTools.Interfaces; using ModuleTools.Models; -using SecurityWindowsDesktop.Controls; +using SecurityWindowsDesktop.EntityControls; +using SecurityWindowsDesktop.SpecialControls; using System.Collections.Generic; namespace SecurityWindowsDesktop @@ -54,5 +55,45 @@ namespace SecurityWindowsDesktop return list; } + + public List GetListControlSpecialList() + { + var manager = DependencyManager.Instance.Resolve(); + if (manager == null) + { + return null; + } + + if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = manager.User }, + AccessOperation.Администрирование, AccessType.View, "Администрирование"))) + { + return null; + } + + var list = new List + { + new WindowDesktopExtensionControlModel { Title = "Администрирование" } + }; + List _controls = new() + { + new BackupControl() + }; + + foreach (var cntrl in _controls) + { + if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = manager.User }, + cntrl.AccessOperation, AccessType.View, cntrl.Title))) + { + list.Add(new WindowDesktopExtensionControlModel + { + Id = cntrl.ControlId, + Title = cntrl.Title, + Control = cntrl + }); + } + } + + return list; + } } } \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowsDesktop.csproj b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowsDesktop.csproj index 17a9bf4..8ff9998 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowsDesktop.csproj +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowsDesktop.csproj @@ -14,6 +14,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.Designer.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.Designer.cs new file mode 100644 index 0000000..c14102e --- /dev/null +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.Designer.cs @@ -0,0 +1,166 @@ + +namespace SecurityWindowsDesktop.SpecialControls +{ + partial class BackupControl + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.groupBoxSaveBackup = new System.Windows.Forms.GroupBox(); + this.buttonCreateBackup = new System.Windows.Forms.Button(); + this.checkBoxCreateArchive = new System.Windows.Forms.CheckBox(); + this.checkBoxFullLoad = new System.Windows.Forms.CheckBox(); + this.buttonSelectFolder = new System.Windows.Forms.Button(); + this.textBoxFolderName = new System.Windows.Forms.TextBox(); + this.labelFolderName = new System.Windows.Forms.Label(); + this.toolStripHeader = new System.Windows.Forms.ToolStrip(); + this.toolStripButtonClose = new System.Windows.Forms.ToolStripButton(); + this.groupBoxSaveBackup.SuspendLayout(); + this.toolStripHeader.SuspendLayout(); + this.SuspendLayout(); + // + // groupBoxSaveBackup + // + this.groupBoxSaveBackup.Controls.Add(this.buttonCreateBackup); + this.groupBoxSaveBackup.Controls.Add(this.checkBoxCreateArchive); + this.groupBoxSaveBackup.Controls.Add(this.checkBoxFullLoad); + this.groupBoxSaveBackup.Controls.Add(this.buttonSelectFolder); + this.groupBoxSaveBackup.Controls.Add(this.textBoxFolderName); + this.groupBoxSaveBackup.Controls.Add(this.labelFolderName); + this.groupBoxSaveBackup.Location = new System.Drawing.Point(0, 28); + this.groupBoxSaveBackup.Name = "groupBoxSaveBackup"; + this.groupBoxSaveBackup.Size = new System.Drawing.Size(496, 100); + this.groupBoxSaveBackup.TabIndex = 0; + this.groupBoxSaveBackup.TabStop = false; + this.groupBoxSaveBackup.Text = "Сохранение в бекап"; + // + // buttonCreateBackup + // + this.buttonCreateBackup.Location = new System.Drawing.Point(385, 71); + this.buttonCreateBackup.Name = "buttonCreateBackup"; + this.buttonCreateBackup.Size = new System.Drawing.Size(99, 23); + this.buttonCreateBackup.TabIndex = 5; + this.buttonCreateBackup.Text = "Выгрузить"; + this.buttonCreateBackup.UseVisualStyleBackColor = true; + this.buttonCreateBackup.Click += new System.EventHandler(this.ButtonCreateBackup_Click); + // + // checkBoxCreateArchive + // + this.checkBoxCreateArchive.AutoSize = true; + this.checkBoxCreateArchive.Location = new System.Drawing.Point(262, 55); + this.checkBoxCreateArchive.Name = "checkBoxCreateArchive"; + this.checkBoxCreateArchive.Size = new System.Drawing.Size(104, 19); + this.checkBoxCreateArchive.TabIndex = 4; + this.checkBoxCreateArchive.Text = "Создать архив"; + this.checkBoxCreateArchive.UseVisualStyleBackColor = true; + // + // checkBoxFullLoad + // + this.checkBoxFullLoad.AutoSize = true; + this.checkBoxFullLoad.Location = new System.Drawing.Point(120, 55); + this.checkBoxFullLoad.Name = "checkBoxFullLoad"; + this.checkBoxFullLoad.Size = new System.Drawing.Size(121, 19); + this.checkBoxFullLoad.TabIndex = 3; + this.checkBoxFullLoad.Text = "Полная выгрузка"; + this.checkBoxFullLoad.UseVisualStyleBackColor = true; + // + // buttonSelectFolder + // + this.buttonSelectFolder.Location = new System.Drawing.Point(385, 26); + this.buttonSelectFolder.Name = "buttonSelectFolder"; + this.buttonSelectFolder.Size = new System.Drawing.Size(99, 23); + this.buttonSelectFolder.TabIndex = 2; + this.buttonSelectFolder.Text = "Выбрать папку"; + this.buttonSelectFolder.UseVisualStyleBackColor = true; + this.buttonSelectFolder.Click += new System.EventHandler(this.ButtonSelectFolder_Click); + // + // textBoxFolderName + // + this.textBoxFolderName.Location = new System.Drawing.Point(107, 26); + this.textBoxFolderName.Name = "textBoxFolderName"; + this.textBoxFolderName.Size = new System.Drawing.Size(272, 23); + this.textBoxFolderName.TabIndex = 1; + // + // labelFolderName + // + this.labelFolderName.AutoSize = true; + this.labelFolderName.Location = new System.Drawing.Point(16, 29); + this.labelFolderName.Name = "labelFolderName"; + this.labelFolderName.Size = new System.Drawing.Size(85, 15); + this.labelFolderName.TabIndex = 0; + this.labelFolderName.Text = "Путь до папки"; + // + // toolStripHeader + // + this.toolStripHeader.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButtonClose}); + this.toolStripHeader.Location = new System.Drawing.Point(0, 0); + this.toolStripHeader.Name = "toolStripHeader"; + this.toolStripHeader.Size = new System.Drawing.Size(708, 25); + this.toolStripHeader.TabIndex = 1; + this.toolStripHeader.Text = "toolStrip1"; + this.toolStripHeader.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ToolStripHeader_ItemClicked); + // + // toolStripButtonClose + // + this.toolStripButtonClose.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.toolStripButtonClose.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonClose.Image = global::SecurityWindowsDesktop.Properties.Resources.Close; + this.toolStripButtonClose.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonClose.Name = "toolStripButtonClose"; + this.toolStripButtonClose.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonClose.Text = "Закрыть"; + // + // BackupControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.toolStripHeader); + this.Controls.Add(this.groupBoxSaveBackup); + this.Name = "BackupControl"; + this.Size = new System.Drawing.Size(708, 486); + this.groupBoxSaveBackup.ResumeLayout(false); + this.groupBoxSaveBackup.PerformLayout(); + this.toolStripHeader.ResumeLayout(false); + this.toolStripHeader.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBoxSaveBackup; + private System.Windows.Forms.Label labelFolderName; + private System.Windows.Forms.TextBox textBoxFolderName; + private System.Windows.Forms.Button buttonSelectFolder; + private System.Windows.Forms.CheckBox checkBoxCreateArchive; + private System.Windows.Forms.Button buttonCreateBackup; + private System.Windows.Forms.CheckBox checkBoxFullLoad; + private System.Windows.Forms.ToolStrip toolStripHeader; + private System.Windows.Forms.ToolStripButton toolStripButtonClose; + } +} diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.cs new file mode 100644 index 0000000..fa577d3 --- /dev/null +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.cs @@ -0,0 +1,89 @@ +using DesktopTools.Helpers; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using SecurityBusinessLogic.BindingModels; +using SecurityBusinessLogic.BusinessLogics; +using System; +using System.Windows.Forms; + +namespace SecurityWindowsDesktop.SpecialControls +{ + public partial class BackupControl : UserControl, IControl + { + private readonly BackupBusinessLogic _businessLogic; + + /// + /// Событие, вызываемое при закрытии контрола + /// + private event Action CloseEvent; + + public BackupControl() + { + InitializeComponent(); + _businessLogic = DependencyManager.Instance.Resolve(); + Title = "Работа с бекапом"; + ControlId = new Guid("cc9844e6-5d92-4c89-b817-4c17ec382bc1"); + AccessOperation = AccessOperation.РаботасБекапом; + } + + public Guid ControlId { get; private set; } + + public string Title { get; private set; } + + public AccessOperation AccessOperation { get; private set; } + + public IControl GetInstance() => new BackupControl() { ControlId = Guid.NewGuid() }; + + public void LoadFromXml(string xml) + { + } + + public void Open(ControlOpenModel model) + { + if (model.CloseList != null) + { + CloseEvent += model.CloseList; + } + Dock = DockStyle.Fill; + } + + public string SaveToXml() + { + return string.Empty; + } + + private void ButtonSelectFolder_Click(object sender, EventArgs e) + { + var fbd = new FolderBrowserDialog(); + if (fbd.ShowDialog() == DialogResult.OK) + { + textBoxFolderName.Text = fbd.SelectedPath; + } + } + + private void ButtonCreateBackup_Click(object sender, EventArgs e) + { + if (_businessLogic.CreateBackUp(new BackupBindingModel + { + FolderName = textBoxFolderName.Text, + FullData = checkBoxFullLoad.Checked, + CreateArchive = checkBoxCreateArchive.Checked + })) + { + DialogHelper.MessageInformation("Сохранение прошло успешно", "Результат"); + } + else + { + DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при сохранении"); + } + } + + private void ToolStripHeader_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + CloseEvent?.Invoke(ControlId); + Dispose(); + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.resx b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SpecialControls/BackupControl.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file