нарабкот по выводу элемента для добавления и редактирования
This commit is contained in:
parent
9325f592e1
commit
da3e126579
@ -21,7 +21,7 @@ namespace DatabaseCore.Models.Security
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
[MapConfiguration("Operation")]
|
||||
[MapConfiguration("AccessOperation")]
|
||||
public AccessOperation AccessOperation { get; set; }
|
||||
|
||||
[Required]
|
||||
|
71
DepartmentPortal/Common/DesktopTools/BaseControls/AbstractBaseControl.Designer.cs
generated
Normal file
71
DepartmentPortal/Common/DesktopTools/BaseControls/AbstractBaseControl.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
partial class AbstractBaseControl
|
||||
{
|
||||
/// <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.labelTitle = new System.Windows.Forms.Label();
|
||||
this.panelControl = new System.Windows.Forms.Panel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelTitle
|
||||
//
|
||||
this.labelTitle.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.labelTitle.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelTitle.Name = "labelTitle";
|
||||
this.labelTitle.Size = new System.Drawing.Size(93, 25);
|
||||
this.labelTitle.TabIndex = 0;
|
||||
this.labelTitle.Text = "Наименование:";
|
||||
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// panelControl
|
||||
//
|
||||
this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelControl.Location = new System.Drawing.Point(93, 0);
|
||||
this.panelControl.Name = "panelControl";
|
||||
this.panelControl.Size = new System.Drawing.Size(407, 25);
|
||||
this.panelControl.TabIndex = 1;
|
||||
//
|
||||
// BaseControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panelControl);
|
||||
this.Controls.Add(this.labelTitle);
|
||||
this.Name = "BaseControl";
|
||||
this.Size = new System.Drawing.Size(500, 25);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected System.Windows.Forms.Label labelTitle;
|
||||
protected System.Windows.Forms.Panel panelControl;
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
using ModuleTools.Extensions;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
public abstract partial class AbstractBaseControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Оригинальное значение (требуется при откате изменений)
|
||||
/// </summary>
|
||||
protected object _originalValue;
|
||||
|
||||
/// <summary>
|
||||
/// Необходимость проверки при получении данных
|
||||
/// </summary>
|
||||
protected bool _mustCheckValue;
|
||||
|
||||
/// <summary>
|
||||
/// Название свойства, по которму идет отображение
|
||||
/// </summary>
|
||||
protected string PropertyName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Событие изменения значения в контроле
|
||||
/// </summary>
|
||||
protected event Action OnValueChange;
|
||||
|
||||
/// <summary>
|
||||
/// Событие изменения значения в контроле
|
||||
/// </summary>
|
||||
public event Action OnValueChangeEvent { add { OnValueChange += value; } remove { OnValueChange -= value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Вызов события в дочерних контролах
|
||||
/// </summary>
|
||||
protected void CallOnValueChangeEvent() => OnValueChange?.Invoke();
|
||||
|
||||
|
||||
public AbstractBaseControl(string propertyName)
|
||||
{
|
||||
InitializeComponent();
|
||||
PropertyName = propertyName;
|
||||
}
|
||||
|
||||
#region Работа с заголовком
|
||||
/// <summary>
|
||||
/// Установка заголовка
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <returns>Ширину полученного загаловка</returns>
|
||||
public int SetTitle(string title)
|
||||
{
|
||||
labelTitle.Text = title;
|
||||
labelTitle.AutoSize = true;
|
||||
return labelTitle.Width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка ширины заголовка (вызывается через событие, чтобы у всех заголовков получилась одна ширина)
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
public void SetTitleWidth(int width)
|
||||
{
|
||||
labelTitle.AutoSize = false;
|
||||
labelTitle.Width = width;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Устанвока контрола в режим только просмотра
|
||||
/// </summary>
|
||||
/// <param name="readOnly"></param>
|
||||
public abstract void SetReadOnly(bool readOnly);
|
||||
|
||||
/// <summary>
|
||||
/// Установка значения
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public virtual void SetValueToControl(object value) => _originalValue = value;
|
||||
|
||||
/// <summary>
|
||||
/// Сброс значения
|
||||
/// </summary>
|
||||
public abstract void DropValue();
|
||||
|
||||
/// <summary>
|
||||
/// Установка флага необхоидмости проверки
|
||||
/// </summary>
|
||||
/// <param name="mustCheckValue"></param>
|
||||
public void SetMustCheckValue(bool mustCheckValue) => _mustCheckValue = mustCheckValue;
|
||||
|
||||
/// <summary>
|
||||
/// Проверка на заполненность
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract bool CheckValue();
|
||||
|
||||
/// <summary>
|
||||
/// Получение значение с контрола
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected abstract object GetValueFromControl();
|
||||
|
||||
/// <summary>
|
||||
/// Заполнение свойства объекта значением из контрола
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public void FillPropertyToObject(object obj)
|
||||
{
|
||||
if (obj != null && PropertyName.IsNotEmpty())
|
||||
{
|
||||
var property = obj.GetType().GetProperty(PropertyName);
|
||||
if (property != null)
|
||||
{
|
||||
property.SetValue(obj, GetValueFromControl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
58
DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.Designer.cs
generated
Normal file
58
DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
partial class BaseControlInt
|
||||
{
|
||||
/// <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;
|
||||
this.checkBoxNullable = new System.Windows.Forms.CheckBox();
|
||||
this.numericUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
//
|
||||
// checkBoxNullable
|
||||
//
|
||||
this.checkBoxNullable.AutoSize = true;
|
||||
this.checkBoxNullable.Location = new System.Drawing.Point(41, 14);
|
||||
this.checkBoxNullable.Name = "checkBoxNullable";
|
||||
this.checkBoxNullable.Size = new System.Drawing.Size(83, 19);
|
||||
this.checkBoxNullable.TabIndex = 1;
|
||||
this.checkBoxNullable.UseVisualStyleBackColor = true;
|
||||
this.checkBoxNullable.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
//
|
||||
// numericUpDown
|
||||
//
|
||||
this.numericUpDown.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.numericUpDown.Location = new System.Drawing.Point(148, 9);
|
||||
this.numericUpDown.Name = "numericUpDown";
|
||||
this.numericUpDown.Size = new System.Drawing.Size(120, 23);
|
||||
this.numericUpDown.TabIndex = 2;
|
||||
this.numericUpDown.Minimum = int.MinValue;
|
||||
this.numericUpDown.Maximum = int.MaxValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox checkBoxNullable;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
public partial class BaseControlInt : AbstractBaseControl
|
||||
{
|
||||
public BaseControlInt(string propertyName) : base(propertyName)
|
||||
{
|
||||
InitializeComponent();
|
||||
checkBoxNullable.Visible = false;
|
||||
panelControl.Controls.Add(checkBoxNullable);
|
||||
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
|
||||
{
|
||||
numericUpDown.Enabled = !(sender as CheckBox).Checked;
|
||||
CallOnValueChangeEvent();
|
||||
};
|
||||
|
||||
panelControl.Controls.Add(numericUpDown);
|
||||
numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
|
||||
_originalValue = 0;
|
||||
}
|
||||
|
||||
public override void SetReadOnly(bool readOnly)
|
||||
{
|
||||
numericUpDown.Enabled = !readOnly;
|
||||
checkBoxNullable.Enabled = !readOnly;
|
||||
}
|
||||
|
||||
public override void SetValueToControl(object value)
|
||||
{
|
||||
base.SetValueToControl(value);
|
||||
if (value != null)
|
||||
{
|
||||
numericUpDown.Value = Convert.ToInt32(value);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DropValue()
|
||||
{
|
||||
numericUpDown.Value = _originalValue != null ? Convert.ToInt32(_originalValue) : 0;
|
||||
}
|
||||
|
||||
public override bool CheckValue()
|
||||
{
|
||||
if (_mustCheckValue && checkBoxNullable.Checked)
|
||||
{
|
||||
BackColor = Color.OrangeRed;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override object GetValueFromControl()
|
||||
{
|
||||
if (_mustCheckValue && checkBoxNullable.Checked)
|
||||
{
|
||||
throw new ArgumentNullException($"Поле свойства '{labelTitle.Text}' должно быть заполнено");
|
||||
}
|
||||
return checkBoxNullable.Checked? null : Convert.ToInt32(numericUpDown.Value);
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
42
DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlText.Designer.cs
generated
Normal file
42
DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlText.Designer.cs
generated
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
partial class BaseControlText
|
||||
{
|
||||
/// <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.textBox = new System.Windows.Forms.TextBox();
|
||||
//
|
||||
// textBox
|
||||
//
|
||||
this.textBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.textBox.Name = "textBox";
|
||||
this.textBox.Size = new System.Drawing.Size(1000, 1000);
|
||||
this.textBox.TabIndex = 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
using ModuleTools.Extensions;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DesktopTools.BaseControls
|
||||
{
|
||||
public partial class BaseControlText : AbstractBaseControl
|
||||
{
|
||||
public BaseControlText(string propertyName) : base(propertyName)
|
||||
{
|
||||
InitializeComponent();
|
||||
panelControl.Controls.Add(textBox);
|
||||
textBox.TextChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
|
||||
_originalValue = string.Empty;
|
||||
}
|
||||
|
||||
public override void SetReadOnly(bool readOnly) => textBox.Enabled = !readOnly;
|
||||
|
||||
public override void SetValueToControl(object value)
|
||||
{
|
||||
base.SetValueToControl(value);
|
||||
textBox.Text = value.ToString();
|
||||
}
|
||||
|
||||
public override void DropValue() => textBox.Text = _originalValue.ToString();
|
||||
|
||||
public override bool CheckValue()
|
||||
{
|
||||
if(_mustCheckValue && textBox.Text.IsEmpty())
|
||||
{
|
||||
BackColor = Color.OrangeRed;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override object GetValueFromControl()
|
||||
{
|
||||
if (_mustCheckValue && textBox.Text.IsEmpty())
|
||||
{
|
||||
throw new ArgumentNullException($"Поле свойства '{labelTitle.Text}' должно быть заполнено");
|
||||
}
|
||||
return textBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
46
DepartmentPortal/Common/DesktopTools/Controls/BaseControlViewEntityElement.Designer.cs
generated
Normal file
46
DepartmentPortal/Common/DesktopTools/Controls/BaseControlViewEntityElement.Designer.cs
generated
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
namespace DesktopTools.Controls
|
||||
{
|
||||
partial class BaseControlViewEntityElement
|
||||
{
|
||||
/// <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();
|
||||
//
|
||||
// BaseControlViewEntityElement
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "BaseControlViewEntityElement";
|
||||
this.Size = new System.Drawing.Size(695, 578);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
using DesktopTools.Helpers;
|
||||
using ModuleTools.Enums;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.Controls
|
||||
{
|
||||
public partial class BaseControlViewEntityElement : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Признак налиичия изменений
|
||||
/// </summary>
|
||||
protected bool _haveChages = false;
|
||||
|
||||
/// <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()
|
||||
{
|
||||
if(_haveChages && DialogHelper.MessageQuestion("Имеется несохраненные данные, вы действительно хотите закрыть элемент?", "Закрытие элемента") ==
|
||||
DialogResult.Yes)
|
||||
{
|
||||
if (!Save())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
CloseEvent?.Invoke(ControlId);
|
||||
Form?.Close();
|
||||
Dispose();
|
||||
}
|
||||
|
||||
protected virtual bool Save() { return true; }
|
||||
|
||||
/// <summary>
|
||||
/// Дубликат контрола
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual BaseControlViewEntityElement Clone() { return null; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка флага, что есть изменения
|
||||
/// </summary>
|
||||
protected void ValueChange() => _haveChages = true;
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор контрола
|
||||
/// </summary>
|
||||
public Guid ControlId { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор элемента с которым идет раота при редактировании
|
||||
/// </summary>
|
||||
public Guid? ElementId { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор родителського элемента
|
||||
/// </summary>
|
||||
public Guid? ParentEleemtId { 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 Form Form { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Констркутор
|
||||
/// </summary>
|
||||
public BaseControlViewEntityElement()
|
||||
{
|
||||
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>
|
@ -26,7 +26,7 @@ namespace DesktopTools.Controls
|
||||
/// </summary>
|
||||
public virtual void Close()
|
||||
{
|
||||
CloseEvent?.Invoke(Id);
|
||||
CloseEvent?.Invoke(ControlId);
|
||||
Dispose();
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ namespace DesktopTools.Controls
|
||||
/// <summary>
|
||||
/// Идентификатор контрола
|
||||
/// </summary>
|
||||
public Guid Id { get; protected set; }
|
||||
public Guid ControlId { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Заголовок контрола
|
||||
|
107
DepartmentPortal/Common/DesktopTools/Controls/GenericControlEntityElement.Designer.cs
generated
Normal file
107
DepartmentPortal/Common/DesktopTools/Controls/GenericControlEntityElement.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
namespace DesktopTools.Controls
|
||||
{
|
||||
partial class GenericControlEntityElement<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.toolStripActions = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButtonSave = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButtonReload = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButtonClose = new System.Windows.Forms.ToolStripButton();
|
||||
this.panelContainer = new System.Windows.Forms.Panel();
|
||||
this.toolStripActions.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// toolStripActions
|
||||
//
|
||||
this.toolStripActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripButtonSave,
|
||||
this.toolStripButtonReload,
|
||||
this.toolStripButtonClose});
|
||||
this.toolStripActions.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripActions.Name = "toolStripActions";
|
||||
this.toolStripActions.Size = new System.Drawing.Size(594, 25);
|
||||
this.toolStripActions.TabIndex = 0;
|
||||
this.toolStripActions.Text = "toolStrip1";
|
||||
//
|
||||
// toolStripButtonSave
|
||||
//
|
||||
this.toolStripButtonSave.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.toolStripButtonSave.Image = global::DesktopTools.Properties.Resources.Save;
|
||||
this.toolStripButtonSave.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonSave.Name = "toolStripButtonSave";
|
||||
this.toolStripButtonSave.Size = new System.Drawing.Size(23, 22);
|
||||
this.toolStripButtonSave.Text = "Сохранить";
|
||||
//
|
||||
// toolStripButtonReload
|
||||
//
|
||||
this.toolStripButtonReload.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.toolStripButtonReload.Image = global::DesktopTools.Properties.Resources.Reload;
|
||||
this.toolStripButtonReload.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonReload.Name = "toolStripButtonReload";
|
||||
this.toolStripButtonReload.Size = new System.Drawing.Size(23, 22);
|
||||
this.toolStripButtonReload.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 = "Закрыть";
|
||||
//
|
||||
// panelContainer
|
||||
//
|
||||
this.panelContainer.AutoScroll = true;
|
||||
this.panelContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelContainer.Location = new System.Drawing.Point(0, 25);
|
||||
this.panelContainer.Name = "panelContainer";
|
||||
this.panelContainer.Size = new System.Drawing.Size(594, 485);
|
||||
this.panelContainer.TabIndex = 1;
|
||||
//
|
||||
// GenericControlEntityElement
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panelContainer);
|
||||
this.Controls.Add(this.toolStripActions);
|
||||
this.Name = "GenericControlEntityElement";
|
||||
this.Size = new System.Drawing.Size(594, 510);
|
||||
this.toolStripActions.ResumeLayout(false);
|
||||
this.toolStripActions.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolStrip toolStripActions;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonSave;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonReload;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonClose;
|
||||
private System.Windows.Forms.Panel panelContainer;
|
||||
}
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
using DesktopTools.BaseControls;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.BusinessLogics;
|
||||
using ModuleTools.ViewModels;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.Controls
|
||||
{
|
||||
public partial class GenericControlEntityElement<G, S, L, E, BL> : BaseControlViewEntityElement
|
||||
where G : GetBindingModel, new()
|
||||
where S : SetBindingModel, new()
|
||||
where L : ListViewModel<E>
|
||||
where E : ElementViewModel
|
||||
where BL : GenericBusinessLogic<G, S, L, E>
|
||||
{
|
||||
/// <summary>
|
||||
/// Объект бизнес-логики для получения данных
|
||||
/// </summary>
|
||||
private readonly BL _businessLogic;
|
||||
|
||||
private event Action<int> SetTitleWidth;
|
||||
|
||||
private event Action DropValues;
|
||||
|
||||
private event Func<bool> CheckValues;
|
||||
|
||||
private event Action<object> GetValues;
|
||||
private E Element { get; set; }
|
||||
|
||||
public GenericControlEntityElement(Guid? id)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitEvents();
|
||||
_businessLogic = DependencyManager.Instance.Resolve<BL>();
|
||||
Element = _businessLogic.GetElement(new G { Id = id });
|
||||
}
|
||||
|
||||
|
||||
public override void Open()
|
||||
{
|
||||
base.Open();
|
||||
if (panelContainer.Controls.Count == 0)
|
||||
{
|
||||
Configurate();
|
||||
}
|
||||
//LoadList();
|
||||
}
|
||||
|
||||
private void InitEvents()
|
||||
{
|
||||
toolStripButtonSave.Click += (object sender, EventArgs e) => { Save(); };
|
||||
toolStripButtonReload.Click += (object sender, EventArgs e) => { DropValues?.Invoke(); };
|
||||
toolStripButtonClose.Click += (object sender, EventArgs e) => { Close(); };
|
||||
}
|
||||
|
||||
private void Configurate()
|
||||
{
|
||||
int positionY = 5;
|
||||
int positionX = 5;
|
||||
int interval = 15;
|
||||
|
||||
int titleWidth = 0;
|
||||
|
||||
foreach (var property in typeof(E).GetProperties())
|
||||
{
|
||||
var attribute = property.GetCustomAttribute<ViewModelOnElementPropertyAttribute>();
|
||||
if (attribute != null)
|
||||
{
|
||||
AbstractBaseControl control = null;
|
||||
switch (property.PropertyType.Name.ToLower())
|
||||
{
|
||||
case "string":
|
||||
control = new BaseControlText(property.Name);
|
||||
break;
|
||||
case "int32":
|
||||
control = new BaseControlInt(property.Name);
|
||||
break;
|
||||
}
|
||||
if (control == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Element != null)
|
||||
{
|
||||
control.SetValueToControl(property.GetValue(Element));
|
||||
}
|
||||
|
||||
var widthTitle = control.SetTitle(attribute.DisplayName);
|
||||
if (widthTitle > titleWidth)
|
||||
{
|
||||
titleWidth = widthTitle;
|
||||
}
|
||||
|
||||
control.OnValueChangeEvent += ValueChange;
|
||||
DropValues += control.DropValue;
|
||||
CheckValues += control.CheckValue;
|
||||
SetTitleWidth += control.SetTitleWidth;
|
||||
GetValues += control.FillPropertyToObject;
|
||||
|
||||
control.Location = new System.Drawing.Point(positionX, positionY);
|
||||
control.Width = Width - positionX * 2;
|
||||
control.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left;
|
||||
positionY += control.Height + interval;
|
||||
|
||||
control.SetReadOnly(attribute.ReadOnly);
|
||||
control.SetMustCheckValue(attribute.MustHaveValue);
|
||||
|
||||
panelContainer.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
|
||||
SetTitleWidth(titleWidth);
|
||||
}
|
||||
|
||||
protected override bool Save()
|
||||
{
|
||||
if (CheckValues.GetInvocationList().Select(x => (bool)x.DynamicInvoke()).ToList().Any(x => !x))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var model = Element == null ? new S() : Mapper.MapToClass<E, S>(Element, true);
|
||||
GetValues(model);
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
if (Element == null)
|
||||
{
|
||||
Element = _businessLogic.Create(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
Element = _businessLogic.Update(model);
|
||||
}
|
||||
|
||||
if (Element == null)
|
||||
{
|
||||
throw new Exception($"Ошибка при сохранении: {_businessLogic.Errors.LastOrDefault().Message}");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -6,15 +6,17 @@ using ModuleTools.Extensions;
|
||||
using ModuleTools.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.Controls
|
||||
{
|
||||
public partial class GenericControlEntityList<G, S, L, E, BL> : BaseControlViewEntityList
|
||||
where G : GetBindingModel
|
||||
where S : SetBindingModel
|
||||
where L: ListViewModel<E>
|
||||
where G : GetBindingModel, new()
|
||||
where S : SetBindingModel, new()
|
||||
where L : ListViewModel<E>
|
||||
where E : ElementViewModel
|
||||
where BL : GenericBusinessLogic<G, S, L, E>
|
||||
{
|
||||
@ -33,14 +35,14 @@ namespace DesktopTools.Controls
|
||||
_businessLogic = DependencyManager.Instance.Resolve<BL>();
|
||||
}
|
||||
|
||||
public override void Open()
|
||||
public override async void Open()
|
||||
{
|
||||
base.Open();
|
||||
if (dataGridViewList.Columns.Count == 0)
|
||||
{
|
||||
Configurate(GetConfig());
|
||||
}
|
||||
LoadList();
|
||||
await LoadListAsync();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
@ -54,7 +56,7 @@ namespace DesktopTools.Controls
|
||||
/// <param name="model">Настройки</param>
|
||||
private void Configurate(ControlViewEntityListConfiguration config)
|
||||
{
|
||||
if(config == null)
|
||||
if (config == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -66,7 +68,8 @@ namespace DesktopTools.Controls
|
||||
var attr = property.GetCustomAttribute<ViewModelOnListPropertyAttribute>();
|
||||
if (attr != null)
|
||||
{
|
||||
dataGridViewList.Columns.Add(new DataGridViewTextBoxColumn
|
||||
var colIndex = attr.DisplayName == "Идентификатор" ? 0 : dataGridViewList.Columns.Count;
|
||||
dataGridViewList.Columns.Insert(colIndex, new DataGridViewTextBoxColumn
|
||||
{
|
||||
HeaderText = attr.DisplayName,
|
||||
Name = string.Format("Column{0}", property.Name),
|
||||
@ -158,10 +161,10 @@ namespace DesktopTools.Controls
|
||||
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(); };
|
||||
toolStripButtonRef.Click += async (object sender, EventArgs e) => { await LoadListAsync(); };
|
||||
toolStripButtonClose.Click += (object sender, EventArgs e) => { Close(); };
|
||||
|
||||
buttonSearch.Click += (object sender, EventArgs e) => { LoadList(); };
|
||||
buttonSearch.Click += async (object sender, EventArgs e) => { await LoadListAsync(); };
|
||||
buttonCancelSearch.Click += (object sender, EventArgs e) => { panelSearch.Visible = false; };
|
||||
|
||||
dataGridViewList.KeyDown += (object sender, KeyEventArgs e) =>
|
||||
@ -184,37 +187,37 @@ namespace DesktopTools.Controls
|
||||
CallUpdElementEvent();
|
||||
};
|
||||
|
||||
toolStripButtonPrev.Click += (object sender, EventArgs e) =>
|
||||
toolStripButtonPrev.Click += async (object sender, EventArgs e) =>
|
||||
{
|
||||
if (int.TryParse(toolStripTextBoxPage.Text, out int page))
|
||||
{
|
||||
toolStripTextBoxPage.Text = (page - 1).ToString();
|
||||
LoadList();
|
||||
await LoadListAsync();
|
||||
}
|
||||
};
|
||||
toolStripButtonNext.Click += (object sender, EventArgs e) =>
|
||||
toolStripButtonNext.Click += async (object sender, EventArgs e) =>
|
||||
{
|
||||
if (int.TryParse(toolStripTextBoxPage.Text, out int page))
|
||||
{
|
||||
toolStripTextBoxPage.Text = (page + 1).ToString();
|
||||
LoadList();
|
||||
await LoadListAsync();
|
||||
}
|
||||
};
|
||||
toolStripTextBoxPage.KeyDown += (object sender, KeyEventArgs e) =>
|
||||
toolStripTextBoxPage.KeyDown += async (object sender, KeyEventArgs e) =>
|
||||
{
|
||||
if (e.KeyData == Keys.Enter)
|
||||
{
|
||||
LoadList();
|
||||
await LoadListAsync();
|
||||
}
|
||||
};
|
||||
|
||||
toolStripComboBoxPageNames.SelectedIndexChanged += (object sender, EventArgs e) => { LoadList(); };
|
||||
toolStripComboBoxPageNames.SelectedIndexChanged += async (object sender, EventArgs e) => { await LoadListAsync(); };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вызов события загрузки данных на datagrid
|
||||
/// </summary>
|
||||
private void LoadList()
|
||||
private async Task LoadListAsync()
|
||||
{
|
||||
var cursor = Cursor.Current;
|
||||
L data = null;
|
||||
@ -229,7 +232,7 @@ namespace DesktopTools.Controls
|
||||
{
|
||||
if (int.TryParse(toolStripTextBoxPage.Text, out int page) && int.TryParse(toolStripTextBoxPage.Tag.ToString(), out int count))
|
||||
{
|
||||
data = GetDataWithPageNumber(page, count);
|
||||
await Task.Run(() => data = GetDataWithPageNumber(page, count));
|
||||
}
|
||||
}
|
||||
// поименная
|
||||
@ -238,13 +241,13 @@ namespace DesktopTools.Controls
|
||||
var key = toolStripComboBoxPageNames.Text;
|
||||
if (key.IsNotEmpty())
|
||||
{
|
||||
data = GetDataWithPageName(key);
|
||||
await Task.Run(() => data = GetDataWithPageName(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = GetData();
|
||||
await Task.Run(() => data = GetData());
|
||||
}
|
||||
|
||||
if (data == null)
|
||||
@ -254,7 +257,7 @@ namespace DesktopTools.Controls
|
||||
}
|
||||
|
||||
toolStripLabelCountPages.Text = $"из {data.MaxCount}";
|
||||
FillDataOnGrid(data.List);
|
||||
FillDataOnGridAsync(data.List);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -266,7 +269,7 @@ namespace DesktopTools.Controls
|
||||
/// Заполнение таблицы
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
private void FillDataOnGrid(List<E> data)
|
||||
private void FillDataOnGridAsync(List<E> data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
@ -288,7 +291,7 @@ namespace DesktopTools.Controls
|
||||
/// <summary>
|
||||
/// Вызов события при добавлении элемента
|
||||
/// </summary>
|
||||
private void CallAddElementEvent() => AddElement();
|
||||
private void CallAddElementEvent() => LaunchControl(null);
|
||||
|
||||
/// <summary>
|
||||
/// Вызов события при изменении элемента
|
||||
@ -297,8 +300,7 @@ namespace DesktopTools.Controls
|
||||
{
|
||||
foreach (DataGridViewRow selected in dataGridViewList.SelectedRows)
|
||||
{
|
||||
var id = new Guid(selected.Cells[0].Value.ToString());
|
||||
UpdElement(id);
|
||||
LaunchControl(new Guid(selected.Cells[0].Value.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,21 +311,60 @@ namespace DesktopTools.Controls
|
||||
{
|
||||
if (MessageBox.Show("Удалить выбранные записи?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
var cursor = Cursor.Current;
|
||||
try
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
foreach (DataGridViewRow selected in dataGridViewList.SelectedRows)
|
||||
{
|
||||
var id = new Guid(selected.Cells[0].Value.ToString());
|
||||
DelElement(id);
|
||||
_businessLogic.Delete(new G { Id = new Guid(selected.Cells[0].Value.ToString()) });
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_businessLogic.Errors.Count != 0)
|
||||
{
|
||||
MessageBox.Show(_businessLogic.Errors.LastOrDefault().Message ?? ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Cursor.Current = cursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void AddElement() { }
|
||||
/// <summary>
|
||||
/// Создание формы с контролом для работы с элементом
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
private void LaunchControl(Guid? id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var control = new GenericControlEntityElement<G, S, L, E, BL>(id);
|
||||
control.Open();
|
||||
var form = new Form
|
||||
{
|
||||
Height = control.Height,
|
||||
Width = control.Width,
|
||||
Text = $"{Title}. Добавление",
|
||||
StartPosition = FormStartPosition.CenterParent,
|
||||
ControlBox = false
|
||||
};
|
||||
form.Controls.Add(control);
|
||||
control.Dock = DockStyle.Fill;
|
||||
control.Form = form;
|
||||
form.Show();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdElement(Guid id) { }
|
||||
|
||||
protected virtual void DelElement(Guid id) { }
|
||||
|
||||
protected virtual ControlViewEntityListConfiguration GetConfig() { return null; }
|
||||
protected virtual ControlViewEntityListConfiguration GetConfig() => new();
|
||||
|
||||
protected virtual L GetData() { return null; }
|
||||
|
||||
|
15
DepartmentPortal/Common/DesktopTools/Helpers/DialogHelper.cs
Normal file
15
DepartmentPortal/Common/DesktopTools/Helpers/DialogHelper.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopTools.Helpers
|
||||
{
|
||||
public static class DialogHelper
|
||||
{
|
||||
public static DialogResult MessageQuestion(string message, string title) =>
|
||||
MessageBox.Show(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
}
|
||||
}
|
@ -130,6 +130,16 @@ namespace DesktopTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap Reload {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Reload", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -140,6 +150,16 @@ namespace DesktopTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap Save {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Save", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -112,43 +112,49 @@
|
||||
<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>
|
||||
<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=5.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>
|
||||
<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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<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="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>
|
||||
<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="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="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 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="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="Save" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Save.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="Reload" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Reload.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
DepartmentPortal/Common/DesktopTools/Resources/Reload.png
Normal file
BIN
DepartmentPortal/Common/DesktopTools/Resources/Reload.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
DepartmentPortal/Common/DesktopTools/Resources/Save.png
Normal file
BIN
DepartmentPortal/Common/DesktopTools/Resources/Save.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
@ -19,24 +19,20 @@ namespace ModuleTools.Attributes
|
||||
/// <summary>
|
||||
/// Сложное свойство (свойствое в другом классе-свойстве)
|
||||
/// </summary>
|
||||
public bool IsDifficle { get; set; }
|
||||
public bool IsDifficle { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Можно копировать поле даже при доступе без прав
|
||||
/// </summary>
|
||||
public bool AllowCopyWithoutRigth { get; set; }
|
||||
public bool AllowCopyWithoutRigth { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Настройка для полей сущности правил маппинга
|
||||
/// </summary>
|
||||
/// <param name="propertyNameFromMModel">Название свойства с класса, из которого извлекаем данные</param>
|
||||
/// <param name="isDifficle">Сложное свойство (свойствое в другом классе-свойстве)</param>
|
||||
/// <param name="allowCopyWithoutRigth">Можно копировать поле даже при доступе без прав</param>
|
||||
public MapConfigurationAttribute(string propertyNameFromMModel, bool isDifficle = false, bool allowCopyWithoutRigth = true)
|
||||
public MapConfigurationAttribute(string propertyNameFromMModel)
|
||||
{
|
||||
PropertyNameFromModel = propertyNameFromMModel;
|
||||
IsDifficle = isDifficle;
|
||||
AllowCopyWithoutRigth = allowCopyWithoutRigth;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
|
||||
namespace ModuleTools.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Настройка отображения свойства класса при выводе объекта класса (требуется для автоматизации вывода элемента,
|
||||
/// применяется к классам ElementViewModel)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ViewModelOnElementPropertyAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Название на форме
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Поле должно быть обязательно заполнено
|
||||
/// </summary>
|
||||
public bool MustHaveValue { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Запрет на редактирование, только вывод
|
||||
/// </summary>
|
||||
public bool ReadOnly { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина
|
||||
/// </summary>
|
||||
public int? Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Высота
|
||||
/// </summary>
|
||||
public int? Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="displayName">Название на форме</param>
|
||||
public ViewModelOnElementPropertyAttribute(string displayName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="displayName">Название на форме</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
public ViewModelOnElementPropertyAttribute(string displayName, int width, int height)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,27 +17,24 @@ namespace ModuleTools.Attributes
|
||||
/// <summary>
|
||||
/// Скрывать или нет при выводе списка
|
||||
/// </summary>
|
||||
public bool IsHide { get; set; }
|
||||
public bool IsHide { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина колонки
|
||||
/// </summary>
|
||||
public int? ColumnWidth { get; set; }
|
||||
public int? ColumnWidth { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Настройка отображения элемента в контролах
|
||||
/// </summary>
|
||||
/// <param name="displayName">Название на форме</param>
|
||||
/// <param name="isHide">Скрывать или нет</param>
|
||||
public ViewModelOnListPropertyAttribute(string displayName, bool isHide = false)
|
||||
public ViewModelOnListPropertyAttribute(string displayName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
ColumnWidth = null;
|
||||
IsHide = isHide;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// Настройка отображения элемента в контролах
|
||||
/// </summary>
|
||||
/// <param name="displayName">Название на форме</param>
|
||||
/// <param name="columnWidth">Ширина колонки</param>
|
||||
@ -45,7 +42,6 @@ namespace ModuleTools.Attributes
|
||||
{
|
||||
DisplayName = displayName;
|
||||
ColumnWidth = columnWidth;
|
||||
IsHide = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ModuleTools.Attributes;
|
||||
using System;
|
||||
|
||||
namespace ModuleTools.BindingModels
|
||||
{
|
||||
@ -10,6 +11,7 @@ namespace ModuleTools.BindingModels
|
||||
/// <summary>
|
||||
/// Идентификатор записи
|
||||
/// </summary>
|
||||
[MapConfiguration("Id")]
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
}
|
@ -70,11 +70,11 @@ namespace ModuleTools.BusinessLogics
|
||||
{
|
||||
if (Security.CheckAccess(new SecurityManagerCheckAccessModel(model, _serviceOperation, type, _entity)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Errors.Add(("Ошибка безопасности", Security.ErrorMessage));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение списка записей
|
||||
@ -86,7 +86,7 @@ namespace ModuleTools.BusinessLogics
|
||||
Errors.Clear();
|
||||
try
|
||||
{
|
||||
model.HaveRight = NoAccess(model, AccessType.View);
|
||||
model.HaveRight = !NoAccess(model, AccessType.View);
|
||||
if (model.HaveRight && !_allowSimpleView)
|
||||
{
|
||||
throw new MethodAccessException("Нет прав на получение списка");
|
||||
@ -117,7 +117,7 @@ namespace ModuleTools.BusinessLogics
|
||||
Errors.Clear();
|
||||
try
|
||||
{
|
||||
model.HaveRight = NoAccess(model, AccessType.View);
|
||||
model.HaveRight = !NoAccess(model, AccessType.View);
|
||||
if (model.HaveRight && !_allowSimpleView)
|
||||
{
|
||||
throw new MethodAccessException("Нет прав на получение списка");
|
||||
|
@ -8,7 +8,7 @@ namespace ModuleTools.ViewModels
|
||||
/// </summary>
|
||||
public class ElementViewModel
|
||||
{
|
||||
[ViewModelOnListProperty("Идентификатор", isHide: true)]
|
||||
[ViewModelOnListProperty("Идентификатор", IsHide = true)]
|
||||
[MapConfiguration("Id")]
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ namespace DepartmentPortalDesctop
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(242, 23);
|
||||
this.textBoxPassword.TabIndex = 3;
|
||||
this.textBoxPassword.UseSystemPasswordChar = true;
|
||||
this.textBoxPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxPassword_KeyDown);
|
||||
//
|
||||
// buttonEnter
|
||||
//
|
||||
@ -91,6 +90,7 @@ namespace DepartmentPortalDesctop
|
||||
//
|
||||
// FormEnter
|
||||
//
|
||||
this.AcceptButton = this.buttonEnter;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(324, 131);
|
||||
|
@ -18,7 +18,7 @@ namespace DepartmentPortalDesctop
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Login()
|
||||
private void ButtonEnter_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBoxLogin.Text.IsEmpty())
|
||||
{
|
||||
@ -40,15 +40,5 @@ namespace DepartmentPortalDesctop
|
||||
ErrorMessanger.PrintErrorMessage("При аутентфикации возникла ошибка: ", new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("Аутентфикация", ex.Message) });
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonEnter_Click(object sender, EventArgs e) => Login();
|
||||
|
||||
private void TextBoxPassword_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
Login();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,16 +66,16 @@ namespace DepartmentPortalDesctop
|
||||
}
|
||||
|
||||
var ctrl = _baseControls[id].Clone();
|
||||
if (!_controls.ContainsKey(ctrl.Id))
|
||||
if (!_controls.ContainsKey(ctrl.ControlId))
|
||||
{
|
||||
ctrl.CloseEventAdd += CloseControl;
|
||||
ctrl.Dock = DockStyle.Fill;
|
||||
ctrl.Open();
|
||||
_controls.Add(ctrl.Id, ctrl);
|
||||
_controls.Add(ctrl.ControlId, ctrl);
|
||||
|
||||
splitContainerMain.Panel1.Controls.Clear();
|
||||
splitContainerMain.Panel1.Controls.Add(ctrl);
|
||||
dataGridViewControls.Rows.Add(new object[] { ctrl.Id, ctrl.Title });
|
||||
dataGridViewControls.Rows.Add(new object[] { ctrl.ControlId, ctrl.Title });
|
||||
dataGridViewControls.Rows[^1].Selected = true;
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ namespace DepartmentPortalDesctop
|
||||
}
|
||||
for (int i = 0; i < dataGridViewControls.Rows.Count; ++i)
|
||||
{
|
||||
if (dataGridViewControls.Rows[i].Cells[0].Value.ToString() == ctrl.Id.ToString())
|
||||
if (dataGridViewControls.Rows[i].Cells[0].Value.ToString() == ctrl.ControlId.ToString())
|
||||
{
|
||||
dataGridViewControls.Rows.RemoveAt(i);
|
||||
if (i < dataGridViewControls.Rows.Count - 1)
|
||||
@ -113,7 +113,7 @@ namespace DepartmentPortalDesctop
|
||||
break;
|
||||
}
|
||||
}
|
||||
_controls.Remove(ctrl.Id);
|
||||
_controls.Remove(ctrl.ControlId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.Enums;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@ -23,11 +24,14 @@ namespace SecurityBusinessLogic.BindingModels
|
||||
/// </summary>
|
||||
public class AccessSetBindingModel : SetBindingModel
|
||||
{
|
||||
[MapConfiguration("RoleId")]
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
public AccessOperation Operation { get; set; }
|
||||
[MapConfiguration("AccessOperation")]
|
||||
public AccessOperation AccessOperation { get; set; }
|
||||
|
||||
[MapConfiguration("AccessType")]
|
||||
public AccessType AccessType { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SecurityBusinessLogic.BindingModels
|
||||
@ -17,12 +18,15 @@ namespace SecurityBusinessLogic.BindingModels
|
||||
public class EnviromentSettingSetBindingModel : SetBindingModel
|
||||
{
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Description")]
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SecurityBusinessLogic.BindingModels
|
||||
@ -14,9 +15,11 @@ namespace SecurityBusinessLogic.BindingModels
|
||||
public class RoleSetBindingModel : SetBindingModel
|
||||
{
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("RoleName")]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("RolePriority")]
|
||||
public int RolePriority { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using ModuleTools.BindingModels;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SecurityBusinessLogic.BindingModels
|
||||
@ -18,25 +18,34 @@ namespace SecurityBusinessLogic.BindingModels
|
||||
public class UserSetBindingModel : SetBindingModel
|
||||
{
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Login")]
|
||||
public string Login { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[MapConfiguration("StudentId")]
|
||||
public Guid? StudentId { get; set; }
|
||||
|
||||
[MapConfiguration("LecturerId")]
|
||||
public Guid? LecturerId { get; set; }
|
||||
|
||||
[MapConfiguration("EmployeeId")]
|
||||
public Guid? EmployeeId { get; set; }
|
||||
|
||||
[MapConfiguration("Avatar")]
|
||||
public byte[] Avatar { get; set; }
|
||||
|
||||
[MapConfiguration("DateLastVisit")]
|
||||
public DateTime? DateLastVisit { get; set; }
|
||||
|
||||
[MapConfiguration("IsBanned")]
|
||||
public bool IsBanned { get; set; }
|
||||
|
||||
[MapConfiguration("DateBanned")]
|
||||
public DateTime? DateBanned { get; set; }
|
||||
|
||||
[MapConfiguration("CountAttempt")]
|
||||
public int CountAttempt { get; set; }
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[ViewModelOnListProperty("Роль", 100)]
|
||||
[MapConfiguration("Role.RoleName", true, AllowCopyWithoutRigth = false)]
|
||||
[MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)]
|
||||
|
@ -14,14 +14,17 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
public class EnviromentSettingViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelOnListProperty("Ключ")]
|
||||
[ViewModelOnElementProperty("Ключ", MustHaveValue = true, ReadOnly = true)]
|
||||
[MapConfiguration("Key", AllowCopyWithoutRigth = false)]
|
||||
public string Key { get; set; }
|
||||
|
||||
[ViewModelOnListProperty("Значение")]
|
||||
[ViewModelOnElementProperty("Значение", MustHaveValue = true)]
|
||||
[MapConfiguration("Value", AllowCopyWithoutRigth = false)]
|
||||
public string Value { get; set; }
|
||||
|
||||
[ViewModelOnListProperty("Описание")]
|
||||
[ViewModelOnElementProperty("Описание")]
|
||||
[MapConfiguration("Description", AllowCopyWithoutRigth = false)]
|
||||
public string Description { get; set; }
|
||||
|
||||
|
@ -14,10 +14,12 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
public class RoleViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelOnListProperty("Название роли")]
|
||||
[ViewModelOnElementProperty("Название роли")]
|
||||
[MapConfiguration("RoleName")]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[ViewModelOnListProperty("Приоритет", 100)]
|
||||
[ViewModelOnElementProperty("Приоритет")]
|
||||
[MapConfiguration("RolePriority")]
|
||||
public int RolePriority { get; set; }
|
||||
|
||||
|
@ -15,9 +15,13 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
public class UserViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelOnListProperty("Пользователь")]
|
||||
[ViewModelOnElementProperty("Логин")]
|
||||
[MapConfiguration("UserName")]
|
||||
public string Login { get; set; }
|
||||
|
||||
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[MapConfiguration("StudentId")]
|
||||
public Guid? StudentId { get; set; }
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace SecurityImplementation.SecurityDatabaseImplementation
|
||||
{
|
||||
using var context = DatabaseManager.GetContext;
|
||||
|
||||
var exsistEntity = context.Accesses.FirstOrDefault(x => x.AccessOperation == model.Operation && x.RoleId == model.RoleId && x.AccessType == model.AccessType);
|
||||
var exsistEntity = context.Accesses.FirstOrDefault(x => x.AccessOperation == model.AccessOperation && x.RoleId == model.RoleId && x.AccessType == model.AccessType);
|
||||
if (exsistEntity == null)
|
||||
{
|
||||
var entity = Mapper.MapToClass<AccessSetBindingModel, Access>(model, true);
|
||||
|
@ -20,12 +20,12 @@ namespace SecurityWindowsDesktop.Controls
|
||||
InitializeComponent();
|
||||
_roleBusinessLogic = DependencyManager.Instance.Resolve<RoleBusinessLogic>();
|
||||
Title = "Доступы";
|
||||
Id = new Guid("6eebc4c4-cb86-4368-93e0-33dbdbb7409a");
|
||||
ControlId = new Guid("6eebc4c4-cb86-4368-93e0-33dbdbb7409a");
|
||||
Order = 1;
|
||||
AccessOperation = AccessOperation.Доступы;
|
||||
}
|
||||
|
||||
public override BaseControlViewEntityList Clone() => new AccessesControl() { Id = Guid.NewGuid() };
|
||||
public override BaseControlViewEntityList Clone() => new AccessesControl() { ControlId = Guid.NewGuid() };
|
||||
|
||||
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||
{
|
||||
|
@ -15,12 +15,12 @@ namespace SecurityWindowsDesktop.Controls
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Настройки Среды";
|
||||
Id = new Guid("b3865c23-b1db-475b-b95c-aa51edc60388");
|
||||
ControlId = new Guid("b3865c23-b1db-475b-b95c-aa51edc60388");
|
||||
Order = 1;
|
||||
AccessOperation = AccessOperation.НастройкиСреды;
|
||||
}
|
||||
|
||||
public override BaseControlViewEntityList Clone() => new EnviromentSettingControl() { Id = Guid.NewGuid() };
|
||||
public override BaseControlViewEntityList Clone() => new EnviromentSettingControl() { ControlId = Guid.NewGuid() };
|
||||
|
||||
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||
{
|
||||
|
@ -15,12 +15,12 @@ namespace SecurityWindowsDesktop.Controls
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Роли";
|
||||
Id = new Guid("6a33ce5c-e950-4294-9f75-2a0b35941bf7");
|
||||
ControlId = new Guid("6a33ce5c-e950-4294-9f75-2a0b35941bf7");
|
||||
Order = 1;
|
||||
AccessOperation = AccessOperation.Роли;
|
||||
}
|
||||
|
||||
public override BaseControlViewEntityList Clone() => new RolesControl() { Id = Guid.NewGuid() };
|
||||
public override BaseControlViewEntityList Clone() => new RolesControl() { ControlId = Guid.NewGuid() };
|
||||
|
||||
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||
{
|
||||
|
@ -15,12 +15,12 @@ namespace SecurityWindowsDesktop.Controls
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Пользователи";
|
||||
Id = new Guid("d5596997-d1f5-4e5e-b94b-6bdd6bca3452");
|
||||
ControlId = new Guid("d5596997-d1f5-4e5e-b94b-6bdd6bca3452");
|
||||
Order = 1;
|
||||
AccessOperation = AccessOperation.Пользователи;
|
||||
}
|
||||
|
||||
public override BaseControlViewEntityList Clone() => new UsersControl() { Id = Guid.NewGuid() };
|
||||
public override BaseControlViewEntityList Clone() => new UsersControl() { ControlId = Guid.NewGuid() };
|
||||
|
||||
protected override ControlViewEntityListConfiguration GetConfig() => new()
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace SecurityWindowsDesktop
|
||||
{
|
||||
list.Add(new WindowDesktopExtensionControlModel
|
||||
{
|
||||
Id = cntrl.Id,
|
||||
Id = cntrl.ControlId,
|
||||
Order = cntrl.Order,
|
||||
Title = cntrl.Title,
|
||||
Control = cntrl
|
||||
|
Loading…
Reference in New Issue
Block a user