diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs index 7ef1c95..76a69fd 100644 --- a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs +++ b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs @@ -12,7 +12,7 @@ namespace DatabaseCore if (optionsBuilder.IsConfigured == false) { #if RELEASE - var connectionString = ModelTools.ServiceProvider.ServiceProviderLoader.GetConfigData("connectionString"); + var connectionString = ModuleTools.ServiceProvider.ServiceProviderLoader.GetConfigData("connectionString"); optionsBuilder.UseSqlServer(connectionString); #endif diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseCore.csproj b/DepartmentPortal/Common/DatabaseCore/DatabaseCore.csproj index b5aca4a..b72d084 100644 --- a/DepartmentPortal/Common/DatabaseCore/DatabaseCore.csproj +++ b/DepartmentPortal/Common/DatabaseCore/DatabaseCore.csproj @@ -14,8 +14,7 @@ - - + diff --git a/DepartmentPortal/Common/DatabaseCore/Models/IdEntity.cs b/DepartmentPortal/Common/DatabaseCore/Models/IdEntity.cs index eb15cd0..c3a8477 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/IdEntity.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/IdEntity.cs @@ -1,4 +1,4 @@ -using ModelTools.Attributes; +using ModuleTools.Attributes; using System; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs index aa77122..1414c2c 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs @@ -1,5 +1,5 @@ -using ModelTools.Attributes; -using ModelTools.Enums; +using ModuleTools.Attributes; +using ModuleTools.Enums; using System; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs index dfd0fb6..ecf49c9 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs @@ -1,4 +1,4 @@ -using ModelTools.Attributes; +using ModuleTools.Attributes; using System.Runtime.Serialization; namespace DatabaseCore.Models.Security diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs index 40f4cf2..15585a9 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs @@ -1,4 +1,4 @@ -using ModelTools.Attributes; +using ModuleTools.Attributes; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs index 6e5aa34..1ae90a7 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs @@ -1,4 +1,4 @@ -using ModelTools.Attributes; +using ModuleTools.Attributes; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs index b2e3bfb..7d0b2fc 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs @@ -1,4 +1,4 @@ -using ModelTools.Attributes; +using ModuleTools.Attributes; using System; using System.Runtime.Serialization; diff --git a/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs b/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs index a3cf4ac..083a088 100644 --- a/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs +++ b/DepartmentPortal/Common/DatabaseCore/SecurityManager.cs @@ -1,8 +1,7 @@ using DatabaseCore.Models.Security; -using ModelTools.Enums; -using ModelTools.Interfaces; -using ModelTools.Models; -using SecurityBusinessLogic.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Interfaces; +using ModuleTools.Models; using System; using System.Collections.Generic; using System.Linq; diff --git a/DepartmentPortal/Common/DesktopTools/Controls/AbstractGenerticControlEntityList.cs b/DepartmentPortal/Common/DesktopTools/Controls/AbstractGenerticControlEntityList.cs index f96e77a..d09cb1b 100644 --- a/DepartmentPortal/Common/DesktopTools/Controls/AbstractGenerticControlEntityList.cs +++ b/DepartmentPortal/Common/DesktopTools/Controls/AbstractGenerticControlEntityList.cs @@ -1,9 +1,9 @@ using DesktopTools.Models; -using ModelTools.Attributes; -using ModelTools.BindingModels; -using ModelTools.BusinessLogics; -using ModelTools.Extensions; -using ModelTools.ViewModels; +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using ModuleTools.BusinessLogics; +using ModuleTools.Extensions; +using ModuleTools.ViewModels; using System; using System.Collections.Generic; using System.Reflection; diff --git a/DepartmentPortal/Common/DesktopTools/Controls/ControlViewEntityList.cs b/DepartmentPortal/Common/DesktopTools/Controls/ControlViewEntityList.cs index 597e374..daffbf1 100644 --- a/DepartmentPortal/Common/DesktopTools/Controls/ControlViewEntityList.cs +++ b/DepartmentPortal/Common/DesktopTools/Controls/ControlViewEntityList.cs @@ -1,4 +1,4 @@ -using ModelTools.Enums; +using ModuleTools.Enums; using System; using System.Windows.Forms; diff --git a/DepartmentPortal/Common/DesktopTools/DesktopTools.csproj b/DepartmentPortal/Common/DesktopTools/DesktopTools.csproj index 6af57c1..31a8bdc 100644 --- a/DepartmentPortal/Common/DesktopTools/DesktopTools.csproj +++ b/DepartmentPortal/Common/DesktopTools/DesktopTools.csproj @@ -6,7 +6,7 @@ - + diff --git a/DepartmentPortal/Common/ModuleTools/Attributes/EntityDependencyAttribute.cs b/DepartmentPortal/Common/ModuleTools/Attributes/EntityDependencyAttribute.cs new file mode 100644 index 0000000..0578d72 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Attributes/EntityDependencyAttribute.cs @@ -0,0 +1,40 @@ +using System; + +namespace ModuleTools.Attributes +{ + /// + /// Оописание зависимости сущности от другой сущности (требуется для выстраивания последоватльности сохранения и загрузки данных, + /// применяется к классам-описывающим сущности в хранилище) + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] + public class EntityDependencyAttribute : Attribute + { + /// + /// Название класса от котрого зависит этот класс + /// + public string ClassName { get; set; } + + /// + /// Название поле в этом классе, которое ссылает на другой класс (идентификатор) + /// + public string ColumnName { get; set; } + + /// + /// Описание зависимости + /// + public string Description { get; set; } + + /// + /// Описание зависимости сущности от другой сущности (требуется для сохранения и загрузки данных) + /// + /// Название класса от котрого зависит этот класс + /// Название поле в этом классе, которое ссылает на другой класс (идентификатор) + /// Описание зависимости + public EntityDependencyAttribute(string className, string columnName, string description) + { + ClassName = className; + ColumnName = columnName; + Description = description; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Attributes/EntityDescriptionAttribute.cs b/DepartmentPortal/Common/ModuleTools/Attributes/EntityDescriptionAttribute.cs new file mode 100644 index 0000000..216294f --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Attributes/EntityDescriptionAttribute.cs @@ -0,0 +1,33 @@ +using System; + +namespace ModuleTools.Attributes +{ + /// + /// Оописание класса из базы данных, его назначение (требуется для выстраивания иерархии с описанием классов, + /// применяется к классам-описывающим сущности в хранилище) + /// + [AttributeUsage(AttributeTargets.Class)] + public class EntityDescriptionAttribute : Attribute + { + /// + /// Название сущности, которую описывает класс + /// + public string EntityName { get; set; } + + /// + /// Описание назначения сущности + /// + public string Description { get; set; } + + /// + /// Описание класса из базы данных, его назначение + /// + /// Название сущности, которую описывает класс + /// Описание назначения сущности + public EntityDescriptionAttribute(string entityName, string description) + { + EntityName = entityName; + Description = description; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Attributes/MapConfigurationAttribute.cs b/DepartmentPortal/Common/ModuleTools/Attributes/MapConfigurationAttribute.cs new file mode 100644 index 0000000..79e24f4 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Attributes/MapConfigurationAttribute.cs @@ -0,0 +1,35 @@ +using System; + +namespace ModuleTools.Attributes +{ + /// + /// Настройка для полей сущности правил маппинга в классе, который требуется заполнять данными из другого класса + /// (требуется для заполнения свойств объекта значениями одного класса значениями свойств объектов другого класса, + /// применяется при создании класса-описывающего сущность в хранилище из класса SetBindingModel + /// и из класса-описывающего сущность в хранилище в класс ElementViewModel) + /// + [AttributeUsage(AttributeTargets.Property)] + public class MapConfigurationAttribute : Attribute + { + /// + /// Название свойства с класса, из которого извлекаем данные + /// + public string PropertyNameFromModel { get; set; } + + /// + /// Сложное свойство (свойствое в другом классе-свойстве) + /// + public bool IsDifficle { get; set; } + + /// + /// Настройка для полей сущности правил маппинга + /// + /// Название свойства с класса, из которого извлекаем данные + /// Сложное свойство (свойствое в другом классе-свойстве) + public MapConfigurationAttribute(string propertyNameFromMModel, bool isDifficle = false) + { + PropertyNameFromModel = propertyNameFromMModel; + IsDifficle = isDifficle; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Attributes/ViewModelOnListPropertyAttribute.cs b/DepartmentPortal/Common/ModuleTools/Attributes/ViewModelOnListPropertyAttribute.cs new file mode 100644 index 0000000..5c30c61 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Attributes/ViewModelOnListPropertyAttribute.cs @@ -0,0 +1,51 @@ +using System; + +namespace ModuleTools.Attributes +{ + /// + /// Настройка отображения свойства класса при табличном выводе списка объектов класса (требуется для автоматизации вывода списка, + /// применяется к классам ElementViewModel) + /// + [AttributeUsage(AttributeTargets.Property)] + public class ViewModelOnListPropertyAttribute : Attribute + { + /// + /// Название на форме + /// + public string DisplayName { get; set; } + + /// + /// Скрывать или нет при выводе списка + /// + public bool IsHide { get; set; } + + /// + /// Ширина колонки + /// + public int? ColumnWidth { get; set; } + + /// + /// Настройка отображения элемента в контролах + /// + /// Название на форме + /// Скрывать или нет + public ViewModelOnListPropertyAttribute(string displayName, bool isHide = false) + { + DisplayName = displayName; + ColumnWidth = null; + IsHide = isHide; + } + + /// + /// Конструктор + /// + /// Название на форме + /// Ширина колонки + public ViewModelOnListPropertyAttribute(string displayName, int columnWidth) + { + DisplayName = displayName; + ColumnWidth = columnWidth; + IsHide = false; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BindingModels/AccessBindingModel.cs b/DepartmentPortal/Common/ModuleTools/BindingModels/AccessBindingModel.cs new file mode 100644 index 0000000..3114ec3 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BindingModels/AccessBindingModel.cs @@ -0,0 +1,20 @@ +using System; + +namespace ModuleTools.BindingModels +{ + /// + /// Информация для доступа к выполнению операций + /// + public class AccessBindingModel + { + /// + /// Пропускать проверку (работает только для получения данных) + /// + public bool SkipCheck { get; set; } + + /// + /// Идентификатор пользователя, который запрашивает выполнение операции + /// + public Guid? UserId { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BindingModels/GetBindingModel.cs b/DepartmentPortal/Common/ModuleTools/BindingModels/GetBindingModel.cs new file mode 100644 index 0000000..0efb260 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BindingModels/GetBindingModel.cs @@ -0,0 +1,30 @@ +using System; + +namespace ModuleTools.BindingModels +{ + /// + /// Получение записи + /// + public class GetBindingModel : AccessBindingModel + { + /// + /// Идентификатор получаемой записи (для одной записи) + /// + public Guid? Id { get; set; } + + /// + /// Номер страницы, которую получаем (для списка) + /// + public int? PageNumber { get; set; } + + /// + /// Количество записей возвращаемых (для списка) + /// + public int? PageSize { get; set; } + + /// + /// Иной признак, по которму отбираем записи (для списка) + /// + public string PageName { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs b/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs new file mode 100644 index 0000000..4a94cfd --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs @@ -0,0 +1,15 @@ +using System; + +namespace ModuleTools.BindingModels +{ + /// + /// Сохранение записи по идентификатору + /// + public class SetBindingModel : AccessBindingModel + { + /// + /// Идентификатор записи + /// + public Guid Id { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs new file mode 100644 index 0000000..b961277 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs @@ -0,0 +1,226 @@ +using ModuleTools.BindingModels; +using ModuleTools.Enums; +using ModuleTools.Interfaces; +using ModuleTools.Models; +using ModuleTools.ViewModels; +using System; +using System.Collections.Generic; + +namespace ModuleTools.BusinessLogics +{ + /// + /// Базовый класс для логики сущности + /// + /// + /// + /// + /// + public abstract class BusinessLogicCore + where G : GetBindingModel + where S : SetBindingModel + where L : ListViewModel + where E : ElementViewModel + { + /// + /// Перечень ошибок при выполнении операции + /// + public List<(string Title, string Message)> Errors { get; protected set; } + + protected IEntityService Service { get; set; } + + protected ISecurityManager Security { get; set; } + + protected readonly AccessOperation _serviceOperation; + + protected readonly string _entity; + + public BusinessLogicCore(IEntityService service, string entity, AccessOperation serviceOperation) + { + Service = service; + Errors = new List<(string Title, string Message)>(); + Security = UnityContainerConfigurator.Resolve(); + _entity = entity; + _serviceOperation = serviceOperation; + } + + /// + /// Проверка доступности операции для пользователя + /// + /// + /// + /// + protected bool NoAccess(AccessBindingModel model, AccessType type) + { + if (Security.CheckAccess(new SecurityManagerCheckAccessModel(model, _serviceOperation, type, _entity))) + { + return false; + } + + Errors.Add(("Ошибка безопасности", Security.ErrorMessage)); + return true; + } + + /// + /// Получение списка записей + /// + /// + /// + public L GetList(G model) + { + Errors.Clear(); + try + { + if (NoAccess(model, AccessType.SimpleView) && NoAccess(model, AccessType.FullView)) + { + return null; + } + var result = Service.Read(model); + if (!result.IsSucceeded) + { + Errors.AddRange(Errors); + return null; + } + + return ConvertToL(result); + } + catch (Exception ex) + { + Errors.Add(("Ошибка получения", ex.Message)); + } + return null; + } + + /// + /// Получение записи + /// + /// + /// + public E GetElement(G model) + { + Errors.Clear(); + try + { + if (NoAccess(model, AccessType.SimpleView) && NoAccess(model, AccessType.FullView)) + { + return null; + } + var result = Service.Read(model); + if (!result.IsSucceeded) + { + Errors.AddRange(Errors); + return null; + } + return ConvertToE(result); + } + catch (Exception ex) + { + Errors.Add(("Ошибка получения", ex.Message)); + } + return null; + } + + /// + /// Создание записи + /// + /// + /// + public E Create(S model) + { + Errors.Clear(); + try + { + if (NoAccess(model, AccessType.Change)) + { + return null; + } + var result = Service.Create(model); + if (!result.IsSucceeded) + { + Errors.AddRange(Errors); + return null; + } + + return ConvertToE(result); + } + catch (Exception ex) + { + Errors.Add(("Ошибка создания", ex.Message)); + } + return null; + } + + /// + /// Изменение записи + /// + /// + /// + public E Update(S model) + { + Errors.Clear(); + try + { + if (NoAccess(model, AccessType.Change)) + { + return null; + } + var result = Service.Update(model); + if (!result.IsSucceeded) + { + Errors.AddRange(Errors); + return null; + } + + return ConvertToE(result); + } + catch (Exception ex) + { + Errors.Add(("Ошибка изменения", ex.Message)); + } + return null; + } + + /// + /// Удаление записи + /// + /// + /// + public bool Delete(G model) + { + Errors.Clear(); + try + { + if (NoAccess(model, AccessType.Delete)) + { + return false; + } + var result = Service.Delete(model); + if (!result.IsSucceeded) + { + Errors.AddRange(Errors); + return false; + } + + return true; + } + catch (Exception ex) + { + Errors.Add(("Ошибка удаления", ex.Message)); + } + return false; + } + + /// + /// Получить список элементов + /// + /// + /// + protected abstract L ConvertToL(OperationResultModel model); + + /// + /// Получить элемент + /// + /// + /// + protected abstract E ConvertToE(OperationResultModel model); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs new file mode 100644 index 0000000..c56e4ce --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs @@ -0,0 +1,100 @@ +using ModuleTools.Attributes; +using System; +using System.Reflection; + +namespace ModuleTools.BusinessLogics +{ + /// + /// Маппер сущностей + /// + public class Mapper + { + /// + /// Преобразование из одного класса в другой + /// + /// + /// + /// + /// + public static To MapToClass(From obj) where To : class => FillObject(obj, (To)Activator.CreateInstance(typeof(To))); + + /// + /// Преобразование из одного класса в другой + /// + /// + /// + /// + /// + /// + public static To MapToClass(From obj, To newObject) where To : class => FillObject(obj, newObject); + + /// + /// Заполнение объекта + /// + /// + /// + /// + /// + /// + private static To FillObject(From obj, To newObject) + where To : class + { + if (obj == null) + { + return null; + } + + if (newObject == null) + { + return null; + } + var typeFrom = typeof(From); + var typeTo = typeof(To); + var properties = typeTo.GetProperties(); + foreach (var property in properties) + { + var customAttribute = property.GetCustomAttribute(); + if (customAttribute != null) + { + object value = obj; + if (customAttribute.IsDifficle) + { + var props = customAttribute.PropertyNameFromModel.Split('.'); + foreach (var prop in props) + { + var bindingProperty = value.GetType().GetProperty(prop); + if (bindingProperty != null) + { + value = bindingProperty.GetValue(value); + if (value is null) + { + break; + } + } + else + { + value = null; + break; + } + } + } + else + { + var bindingProperty = typeFrom.GetProperty(customAttribute.PropertyNameFromModel); + if (bindingProperty != null) + { + value = bindingProperty.GetValue(obj); + } + } + if (value is null) + { + continue; + } + property.SetValue(newObject, value); + } + } + + return newObject; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/ServiceProviderLoader.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/ServiceProviderLoader.cs new file mode 100644 index 0000000..e46e0e8 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/ServiceProviderLoader.cs @@ -0,0 +1,112 @@ +using ModuleTools.Extensions; +using ModuleTools.Interfaces; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Xml.XPath; + +namespace ModuleTools.BusinessLogics +{ + /// + /// Загрузчик данных + /// + public static class ServiceProviderLoader + { + private static readonly string _configFileName = "DepartmentPortal.config"; + + private static readonly string _pathToImplementationExt = "..\\..\\..\\..\\ImplementationExtensions\\"; + + private static readonly string _pathToWindowDestopExt = "..\\..\\..\\..\\WindowDestopExtensions\\"; + + /// + /// Получение данных с файла настроек + /// + /// + /// + public static string GetConfigData(string key) + { + var fileName = GetFile(_configFileName); + if (!File.Exists(fileName)) + { + return string.Empty; + } + + var doc = new XPathDocument(fileName); + var nav = doc.CreateNavigator(); + var data = nav.SelectDescendants(key, "", false); + data.MoveNext(); + return data.Current.Value; + } + + /// + /// Загрузка всех классов-реализаций IImplementationExtension + /// + /// + public static List GetImplementationExtensions() + { + var list = new List(); + if(Directory.Exists(_pathToImplementationExt)) + { + var files = Directory.GetFiles(_pathToImplementationExt, "*.dll", SearchOption.AllDirectories); + var loadedFiles = new List(); + foreach(var file in files.Distinct()) + { + if(loadedFiles.Contains(file.GetFileName())) + { + continue; + } + Assembly asm = Assembly.LoadFrom(file); + foreach (var t in asm.GetExportedTypes()) + { + if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t)) + { + list.Add((IImplementationExtension)Activator.CreateInstance(t)); + } + } + loadedFiles.Add(file.GetFileName()); + } + } + return list; + } + + /// + /// Загрузка всех классов-реализаций IWindowDesktopExtension + /// + /// + public static List GetWindowDesktopExtensions() + { + var list = new List(); + if (Directory.Exists(_pathToWindowDestopExt)) + { + var files = Directory.GetFiles(_pathToWindowDestopExt, "*.dll", SearchOption.AllDirectories); + var loadedFiles = new List(); + foreach (var file in files.Distinct()) + { + if (loadedFiles.Contains(file.GetFileName())) + { + continue; + } + Assembly asm = Assembly.LoadFrom(file); + foreach (var t in asm.GetExportedTypes()) + { + if (t.IsClass && typeof(IWindowDesktopExtension).IsAssignableFrom(t)) + { + list.Add((IWindowDesktopExtension)Activator.CreateInstance(t)); + } + } + loadedFiles.Add(file.GetFileName()); + } + } + return list; + } + + /// + /// Получение имени файла + /// + /// + /// + private static string GetFile(string fileName) => Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), fileName); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/UnityContainerConfigurator.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/UnityContainerConfigurator.cs new file mode 100644 index 0000000..0a3c7eb --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/UnityContainerConfigurator.cs @@ -0,0 +1,54 @@ +using System; +using Unity; +using Unity.Lifetime; + +namespace ModuleTools.BusinessLogics +{ + /// + /// Работа с UnityContainer + /// + public class UnityContainerConfigurator + { + private static IUnityContainer _unityContainer; + + public static IUnityContainer Container + { + get + { + if (_unityContainer == null) _unityContainer = new UnityContainer(); + return _unityContainer; + } + } + + /// + /// Инициализация сервисов + /// + public static void InitServices() + { + var ext = ServiceProviderLoader.GetImplementationExtensions(); + if (ext.Count == 0) + { + throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям"); + } + // регистрируем в UnityContainaer зависимости + foreach (var e in ext) + { + e.RegisterServices(); + } + } + + /// + /// Добавление зависимости + /// + /// + /// + public static void PublishService() where U : T => Container.RegisterType(new HierarchicalLifetimeManager()); + + /// + /// Получение класса со всеми зависмостями + /// + /// + /// + public static T Resolve() => Container.Resolve(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs new file mode 100644 index 0000000..99f2005 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -0,0 +1,100 @@ +namespace ModuleTools.Enums +{ + /// + /// Операции в системе + /// + public enum AccessOperation + { + #region Администрирование + Администрирование = 0, + + Роли = 1, + + Доступы = 2, + + Пользователи = 3, + + НастройкиСреды = 4, + #endregion + + #region База + Кафедра = 100, + + Аудитории = 101, + + Направления = 102, + + Преподаватели = 103, // + должности, звания + + Дисциплины = 104, // + Блоки дисциплин + + Группы = 105, // + + Студенты = 106, + + Приказы_студентов = 107, + #endregion + + // Меню Учебный процесс + Учебный_процесс = 150, + + Учебные_планы = 120, + + Виды_нагрузок = 121, + + Учебные_года = 122, + + Даты_семестра = 126, + + Контингент = 123, + + Нормы_времени = 124, + + Расчет_штатов = 125, + + Расчасовки = 127, + + Преподавательская_ставка = 128, + + Индивидуальный_план = 130, + + // Меню Расписание + Расписание = 200, + + Расписание_аудитории = 201, + + Расписание_группы = 202, + + Расписание_преподаватели = 203, + + Расписание_настройки = 204, + + Расписание_интервалы_пар = 205, + + Расписание_дисциплины = 206, + + // Меню Сервис + Сервис = 300, + + Генерация_билетов = 301, + + // Меню зав лаб + ЗавЛабораторией = 400, + + МатериальноТехническиеЦенности = 401, + + УстановленоеПО = 402, + + // Экзамены - составление билетов и проведение + СоставлениеЭкзаменов = 500, + + Ведомости = 501, + + ШаблоныБилетов = 502, + + // Web-портал + Новости = 600, + + Комментарии = 601 + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessType.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessType.cs new file mode 100644 index 0000000..acff2c2 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessType.cs @@ -0,0 +1,28 @@ +namespace ModuleTools.Enums +{ + /// + /// Тип операции + /// + public enum AccessType : int + { + /// + /// Простой просомтр + /// + SimpleView = 1, + + /// + /// Полный просомтр + /// + FullView = 2, + + /// + /// Добавление/Изменение + /// + Change = 4, + + /// + /// Удаление + /// + Delete = 8 + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Enums/ResultServiceStatusCode.cs b/DepartmentPortal/Common/ModuleTools/Enums/ResultServiceStatusCode.cs new file mode 100644 index 0000000..310f9b2 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Enums/ResultServiceStatusCode.cs @@ -0,0 +1,38 @@ +namespace ModuleTools.Enums +{ + /// + /// Статус результата операции + /// + public enum ResultServiceStatusCode + { + /// + /// Успешно + /// + Success = 200, + + /// + /// Ошибка общая + /// + Error = 400, + + /// + /// Элемент уже сущствует + /// + ExsistItem = 401, + + /// + /// Запись удалена + /// + WasDelete = 402, + + /// + /// Не найдено + /// + NotFound = 404, + + /// + /// Не найден файл + /// + FileNotFound = 405 + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Extensions/StringExtension.cs b/DepartmentPortal/Common/ModuleTools/Extensions/StringExtension.cs new file mode 100644 index 0000000..20495b3 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Extensions/StringExtension.cs @@ -0,0 +1,28 @@ +using System.IO; + +namespace ModuleTools.Extensions +{ + public static class StringExtension + { + /// + /// Проверка, что строка пустая + /// + /// + /// + public static bool IsEmpty(this string str) => string.IsNullOrEmpty(str); + + /// + /// Проверка, что строка не пустая + /// + /// + /// + public static bool IsNotEmpty(this string str) => !string.IsNullOrEmpty(str); + + /// + /// Получение имени файла по полному пути + /// + /// + /// + public static string GetFileName(this string str) => (new FileInfo(str)).Name; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Interfaces/IEntityService.cs b/DepartmentPortal/Common/ModuleTools/Interfaces/IEntityService.cs new file mode 100644 index 0000000..106f0f5 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Interfaces/IEntityService.cs @@ -0,0 +1,41 @@ +using ModuleTools.BindingModels; +using ModuleTools.Models; + +namespace ModuleTools.Interfaces +{ + /// + /// Описание логики для хранилища сущности + /// + public interface IEntityService + where G : GetBindingModel + where S : SetBindingModel + { + /// + /// Получение списка сущностей + /// + /// + /// + OperationResultModel Read(G model); + + /// + /// Создание новой сущности + /// + /// + /// + OperationResultModel Create(S model); + + /// + /// Изменение сущности + /// + /// + /// + OperationResultModel Update(S model); + + /// + /// Удаление сущности + /// + /// + /// + OperationResultModel Delete(G model); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Interfaces/IImplementationExtension.cs b/DepartmentPortal/Common/ModuleTools/Interfaces/IImplementationExtension.cs new file mode 100644 index 0000000..a4a8002 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Interfaces/IImplementationExtension.cs @@ -0,0 +1,13 @@ +namespace ModuleTools.Interfaces +{ + /// + /// Интерфейс для регистрации зависимостей в модулях + /// + public interface IImplementationExtension + { + /// + /// Регистрация сервисов + /// + public void RegisterServices(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Interfaces/ISecurityManager.cs b/DepartmentPortal/Common/ModuleTools/Interfaces/ISecurityManager.cs new file mode 100644 index 0000000..c2acc52 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Interfaces/ISecurityManager.cs @@ -0,0 +1,67 @@ +using ModuleTools.Models; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace ModuleTools.Interfaces +{ + /// + /// Интерфейс для аутентификации пользователя и проверки доступа к операциям для пользователя + /// + public interface ISecurityManager + { + /// + /// Аутентифицированный пользователь + /// + public Guid? User { get; set; } + + /// + /// Список ролей аутентифицированного пользователь + /// + public List Roles { get; set; } + + /// + /// Выполнена ли аутентификация + /// + public bool IsAuth { get; } + + /// + /// Сообщение с причиной не получения доступа + /// + string ErrorMessage { get; set; } + + /// + /// Авторизация пользователя к операции + /// + /// Данные по операции + /// + bool CheckAccess(SecurityManagerCheckAccessModel model); + + /// + /// Проверка наличия старотвых данных для работы с ситемой + /// + void CheckStartDataSource(); + + /// + /// Аутентификация пользователя + /// + /// + /// + /// + Task LoginAsync(string login, string password); + + /// + /// Выход из системы + /// + /// + Task LogoutAsync(); + + /// + /// Смена пароля + /// + /// + /// + /// + Task ChangePassword(string login, string oldPassword, string newPassword); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Interfaces/IWindowDesktopExtension.cs b/DepartmentPortal/Common/ModuleTools/Interfaces/IWindowDesktopExtension.cs new file mode 100644 index 0000000..5fdbb01 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Interfaces/IWindowDesktopExtension.cs @@ -0,0 +1,17 @@ +using ModuleTools.Models; +using System.Collections.Generic; + +namespace ModuleTools.Interfaces +{ + /// + /// Интерфейс для регистрации контролов для десктопного приложения + /// + public interface IWindowDesktopExtension + { + /// + /// Получение списка контролов модуля, доступных для работы по авторизованному пользователю + /// + /// + List GetListControlEntityList(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Models/OperationResultModel.cs b/DepartmentPortal/Common/ModuleTools/Models/OperationResultModel.cs new file mode 100644 index 0000000..9ea390d --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Models/OperationResultModel.cs @@ -0,0 +1,114 @@ +using ModuleTools.Enums; +using System; +using System.Collections.Generic; + +namespace ModuleTools.Models +{ + /// + /// Результат любой операции с сущностью + /// + public class OperationResultModel + { + /// + /// Успешность операции (количество ошибок = 0) + /// + public bool IsSucceeded => Errors.Count == 0; + + /// + /// Статус операции + /// + public ResultServiceStatusCode StatusCode { get; set; } + + /// + /// Спсиок ошибок + /// + public List<(string Title, string Message)> Errors { get; private set; } + + /// + /// Объект, получаемый по результатам операции + /// + public object Result { get; private set; } + + /// + /// Конструктор по умолчанию + /// + public OperationResultModel() + { + Errors = new List<(string Title, string Message)>(); + StatusCode = ResultServiceStatusCode.Success; + } + + /// + /// Успешно + /// + /// + /// + public static OperationResultModel Success(object obj) + { + return new OperationResultModel + { + Result = obj, + Errors = new List<(string Title, string Message)>(), + StatusCode = ResultServiceStatusCode.Success + }; + } + + /// + /// Добавление простой ошибки + /// + /// + /// + /// + public static OperationResultModel Error(string key, string value) => Error(key, value, ResultServiceStatusCode.Error); + + /// + /// Добавление простой ошибки со сменой статуса + /// + /// + /// + /// + /// + public static OperationResultModel Error(string key, string error, ResultServiceStatusCode statusCode) + { + var model = new OperationResultModel(); + model.Errors.Add((key, error)); + model.StatusCode = statusCode; + return model; + } + + /// + /// Добавление ошибки + /// + /// + /// + public static OperationResultModel Error(Exception error) => Error(error, ResultServiceStatusCode.Error); + + /// + /// Добавление ошибки + /// + /// + /// + /// + public static OperationResultModel Error(Exception error, ResultServiceStatusCode statusCode) => Error("Ошибка", error, statusCode); + + /// + /// Добавление ошибки (включая вложеннные) + /// + /// + /// + /// + /// + public static OperationResultModel Error(string key, Exception error, ResultServiceStatusCode statusCode) + { + var model = new OperationResultModel(); + model.Errors.Add((key, error.Message)); + while (error.InnerException != null) + { + error = error.InnerException; + model.Errors.Add(("Inner error:", error.Message)); + } + model.StatusCode = statusCode; + return model; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Models/SecurityManagerCheckAccessModel.cs b/DepartmentPortal/Common/ModuleTools/Models/SecurityManagerCheckAccessModel.cs new file mode 100644 index 0000000..cf5a511 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Models/SecurityManagerCheckAccessModel.cs @@ -0,0 +1,39 @@ +using ModuleTools.BindingModels; +using ModuleTools.Enums; + +namespace ModuleTools.Models +{ + /// + /// Данные для проверки доступа + /// + public class SecurityManagerCheckAccessModel + { + /// + /// Данные по пользователю + /// + public AccessBindingModel Model { get; set; } + + /// + /// Операция, которую хотят выполнить + /// + public AccessOperation Operation { get; set; } + + /// + /// Тип операции + /// + public AccessType Type { get; set; } + + /// + /// Для какой сущности + /// + public string Entity { get; set; } + + public SecurityManagerCheckAccessModel(AccessBindingModel model, AccessOperation operation, AccessType type, string entity) + { + Model = model; + Operation = operation; + Type = type; + Entity = entity; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Models/WindowDesktopExtensionControlModel.cs b/DepartmentPortal/Common/ModuleTools/Models/WindowDesktopExtensionControlModel.cs new file mode 100644 index 0000000..1d9e081 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/Models/WindowDesktopExtensionControlModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ModuleTools.Models +{ + public class WindowDesktopExtensionControlModel + { + public Guid Id { get; set; } + + public int Order { get; set; } + + public string Title { get; set; } + + public object Control { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/ModuleTools.csproj b/DepartmentPortal/Common/ModuleTools/ModuleTools.csproj new file mode 100644 index 0000000..dfb11d9 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/ModuleTools.csproj @@ -0,0 +1,11 @@ + + + + net5.0 + + + + + + + diff --git a/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs b/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs new file mode 100644 index 0000000..17ef36a --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs @@ -0,0 +1,15 @@ +using ModuleTools.Attributes; +using System; + +namespace ModuleTools.ViewModels +{ + /// + /// Возвращаемая запись + /// + public class ElementViewModel + { + [ViewModelOnListProperty("Идентификатор", isHide: true)] + [MapConfiguration("Id")] + public Guid Id { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/ViewModels/ListViewModel.cs b/DepartmentPortal/Common/ModuleTools/ViewModels/ListViewModel.cs new file mode 100644 index 0000000..33de5e8 --- /dev/null +++ b/DepartmentPortal/Common/ModuleTools/ViewModels/ListViewModel.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace ModuleTools.ViewModels +{ + /// + /// Список возвращаемых значений + /// + /// + public class ListViewModel + where T : ElementViewModel + { + public int MaxCount { get; set; } + + public List List { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/DepartmentPortal.sln b/DepartmentPortal/DepartmentPortal.sln index a2739c1..79c1938 100644 --- a/DepartmentPortal/DepartmentPortal.sln +++ b/DepartmentPortal/DepartmentPortal.sln @@ -7,8 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{6F154F EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseCore", "Common\DatabaseCore\DatabaseCore.csproj", "{D4DAAEDE-A550-42BB-A50C-AD8FCB23D00A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModelTools", "Common\ModelTools\ModelTools.csproj", "{8BE3C29B-6E9F-4DFC-BAC3-14229D58616F}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Security", "Security", "{7DA26C36-778E-4563-9AEC-966E26EA7B2A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityBusinessLogic", "Security\SecurityBusinessLogic\SecurityBusinessLogic.csproj", "{D424B54F-AF26-4A39-8D2B-CF874F31DE42}" @@ -21,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityWindowsDesktop", "S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityDatabaseImplementation", "Security\SecurityDatabaseImplementation\SecurityDatabaseImplementation.csproj", "{26FCAAC6-F8F4-4CE6-92FE-1C6C376E5DE6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModuleTools", "Common\ModuleTools\ModuleTools.csproj", "{84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,10 +31,6 @@ Global {D4DAAEDE-A550-42BB-A50C-AD8FCB23D00A}.Debug|Any CPU.Build.0 = Debug|Any CPU {D4DAAEDE-A550-42BB-A50C-AD8FCB23D00A}.Release|Any CPU.ActiveCfg = Release|Any CPU {D4DAAEDE-A550-42BB-A50C-AD8FCB23D00A}.Release|Any CPU.Build.0 = Release|Any CPU - {8BE3C29B-6E9F-4DFC-BAC3-14229D58616F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8BE3C29B-6E9F-4DFC-BAC3-14229D58616F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8BE3C29B-6E9F-4DFC-BAC3-14229D58616F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8BE3C29B-6E9F-4DFC-BAC3-14229D58616F}.Release|Any CPU.Build.0 = Release|Any CPU {D424B54F-AF26-4A39-8D2B-CF874F31DE42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D424B54F-AF26-4A39-8D2B-CF874F31DE42}.Debug|Any CPU.Build.0 = Debug|Any CPU {D424B54F-AF26-4A39-8D2B-CF874F31DE42}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -55,17 +51,21 @@ Global {26FCAAC6-F8F4-4CE6-92FE-1C6C376E5DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU {26FCAAC6-F8F4-4CE6-92FE-1C6C376E5DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU {26FCAAC6-F8F4-4CE6-92FE-1C6C376E5DE6}.Release|Any CPU.Build.0 = Release|Any CPU + {84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {D4DAAEDE-A550-42BB-A50C-AD8FCB23D00A} = {6F154F8D-3437-45EE-9D89-02B96BDF3E8E} - {8BE3C29B-6E9F-4DFC-BAC3-14229D58616F} = {6F154F8D-3437-45EE-9D89-02B96BDF3E8E} {D424B54F-AF26-4A39-8D2B-CF874F31DE42} = {7DA26C36-778E-4563-9AEC-966E26EA7B2A} {6B923E2B-85EE-4490-81BA-C7AB5DB582AC} = {6F154F8D-3437-45EE-9D89-02B96BDF3E8E} {40F7C37A-3544-4A6A-893D-D611DE100036} = {7DA26C36-778E-4563-9AEC-966E26EA7B2A} {26FCAAC6-F8F4-4CE6-92FE-1C6C376E5DE6} = {7DA26C36-778E-4563-9AEC-966E26EA7B2A} + {84CD6D9F-9B38-4392-B8A5-4FD32CF54BEC} = {6F154F8D-3437-45EE-9D89-02B96BDF3E8E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FBA0CB49-EF2D-4538-9D00-FCEDA24879A9} diff --git a/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs b/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs index b81a362..d2caaae 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs @@ -1,8 +1,7 @@ using DesktopTools.BusinessLogics; -using ModelTools.BusinessLogics; -using ModelTools.Extensions; -using ModelTools.Interfaces; -using SecurityBusinessLogic.BusinessLogics; +using ModuleTools.BusinessLogics; +using ModuleTools.Extensions; +using ModuleTools.Interfaces; using System; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs b/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs index 91d99f3..2b8c907 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/FormMain.cs @@ -1,5 +1,5 @@ using DesktopTools.Controls; -using ModelTools.BusinessLogics; +using ModuleTools.BusinessLogics; using System; using System.Collections.Generic; using System.Linq; diff --git a/DepartmentPortal/DepartmentPortalDesctop/Program.cs b/DepartmentPortal/DepartmentPortalDesctop/Program.cs index 472ce00..49a5aa9 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/Program.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/Program.cs @@ -1,7 +1,6 @@ using DatabaseCore; -using ModelTools.BusinessLogics; -using ModelTools.Interfaces; -using SecurityBusinessLogic.BusinessLogics; +using ModuleTools.BusinessLogics; +using ModuleTools.Interfaces; using System; using System.Windows.Forms; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/AccessBindingModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/AccessBindingModels.cs index 21a3b24..4da537b 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/AccessBindingModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/AccessBindingModels.cs @@ -1,5 +1,5 @@ -using ModelTools.BindingModels; -using ModelTools.Enums; +using ModuleTools.BindingModels; +using ModuleTools.Enums; using System; using System.ComponentModel.DataAnnotations; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs index e672f6f..448ab27 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs @@ -1,4 +1,4 @@ -using ModelTools.BindingModels; +using ModuleTools.BindingModels; using System.ComponentModel.DataAnnotations; namespace SecurityBusinessLogic.BindingModels diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/RoleBindingModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/RoleBindingModels.cs index 2cbbc29..6849acc 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/RoleBindingModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/RoleBindingModels.cs @@ -1,4 +1,4 @@ -using ModelTools.BindingModels; +using ModuleTools.BindingModels; using System.ComponentModel.DataAnnotations; namespace SecurityBusinessLogic.BindingModels diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/UserBindingModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/UserBindingModels.cs index 41063ef..56b6111 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/UserBindingModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/UserBindingModels.cs @@ -1,4 +1,4 @@ -using ModelTools.BindingModels; +using ModuleTools.BindingModels; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/AccessBusinessLogic.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/AccessBusinessLogic.cs index 25e4196..70ad08a 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/AccessBusinessLogic.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/AccessBusinessLogic.cs @@ -1,6 +1,6 @@ -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/EnviromentSettingBusinessLogic.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/EnviromentSettingBusinessLogic.cs index c4f0a1f..6efa781 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/EnviromentSettingBusinessLogic.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/EnviromentSettingBusinessLogic.cs @@ -1,6 +1,6 @@ -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/RoleBusinessLogic.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/RoleBusinessLogic.cs index b9e212a..926d10d 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/RoleBusinessLogic.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/RoleBusinessLogic.cs @@ -1,6 +1,6 @@ -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/UserBusinessLogic.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/UserBusinessLogic.cs index 649a73a..7f49456 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/UserBusinessLogic.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/UserBusinessLogic.cs @@ -1,6 +1,6 @@ -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IAccessService.cs b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IAccessService.cs index 9d25010..5be9efc 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IAccessService.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IAccessService.cs @@ -1,4 +1,4 @@ -using ModelTools.Interfaces; +using ModuleTools.Interfaces; using SecurityBusinessLogic.BindingModels; namespace SecurityBusinessLogic.Interfaces diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IEnviromentSettingService.cs b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IEnviromentSettingService.cs index 1c4fea5..5189fac 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IEnviromentSettingService.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IEnviromentSettingService.cs @@ -1,4 +1,4 @@ -using ModelTools.Interfaces; +using ModuleTools.Interfaces; using SecurityBusinessLogic.BindingModels; namespace SecurityBusinessLogic.Interfaces diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IRoleService.cs b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IRoleService.cs index e65ce8c..fa4515a 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IRoleService.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IRoleService.cs @@ -1,4 +1,4 @@ -using ModelTools.Interfaces; +using ModuleTools.Interfaces; using SecurityBusinessLogic.BindingModels; namespace SecurityBusinessLogic.Interfaces diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IUserService.cs b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IUserService.cs index d62fdac..19ef165 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IUserService.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/Interfaces/IUserService.cs @@ -1,4 +1,4 @@ -using ModelTools.Interfaces; +using ModuleTools.Interfaces; using SecurityBusinessLogic.BindingModels; namespace SecurityBusinessLogic.Interfaces diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/SecurityBusinessLogic.csproj b/DepartmentPortal/Security/SecurityBusinessLogic/SecurityBusinessLogic.csproj index eea8d8b..856967c 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/SecurityBusinessLogic.csproj +++ b/DepartmentPortal/Security/SecurityBusinessLogic/SecurityBusinessLogic.csproj @@ -4,12 +4,12 @@ net5.0 - - - - + + + + diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs index db2d128..569a59e 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs @@ -1,6 +1,6 @@ -using ModelTools.Attributes; -using ModelTools.Enums; -using ModelTools.ViewModels; +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; using System; namespace SecurityBusinessLogic.ViewModels diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs index e74d6f8..b622851 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs @@ -1,5 +1,5 @@ -using ModelTools.Attributes; -using ModelTools.ViewModels; +using ModuleTools.Attributes; +using ModuleTools.ViewModels; namespace SecurityBusinessLogic.ViewModels { diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs index bee9b6f..bc975a9 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs @@ -1,5 +1,5 @@ -using ModelTools.Attributes; -using ModelTools.ViewModels; +using ModuleTools.Attributes; +using ModuleTools.ViewModels; namespace SecurityBusinessLogic.ViewModels { diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs index e6e4a36..67df501 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs @@ -1,5 +1,5 @@ -using ModelTools.Attributes; -using ModelTools.ViewModels; +using ModuleTools.Attributes; +using ModuleTools.ViewModels; using System; namespace SecurityBusinessLogic.ViewModels diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/AccessService.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/AccessService.cs index 9967e98..d01a769 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/AccessService.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/AccessService.cs @@ -1,10 +1,10 @@ using DatabaseCore; using DatabaseCore.Models.Security; using Microsoft.EntityFrameworkCore; -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Extensions; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Extensions; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/EnviromentSettingService.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/EnviromentSettingService.cs index ed0c5f5..4432730 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/EnviromentSettingService.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/EnviromentSettingService.cs @@ -1,9 +1,9 @@ using DatabaseCore; using DatabaseCore.Models.Security; -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Extensions; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Extensions; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/RoleService.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/RoleService.cs index ac702b3..3f015de 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/RoleService.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/RoleService.cs @@ -1,8 +1,8 @@ using DatabaseCore; using DatabaseCore.Models.Security; -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/UserService.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/UserService.cs index d13d428..6921e0c 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/UserService.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/Implementations/UserService.cs @@ -1,8 +1,8 @@ using DatabaseCore; using DatabaseCore.Models.Security; -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Models; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityDatabaseImplementation.csproj b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityDatabaseImplementation.csproj index 0a85f4e..364e4dd 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityDatabaseImplementation.csproj +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityDatabaseImplementation.csproj @@ -6,7 +6,6 @@ - diff --git a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs index 5792fe2..b3f53c9 100644 --- a/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs +++ b/DepartmentPortal/Security/SecurityDatabaseImplementation/SecurityImplementationExtensions.cs @@ -1,5 +1,5 @@ -using ModelTools.BusinessLogics; -using ModelTools.Interfaces; +using ModuleTools.BusinessLogics; +using ModuleTools.Interfaces; using SecurityBusinessLogic.Interfaces; using SecurityImplementation.SecurityDatabaseImplementation; diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/AccessesControl.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/AccessesControl.cs index c31c219..37d8a0d 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/AccessesControl.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/AccessesControl.cs @@ -1,7 +1,7 @@ using DesktopTools.Controls; using DesktopTools.Models; -using ModelTools.BusinessLogics; -using ModelTools.Enums; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/EnviromentSettingControl.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/EnviromentSettingControl.cs index af9e597..7429669 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/EnviromentSettingControl.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/EnviromentSettingControl.cs @@ -1,7 +1,7 @@ using DesktopTools.Controls; using DesktopTools.Models; -using ModelTools.BusinessLogics; -using ModelTools.Enums; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/RolesControl.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/RolesControl.cs index 3f78267..97f8569 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/RolesControl.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/RolesControl.cs @@ -1,7 +1,7 @@ using DesktopTools.Controls; using DesktopTools.Models; -using ModelTools.BusinessLogics; -using ModelTools.Enums; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/UsersControl.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/UsersControl.cs index 72a06de..ac2f7af 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/UsersControl.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/UsersControl.cs @@ -1,7 +1,7 @@ using DesktopTools.Controls; using DesktopTools.Models; -using ModelTools.BusinessLogics; -using ModelTools.Enums; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.BusinessLogics; using SecurityBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs index 1b58e7e..5830c7d 100644 --- a/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs +++ b/DepartmentPortal/Security/SecurityWindowsDesktop/SecurityWindowDesktopExtension.cs @@ -1,9 +1,9 @@ using DesktopTools.Controls; -using ModelTools.BindingModels; -using ModelTools.BusinessLogics; -using ModelTools.Enums; -using ModelTools.Interfaces; -using ModelTools.Models; +using ModuleTools.BindingModels; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Interfaces; +using ModuleTools.Models; using SecurityBusinessLogic.BusinessLogics; using SecurityWindowsDesktop.Controls; using System.Collections.Generic;