работа с контролом вывода списка + вывод списков по безопасности
217
DepartmentPortal/Common/DatabaseCore/Migrations/20210327194001_ChangeSecurityFields.Designer.cs
generated
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using DatabaseCore;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
namespace DatabaseCore.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
[Migration("20210327194001_ChangeSecurityFields")]
|
||||||
|
partial class ChangeSecurityFields
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.4")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("AccessOperation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("AccessType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateDelete")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("Accesses");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.EnviromentSetting", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Key")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("EnviromentSettings");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateDelete")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("RoleName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("RolePriority")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Roles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Avatar")
|
||||||
|
.HasColumnType("varbinary(max)");
|
||||||
|
|
||||||
|
b.Property<int>("CountAttempt")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateBanned")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateDelete")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateLastVisit")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid?>("EmployeeId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("IsBanned")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid?>("LecturerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("StudentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateDelete")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DatabaseCore.Models.Security.Role", "Role")
|
||||||
|
.WithMany("Access")
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DatabaseCore.Models.Security.Role", "Role")
|
||||||
|
.WithMany("UserRoles")
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("DatabaseCore.Models.Security.User", "User")
|
||||||
|
.WithMany("UserRoles")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Access");
|
||||||
|
|
||||||
|
b.Navigation("UserRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("UserRoles");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace DatabaseCore.Migrations
|
||||||
|
{
|
||||||
|
public partial class ChangeSecurityFields : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DateLocked",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Operation",
|
||||||
|
table: "Accesses",
|
||||||
|
newName: "AccessOperation");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "DateCreate",
|
||||||
|
table: "UserRoles",
|
||||||
|
type: "datetime2",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "DateDelete",
|
||||||
|
table: "UserRoles",
|
||||||
|
type: "datetime2",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsDeleted",
|
||||||
|
table: "UserRoles",
|
||||||
|
type: "bit",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DateCreate",
|
||||||
|
table: "UserRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DateDelete",
|
||||||
|
table: "UserRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsDeleted",
|
||||||
|
table: "UserRoles");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "AccessOperation",
|
||||||
|
table: "Accesses",
|
||||||
|
newName: "Operation");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "DateLocked",
|
||||||
|
table: "Users",
|
||||||
|
type: "datetime2",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,9 @@ namespace DatabaseCore.Migrations
|
|||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("AccessOperation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("AccessType")
|
b.Property<int>("AccessType")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -36,9 +39,6 @@ namespace DatabaseCore.Migrations
|
|||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<int>("Operation")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<Guid>("RoleId")
|
b.Property<Guid>("RoleId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
@ -113,9 +113,6 @@ namespace DatabaseCore.Migrations
|
|||||||
b.Property<DateTime?>("DateLastVisit")
|
b.Property<DateTime?>("DateLastVisit")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<DateTime?>("DateLocked")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<Guid?>("EmployeeId")
|
b.Property<Guid?>("EmployeeId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
@ -147,6 +144,15 @@ namespace DatabaseCore.Migrations
|
|||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateDelete")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<Guid>("RoleId")
|
b.Property<Guid>("RoleId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace DatabaseCore.Models.Security
|
|||||||
[Required]
|
[Required]
|
||||||
[DataMember]
|
[DataMember]
|
||||||
[MapConfiguration("Operation")]
|
[MapConfiguration("Operation")]
|
||||||
public AccessOperation Operation { get; set; }
|
public AccessOperation AccessOperation { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[DataMember]
|
[DataMember]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using DatabaseCore.Models.Security;
|
using DatabaseCore.Models.Security;
|
||||||
using ModelTools.BindingModels;
|
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.Interfaces;
|
using ModelTools.Interfaces;
|
||||||
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BusinessLogics;
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -11,52 +11,52 @@ namespace DatabaseCore
|
|||||||
{
|
{
|
||||||
public string ErrorMessage { get; set; }
|
public string ErrorMessage { get; set; }
|
||||||
|
|
||||||
public bool CheckAccess(AccessBindingModel model, AccessOperation operation, AccessType type, string entity)
|
public bool CheckAccess(SecurityManagerCheckAccessModel model)
|
||||||
{
|
{
|
||||||
using var context = DatabaseManager.GetContext;
|
using var context = DatabaseManager.GetContext;
|
||||||
Access access;
|
Access access;
|
||||||
if (model != null)
|
if (model != null)
|
||||||
{
|
{
|
||||||
// простой просмотр возможен
|
// простой просмотр возможен
|
||||||
if (model.SkipCheck && type == AccessType.SimpleView)
|
if (model.Model.SkipCheck && model.Type == AccessType.SimpleView)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// если не указан идентификатор пользователя, то смотрим, может он авторизован
|
// если не указан идентификатор пользователя, то смотрим, может он авторизован
|
||||||
if (!model.UserId.HasValue && UserManager.GetInstance.User != null)
|
if (!model.Model.UserId.HasValue && UserManager.GetInstance.User != null)
|
||||||
{
|
{
|
||||||
model.UserId = UserManager.GetInstance.UserId;
|
model.Model.UserId = UserManager.GetInstance.UserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
var roles = context.UserRoles.Where(x => x.UserId == model.UserId).Select(x => x.Role).OrderByDescending(x => x.RolePriority).ToList();
|
var roles = context.UserRoles.Where(x => x.UserId == model.Model.UserId).Select(x => x.Role).OrderByDescending(x => x.RolePriority).ToList();
|
||||||
if (roles == null)
|
if (roles == null)
|
||||||
{
|
{
|
||||||
ErrorMessage = $"Не верный пользователь";
|
ErrorMessage = $"Не верный пользователь";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
access = context.Accesses.FirstOrDefault(a => a.Operation == operation && roles.Contains(a.Role));
|
access = context.Accesses.FirstOrDefault(a => a.AccessOperation == model.Operation && roles.Contains(a.Role));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
access = context.Accesses.FirstOrDefault(a => a.Operation == operation && UserManager.GetInstance.Roles.Contains(a.RoleId));
|
access = context.Accesses.FirstOrDefault(a => a.AccessOperation == model.Operation && UserManager.GetInstance.Roles.Contains(a.RoleId));
|
||||||
}
|
}
|
||||||
if (access != null)
|
if (access != null)
|
||||||
{
|
{
|
||||||
if (access.AccessType >= type) return true;
|
if (access.AccessType >= model.Type) return true;
|
||||||
}
|
}
|
||||||
switch (type)
|
switch (model.Type)
|
||||||
{
|
{
|
||||||
case AccessType.FullView:
|
case AccessType.FullView:
|
||||||
ErrorMessage = $"Нет доступа на чтение данных по сущности '{entity}'";
|
ErrorMessage = $"Нет доступа на чтение данных по сущности '{model.Entity}'";
|
||||||
return false;
|
return false;
|
||||||
case AccessType.Change:
|
case AccessType.Change:
|
||||||
ErrorMessage = $"Нет доступа на изменение данных по сущности '{entity}'";
|
ErrorMessage = $"Нет доступа на изменение данных по сущности '{model.Entity}'";
|
||||||
return false;
|
return false;
|
||||||
case AccessType.Delete:
|
case AccessType.Delete:
|
||||||
ErrorMessage = $"Нет доступа на удаление данных по сущности '{entity}'";
|
ErrorMessage = $"Нет доступа на удаление данных по сущности '{model.Entity}'";
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
ErrorMessage = $"Нет доступа по сущности '{entity}'";
|
ErrorMessage = $"Нет доступа по сущности '{model.Entity}'";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
330
DepartmentPortal/Common/DesktopTools/Controls/AbstractGenerticControlEntityList.Designer.cs
generated
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
namespace DesktopTools.Controls
|
||||||
|
{
|
||||||
|
partial class AbstractGenerticControlEntityList<G, S, L, E, BL>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.toolStripMenu = new System.Windows.Forms.ToolStrip();
|
||||||
|
this.toolStripButtonAdd = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.toolStripButtonUpd = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.toolStripButtonDel = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.toolStripButtonSearch = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.toolStripButtonRef = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.toolStripSplitButtonActions = new System.Windows.Forms.ToolStripSplitButton();
|
||||||
|
this.toolStripButtonClose = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.panelSearch = new System.Windows.Forms.Panel();
|
||||||
|
this.buttonCancelSearch = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSearch = new System.Windows.Forms.Button();
|
||||||
|
this.toolStripFooter = new System.Windows.Forms.ToolStrip();
|
||||||
|
this.toolStripButtonPrev = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripLabelPage = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripTextBoxPage = new System.Windows.Forms.ToolStripTextBox();
|
||||||
|
this.toolStripLabelCountPages = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripButtonNext = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripLabelPageName = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.toolStripComboBoxPageNames = new System.Windows.Forms.ToolStripComboBox();
|
||||||
|
this.contextMenuStripDataGrid = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.dataGridViewList = new System.Windows.Forms.DataGridView();
|
||||||
|
this.toolStripMenu.SuspendLayout();
|
||||||
|
this.panelSearch.SuspendLayout();
|
||||||
|
this.toolStripFooter.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewList)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// toolStripMenu
|
||||||
|
//
|
||||||
|
this.toolStripMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripButtonAdd,
|
||||||
|
this.toolStripSeparator1,
|
||||||
|
this.toolStripButtonUpd,
|
||||||
|
this.toolStripSeparator2,
|
||||||
|
this.toolStripButtonDel,
|
||||||
|
this.toolStripSeparator3,
|
||||||
|
this.toolStripButtonSearch,
|
||||||
|
this.toolStripSeparator4,
|
||||||
|
this.toolStripButtonRef,
|
||||||
|
this.toolStripSeparator5,
|
||||||
|
this.toolStripSplitButtonActions,
|
||||||
|
this.toolStripButtonClose});
|
||||||
|
this.toolStripMenu.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.toolStripMenu.Name = "toolStripMenu";
|
||||||
|
this.toolStripMenu.Size = new System.Drawing.Size(1000, 25);
|
||||||
|
this.toolStripMenu.TabIndex = 0;
|
||||||
|
this.toolStripMenu.Text = "Главное меню";
|
||||||
|
//
|
||||||
|
// toolStripButtonAdd
|
||||||
|
//
|
||||||
|
this.toolStripButtonAdd.Image = global::DesktopTools.Properties.Resources.Add;
|
||||||
|
this.toolStripButtonAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonAdd.Name = "toolStripButtonAdd";
|
||||||
|
this.toolStripButtonAdd.Size = new System.Drawing.Size(79, 22);
|
||||||
|
this.toolStripButtonAdd.Text = "Добавить";
|
||||||
|
//
|
||||||
|
// toolStripSeparator1
|
||||||
|
//
|
||||||
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
|
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// toolStripButtonUpd
|
||||||
|
//
|
||||||
|
this.toolStripButtonUpd.Image = global::DesktopTools.Properties.Resources.Upd;
|
||||||
|
this.toolStripButtonUpd.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonUpd.Name = "toolStripButtonUpd";
|
||||||
|
this.toolStripButtonUpd.Size = new System.Drawing.Size(81, 22);
|
||||||
|
this.toolStripButtonUpd.Text = "Изменить";
|
||||||
|
//
|
||||||
|
// toolStripSeparator2
|
||||||
|
//
|
||||||
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
|
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// toolStripButtonDel
|
||||||
|
//
|
||||||
|
this.toolStripButtonDel.Image = global::DesktopTools.Properties.Resources.Del;
|
||||||
|
this.toolStripButtonDel.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonDel.Name = "toolStripButtonDel";
|
||||||
|
this.toolStripButtonDel.Size = new System.Drawing.Size(71, 22);
|
||||||
|
this.toolStripButtonDel.Text = "Удалить";
|
||||||
|
//
|
||||||
|
// toolStripSeparator3
|
||||||
|
//
|
||||||
|
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||||
|
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// toolStripButtonSearch
|
||||||
|
//
|
||||||
|
this.toolStripButtonSearch.Image = global::DesktopTools.Properties.Resources.Search;
|
||||||
|
this.toolStripButtonSearch.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonSearch.Name = "toolStripButtonSearch";
|
||||||
|
this.toolStripButtonSearch.Size = new System.Drawing.Size(62, 22);
|
||||||
|
this.toolStripButtonSearch.Text = "Поиск";
|
||||||
|
//
|
||||||
|
// toolStripSeparator4
|
||||||
|
//
|
||||||
|
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||||
|
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// toolStripButtonRef
|
||||||
|
//
|
||||||
|
this.toolStripButtonRef.Image = global::DesktopTools.Properties.Resources.Ref;
|
||||||
|
this.toolStripButtonRef.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonRef.Name = "toolStripButtonRef";
|
||||||
|
this.toolStripButtonRef.Size = new System.Drawing.Size(81, 22);
|
||||||
|
this.toolStripButtonRef.Text = "Обновить";
|
||||||
|
//
|
||||||
|
// toolStripSeparator5
|
||||||
|
//
|
||||||
|
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||||
|
this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// toolStripSplitButtonActions
|
||||||
|
//
|
||||||
|
this.toolStripSplitButtonActions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
|
this.toolStripSplitButtonActions.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripSplitButtonActions.Name = "toolStripSplitButtonActions";
|
||||||
|
this.toolStripSplitButtonActions.Size = new System.Drawing.Size(74, 22);
|
||||||
|
this.toolStripSplitButtonActions.Text = "Действия";
|
||||||
|
//
|
||||||
|
// toolStripButtonClose
|
||||||
|
//
|
||||||
|
this.toolStripButtonClose.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||||
|
this.toolStripButtonClose.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.toolStripButtonClose.Image = global::DesktopTools.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 = "Закрть";
|
||||||
|
//
|
||||||
|
// panelSearch
|
||||||
|
//
|
||||||
|
this.panelSearch.Controls.Add(this.buttonCancelSearch);
|
||||||
|
this.panelSearch.Controls.Add(this.buttonSearch);
|
||||||
|
this.panelSearch.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.panelSearch.Location = new System.Drawing.Point(0, 25);
|
||||||
|
this.panelSearch.Name = "panelSearch";
|
||||||
|
this.panelSearch.Size = new System.Drawing.Size(1000, 87);
|
||||||
|
this.panelSearch.TabIndex = 1;
|
||||||
|
this.panelSearch.Visible = false;
|
||||||
|
//
|
||||||
|
// buttonCancelSearch
|
||||||
|
//
|
||||||
|
this.buttonCancelSearch.Location = new System.Drawing.Point(11, 47);
|
||||||
|
this.buttonCancelSearch.Name = "buttonCancelSearch";
|
||||||
|
this.buttonCancelSearch.Size = new System.Drawing.Size(89, 24);
|
||||||
|
this.buttonCancelSearch.TabIndex = 1;
|
||||||
|
this.buttonCancelSearch.Text = "Скрыть";
|
||||||
|
this.buttonCancelSearch.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonSearch
|
||||||
|
//
|
||||||
|
this.buttonSearch.Location = new System.Drawing.Point(11, 13);
|
||||||
|
this.buttonSearch.Name = "buttonSearch";
|
||||||
|
this.buttonSearch.Size = new System.Drawing.Size(89, 24);
|
||||||
|
this.buttonSearch.TabIndex = 0;
|
||||||
|
this.buttonSearch.Text = "Запуск";
|
||||||
|
this.buttonSearch.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// toolStripFooter
|
||||||
|
//
|
||||||
|
this.toolStripFooter.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
this.toolStripFooter.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripButtonPrev,
|
||||||
|
this.toolStripLabelPage,
|
||||||
|
this.toolStripTextBoxPage,
|
||||||
|
this.toolStripLabelCountPages,
|
||||||
|
this.toolStripButtonNext,
|
||||||
|
this.toolStripLabelPageName,
|
||||||
|
this.toolStripComboBoxPageNames});
|
||||||
|
this.toolStripFooter.Location = new System.Drawing.Point(0, 775);
|
||||||
|
this.toolStripFooter.Name = "toolStripFooter";
|
||||||
|
this.toolStripFooter.Size = new System.Drawing.Size(1000, 25);
|
||||||
|
this.toolStripFooter.TabIndex = 2;
|
||||||
|
this.toolStripFooter.Text = "Пагинация";
|
||||||
|
//
|
||||||
|
// toolStripButtonPrev
|
||||||
|
//
|
||||||
|
this.toolStripButtonPrev.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.toolStripButtonPrev.Image = global::DesktopTools.Properties.Resources.Left;
|
||||||
|
this.toolStripButtonPrev.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonPrev.Name = "toolStripButtonPrev";
|
||||||
|
this.toolStripButtonPrev.Size = new System.Drawing.Size(23, 22);
|
||||||
|
this.toolStripButtonPrev.Text = "Назад";
|
||||||
|
//
|
||||||
|
// toolStripLabelPage
|
||||||
|
//
|
||||||
|
this.toolStripLabelPage.Name = "toolStripLabelPage";
|
||||||
|
this.toolStripLabelPage.Size = new System.Drawing.Size(60, 22);
|
||||||
|
this.toolStripLabelPage.Text = "Страница";
|
||||||
|
//
|
||||||
|
// toolStripTextBoxPage
|
||||||
|
//
|
||||||
|
this.toolStripTextBoxPage.Name = "toolStripTextBoxPage";
|
||||||
|
this.toolStripTextBoxPage.Size = new System.Drawing.Size(30, 25);
|
||||||
|
this.toolStripTextBoxPage.Text = "1";
|
||||||
|
//
|
||||||
|
// toolStripLabelCountPages
|
||||||
|
//
|
||||||
|
this.toolStripLabelCountPages.Name = "toolStripLabelCountPages";
|
||||||
|
this.toolStripLabelCountPages.Size = new System.Drawing.Size(28, 22);
|
||||||
|
this.toolStripLabelCountPages.Text = "из 0";
|
||||||
|
//
|
||||||
|
// toolStripButtonNext
|
||||||
|
//
|
||||||
|
this.toolStripButtonNext.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.toolStripButtonNext.Image = global::DesktopTools.Properties.Resources.Right;
|
||||||
|
this.toolStripButtonNext.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButtonNext.Name = "toolStripButtonNext";
|
||||||
|
this.toolStripButtonNext.Size = new System.Drawing.Size(23, 22);
|
||||||
|
this.toolStripButtonNext.Text = "Вперед";
|
||||||
|
//
|
||||||
|
// toolStripLabelPageName
|
||||||
|
//
|
||||||
|
this.toolStripLabelPageName.Name = "toolStripLabelPageName";
|
||||||
|
this.toolStripLabelPageName.Size = new System.Drawing.Size(62, 22);
|
||||||
|
this.toolStripLabelPageName.Text = "Параметр";
|
||||||
|
//
|
||||||
|
// toolStripComboBoxPageNames
|
||||||
|
//
|
||||||
|
this.toolStripComboBoxPageNames.Name = "toolStripComboBoxPageNames";
|
||||||
|
this.toolStripComboBoxPageNames.Size = new System.Drawing.Size(200, 25);
|
||||||
|
this.toolStripComboBoxPageNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
//
|
||||||
|
// contextMenuStripDataGrid
|
||||||
|
//
|
||||||
|
this.contextMenuStripDataGrid.Name = "contextMenuStripDataGrid";
|
||||||
|
this.contextMenuStripDataGrid.Size = new System.Drawing.Size(61, 4);
|
||||||
|
//
|
||||||
|
// dataGridViewList
|
||||||
|
//
|
||||||
|
this.dataGridViewList.AllowUserToAddRows = false;
|
||||||
|
this.dataGridViewList.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridViewList.AllowUserToResizeRows = false;
|
||||||
|
this.dataGridViewList.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
this.dataGridViewList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridViewList.ContextMenuStrip = this.contextMenuStripDataGrid;
|
||||||
|
this.dataGridViewList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.dataGridViewList.Location = new System.Drawing.Point(0, 112);
|
||||||
|
this.dataGridViewList.Name = "dataGridViewList";
|
||||||
|
this.dataGridViewList.ReadOnly = true;
|
||||||
|
this.dataGridViewList.RowHeadersVisible = false;
|
||||||
|
this.dataGridViewList.RowTemplate.Height = 25;
|
||||||
|
this.dataGridViewList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridViewList.Size = new System.Drawing.Size(1000, 663);
|
||||||
|
this.dataGridViewList.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// AbstractControlEntityList
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.dataGridViewList);
|
||||||
|
this.Controls.Add(this.toolStripFooter);
|
||||||
|
this.Controls.Add(this.panelSearch);
|
||||||
|
this.Controls.Add(this.toolStripMenu);
|
||||||
|
this.Name = "AbstractControlEntityList";
|
||||||
|
this.Size = new System.Drawing.Size(1000, 800);
|
||||||
|
this.toolStripMenu.ResumeLayout(false);
|
||||||
|
this.toolStripMenu.PerformLayout();
|
||||||
|
this.panelSearch.ResumeLayout(false);
|
||||||
|
this.toolStripFooter.ResumeLayout(false);
|
||||||
|
this.toolStripFooter.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewList)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ToolStrip toolStripMenu;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonAdd;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonUpd;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonDel;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonSearch;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonRef;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||||
|
private System.Windows.Forms.ToolStripSplitButton toolStripSplitButtonActions;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonClose;
|
||||||
|
protected System.Windows.Forms.Panel panelSearch;
|
||||||
|
private System.Windows.Forms.Button buttonCancelSearch;
|
||||||
|
private System.Windows.Forms.Button buttonSearch;
|
||||||
|
private System.Windows.Forms.ToolStrip toolStripFooter;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonPrev;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabelPage;
|
||||||
|
private System.Windows.Forms.ToolStripTextBox toolStripTextBoxPage;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabelCountPages;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButtonNext;
|
||||||
|
private System.Windows.Forms.ToolStripLabel toolStripLabelPageName;
|
||||||
|
private System.Windows.Forms.ToolStripComboBox toolStripComboBoxPageNames;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStripDataGrid;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridViewList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,333 @@
|
|||||||
|
using DesktopTools.Models;
|
||||||
|
using ModelTools.Attributes;
|
||||||
|
using ModelTools.BindingModels;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Extensions;
|
||||||
|
using ModelTools.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace DesktopTools.Controls
|
||||||
|
{
|
||||||
|
public partial class AbstractGenerticControlEntityList<G, S, L, E, BL> : ControlViewEntityList
|
||||||
|
where G : GetBindingModel
|
||||||
|
where S : SetBindingModel
|
||||||
|
where L: ListViewModel<E>
|
||||||
|
where E : ElementViewModel
|
||||||
|
where BL : BusinessLogicCore<G, S, L, E>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Объект бизнес-логики для получения данных
|
||||||
|
/// </summary>
|
||||||
|
protected BL _businessLogic;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Констркутор
|
||||||
|
/// </summary>
|
||||||
|
public AbstractGenerticControlEntityList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
InitEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Open()
|
||||||
|
{
|
||||||
|
base.Open();
|
||||||
|
if (dataGridViewList.Columns.Count == 0)
|
||||||
|
{
|
||||||
|
Configurate(GetConfig());
|
||||||
|
}
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Close()
|
||||||
|
{
|
||||||
|
base.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конфигуратор контрола
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model">Настройки</param>
|
||||||
|
private void Configurate(ControlViewEntityListConfiguration config)
|
||||||
|
{
|
||||||
|
if(config == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// формирование таблицы на основе модели
|
||||||
|
dataGridViewList.Columns.Clear();
|
||||||
|
var properties = typeof(E).GetProperties();
|
||||||
|
foreach (var property in properties)
|
||||||
|
{
|
||||||
|
var attr = property.GetCustomAttribute<ViewModelOnListPropertyAttribute>();
|
||||||
|
if (attr != null)
|
||||||
|
{
|
||||||
|
dataGridViewList.Columns.Add(new DataGridViewTextBoxColumn
|
||||||
|
{
|
||||||
|
HeaderText = attr.DisplayName,
|
||||||
|
Name = string.Format("Column{0}", property.Name),
|
||||||
|
ReadOnly = true,
|
||||||
|
Visible = !attr.IsHide,
|
||||||
|
Width = attr.ColumnWidth ?? 0,
|
||||||
|
AutoSizeMode = attr.ColumnWidth.HasValue ? DataGridViewAutoSizeColumnMode.None : DataGridViewAutoSizeColumnMode.Fill
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// настройка отображения основных кнопок
|
||||||
|
if (config.ShowToolStripButton != null)
|
||||||
|
{
|
||||||
|
foreach (ToolStripItem button in toolStripMenu.Items)
|
||||||
|
{
|
||||||
|
if (config.ShowToolStripButton.Contains(button.Name))
|
||||||
|
{
|
||||||
|
button.Visible = false;
|
||||||
|
switch (button.Name)
|
||||||
|
{
|
||||||
|
case "toolStripButtonUpd":
|
||||||
|
toolStripSeparator1.Visible = false;
|
||||||
|
break;
|
||||||
|
case "toolStripButtonDel":
|
||||||
|
toolStripSeparator2.Visible = false;
|
||||||
|
break;
|
||||||
|
case "toolStripButtonRef":
|
||||||
|
toolStripSeparator3.Visible = false;
|
||||||
|
break;
|
||||||
|
case "toolStripButtonSearch":
|
||||||
|
toolStripSeparator4.Visible = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Загрузка подпунктов в контекстное меню и в пункт меню "Действие"
|
||||||
|
if (config.ControlOnMoveElem != null)
|
||||||
|
{
|
||||||
|
foreach (var elem in config.ControlOnMoveElem)
|
||||||
|
{
|
||||||
|
ToolStripMenuItem item = new() { Text = elem.Value.Title, Name = elem.Key };
|
||||||
|
item.Click += elem.Value.Event;
|
||||||
|
toolStripSplitButtonActions.DropDownItems.Add(item);
|
||||||
|
contextMenuStripDataGrid.Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// либо скрытие пункта, если не предусмотренно подпунктов
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolStripSplitButtonActions.Visible = false;
|
||||||
|
toolStripSeparator3.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Пагинация
|
||||||
|
if (config.PaginationOn)
|
||||||
|
{
|
||||||
|
if (config.CountElementsOnPage.HasValue)
|
||||||
|
{
|
||||||
|
toolStripTextBoxPage.Tag = config.CountElementsOnPage.Value;
|
||||||
|
}
|
||||||
|
// пагинация по названиям
|
||||||
|
if (config.PageNamesForPagination != null)
|
||||||
|
{
|
||||||
|
toolStripButtonPrev.Visible = toolStripLabelPage.Visible = toolStripTextBoxPage.Visible = toolStripLabelCountPages.Visible =
|
||||||
|
toolStripButtonNext.Visible = false;
|
||||||
|
toolStripComboBoxPageNames.Items.AddRange(config.PageNamesForPagination.ToArray());
|
||||||
|
toolStripComboBoxPageNames.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
// пагинация по страницам
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolStripLabelPageName.Visible = toolStripComboBoxPageNames.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// нет пагинации
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolStripFooter.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация событий к контролам
|
||||||
|
/// </summary>
|
||||||
|
private void InitEvents()
|
||||||
|
{
|
||||||
|
toolStripButtonAdd.Click += (object sender, EventArgs e) => { CallAddElementEvent(); };
|
||||||
|
toolStripButtonUpd.Click += (object sender, EventArgs e) => { CallUpdElementEvent(); };
|
||||||
|
toolStripButtonDel.Click += (object sender, EventArgs e) => { CallDelElementEvent(); };
|
||||||
|
toolStripButtonSearch.Click += (object sender, EventArgs e) => { panelSearch.Visible = !panelSearch.Visible; };
|
||||||
|
toolStripButtonRef.Click += (object sender, EventArgs e) => { LoadList(); };
|
||||||
|
toolStripButtonClose.Click += (object sender, EventArgs e) => { Close(); };
|
||||||
|
|
||||||
|
buttonSearch.Click += (object sender, EventArgs e) => { LoadList(); };
|
||||||
|
buttonCancelSearch.Click += (object sender, EventArgs e) => { panelSearch.Visible = false; };
|
||||||
|
|
||||||
|
dataGridViewList.KeyDown += (object sender, KeyEventArgs e) =>
|
||||||
|
{
|
||||||
|
switch (e.KeyCode)
|
||||||
|
{
|
||||||
|
case Keys.Insert:
|
||||||
|
CallAddElementEvent();
|
||||||
|
break;
|
||||||
|
case Keys.Enter:
|
||||||
|
CallUpdElementEvent();
|
||||||
|
break;
|
||||||
|
case Keys.Delete:
|
||||||
|
CallDelElementEvent();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dataGridViewList.CellDoubleClick += (object sender, DataGridViewCellEventArgs e) =>
|
||||||
|
{
|
||||||
|
CallUpdElementEvent();
|
||||||
|
};
|
||||||
|
|
||||||
|
toolStripButtonPrev.Click += (object sender, EventArgs e) =>
|
||||||
|
{
|
||||||
|
if (int.TryParse(toolStripTextBoxPage.Text, out int page))
|
||||||
|
{
|
||||||
|
toolStripTextBoxPage.Text = (page - 1).ToString();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
toolStripButtonNext.Click += (object sender, EventArgs e) =>
|
||||||
|
{
|
||||||
|
if (int.TryParse(toolStripTextBoxPage.Text, out int page))
|
||||||
|
{
|
||||||
|
toolStripTextBoxPage.Text = (page + 1).ToString();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
toolStripTextBoxPage.KeyDown += (object sender, KeyEventArgs e) =>
|
||||||
|
{
|
||||||
|
if (e.KeyData == Keys.Enter)
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
toolStripComboBoxPageNames.SelectedIndexChanged += (object sender, EventArgs e) => { LoadList(); };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вызов события загрузки данных на datagrid
|
||||||
|
/// </summary>
|
||||||
|
private void LoadList()
|
||||||
|
{
|
||||||
|
var cursor = Cursor.Current;
|
||||||
|
L data = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
// если включена пагинация
|
||||||
|
if (toolStripFooter.Visible)
|
||||||
|
{
|
||||||
|
// постраничная
|
||||||
|
if (toolStripTextBoxPage.Visible)
|
||||||
|
{
|
||||||
|
if (int.TryParse(toolStripTextBoxPage.Text, out int page) && int.TryParse(toolStripTextBoxPage.Tag.ToString(), out int count))
|
||||||
|
{
|
||||||
|
data = GetDataWithPageNumber(page, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// поименная
|
||||||
|
else if (toolStripComboBoxPageNames.Visible)
|
||||||
|
{
|
||||||
|
var key = toolStripComboBoxPageNames.Text;
|
||||||
|
if (key.IsNotEmpty())
|
||||||
|
{
|
||||||
|
data = GetDataWithPageName(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = GetData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
// TODO вывод сообщения об ощибок
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
toolStripLabelCountPages.Text = $"из {data.MaxCount}";
|
||||||
|
FillDataOnGrid(data.List);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Cursor.Current = cursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Заполнение таблицы
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
private void FillDataOnGrid(List<E> data)
|
||||||
|
{
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dataGridViewList.Rows.Clear();
|
||||||
|
foreach (var elem in data)
|
||||||
|
{
|
||||||
|
var mas = new List<object>();
|
||||||
|
foreach (DataGridViewColumn column in dataGridViewList.Columns)
|
||||||
|
{
|
||||||
|
mas.Add(elem.GetType().GetProperty(column.Name["Column".Length..])?.GetValue(elem));
|
||||||
|
}
|
||||||
|
|
||||||
|
dataGridViewList.Rows.Add(mas.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вызов события при добавлении элемента
|
||||||
|
/// </summary>
|
||||||
|
private void CallAddElementEvent() => AddElement();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вызов события при изменении элемента
|
||||||
|
/// </summary>
|
||||||
|
private void CallUpdElementEvent()
|
||||||
|
{
|
||||||
|
foreach (DataGridViewRow selected in dataGridViewList.SelectedRows)
|
||||||
|
{
|
||||||
|
var id = new Guid(selected.Cells[0].Value.ToString());
|
||||||
|
UpdElement(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вызов события при удалении элемента
|
||||||
|
/// </summary>
|
||||||
|
private void CallDelElementEvent()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить выбранные записи?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
foreach (DataGridViewRow selected in dataGridViewList.SelectedRows)
|
||||||
|
{
|
||||||
|
var id = new Guid(selected.Cells[0].Value.ToString());
|
||||||
|
DelElement(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void AddElement() { }
|
||||||
|
|
||||||
|
protected virtual void UpdElement(Guid id) { }
|
||||||
|
|
||||||
|
protected virtual void DelElement(Guid id) { }
|
||||||
|
|
||||||
|
protected virtual ControlViewEntityListConfiguration GetConfig() { return null; }
|
||||||
|
|
||||||
|
protected virtual L GetData() { return null; }
|
||||||
|
|
||||||
|
protected virtual L GetDataWithPageName(string key) { return null; }
|
||||||
|
|
||||||
|
protected virtual L GetDataWithPageNumber(int page, int count) { return null; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
45
DepartmentPortal/Common/DesktopTools/Controls/ControlViewEntityList.Designer.cs
generated
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
namespace DesktopTools.Controls
|
||||||
|
{
|
||||||
|
partial class ControlViewEntityList
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
protected System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ControlViewEntityList
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Name = "ControlViewEntityList";
|
||||||
|
this.Size = new System.Drawing.Size(1116, 747);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
using ModelTools.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace DesktopTools.Controls
|
||||||
|
{
|
||||||
|
public partial class ControlViewEntityList : UserControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Событие, вызываемое при закрытии контрола
|
||||||
|
/// </summary>
|
||||||
|
protected event Action<Guid> CloseEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие, вызываемое при закрытии контрола
|
||||||
|
/// </summary>
|
||||||
|
public event Action<Guid> CloseEventAdd { add { CloseEvent += value; } remove { CloseEvent -= value; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Открытие формы
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Open() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Закрытие формы
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Close()
|
||||||
|
{
|
||||||
|
CloseEvent?.Invoke(Id);
|
||||||
|
Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дубликат контрола
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual ControlViewEntityList Clone() { return null; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Идентификатор контрола
|
||||||
|
/// </summary>
|
||||||
|
public Guid Id { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Заголовок контрола
|
||||||
|
/// </summary>
|
||||||
|
public string Title { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Порядок контрола в меню
|
||||||
|
/// </summary>
|
||||||
|
public int Order { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Операция в системе
|
||||||
|
/// </summary>
|
||||||
|
public AccessOperation AccessOperation { get; protected set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Констркутор
|
||||||
|
/// </summary>
|
||||||
|
public ControlViewEntityList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
27
DepartmentPortal/Common/DesktopTools/DesktopTools.csproj
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ModelTools\ModelTools.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DesktopTools.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Настройки для таблицы вывода списка записей сущности
|
||||||
|
/// </summary>
|
||||||
|
public class ControlViewEntityListConfiguration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Тип класса, который будет выводится
|
||||||
|
/// </summary>
|
||||||
|
public Type EntityType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Список названий кнопок, которые надо скрыть
|
||||||
|
/// </summary>
|
||||||
|
public List<string> ShowToolStripButton { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перечень действий для контектснго меню и выпадающего в верхнем меню пункта "Действия"
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, (string Title, EventHandler Event)> ControlOnMoveElem { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Есть пагинация
|
||||||
|
/// </summary>
|
||||||
|
public bool PaginationOn { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перечень значений для выбора при выводе пагинации по названиям
|
||||||
|
/// </summary>
|
||||||
|
public List<string> PageNamesForPagination { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Количество записей на странице (для пагинации)
|
||||||
|
/// </summary>
|
||||||
|
public int? CountElementsOnPage { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
173
DepartmentPortal/Common/DesktopTools/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace DesktopTools.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом 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()]
|
||||||
|
public class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DesktopTools.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Add {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Add", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Clear {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Clear", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Close {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Close", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Del {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Del", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Down {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Down", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Left {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Left", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Ref {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Ref", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Right {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Right", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Search {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Search", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Up {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Up", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap Upd {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Upd", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
154
DepartmentPortal/Common/DesktopTools/Properties/Resources.resx
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Close" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Del" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Del.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Down.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Left.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Ref" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Ref.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Right.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Up.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Upd" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Upd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
BIN
DepartmentPortal/Common/DesktopTools/Resources/Add.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Clear.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Close.png
Normal file
After Width: | Height: | Size: 412 B |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Del.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Down.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Left.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Ref.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Right.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Search.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Up.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Upd.png
Normal file
After Width: | Height: | Size: 563 B |
@ -5,19 +5,9 @@ namespace ModelTools.Attributes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Настройка отображения элемента в контролах
|
/// Настройка отображения элемента в контролах
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
public class ViewModelPropertyAttribute : Attribute
|
public class ViewModelOnListPropertyAttribute : Attribute
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Используется при выводе списка
|
|
||||||
/// </summary>
|
|
||||||
public bool UseOnList { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Используется при выводе элемента
|
|
||||||
/// </summary>
|
|
||||||
public bool UseOnElement { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Название на форме
|
/// Название на форме
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,14 +27,10 @@ namespace ModelTools.Attributes
|
|||||||
/// Настройка отображения элемента в контролах
|
/// Настройка отображения элемента в контролах
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="displayName">Название на форме</param>
|
/// <param name="displayName">Название на форме</param>
|
||||||
/// <param name="useOnList">Используется при выводе списка</param>
|
|
||||||
/// <param name="useOnElement">Используется при выводе элемента</param>
|
|
||||||
/// <param name="isHide">Скрывать или нет</param>
|
/// <param name="isHide">Скрывать или нет</param>
|
||||||
public ViewModelPropertyAttribute(string displayName, bool useOnList, bool useOnElement, bool isHide = false)
|
public ViewModelOnListPropertyAttribute(string displayName, bool isHide = false)
|
||||||
{
|
{
|
||||||
DisplayName = displayName;
|
DisplayName = displayName;
|
||||||
UseOnList = useOnList;
|
|
||||||
UseOnElement = useOnElement;
|
|
||||||
ColumnWidth = null;
|
ColumnWidth = null;
|
||||||
IsHide = isHide;
|
IsHide = isHide;
|
||||||
}
|
}
|
||||||
@ -53,14 +39,10 @@ namespace ModelTools.Attributes
|
|||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="displayName">Название на форме</param>
|
/// <param name="displayName">Название на форме</param>
|
||||||
/// <param name="useOnList">Используется при выводе списка</param>
|
|
||||||
/// <param name="useOnElement">Используется при выводе элемента</param>
|
|
||||||
/// <param name="columnWidth">Ширина колонки</param>
|
/// <param name="columnWidth">Ширина колонки</param>
|
||||||
public ViewModelPropertyAttribute(string displayName, bool useOnList, bool useOnElement, int columnWidth)
|
public ViewModelOnListPropertyAttribute(string displayName, int columnWidth)
|
||||||
{
|
{
|
||||||
DisplayName = displayName;
|
DisplayName = displayName;
|
||||||
UseOnList = useOnList;
|
|
||||||
UseOnElement = useOnElement;
|
|
||||||
ColumnWidth = columnWidth;
|
ColumnWidth = columnWidth;
|
||||||
IsHide = false;
|
IsHide = false;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using ModelTools.BindingModels;
|
using ModelTools.BindingModels;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.Interfaces;
|
using ModelTools.Interfaces;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using ModelTools.ViewModels;
|
using ModelTools.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -51,7 +51,7 @@ namespace ModelTools.BusinessLogics
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected bool NoAccess(AccessBindingModel model, AccessType type)
|
protected bool NoAccess(AccessBindingModel model, AccessType type)
|
||||||
{
|
{
|
||||||
if (Security.CheckAccess(model, _serviceOperation, type, _entity))
|
if (Security.CheckAccess(new SecurityManagerCheckAccessModel(model, _serviceOperation, type, _entity)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ namespace ModelTools.BusinessLogics
|
|||||||
var bindingProperty = value.GetType().GetProperty(prop);
|
var bindingProperty = value.GetType().GetProperty(prop);
|
||||||
if (bindingProperty != null)
|
if (bindingProperty != null)
|
||||||
{
|
{
|
||||||
value = bindingProperty.GetValue(obj);
|
value = bindingProperty.GetValue(value);
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -16,7 +16,9 @@ namespace ModelTools.BusinessLogics
|
|||||||
{
|
{
|
||||||
private static readonly string _configFileName = "DepartmentPortal.config";
|
private static readonly string _configFileName = "DepartmentPortal.config";
|
||||||
|
|
||||||
private static readonly string _pathToLoaderExt = "..\\..\\..\\..\\Extensions\\";
|
private static readonly string _pathToImplementationExt = "..\\..\\..\\..\\ImplementationExtensions\\";
|
||||||
|
|
||||||
|
private static readonly string _pathToWindowDestopExt = "..\\..\\..\\..\\WindowDestopExtensions\\";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение данных с файла настроек
|
/// Получение данных с файла настроек
|
||||||
@ -39,15 +41,15 @@ namespace ModelTools.BusinessLogics
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Загрузка всех классов-реализаций ILoaderExtensions
|
/// Загрузка всех классов-реализаций IImplementationExtension
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static List<ILoaderExtensions> GetLoaderExtensions()
|
public static List<IImplementationExtension> GetImplementationExtensions()
|
||||||
{
|
{
|
||||||
var list = new List<ILoaderExtensions>();
|
var list = new List<IImplementationExtension>();
|
||||||
if(Directory.Exists(_pathToLoaderExt))
|
if(Directory.Exists(_pathToImplementationExt))
|
||||||
{
|
{
|
||||||
var files = Directory.GetFiles(_pathToLoaderExt, "*.dll", SearchOption.AllDirectories);
|
var files = Directory.GetFiles(_pathToImplementationExt, "*.dll", SearchOption.AllDirectories);
|
||||||
var loadedFiles = new List<string>();
|
var loadedFiles = new List<string>();
|
||||||
foreach(var file in files.Distinct())
|
foreach(var file in files.Distinct())
|
||||||
{
|
{
|
||||||
@ -58,9 +60,40 @@ namespace ModelTools.BusinessLogics
|
|||||||
Assembly asm = Assembly.LoadFrom(file);
|
Assembly asm = Assembly.LoadFrom(file);
|
||||||
foreach (var t in asm.GetExportedTypes())
|
foreach (var t in asm.GetExportedTypes())
|
||||||
{
|
{
|
||||||
if (t.IsClass && typeof(ILoaderExtensions).IsAssignableFrom(t))
|
if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t))
|
||||||
{
|
{
|
||||||
list.Add((ILoaderExtensions)Activator.CreateInstance(t));
|
list.Add((IImplementationExtension)Activator.CreateInstance(t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadedFiles.Add(file.GetFileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка всех классов-реализаций IWindowDesktopExtension
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<IWindowDesktopExtension> GetWindowDesktopExtensions()
|
||||||
|
{
|
||||||
|
var list = new List<IWindowDesktopExtension>();
|
||||||
|
if (Directory.Exists(_pathToWindowDestopExt))
|
||||||
|
{
|
||||||
|
var files = Directory.GetFiles(_pathToWindowDestopExt, "*.dll", SearchOption.AllDirectories);
|
||||||
|
var loadedFiles = new List<string>();
|
||||||
|
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());
|
loadedFiles.Add(file.GetFileName());
|
||||||
|
@ -22,7 +22,7 @@ namespace ModelTools.BusinessLogics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void InitServices()
|
public static void InitServices()
|
||||||
{
|
{
|
||||||
var ext = ServiceProviderLoader.GetLoaderExtensions();
|
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
||||||
if (ext.Count == 0)
|
if (ext.Count == 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
||||||
@ -38,6 +38,8 @@ namespace ModelTools.BusinessLogics
|
|||||||
|
|
||||||
public static void PublishService<T>() => Container.RegisterType<T>(new HierarchicalLifetimeManager());
|
public static void PublishService<T>() => Container.RegisterType<T>(new HierarchicalLifetimeManager());
|
||||||
|
|
||||||
|
public static void PublishService(Type t) => Container.RegisterType(t);
|
||||||
|
|
||||||
public static T Resolve<T>() => Container.Resolve<T>();
|
public static T Resolve<T>() => Container.Resolve<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
// TODO убрать
|
// TODO убрать
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Доступ к админке
|
/// Доступ к меню
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Administrator = 8
|
Menu = 8
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
using ModelTools.BindingModels;
|
using ModelTools.BindingModels;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
|
|
||||||
namespace ModelTools.Interfaces
|
namespace ModelTools.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Интерфейс для регистрации зависомстей в модулях
|
/// Интерфейс для регистрации зависомстей в модулях
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ILoaderExtensions
|
public interface IImplementationExtension
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Регистрация сервисов
|
/// Регистрация сервисов
|
@ -1,5 +1,4 @@
|
|||||||
using ModelTools.BindingModels;
|
using ModelTools.Models;
|
||||||
using ModelTools.Enums;
|
|
||||||
|
|
||||||
namespace ModelTools.Interfaces
|
namespace ModelTools.Interfaces
|
||||||
{
|
{
|
||||||
@ -13,11 +12,8 @@ namespace ModelTools.Interfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Авторизация пользователя к операции
|
/// Авторизация пользователя к операции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model">Данные по пользователю</param>
|
/// <param name="model">Данные по операции</param>
|
||||||
/// <param name="operation">Операция, которую хотят выполнить</param>
|
|
||||||
/// <param name="type">Тип операции</param>
|
|
||||||
/// <param name="entity">Для какой сущности</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool CheckAccess(AccessBindingModel model, AccessOperation operation, AccessType type, string entity);
|
bool CheckAccess(SecurityManagerCheckAccessModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using ModelTools.Models;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ModelTools.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение контролов для основной формы
|
||||||
|
/// </summary>
|
||||||
|
public interface IWindowDesktopExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка контролов модуля, доступных для работы по авторизованному пользователю
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<WindowDesktopExtensionControlModel> GetListControlEntityList();
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ModelTools.OperationResultModels
|
namespace ModelTools.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Результат любой операции
|
/// Результат любой операции с сущностью
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OperationResultModel
|
public class OperationResultModel
|
||||||
{
|
{
|
@ -0,0 +1,39 @@
|
|||||||
|
using ModelTools.BindingModels;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
|
||||||
|
namespace ModelTools.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Данные для проверки доступа
|
||||||
|
/// </summary>
|
||||||
|
public class SecurityManagerCheckAccessModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Данные по пользователю
|
||||||
|
/// </summary>
|
||||||
|
public AccessBindingModel Model { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Операция, которую хотят выполнить
|
||||||
|
/// </summary>
|
||||||
|
public AccessOperation Operation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Тип операции
|
||||||
|
/// </summary>
|
||||||
|
public AccessType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для какой сущности
|
||||||
|
/// </summary>
|
||||||
|
public string Entity { get; set; }
|
||||||
|
|
||||||
|
public SecurityManagerCheckAccessModel(AccessBindingModel model, AccessOperation operation, AccessType type, string entity)
|
||||||
|
{
|
||||||
|
Model = model;
|
||||||
|
Operation = operation;
|
||||||
|
Type = type;
|
||||||
|
Entity = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModelTools.Models
|
||||||
|
{
|
||||||
|
public class WindowDesktopExtensionControlModel
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public int Order { get; set; }
|
||||||
|
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
public object Control { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@ namespace ModelTools.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ElementViewModel
|
public class ElementViewModel
|
||||||
{
|
{
|
||||||
[ViewModelProperty("Идентификатор", useOnList: true, useOnElement: false, isHide: true)]
|
[ViewModelOnListProperty("Идентификатор", isHide: true)]
|
||||||
[MapConfiguration("Id")]
|
[MapConfiguration("Id")]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityBusinessLogic", "Se
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepartmentPortalDesctop", "DepartmentPortalDesctop\DepartmentPortalDesctop.csproj", "{B6CE93CB-998F-4F2D-BE9E-6FDF37FDFD0E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepartmentPortalDesctop", "DepartmentPortalDesctop\DepartmentPortalDesctop.csproj", "{B6CE93CB-998F-4F2D-BE9E-6FDF37FDFD0E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityImplementation", "Security\SecurityImplementation\SecurityImplementation.csproj", "{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityImplementation", "Security\SecurityImplementation\SecurityImplementation.csproj", "{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopTools", "Common\DesktopTools\DesktopTools.csproj", "{6B923E2B-85EE-4490-81BA-C7AB5DB582AC}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityWindowsDesktop", "Security\SecurityWindowsDesktop\SecurityWindowsDesktop.csproj", "{40F7C37A-3544-4A6A-893D-D611DE100036}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -43,6 +47,14 @@ Global
|
|||||||
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6B923E2B-85EE-4490-81BA-C7AB5DB582AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6B923E2B-85EE-4490-81BA-C7AB5DB582AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6B923E2B-85EE-4490-81BA-C7AB5DB582AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6B923E2B-85EE-4490-81BA-C7AB5DB582AC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{40F7C37A-3544-4A6A-893D-D611DE100036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{40F7C37A-3544-4A6A-893D-D611DE100036}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{40F7C37A-3544-4A6A-893D-D611DE100036}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{40F7C37A-3544-4A6A-893D-D611DE100036}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -52,6 +64,8 @@ Global
|
|||||||
{8BE3C29B-6E9F-4DFC-BAC3-14229D58616F} = {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}
|
{D424B54F-AF26-4A39-8D2B-CF874F31DE42} = {7DA26C36-778E-4563-9AEC-966E26EA7B2A}
|
||||||
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED} = {7DA26C36-778E-4563-9AEC-966E26EA7B2A}
|
{24D7BD00-EC45-4B98-92BB-C6FFB01F66ED} = {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}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {FBA0CB49-EF2D-4538-9D00-FCEDA24879A9}
|
SolutionGuid = {FBA0CB49-EF2D-4538-9D00-FCEDA24879A9}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Common\DatabaseCore\DatabaseCore.csproj" />
|
<ProjectReference Include="..\Common\DatabaseCore\DatabaseCore.csproj" />
|
||||||
|
<ProjectReference Include="..\Common\DesktopTools\DesktopTools.csproj" />
|
||||||
<ProjectReference Include="..\Security\SecurityBusinessLogic\SecurityBusinessLogic.csproj" />
|
<ProjectReference Include="..\Security\SecurityBusinessLogic\SecurityBusinessLogic.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -31,10 +31,13 @@ namespace DepartmentPortalDesctop
|
|||||||
{
|
{
|
||||||
this.menuMain = new System.Windows.Forms.MenuStrip();
|
this.menuMain = new System.Windows.Forms.MenuStrip();
|
||||||
this.panelControls = new System.Windows.Forms.Panel();
|
this.panelControls = new System.Windows.Forms.Panel();
|
||||||
this.listBoxControls = new System.Windows.Forms.ListBox();
|
this.dataGridViewControls = new System.Windows.Forms.DataGridView();
|
||||||
|
this.ColumnControlId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.ColumnControlName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.splitContainerMain = new System.Windows.Forms.SplitContainer();
|
this.splitContainerMain = new System.Windows.Forms.SplitContainer();
|
||||||
this.ButtonShowHideControlList = new System.Windows.Forms.Button();
|
this.ButtonShowHideControlList = new System.Windows.Forms.Button();
|
||||||
this.panelControls.SuspendLayout();
|
this.panelControls.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).BeginInit();
|
||||||
this.splitContainerMain.SuspendLayout();
|
this.splitContainerMain.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -49,22 +52,50 @@ namespace DepartmentPortalDesctop
|
|||||||
//
|
//
|
||||||
// panelControls
|
// panelControls
|
||||||
//
|
//
|
||||||
this.panelControls.Controls.Add(this.listBoxControls);
|
this.panelControls.Controls.Add(this.dataGridViewControls);
|
||||||
this.panelControls.Dock = System.Windows.Forms.DockStyle.Left;
|
this.panelControls.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
this.panelControls.Location = new System.Drawing.Point(0, 24);
|
this.panelControls.Location = new System.Drawing.Point(0, 24);
|
||||||
this.panelControls.Name = "panelControls";
|
this.panelControls.Name = "panelControls";
|
||||||
this.panelControls.Size = new System.Drawing.Size(191, 426);
|
this.panelControls.Size = new System.Drawing.Size(191, 426);
|
||||||
this.panelControls.TabIndex = 1;
|
this.panelControls.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// listBoxControls
|
// dataGridViewControls
|
||||||
//
|
//
|
||||||
this.listBoxControls.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.dataGridViewControls.AllowUserToAddRows = false;
|
||||||
this.listBoxControls.FormattingEnabled = true;
|
this.dataGridViewControls.AllowUserToDeleteRows = false;
|
||||||
this.listBoxControls.ItemHeight = 15;
|
this.dataGridViewControls.AllowUserToResizeColumns = false;
|
||||||
this.listBoxControls.Location = new System.Drawing.Point(0, 0);
|
this.dataGridViewControls.AllowUserToResizeRows = false;
|
||||||
this.listBoxControls.Name = "listBoxControls";
|
this.dataGridViewControls.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.listBoxControls.Size = new System.Drawing.Size(191, 426);
|
this.dataGridViewControls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.listBoxControls.TabIndex = 0;
|
this.dataGridViewControls.ColumnHeadersVisible = false;
|
||||||
|
this.dataGridViewControls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.ColumnControlId,
|
||||||
|
this.ColumnControlName});
|
||||||
|
this.dataGridViewControls.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.dataGridViewControls.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.dataGridViewControls.MultiSelect = false;
|
||||||
|
this.dataGridViewControls.Name = "dataGridViewControls";
|
||||||
|
this.dataGridViewControls.ReadOnly = true;
|
||||||
|
this.dataGridViewControls.RowHeadersVisible = false;
|
||||||
|
this.dataGridViewControls.RowTemplate.Height = 25;
|
||||||
|
this.dataGridViewControls.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridViewControls.Size = new System.Drawing.Size(191, 426);
|
||||||
|
this.dataGridViewControls.TabIndex = 0;
|
||||||
|
this.dataGridViewControls.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridViewControls_CellClick);
|
||||||
|
//
|
||||||
|
// ColumnControlId
|
||||||
|
//
|
||||||
|
this.ColumnControlId.HeaderText = "Id";
|
||||||
|
this.ColumnControlId.Name = "ColumnControlId";
|
||||||
|
this.ColumnControlId.ReadOnly = true;
|
||||||
|
this.ColumnControlId.Visible = false;
|
||||||
|
//
|
||||||
|
// ColumnControlName
|
||||||
|
//
|
||||||
|
this.ColumnControlName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
this.ColumnControlName.HeaderText = "ControlName";
|
||||||
|
this.ColumnControlName.Name = "ColumnControlName";
|
||||||
|
this.ColumnControlName.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// splitContainerMain
|
// splitContainerMain
|
||||||
//
|
//
|
||||||
@ -106,6 +137,7 @@ namespace DepartmentPortalDesctop
|
|||||||
this.Text = "Кафедральный портал";
|
this.Text = "Кафедральный портал";
|
||||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||||
this.panelControls.ResumeLayout(false);
|
this.panelControls.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).EndInit();
|
||||||
this.splitContainerMain.ResumeLayout(false);
|
this.splitContainerMain.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@ -117,9 +149,11 @@ namespace DepartmentPortalDesctop
|
|||||||
|
|
||||||
private System.Windows.Forms.MenuStrip menuMain;
|
private System.Windows.Forms.MenuStrip menuMain;
|
||||||
private System.Windows.Forms.Panel panelControls;
|
private System.Windows.Forms.Panel panelControls;
|
||||||
private System.Windows.Forms.ListBox listBoxControls;
|
|
||||||
private System.Windows.Forms.SplitContainer splitContainerMain;
|
private System.Windows.Forms.SplitContainer splitContainerMain;
|
||||||
private System.Windows.Forms.Button ButtonShowHideControlList;
|
private System.Windows.Forms.Button ButtonShowHideControlList;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridViewControls;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlId;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,138 @@
|
|||||||
using System;
|
using DesktopTools.Controls;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace DepartmentPortalDesctop
|
namespace DepartmentPortalDesctop
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
private Dictionary<Guid, Control> controls;
|
private Dictionary<Guid, ControlViewEntityList> _baseControls;
|
||||||
|
|
||||||
|
private Dictionary<Guid, ControlViewEntityList> _controls;
|
||||||
|
|
||||||
public FormMain()
|
public FormMain()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
controls = new Dictionary<Guid, Control>();
|
_baseControls = new Dictionary<Guid, ControlViewEntityList>();
|
||||||
|
_controls = new Dictionary<Guid, ControlViewEntityList>();
|
||||||
|
|
||||||
|
var extensions = ServiceProviderLoader.GetWindowDesktopExtensions();
|
||||||
|
foreach (var extens in extensions)
|
||||||
|
{
|
||||||
|
var list = extens?.GetListControlEntityList()?.OrderBy(x => x.Order).ToList();
|
||||||
|
if (list != null && list.Count > 0)
|
||||||
|
{
|
||||||
|
var menu = new ToolStripMenuItem { Text = list[0].Title };
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
if (list[i].Control is ControlViewEntityList 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuMain.Items.Add(menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление нового контрола
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
private void OpenControl(Guid id)
|
||||||
|
{
|
||||||
|
if (!_baseControls.ContainsKey(id))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_baseControls[id] == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ctrl = _baseControls[id].Clone();
|
||||||
|
if (!_controls.ContainsKey(ctrl.Id))
|
||||||
|
{
|
||||||
|
ctrl.CloseEventAdd += CloseControl;
|
||||||
|
ctrl.Dock = DockStyle.Fill;
|
||||||
|
ctrl.Open();
|
||||||
|
_controls.Add(ctrl.Id, ctrl);
|
||||||
|
|
||||||
|
splitContainerMain.Panel1.Controls.Clear();
|
||||||
|
splitContainerMain.Panel1.Controls.Add(ctrl);
|
||||||
|
dataGridViewControls.Rows.Add(new object[] { ctrl.Id, ctrl.Title });
|
||||||
|
dataGridViewControls.Rows[dataGridViewControls.Rows.Count - 1].Selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Закрытие контрола
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
private void CloseControl(Guid id)
|
||||||
|
{
|
||||||
|
if (!_controls.ContainsKey(id))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ctrl = _controls[id];
|
||||||
|
if (ctrl == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < dataGridViewControls.Rows.Count; ++i)
|
||||||
|
{
|
||||||
|
if (dataGridViewControls.Rows[i].Cells[0].Value.ToString() == ctrl.Id.ToString())
|
||||||
|
{
|
||||||
|
dataGridViewControls.Rows.RemoveAt(i);
|
||||||
|
if (i < dataGridViewControls.Rows.Count - 1)
|
||||||
|
{
|
||||||
|
dataGridViewControls.Rows[i].Selected = true;
|
||||||
|
ShowControl(new Guid(dataGridViewControls.Rows[i].Cells[0].Value.ToString()));
|
||||||
|
}
|
||||||
|
else if (i > 0)
|
||||||
|
{
|
||||||
|
dataGridViewControls.Rows[i - 1].Selected = true;
|
||||||
|
ShowControl(new Guid(dataGridViewControls.Rows[i - 1].Cells[0].Value.ToString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_controls.Remove(ctrl.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Отображение контрола
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
private void ShowControl(Guid id)
|
||||||
|
{
|
||||||
|
if (!_controls.ContainsKey(id))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ctrl = _controls[id];
|
||||||
|
if (ctrl == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
splitContainerMain.Panel1.Controls.Clear();
|
||||||
|
splitContainerMain.Panel1.Controls.Add(ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonShowHideControlList_Click(object sender, EventArgs e)
|
private void ButtonShowHideControlList_Click(object sender, EventArgs e)
|
||||||
@ -18,5 +140,7 @@ namespace DepartmentPortalDesctop
|
|||||||
ButtonShowHideControlList.Text = panelControls.Visible ? ">" : "<";
|
ButtonShowHideControlList.Text = panelControls.Visible ? ">" : "<";
|
||||||
panelControls.Visible = !panelControls.Visible;
|
panelControls.Visible = !panelControls.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataGridViewControls_CellClick(object sender, DataGridViewCellEventArgs e) => ShowControl(new Guid(dataGridViewControls.Rows[e.RowIndex].Cells[0].Value.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -57,4 +57,10 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="ColumnControlId.UserAddedColumn" type="System.Boolean, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnControlName.UserAddedColumn" type="System.Boolean, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -1,4 +1,5 @@
|
|||||||
using DatabaseCore;
|
using DatabaseCore;
|
||||||
|
using DesktopTools.Controls;
|
||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Interfaces;
|
using ModelTools.Interfaces;
|
||||||
using SecurityBusinessLogic.BusinessLogics;
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
BIN
DepartmentPortal/ImplementationExtensions/net5.0/ModelTools.dll
Normal file
@ -11,6 +11,11 @@ namespace SecurityBusinessLogic.BindingModels
|
|||||||
public class AccessGetBindingModel : GetBindingModel
|
public class AccessGetBindingModel : GetBindingModel
|
||||||
{
|
{
|
||||||
public Guid? RoleId { get; set; }
|
public Guid? RoleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Для вывода списка доступов по роли в контроле десктопном
|
||||||
|
/// </summary>
|
||||||
|
public string RoleName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -15,26 +15,23 @@ namespace SecurityBusinessLogic.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AccessViewModel : ElementViewModel
|
public class AccessViewModel : ElementViewModel
|
||||||
{
|
{
|
||||||
[ViewModelProperty("Роль", false, true)]
|
|
||||||
[MapConfiguration("RoleId")]
|
[MapConfiguration("RoleId")]
|
||||||
public Guid RoleId { get; set; }
|
public Guid RoleId { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Роль", true, false, 100)]
|
[ViewModelOnListProperty("Роль", 100)]
|
||||||
[MapConfiguration("Role.RoleName", true)]
|
[MapConfiguration("Role.RoleName", true)]
|
||||||
public string RoleName { get; set; }
|
public string RoleName { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Операция", false, true)]
|
|
||||||
[MapConfiguration("AccessOperation")]
|
[MapConfiguration("AccessOperation")]
|
||||||
public AccessOperation AccessOperation { get; set; }
|
public AccessOperation AccessOperation { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Операция", true, false)]
|
[ViewModelOnListProperty("Операция")]
|
||||||
public string AccessOperationTitle => AccessOperation.ToString("G");
|
public string AccessOperationTitle => AccessOperation.ToString("G");
|
||||||
|
|
||||||
[ViewModelProperty("Тип", false, true)]
|
|
||||||
[MapConfiguration("AccessType")]
|
[MapConfiguration("AccessType")]
|
||||||
public AccessType AccessType { get; set; }
|
public AccessType AccessType { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Тип", true, false, 50)]
|
[ViewModelOnListProperty("Тип", 150)]
|
||||||
public string AccessTypeTitle => AccessType.ToString("G");
|
public string AccessTypeTitle => AccessType.ToString("G");
|
||||||
|
|
||||||
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
|
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
|
||||||
|
@ -13,11 +13,11 @@ namespace SecurityBusinessLogic.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EnviromentSettingViewModel : ElementViewModel
|
public class EnviromentSettingViewModel : ElementViewModel
|
||||||
{
|
{
|
||||||
[ViewModelProperty("Ключ", true, true)]
|
[ViewModelOnListProperty("Ключ")]
|
||||||
[MapConfiguration("Key")]
|
[MapConfiguration("Key")]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Значение", true, true, 100)]
|
[ViewModelOnListProperty("Значение", 100)]
|
||||||
[MapConfiguration("Value")]
|
[MapConfiguration("Value")]
|
||||||
public int Value { get; set; }
|
public int Value { get; set; }
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@ namespace SecurityBusinessLogic.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoleViewModel : ElementViewModel
|
public class RoleViewModel : ElementViewModel
|
||||||
{
|
{
|
||||||
[ViewModelProperty("Название роли", true, true)]
|
[ViewModelOnListProperty("Название роли")]
|
||||||
[MapConfiguration("RoleName")]
|
[MapConfiguration("RoleName")]
|
||||||
public string RoleName { get; set; }
|
public string RoleName { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Приоритет", true, true, 100)]
|
[ViewModelOnListProperty("Приоритет", 100)]
|
||||||
[MapConfiguration("RolePriority")]
|
[MapConfiguration("RolePriority")]
|
||||||
public int RolePriority { get; set; }
|
public int RolePriority { get; set; }
|
||||||
|
|
||||||
|
@ -14,45 +14,38 @@ namespace SecurityBusinessLogic.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserViewModel : ElementViewModel
|
public class UserViewModel : ElementViewModel
|
||||||
{
|
{
|
||||||
[ViewModelProperty("Пользователь", true, true)]
|
[ViewModelOnListProperty("Пользователь")]
|
||||||
[MapConfiguration("UserName")]
|
[MapConfiguration("UserName")]
|
||||||
public string Login { get; set; }
|
public string Login { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Студент", false, true)]
|
|
||||||
[MapConfiguration("StudentId")]
|
[MapConfiguration("StudentId")]
|
||||||
public Guid? StudentId { get; set; }
|
public Guid? StudentId { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Преподаватель", false, true)]
|
|
||||||
[MapConfiguration("LecturerId")]
|
[MapConfiguration("LecturerId")]
|
||||||
public Guid? LecturerId { get; set; }
|
public Guid? LecturerId { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Сотрудник", false, true)]
|
|
||||||
[MapConfiguration("EmployeeId")]
|
[MapConfiguration("EmployeeId")]
|
||||||
public Guid? EmployeeId { get; set; }
|
public Guid? EmployeeId { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Фото", false, true)]
|
|
||||||
[MapConfiguration("Avatar")]
|
[MapConfiguration("Avatar")]
|
||||||
public byte[] Avatar { get; set; }
|
public byte[] Avatar { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Посл. визит", true, false, 100)]
|
[ViewModelOnListProperty("Посл. визит", 100)]
|
||||||
[MapConfiguration("DateLastVisit")]
|
[MapConfiguration("DateLastVisit")]
|
||||||
public DateTime? DateLastVisit { get; set; }
|
public DateTime? DateLastVisit { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Блокировка", false, true)]
|
|
||||||
[MapConfiguration("IsBanned")]
|
[MapConfiguration("IsBanned")]
|
||||||
public bool IsBanned { get; set; }
|
public bool IsBanned { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Блокир.", true, false, 100)]
|
[ViewModelOnListProperty("Блокир.", 80)]
|
||||||
public string Banned => IsBanned ? "Да" : "Нет";
|
public string Banned => IsBanned ? "Да" : "Нет";
|
||||||
|
|
||||||
[ViewModelProperty("Дата Б.", false, true, 100)]
|
|
||||||
[MapConfiguration("DateBanned")]
|
[MapConfiguration("DateBanned")]
|
||||||
public DateTime? DateBanned { get; set; }
|
public DateTime? DateBanned { get; set; }
|
||||||
|
|
||||||
[ViewModelProperty("Дата Б.", true, false, 100)]
|
[ViewModelOnListProperty("Дата Б.", 100)]
|
||||||
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
||||||
|
|
||||||
[ViewModelProperty("Количество попыток входа", false, false)]
|
|
||||||
[MapConfiguration("CountAttempt")]
|
[MapConfiguration("CountAttempt")]
|
||||||
public int CountAttempt { get; set; }
|
public int CountAttempt { get; set; }
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ using DatabaseCore.Models.Security;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Extensions;
|
||||||
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
@ -21,7 +22,7 @@ namespace SecurityImplementation.Implementations
|
|||||||
{
|
{
|
||||||
using var context = DatabaseManager.GetContext;
|
using var context = DatabaseManager.GetContext;
|
||||||
|
|
||||||
var exsistEntity = context.Accesses.FirstOrDefault(x => x.Operation == model.Operation && x.RoleId == model.RoleId && x.AccessType == model.AccessType);
|
var exsistEntity = context.Accesses.FirstOrDefault(x => x.AccessOperation == model.Operation && x.RoleId == model.RoleId && x.AccessType == model.AccessType);
|
||||||
if (exsistEntity == null)
|
if (exsistEntity == null)
|
||||||
{
|
{
|
||||||
var entity = Mapper.MapToClass<AccessSetBindingModel, Access>(model);
|
var entity = Mapper.MapToClass<AccessSetBindingModel, Access>(model);
|
||||||
@ -86,8 +87,12 @@ namespace SecurityImplementation.Implementations
|
|||||||
{
|
{
|
||||||
query = query.Where(x => x.RoleId == model.RoleId);
|
query = query.Where(x => x.RoleId == model.RoleId);
|
||||||
}
|
}
|
||||||
|
if(model.RoleName.IsNotEmpty())
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.Role.RoleName == model.RoleName);
|
||||||
|
}
|
||||||
|
|
||||||
query = query.OrderBy(x => x.Role.RoleName).ThenBy(x => x.Operation).ThenBy(x => x.AccessType);
|
query = query.OrderBy(x => x.Role.RoleName).ThenBy(x => x.AccessOperation).ThenBy(x => x.AccessType);
|
||||||
|
|
||||||
if (model.PageNumber.HasValue && model.PageSize.HasValue)
|
if (model.PageNumber.HasValue && model.PageSize.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using DatabaseCore.Models.Security;
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.Extensions;
|
using ModelTools.Extensions;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using DatabaseCore.Models.Security;
|
using DatabaseCore.Models.Security;
|
||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -3,7 +3,7 @@ using DatabaseCore.Models.Security;
|
|||||||
using ModelTools.BusinessLogics;
|
using ModelTools.BusinessLogics;
|
||||||
using ModelTools.Enums;
|
using ModelTools.Enums;
|
||||||
using ModelTools.Extensions;
|
using ModelTools.Extensions;
|
||||||
using ModelTools.OperationResultModels;
|
using ModelTools.Models;
|
||||||
using SecurityBusinessLogic.BindingModels;
|
using SecurityBusinessLogic.BindingModels;
|
||||||
using SecurityBusinessLogic.Interfaces;
|
using SecurityBusinessLogic.Interfaces;
|
||||||
using SecurityBusinessLogic.ViewModels;
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<OutputPath>..\..\Extensions\</OutputPath>
|
<OutputPath>..\..\ImplementationExtensions\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,7 +6,7 @@ using SecurityImplementation.Implementations;
|
|||||||
|
|
||||||
namespace SecurityImplementation
|
namespace SecurityImplementation
|
||||||
{
|
{
|
||||||
public class SecurityLoaderExtensions : ILoaderExtensions
|
public class SecurityLoaderExtensions : IImplementationExtension
|
||||||
{
|
{
|
||||||
public void RegisterServices()
|
public void RegisterServices()
|
||||||
{
|
{
|
||||||
|
33
DepartmentPortal/Security/SecurityWindowsDesktop/Controls/AccessesControl.Designer.cs
generated
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
partial class AccessesControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
using DesktopTools.Controls;
|
||||||
|
using DesktopTools.Models;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
using SecurityBusinessLogic.BindingModels;
|
||||||
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
public partial class AccessesControl : AbstractGenerticControlEntityList<AccessGetBindingModel, AccessSetBindingModel, AccessListViewModel, AccessViewModel, AccessBusinessLogic>
|
||||||
|
{
|
||||||
|
private readonly RoleBusinessLogic _roleBusinessLogic;
|
||||||
|
|
||||||
|
public AccessesControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_businessLogic = UnityContainerConfigurator.Resolve<AccessBusinessLogic>();
|
||||||
|
_roleBusinessLogic = UnityContainerConfigurator.Resolve<RoleBusinessLogic>();
|
||||||
|
Title = "Доступы";
|
||||||
|
Id = new Guid("6eebc4c4-cb86-4368-93e0-33dbdbb7409a");
|
||||||
|
Order = 1;
|
||||||
|
AccessOperation = AccessOperation.Доступы;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ControlViewEntityList Clone() => new AccessesControl() { Id = Guid.NewGuid() };
|
||||||
|
|
||||||
|
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||||
|
{
|
||||||
|
PaginationOn = true,
|
||||||
|
PageNamesForPagination = _roleBusinessLogic.GetList(new RoleGetBindingModel())?.List?.Select(x => x.RoleName)?.ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override AccessListViewModel GetDataWithPageName(string key)
|
||||||
|
{
|
||||||
|
var list = _businessLogic.GetList(new AccessGetBindingModel { RoleName = key });
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
33
DepartmentPortal/Security/SecurityWindowsDesktop/Controls/EnviromentSettingControl.Designer.cs
generated
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
partial class EnviromentSettingControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
using DesktopTools.Controls;
|
||||||
|
using DesktopTools.Models;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
using SecurityBusinessLogic.BindingModels;
|
||||||
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
public partial class EnviromentSettingControl : AbstractGenerticControlEntityList<EnviromentSettingGetBindingModel, EnviromentSettingSetBindingModel, EnviromentSettingListViewModel, EnviromentSettingViewModel, EnviromentSettingBusinessLogic>
|
||||||
|
{
|
||||||
|
public EnviromentSettingControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_businessLogic = UnityContainerConfigurator.Resolve<EnviromentSettingBusinessLogic>();
|
||||||
|
Title = "Настройки Среды";
|
||||||
|
Id = new Guid("b3865c23-b1db-475b-b95c-aa51edc60388");
|
||||||
|
Order = 1;
|
||||||
|
AccessOperation = AccessOperation.НастройкиСреды;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ControlViewEntityList Clone() => new EnviromentSettingControl() { Id = Guid.NewGuid() };
|
||||||
|
|
||||||
|
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||||
|
{
|
||||||
|
PaginationOn = false
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override EnviromentSettingListViewModel GetData()
|
||||||
|
{
|
||||||
|
var list = _businessLogic.GetList(new EnviromentSettingGetBindingModel());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
33
DepartmentPortal/Security/SecurityWindowsDesktop/Controls/RolesControl.Designer.cs
generated
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
partial class RolesControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
using DesktopTools.Controls;
|
||||||
|
using DesktopTools.Models;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
using SecurityBusinessLogic.BindingModels;
|
||||||
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
public partial class RolesControl : AbstractGenerticControlEntityList<RoleGetBindingModel, RoleSetBindingModel, RoleListViewModel, RoleViewModel, RoleBusinessLogic>
|
||||||
|
{
|
||||||
|
public RolesControl() : base()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_businessLogic = UnityContainerConfigurator.Resolve<RoleBusinessLogic>();
|
||||||
|
Title = "Роли";
|
||||||
|
Id = new Guid("6a33ce5c-e950-4294-9f75-2a0b35941bf7");
|
||||||
|
Order = 1;
|
||||||
|
AccessOperation = AccessOperation.Роли;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ControlViewEntityList Clone() => new RolesControl() { Id = Guid.NewGuid() };
|
||||||
|
|
||||||
|
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||||
|
{
|
||||||
|
PaginationOn = false
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override RoleListViewModel GetData()
|
||||||
|
{
|
||||||
|
var list = _businessLogic.GetList(new RoleGetBindingModel());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
33
DepartmentPortal/Security/SecurityWindowsDesktop/Controls/UsersControl.Designer.cs
generated
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
partial class UsersControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
using DesktopTools.Controls;
|
||||||
|
using DesktopTools.Models;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
using SecurityBusinessLogic.BindingModels;
|
||||||
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
using SecurityBusinessLogic.ViewModels;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SecurityWindowsDesktop.Controls
|
||||||
|
{
|
||||||
|
public partial class UsersControl : AbstractGenerticControlEntityList<UserGetBindingModel, UserSetBindingModel, UserListViewModel, UserViewModel, UserBusinessLogic>
|
||||||
|
{
|
||||||
|
public UsersControl() : base()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_businessLogic = UnityContainerConfigurator.Resolve<UserBusinessLogic>();
|
||||||
|
Title = "Пользователи";
|
||||||
|
Id = new Guid("d5596997-d1f5-4e5e-b94b-6bdd6bca3452");
|
||||||
|
Order = 1;
|
||||||
|
AccessOperation = AccessOperation.Пользователи;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ControlViewEntityList Clone() => new UsersControl() { Id = Guid.NewGuid() };
|
||||||
|
|
||||||
|
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||||
|
{
|
||||||
|
PaginationOn = true,
|
||||||
|
CountElementsOnPage = 40
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override UserListViewModel GetDataWithPageNumber(int page, int count)
|
||||||
|
{
|
||||||
|
var list = _businessLogic.GetList(new UserGetBindingModel
|
||||||
|
{
|
||||||
|
PageNumber = page,
|
||||||
|
PageSize = count
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -0,0 +1,59 @@
|
|||||||
|
using DesktopTools.Controls;
|
||||||
|
using ModelTools.BindingModels;
|
||||||
|
using ModelTools.BusinessLogics;
|
||||||
|
using ModelTools.Enums;
|
||||||
|
using ModelTools.Interfaces;
|
||||||
|
using ModelTools.Models;
|
||||||
|
using SecurityBusinessLogic.BusinessLogics;
|
||||||
|
using SecurityWindowsDesktop.Controls;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SecurityWindowsDesktop
|
||||||
|
{
|
||||||
|
public class SecurityWindowDesktopExtension : IWindowDesktopExtension
|
||||||
|
{
|
||||||
|
public List<WindowDesktopExtensionControlModel> GetListControlEntityList()
|
||||||
|
{
|
||||||
|
var manager = UnityContainerConfigurator.Resolve<ISecurityManager>();
|
||||||
|
if (manager == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = UserManager.GetInstance.UserId },
|
||||||
|
AccessOperation.Администрирование, AccessType.SimpleView, "Администрирование")))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = new List<WindowDesktopExtensionControlModel>
|
||||||
|
{
|
||||||
|
new WindowDesktopExtensionControlModel { Order = 0, Title = "Администрирование" }
|
||||||
|
};
|
||||||
|
List<ControlViewEntityList> _controls = new()
|
||||||
|
{
|
||||||
|
new UsersControl(),
|
||||||
|
new RolesControl(),
|
||||||
|
new AccessesControl(),
|
||||||
|
new EnviromentSettingControl()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var cntrl in _controls)
|
||||||
|
{
|
||||||
|
if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = UserManager.GetInstance.UserId },
|
||||||
|
cntrl.AccessOperation, AccessType.SimpleView, cntrl.Title)))
|
||||||
|
{
|
||||||
|
list.Add(new WindowDesktopExtensionControlModel
|
||||||
|
{
|
||||||
|
Id = cntrl.Id,
|
||||||
|
Order = cntrl.Order,
|
||||||
|
Title = cntrl.Title,
|
||||||
|
Control = cntrl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<OutputPath>..\..\WindowDestopExtensions\</OutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Accesses\" />
|
||||||
|
<Folder Include="EnviromentSettings\" />
|
||||||
|
<Folder Include="Roles\" />
|
||||||
|
<Folder Include="Users\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Common\DesktopTools\DesktopTools.csproj" />
|
||||||
|
<ProjectReference Include="..\SecurityBusinessLogic\SecurityBusinessLogic.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,96 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETCoreApp,Version=v5.0",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETCoreApp,Version=v5.0": {
|
||||||
|
"SecurityWindowsDesktop/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"DesktopTools": "1.0.0",
|
||||||
|
"SecurityBusinessLogic": "1.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"SecurityWindowsDesktop.dll": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {},
|
||||||
|
"Unity/5.11.10": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netcoreapp3.0/Unity.Abstractions.dll": {
|
||||||
|
"assemblyVersion": "5.11.7.0",
|
||||||
|
"fileVersion": "5.11.7.0"
|
||||||
|
},
|
||||||
|
"lib/netcoreapp3.0/Unity.Container.dll": {
|
||||||
|
"assemblyVersion": "5.11.11.0",
|
||||||
|
"fileVersion": "5.11.11.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"DesktopTools/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"ModelTools": "1.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"DesktopTools.dll": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ModelTools/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Unity": "5.11.10"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"ModelTools.dll": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SecurityBusinessLogic/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"ModelTools": "1.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"SecurityBusinessLogic.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"SecurityWindowsDesktop/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/4.5.2": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==",
|
||||||
|
"path": "system.runtime.compilerservices.unsafe/4.5.2",
|
||||||
|
"hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Unity/5.11.10": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-B4+Ps3oqI78hJ+dAFsJhPkJT6qycsNExgLbtw7CEHSzKc2ac3YyUR8SHQ+ZyTwld/y5IbDx/aNOHnKE9Em1zWA==",
|
||||||
|
"path": "unity/5.11.10",
|
||||||
|
"hashPath": "unity.5.11.10.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"DesktopTools/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
},
|
||||||
|
"ModelTools/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
},
|
||||||
|
"SecurityBusinessLogic/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|