新增角色管理功能,初步新增多语言版本功能,更新readme,v1.6.0
This commit is contained in:
@@ -14,7 +14,12 @@ namespace ClientsLibrary
|
||||
/*********************************************************************************
|
||||
*
|
||||
* 统一的账户登录模型
|
||||
*
|
||||
* 包含的功能有
|
||||
* 1、维护状态检查
|
||||
* 2、账户检查
|
||||
* 3、框架版本检查、
|
||||
* 4、系统版本号检查
|
||||
* 5、初始化数据
|
||||
*
|
||||
*********************************************************************************/
|
||||
|
||||
@@ -78,9 +83,11 @@ namespace ClientsLibrary
|
||||
// 延时
|
||||
Thread.Sleep(200);
|
||||
|
||||
//===================================================================================
|
||||
//=======================================================================================
|
||||
//
|
||||
// 根据实际情况校验,选择数据库校验或是将用户名密码发至服务器校验
|
||||
// 以下展示了服务器校验的方法,如您需要数据库校验,请删除下面并改成SQL访问验证的方式
|
||||
// 如果还有其他数据一并传到服务器进行验证的,都在下面进行数据包装
|
||||
|
||||
// 包装数据
|
||||
JObject json = new JObject
|
||||
@@ -146,6 +153,7 @@ namespace ClientsLibrary
|
||||
}
|
||||
else
|
||||
{
|
||||
// 超级管理员可以使用超前版本进行登录
|
||||
if (UserClient.CurrentVersion < sv)
|
||||
{
|
||||
// 保存新版本信息
|
||||
@@ -182,7 +190,7 @@ namespace ClientsLibrary
|
||||
{
|
||||
// 服务器返回初始化的数据,此处进行数据的提取,有可能包含了多个数据
|
||||
json = JObject.Parse(result.Content);
|
||||
// 例如公告数据
|
||||
// 例如公告数据和分厂数据
|
||||
UserClient.Announcement = SoftBasic.GetValueFromJsonObject(json, nameof(UserClient.Announcement), "");
|
||||
if (json[nameof(UserClient.SystemFactories)] != null)
|
||||
{
|
||||
|
||||
@@ -55,16 +55,16 @@
|
||||
this.textBox_UserName = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox_file_uploadTime = new System.Windows.Forms.TextBox();
|
||||
this.label_uploadTime = new System.Windows.Forms.Label();
|
||||
this.textBox_file_size = new System.Windows.Forms.TextBox();
|
||||
this.label_fileSize = new System.Windows.Forms.Label();
|
||||
this.textBox_file_name = new System.Windows.Forms.TextBox();
|
||||
this.label_fileName = new System.Windows.Forms.Label();
|
||||
this.userButton_delete = new HslCommunication.Controls.UserButton();
|
||||
this.userButton_download = new HslCommunication.Controls.UserButton();
|
||||
this.userButton_upload = new HslCommunication.Controls.UserButton();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.textBox_file_name = new System.Windows.Forms.TextBox();
|
||||
this.label_fileName = new System.Windows.Forms.Label();
|
||||
this.textBox_file_size = new System.Windows.Forms.TextBox();
|
||||
this.label_fileSize = new System.Windows.Forms.Label();
|
||||
this.textBox_file_uploadTime = new System.Windows.Forms.TextBox();
|
||||
this.label_uploadTime = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox_UserPortrait)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -109,7 +109,7 @@
|
||||
//
|
||||
this.pictureBox_UserPortrait.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pictureBox_UserPortrait.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.pictureBox_UserPortrait.Location = new System.Drawing.Point(112, 22);
|
||||
this.pictureBox_UserPortrait.Location = new System.Drawing.Point(153, 22);
|
||||
this.pictureBox_UserPortrait.Name = "pictureBox_UserPortrait";
|
||||
this.pictureBox_UserPortrait.Size = new System.Drawing.Size(136, 136);
|
||||
this.pictureBox_UserPortrait.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
@@ -129,10 +129,10 @@
|
||||
// textBox_LoginFailedCount
|
||||
//
|
||||
this.textBox_LoginFailedCount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LoginFailedCount.Location = new System.Drawing.Point(112, 459);
|
||||
this.textBox_LoginFailedCount.Location = new System.Drawing.Point(153, 459);
|
||||
this.textBox_LoginFailedCount.Name = "textBox_LoginFailedCount";
|
||||
this.textBox_LoginFailedCount.ReadOnly = true;
|
||||
this.textBox_LoginFailedCount.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LoginFailedCount.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LoginFailedCount.TabIndex = 21;
|
||||
//
|
||||
// label11
|
||||
@@ -147,10 +147,10 @@
|
||||
// textBox_LastLoginWay
|
||||
//
|
||||
this.textBox_LastLoginWay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LastLoginWay.Location = new System.Drawing.Point(112, 428);
|
||||
this.textBox_LastLoginWay.Location = new System.Drawing.Point(153, 428);
|
||||
this.textBox_LastLoginWay.Name = "textBox_LastLoginWay";
|
||||
this.textBox_LastLoginWay.ReadOnly = true;
|
||||
this.textBox_LastLoginWay.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LastLoginWay.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LastLoginWay.TabIndex = 19;
|
||||
//
|
||||
// label10
|
||||
@@ -165,10 +165,10 @@
|
||||
// textBox_LastLoginIpAddress
|
||||
//
|
||||
this.textBox_LastLoginIpAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LastLoginIpAddress.Location = new System.Drawing.Point(112, 398);
|
||||
this.textBox_LastLoginIpAddress.Location = new System.Drawing.Point(153, 398);
|
||||
this.textBox_LastLoginIpAddress.Name = "textBox_LastLoginIpAddress";
|
||||
this.textBox_LastLoginIpAddress.ReadOnly = true;
|
||||
this.textBox_LastLoginIpAddress.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LastLoginIpAddress.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LastLoginIpAddress.TabIndex = 17;
|
||||
//
|
||||
// label9
|
||||
@@ -183,10 +183,10 @@
|
||||
// textBox_LastLoginTime
|
||||
//
|
||||
this.textBox_LastLoginTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LastLoginTime.Location = new System.Drawing.Point(112, 368);
|
||||
this.textBox_LastLoginTime.Location = new System.Drawing.Point(153, 368);
|
||||
this.textBox_LastLoginTime.Name = "textBox_LastLoginTime";
|
||||
this.textBox_LastLoginTime.ReadOnly = true;
|
||||
this.textBox_LastLoginTime.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LastLoginTime.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LastLoginTime.TabIndex = 15;
|
||||
//
|
||||
// label8
|
||||
@@ -201,10 +201,10 @@
|
||||
// textBox_LoginFrequency
|
||||
//
|
||||
this.textBox_LoginFrequency.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LoginFrequency.Location = new System.Drawing.Point(112, 338);
|
||||
this.textBox_LoginFrequency.Location = new System.Drawing.Point(153, 338);
|
||||
this.textBox_LoginFrequency.Name = "textBox_LoginFrequency";
|
||||
this.textBox_LoginFrequency.ReadOnly = true;
|
||||
this.textBox_LoginFrequency.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LoginFrequency.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LoginFrequency.TabIndex = 13;
|
||||
//
|
||||
// label7
|
||||
@@ -219,10 +219,10 @@
|
||||
// textBox_LoginEnable
|
||||
//
|
||||
this.textBox_LoginEnable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_LoginEnable.Location = new System.Drawing.Point(112, 308);
|
||||
this.textBox_LoginEnable.Location = new System.Drawing.Point(153, 308);
|
||||
this.textBox_LoginEnable.Name = "textBox_LoginEnable";
|
||||
this.textBox_LoginEnable.ReadOnly = true;
|
||||
this.textBox_LoginEnable.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_LoginEnable.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_LoginEnable.TabIndex = 11;
|
||||
//
|
||||
// label6
|
||||
@@ -237,10 +237,10 @@
|
||||
// textBox_RegisterTime
|
||||
//
|
||||
this.textBox_RegisterTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_RegisterTime.Location = new System.Drawing.Point(112, 279);
|
||||
this.textBox_RegisterTime.Location = new System.Drawing.Point(153, 279);
|
||||
this.textBox_RegisterTime.Name = "textBox_RegisterTime";
|
||||
this.textBox_RegisterTime.ReadOnly = true;
|
||||
this.textBox_RegisterTime.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_RegisterTime.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_RegisterTime.TabIndex = 9;
|
||||
//
|
||||
// label5
|
||||
@@ -255,10 +255,10 @@
|
||||
// textBox_GradeDescription
|
||||
//
|
||||
this.textBox_GradeDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_GradeDescription.Location = new System.Drawing.Point(112, 251);
|
||||
this.textBox_GradeDescription.Location = new System.Drawing.Point(153, 251);
|
||||
this.textBox_GradeDescription.Name = "textBox_GradeDescription";
|
||||
this.textBox_GradeDescription.ReadOnly = true;
|
||||
this.textBox_GradeDescription.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_GradeDescription.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_GradeDescription.TabIndex = 7;
|
||||
//
|
||||
// label4
|
||||
@@ -273,10 +273,10 @@
|
||||
// textBox_Factory
|
||||
//
|
||||
this.textBox_Factory.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_Factory.Location = new System.Drawing.Point(112, 223);
|
||||
this.textBox_Factory.Location = new System.Drawing.Point(153, 223);
|
||||
this.textBox_Factory.Name = "textBox_Factory";
|
||||
this.textBox_Factory.ReadOnly = true;
|
||||
this.textBox_Factory.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_Factory.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_Factory.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
@@ -291,10 +291,10 @@
|
||||
// textBox_NameAlias
|
||||
//
|
||||
this.textBox_NameAlias.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_NameAlias.Location = new System.Drawing.Point(112, 194);
|
||||
this.textBox_NameAlias.Location = new System.Drawing.Point(153, 194);
|
||||
this.textBox_NameAlias.Name = "textBox_NameAlias";
|
||||
this.textBox_NameAlias.ReadOnly = true;
|
||||
this.textBox_NameAlias.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_NameAlias.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_NameAlias.TabIndex = 3;
|
||||
//
|
||||
// label2
|
||||
@@ -309,10 +309,10 @@
|
||||
// textBox_UserName
|
||||
//
|
||||
this.textBox_UserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_UserName.Location = new System.Drawing.Point(112, 164);
|
||||
this.textBox_UserName.Location = new System.Drawing.Point(153, 164);
|
||||
this.textBox_UserName.Name = "textBox_UserName";
|
||||
this.textBox_UserName.ReadOnly = true;
|
||||
this.textBox_UserName.Size = new System.Drawing.Size(177, 23);
|
||||
this.textBox_UserName.Size = new System.Drawing.Size(136, 23);
|
||||
this.textBox_UserName.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
@@ -345,6 +345,67 @@
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "个人文件,支持拖拽上传,双击下载";
|
||||
//
|
||||
// textBox_file_uploadTime
|
||||
//
|
||||
this.textBox_file_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox_file_uploadTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_uploadTime.Location = new System.Drawing.Point(252, 432);
|
||||
this.textBox_file_uploadTime.Name = "textBox_file_uploadTime";
|
||||
this.textBox_file_uploadTime.ReadOnly = true;
|
||||
this.textBox_file_uploadTime.Size = new System.Drawing.Size(111, 23);
|
||||
this.textBox_file_uploadTime.TabIndex = 16;
|
||||
//
|
||||
// label_uploadTime
|
||||
//
|
||||
this.label_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_uploadTime.AutoSize = true;
|
||||
this.label_uploadTime.Location = new System.Drawing.Point(182, 434);
|
||||
this.label_uploadTime.Name = "label_uploadTime";
|
||||
this.label_uploadTime.Size = new System.Drawing.Size(68, 17);
|
||||
this.label_uploadTime.TabIndex = 15;
|
||||
this.label_uploadTime.Text = "上传日期:";
|
||||
//
|
||||
// textBox_file_size
|
||||
//
|
||||
this.textBox_file_size.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox_file_size.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_size.Location = new System.Drawing.Point(66, 432);
|
||||
this.textBox_file_size.Name = "textBox_file_size";
|
||||
this.textBox_file_size.ReadOnly = true;
|
||||
this.textBox_file_size.Size = new System.Drawing.Size(110, 23);
|
||||
this.textBox_file_size.TabIndex = 14;
|
||||
//
|
||||
// label_fileSize
|
||||
//
|
||||
this.label_fileSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_fileSize.AutoSize = true;
|
||||
this.label_fileSize.Location = new System.Drawing.Point(7, 434);
|
||||
this.label_fileSize.Name = "label_fileSize";
|
||||
this.label_fileSize.Size = new System.Drawing.Size(44, 17);
|
||||
this.label_fileSize.TabIndex = 13;
|
||||
this.label_fileSize.Text = "大小:";
|
||||
//
|
||||
// textBox_file_name
|
||||
//
|
||||
this.textBox_file_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox_file_name.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_name.Location = new System.Drawing.Point(66, 405);
|
||||
this.textBox_file_name.Name = "textBox_file_name";
|
||||
this.textBox_file_name.ReadOnly = true;
|
||||
this.textBox_file_name.Size = new System.Drawing.Size(297, 23);
|
||||
this.textBox_file_name.TabIndex = 12;
|
||||
//
|
||||
// label_fileName
|
||||
//
|
||||
this.label_fileName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_fileName.AutoSize = true;
|
||||
this.label_fileName.Location = new System.Drawing.Point(7, 407);
|
||||
this.label_fileName.Name = "label_fileName";
|
||||
this.label_fileName.Size = new System.Drawing.Size(56, 17);
|
||||
this.label_fileName.TabIndex = 11;
|
||||
this.label_fileName.Text = "文件名:";
|
||||
//
|
||||
// userButton_delete
|
||||
//
|
||||
this.userButton_delete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
@@ -409,67 +470,6 @@
|
||||
this.treeView1.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView1_DragEnter);
|
||||
this.treeView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseDoubleClick);
|
||||
//
|
||||
// textBox_file_name
|
||||
//
|
||||
this.textBox_file_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox_file_name.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_name.Location = new System.Drawing.Point(66, 405);
|
||||
this.textBox_file_name.Name = "textBox_file_name";
|
||||
this.textBox_file_name.ReadOnly = true;
|
||||
this.textBox_file_name.Size = new System.Drawing.Size(297, 23);
|
||||
this.textBox_file_name.TabIndex = 12;
|
||||
//
|
||||
// label_fileName
|
||||
//
|
||||
this.label_fileName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_fileName.AutoSize = true;
|
||||
this.label_fileName.Location = new System.Drawing.Point(7, 407);
|
||||
this.label_fileName.Name = "label_fileName";
|
||||
this.label_fileName.Size = new System.Drawing.Size(56, 17);
|
||||
this.label_fileName.TabIndex = 11;
|
||||
this.label_fileName.Text = "文件名:";
|
||||
//
|
||||
// textBox_file_size
|
||||
//
|
||||
this.textBox_file_size.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox_file_size.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_size.Location = new System.Drawing.Point(66, 432);
|
||||
this.textBox_file_size.Name = "textBox_file_size";
|
||||
this.textBox_file_size.ReadOnly = true;
|
||||
this.textBox_file_size.Size = new System.Drawing.Size(110, 23);
|
||||
this.textBox_file_size.TabIndex = 14;
|
||||
//
|
||||
// label_fileSize
|
||||
//
|
||||
this.label_fileSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_fileSize.AutoSize = true;
|
||||
this.label_fileSize.Location = new System.Drawing.Point(7, 434);
|
||||
this.label_fileSize.Name = "label_fileSize";
|
||||
this.label_fileSize.Size = new System.Drawing.Size(44, 17);
|
||||
this.label_fileSize.TabIndex = 13;
|
||||
this.label_fileSize.Text = "大小:";
|
||||
//
|
||||
// textBox_file_uploadTime
|
||||
//
|
||||
this.textBox_file_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox_file_uploadTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox_file_uploadTime.Location = new System.Drawing.Point(252, 432);
|
||||
this.textBox_file_uploadTime.Name = "textBox_file_uploadTime";
|
||||
this.textBox_file_uploadTime.ReadOnly = true;
|
||||
this.textBox_file_uploadTime.Size = new System.Drawing.Size(111, 23);
|
||||
this.textBox_file_uploadTime.TabIndex = 16;
|
||||
//
|
||||
// label_uploadTime
|
||||
//
|
||||
this.label_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label_uploadTime.AutoSize = true;
|
||||
this.label_uploadTime.Location = new System.Drawing.Point(182, 434);
|
||||
this.label_uploadTime.Name = "label_uploadTime";
|
||||
this.label_uploadTime.Size = new System.Drawing.Size(68, 17);
|
||||
this.label_uploadTime.TabIndex = 15;
|
||||
this.label_uploadTime.Text = "上传日期:";
|
||||
//
|
||||
// FormAccountDetails
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
|
||||
@@ -52,6 +52,9 @@ namespace ClientsLibrary
|
||||
|
||||
// 加载文件列表
|
||||
DownloadUserFileNames();
|
||||
|
||||
// 本地化显示
|
||||
UILocalization();
|
||||
}
|
||||
|
||||
private void AccountDetails_Load(object sender, EventArgs e)
|
||||
@@ -66,6 +69,32 @@ namespace ClientsLibrary
|
||||
treeView1.Nodes[0].SelectedImageIndex = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Localization Support
|
||||
|
||||
/// <summary>
|
||||
/// 本地化显示的操作,还未完成
|
||||
/// </summary>
|
||||
private void UILocalization()
|
||||
{
|
||||
Text = UserLocalization.Localization.AccountDetails;
|
||||
groupBox1.Text = UserLocalization.Localization.AccountDetails;
|
||||
label12.Text = UserLocalization.Localization.AccountPortrait + ":";
|
||||
label1.Text = UserLocalization.Localization.AccountName + ":";
|
||||
label2.Text = UserLocalization.Localization.AccountAlias + ":";
|
||||
label3.Text = UserLocalization.Localization.AccountFactory + ":";
|
||||
label4.Text = UserLocalization.Localization.AccountGrade + ":";
|
||||
label5.Text = UserLocalization.Localization.AccountRegisterTime + ":";
|
||||
label6.Text = UserLocalization.Localization.AccountLoginEnable + ":";
|
||||
label7.Text = UserLocalization.Localization.AccountLoginFrequency + ":";
|
||||
label8.Text = UserLocalization.Localization.AccountLastLoginTime + ":";
|
||||
label9.Text = UserLocalization.Localization.AccountLastLoginIpAddress + ":";
|
||||
label10.Text = UserLocalization.Localization.AccountLastLoginWay + ":";
|
||||
label11.Text = UserLocalization.Localization.AccountLoginFailedCount + ":";
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Load Portrait
|
||||
|
||||
145
ClientsLibrary/AccountSupport/FormAccountSelect.Designer.cs
generated
Normal file
145
ClientsLibrary/AccountSupport/FormAccountSelect.Designer.cs
generated
Normal file
@@ -0,0 +1,145 @@
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
partial class FormAccountSelect
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.userButton_login = new HslCommunication.Controls.UserButton();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// userButton_login
|
||||
//
|
||||
this.userButton_login.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton_login.CustomerInformation = "";
|
||||
this.userButton_login.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton_login.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton_login.Location = new System.Drawing.Point(309, 442);
|
||||
this.userButton_login.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton_login.Name = "userButton_login";
|
||||
this.userButton_login.Size = new System.Drawing.Size(108, 27);
|
||||
this.userButton_login.TabIndex = 8;
|
||||
this.userButton_login.UIText = "确认";
|
||||
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = false;
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
||||
this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column1,
|
||||
this.Column2,
|
||||
this.Column3,
|
||||
this.Column4,
|
||||
this.Column5});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dataGridView1.MultiSelect = false;
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(721, 433);
|
||||
this.dataGridView1.TabIndex = 9;
|
||||
//
|
||||
// Column1
|
||||
//
|
||||
this.Column1.HeaderText = "选择";
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.Width = 70;
|
||||
//
|
||||
// Column2
|
||||
//
|
||||
this.Column2.HeaderText = "账户名";
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column2.ReadOnly = true;
|
||||
this.Column2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column3
|
||||
//
|
||||
this.Column3.HeaderText = "别名";
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.ReadOnly = true;
|
||||
this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column4
|
||||
//
|
||||
this.Column4.HeaderText = "分厂";
|
||||
this.Column4.Name = "Column4";
|
||||
this.Column4.ReadOnly = true;
|
||||
this.Column4.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column5
|
||||
//
|
||||
this.Column5.HeaderText = "注册时间";
|
||||
this.Column5.Name = "Column5";
|
||||
this.Column5.ReadOnly = true;
|
||||
this.Column5.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Column5.Width = 200;
|
||||
//
|
||||
// FormAccountSelect
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(721, 480);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.userButton_login);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormAccountSelect";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "账号选择";
|
||||
this.Load += new System.EventHandler(this.FormAccountSelect_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private HslCommunication.Controls.UserButton userButton_login;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
|
||||
}
|
||||
}
|
||||
144
ClientsLibrary/AccountSupport/FormAccountSelect.cs
Normal file
144
ClientsLibrary/AccountSupport/FormAccountSelect.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using CommonLibrary;
|
||||
using HslCommunication;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
public partial class FormAccountSelect : Form
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
|
||||
public FormAccountSelect(List<string> selected = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
m_selected = selected;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Form Load
|
||||
|
||||
|
||||
private void FormAccountSelect_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 初始化
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.获取账户, "");
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
List<UserAccount> accounts = JArray.Parse(result.Content).ToObject<List<UserAccount>>();
|
||||
// 添加到数据表
|
||||
|
||||
foreach (var m in accounts)
|
||||
{
|
||||
DataGridViewRow dgvr = dataGridView1.Rows[dataGridView1.Rows.Add()];
|
||||
if(m_selected != null)
|
||||
{
|
||||
if(m_selected.Contains(m.UserName))
|
||||
{
|
||||
dgvr.Cells[0].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
dgvr.Cells[1].Value = m.UserName;
|
||||
dgvr.Cells[2].Value = m.NameAlias;
|
||||
dgvr.Cells[3].Value = m.Factory;
|
||||
dgvr.Cells[4].Value = m.RegisterTime.ToString();
|
||||
dgvr.Tag = m;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请求服务器失败,请稍后重试!");
|
||||
|
||||
}
|
||||
|
||||
// 本地化
|
||||
UILocalization();
|
||||
|
||||
dataGridView1.RowsDefaultCellStyle.SelectionBackColor = dataGridView1.RowsDefaultCellStyle.BackColor;
|
||||
dataGridView1.RowsDefaultCellStyle.SelectionForeColor = dataGridView1.RowsDefaultCellStyle.ForeColor;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Localization Support
|
||||
|
||||
private void UILocalization()
|
||||
{
|
||||
|
||||
Text = UserLocalization.Localization.AccountSelect;
|
||||
Column1.HeaderText = UserLocalization.Localization.AccountSelect;
|
||||
Column2.HeaderText = UserLocalization.Localization.AccountName;
|
||||
Column3.HeaderText = UserLocalization.Localization.AccountAlias;
|
||||
Column4.HeaderText = UserLocalization.Localization.AccountFactory;
|
||||
Column5.HeaderText = UserLocalization.Localization.AccountRegisterTime;
|
||||
|
||||
userButton_login.UIText = UserLocalization.Localization.ButtonEnsure;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Property
|
||||
/// <summary>
|
||||
/// 返回已经选择的账户
|
||||
/// </summary>
|
||||
public List<UserAccount> SelectAccounts
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Button Click
|
||||
|
||||
private void userButton_login_Click(object sender, EventArgs e)
|
||||
{
|
||||
m_result = new List<UserAccount>();
|
||||
|
||||
for (int i = 0; i < dataGridView1.Rows.Count; i++)
|
||||
{
|
||||
DataGridViewRow dgvr = dataGridView1.Rows[i];
|
||||
if(dgvr.Cells[0].Value != null)
|
||||
{
|
||||
if ((bool)dgvr.Cells[0].Value)
|
||||
{
|
||||
m_result.Add((UserAccount)dgvr.Tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
|
||||
private List<string> m_selected;
|
||||
private List<UserAccount> m_result;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
135
ClientsLibrary/AccountSupport/FormAccountSelect.resx
Normal file
135
ClientsLibrary/AccountSupport/FormAccountSelect.resx
Normal file
@@ -0,0 +1,135 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -14,6 +14,8 @@ namespace ClientsLibrary
|
||||
{
|
||||
public partial class FormRegisterAccount : Form
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// 实例化对象
|
||||
/// </summary>
|
||||
@@ -32,7 +34,9 @@ namespace ClientsLibrary
|
||||
Factories.Add("总公司");
|
||||
}
|
||||
|
||||
private List<string> Factories = null;
|
||||
#endregion
|
||||
|
||||
#region Form Load
|
||||
|
||||
private void FormRegisterAccount_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -47,7 +51,10 @@ namespace ClientsLibrary
|
||||
textBox4.Text = (new UserAccount()).ForbidMessage;
|
||||
}
|
||||
|
||||
private NetSimplifyClient net_client = null;
|
||||
#endregion
|
||||
|
||||
#region Register Account
|
||||
|
||||
|
||||
private void userButton_login_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -76,5 +83,14 @@ namespace ClientsLibrary
|
||||
MessageBox.Show("注册失败!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
private List<string> Factories = null; // 分厂信息
|
||||
private NetSimplifyClient net_client = null; // 服务器数据交换的通信对象
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
93
ClientsLibrary/BasicSupport/FormGetInputString.Designer.cs
generated
Normal file
93
ClientsLibrary/BasicSupport/FormGetInputString.Designer.cs
generated
Normal file
@@ -0,0 +1,93 @@
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
partial class FormGetInputString
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.userButton_login = new HslCommunication.Controls.UserButton();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(21, 67);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(383, 29);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// userButton_login
|
||||
//
|
||||
this.userButton_login.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton_login.CustomerInformation = "";
|
||||
this.userButton_login.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton_login.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton_login.Location = new System.Drawing.Point(154, 101);
|
||||
this.userButton_login.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton_login.Name = "userButton_login";
|
||||
this.userButton_login.Size = new System.Drawing.Size(108, 27);
|
||||
this.userButton_login.TabIndex = 7;
|
||||
this.userButton_login.UIText = "确认";
|
||||
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(18, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(386, 55);
|
||||
this.label1.TabIndex = 8;
|
||||
this.label1.Text = "label1";
|
||||
//
|
||||
// FormGetInputString
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(434, 133);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.userButton_login);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FormGetInputString";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "等待输入信息";
|
||||
this.Load += new System.EventHandler(this.FormGetInputString_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private HslCommunication.Controls.UserButton userButton_login;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
55
ClientsLibrary/BasicSupport/FormGetInputString.cs
Normal file
55
ClientsLibrary/BasicSupport/FormGetInputString.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
public partial class FormGetInputString : Form
|
||||
{
|
||||
public FormGetInputString(
|
||||
string info,
|
||||
string defaultValue = "",
|
||||
string title = "等待输入信息",
|
||||
int maxlength = 100
|
||||
)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
Info = info;
|
||||
DefaultValue = defaultValue;
|
||||
Title = title;
|
||||
MaxLength = maxlength;
|
||||
}
|
||||
|
||||
private void FormGetInputString_Load(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text = DefaultValue;
|
||||
textBox1.MaxLength = MaxLength;
|
||||
Text = Title;
|
||||
label1.Text = Info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string Info;
|
||||
private string DefaultValue;
|
||||
private string Title;
|
||||
private int MaxLength = 100;
|
||||
private string m_outPut;
|
||||
|
||||
public string InputString { get => m_outPut; private set => m_outPut = value; }
|
||||
|
||||
private void userButton_login_Click(object sender, EventArgs e)
|
||||
{
|
||||
m_outPut = textBox1.Text;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ClientsLibrary/BasicSupport/FormGetInputString.resx
Normal file
120
ClientsLibrary/BasicSupport/FormGetInputString.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -56,12 +56,24 @@
|
||||
<DependentUpon>FormAccountDetails.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AccountSupport\AccountLogin.cs" />
|
||||
<Compile Include="AccountSupport\FormAccountSelect.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AccountSupport\FormAccountSelect.Designer.cs">
|
||||
<DependentUpon>FormAccountSelect.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\FormDownloading.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\FormDownloading.Designer.cs">
|
||||
<DependentUpon>FormDownloading.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\FormGetInputString.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\FormGetInputString.Designer.cs">
|
||||
<DependentUpon>FormGetInputString.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\FormShowMachineId.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -92,6 +104,12 @@
|
||||
<Compile Include="Configuration\FormConfiguration.Designer.cs">
|
||||
<DependentUpon>FormConfiguration.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\RolesConfiguration.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\RolesConfiguration.Designer.cs">
|
||||
<DependentUpon>RolesConfiguration.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FileSupport\FileOperateControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@@ -148,9 +166,15 @@
|
||||
<EmbeddedResource Include="AccountSupport\FormAccountDetails.resx">
|
||||
<DependentUpon>FormAccountDetails.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="AccountSupport\FormAccountSelect.resx">
|
||||
<DependentUpon>FormAccountSelect.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BasicSupport\FormDownloading.resx">
|
||||
<DependentUpon>FormDownloading.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BasicSupport\FormGetInputString.resx">
|
||||
<DependentUpon>FormGetInputString.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BasicSupport\FormShowMachineId.resx">
|
||||
<DependentUpon>FormShowMachineId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -166,6 +190,9 @@
|
||||
<EmbeddedResource Include="Configuration\FormConfiguration.resx">
|
||||
<DependentUpon>FormConfiguration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\RolesConfiguration.resx">
|
||||
<DependentUpon>RolesConfiguration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FileSupport\FileItemShow.resx">
|
||||
<DependentUpon>FileItemShow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using CommonLibrary;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
@@ -21,15 +22,17 @@ namespace ClientsLibrary
|
||||
|
||||
private void FormConfiguration_Load(object sender, EventArgs e)
|
||||
{
|
||||
Text = "配置系统的参数";
|
||||
Text = UserLocalization.Localization.SettingsText;
|
||||
|
||||
|
||||
treeView1.AfterSelect += TreeView1_AfterSelect;
|
||||
TreeNode treeNodeSystem = treeView1.Nodes[0];
|
||||
treeNodeSystem.Text = UserLocalization.Localization.SettingsSystem;
|
||||
|
||||
treeNodeSystem.Nodes.Add("General", "常规配置");
|
||||
treeNodeSystem.Nodes.Add("Factory", "配置分厂信息");
|
||||
treeNodeSystem.Nodes.Add("Client", "客户端信任功能");
|
||||
treeNodeSystem.Nodes.Add("General", UserLocalization.Localization.SettingsGeneral);
|
||||
treeNodeSystem.Nodes.Add("Factory", UserLocalization.Localization.SettingsAccountFactory);
|
||||
treeNodeSystem.Nodes.Add("Client", UserLocalization.Localization.SettingsTrustClient);
|
||||
treeNodeSystem.Nodes.Add("Roles", UserLocalization.Localization.SettingsRoleAssign);
|
||||
|
||||
treeNodeSystem.Expand();
|
||||
}
|
||||
@@ -64,6 +67,10 @@ namespace ClientsLibrary
|
||||
{
|
||||
control = new ClientConfiguration();
|
||||
}
|
||||
else if (e.Node.Name == "Roles")
|
||||
{
|
||||
control = new RolesConfiguration();
|
||||
}
|
||||
else
|
||||
{
|
||||
control = new UserControl();
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace ClientsLibrary.Configuration
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
public void SetInfomation(int download, int upload, string headText)
|
||||
{
|
||||
Download = download;
|
||||
|
||||
203
ClientsLibrary/Configuration/RolesConfiguration.Designer.cs
generated
Normal file
203
ClientsLibrary/Configuration/RolesConfiguration.Designer.cs
generated
Normal file
@@ -0,0 +1,203 @@
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
partial class RolesConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.userButton4 = new HslCommunication.Controls.UserButton();
|
||||
this.userButton3 = new HslCommunication.Controls.UserButton();
|
||||
this.userButton2 = new HslCommunication.Controls.UserButton();
|
||||
this.userButton1 = new HslCommunication.Controls.UserButton();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.listBox2 = new System.Windows.Forms.ListBox();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 3);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(80, 17);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "角色名称列表";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 3);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(80, 17);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "关联账号列表";
|
||||
//
|
||||
// userButton4
|
||||
//
|
||||
this.userButton4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton4.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton4.CustomerInformation = "";
|
||||
this.userButton4.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton4.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton4.Location = new System.Drawing.Point(458, 427);
|
||||
this.userButton4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton4.Name = "userButton4";
|
||||
this.userButton4.Size = new System.Drawing.Size(78, 25);
|
||||
this.userButton4.TabIndex = 7;
|
||||
this.userButton4.UIText = "保存";
|
||||
this.userButton4.Click += new System.EventHandler(this.userButton4_Click);
|
||||
//
|
||||
// userButton3
|
||||
//
|
||||
this.userButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.userButton3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton3.CustomerInformation = "";
|
||||
this.userButton3.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton3.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton3.Location = new System.Drawing.Point(5, 392);
|
||||
this.userButton3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton3.Name = "userButton3";
|
||||
this.userButton3.Size = new System.Drawing.Size(78, 25);
|
||||
this.userButton3.TabIndex = 6;
|
||||
this.userButton3.UIText = "编辑";
|
||||
this.userButton3.Click += new System.EventHandler(this.userButton3_Click);
|
||||
//
|
||||
// userButton2
|
||||
//
|
||||
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.userButton2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton2.CustomerInformation = "";
|
||||
this.userButton2.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton2.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton2.Location = new System.Drawing.Point(87, 392);
|
||||
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton2.Name = "userButton2";
|
||||
this.userButton2.Size = new System.Drawing.Size(78, 25);
|
||||
this.userButton2.TabIndex = 5;
|
||||
this.userButton2.UIText = "删除";
|
||||
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
|
||||
//
|
||||
// userButton1
|
||||
//
|
||||
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.userButton1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.userButton1.CustomerInformation = "";
|
||||
this.userButton1.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
|
||||
this.userButton1.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.userButton1.Location = new System.Drawing.Point(3, 392);
|
||||
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.userButton1.Name = "userButton1";
|
||||
this.userButton1.Size = new System.Drawing.Size(78, 25);
|
||||
this.userButton1.TabIndex = 1;
|
||||
this.userButton1.UIText = "新增";
|
||||
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 3);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.listBox1);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label1);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.userButton1);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.userButton2);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.listBox2);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label2);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.userButton3);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(536, 421);
|
||||
this.splitContainer1.SplitterDistance = 264;
|
||||
this.splitContainer1.TabIndex = 8;
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.ItemHeight = 17;
|
||||
this.listBox1.Location = new System.Drawing.Point(3, 23);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(257, 361);
|
||||
this.listBox1.TabIndex = 6;
|
||||
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
|
||||
//
|
||||
// listBox2
|
||||
//
|
||||
this.listBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox2.FormattingEnabled = true;
|
||||
this.listBox2.ItemHeight = 17;
|
||||
this.listBox2.Location = new System.Drawing.Point(3, 23);
|
||||
this.listBox2.Name = "listBox2";
|
||||
this.listBox2.Size = new System.Drawing.Size(258, 361);
|
||||
this.listBox2.TabIndex = 7;
|
||||
//
|
||||
// RolesConfiguration
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.userButton4);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "RolesConfiguration";
|
||||
this.Size = new System.Drawing.Size(539, 456);
|
||||
this.Load += new System.EventHandler(this.RolesConfiguration_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private HslCommunication.Controls.UserButton userButton1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private HslCommunication.Controls.UserButton userButton2;
|
||||
private HslCommunication.Controls.UserButton userButton3;
|
||||
private HslCommunication.Controls.UserButton userButton4;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.ListBox listBox2;
|
||||
}
|
||||
}
|
||||
136
ClientsLibrary/Configuration/RolesConfiguration.cs
Normal file
136
ClientsLibrary/Configuration/RolesConfiguration.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HslCommunication;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using CommonLibrary;
|
||||
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
public partial class RolesConfiguration : UserControl
|
||||
{
|
||||
public RolesConfiguration()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RolesConfiguration_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 初始化
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求角色配置, "");
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
List<RoleItem> roles = JArray.Parse(result.Content).ToObject<List<RoleItem>>();
|
||||
|
||||
foreach(var m in roles)
|
||||
{
|
||||
listBox1.Items.Add(m);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请求服务器失败,请稍后重试!");
|
||||
userButton4.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(listBox1.SelectedItem is RoleItem role)
|
||||
{
|
||||
listBox2.DataSource = role.Accounts;
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
// delete list item
|
||||
if (listBox1.SelectedItem != null)
|
||||
{
|
||||
if (MessageBox.Show("是否真的删除该角色信息?", "删除确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
listBox1.Items.Remove(listBox1.SelectedItem);
|
||||
listBox2.DataSource = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckRoleWhetherExisting(string role)
|
||||
{
|
||||
foreach(var m in listBox1.Items)
|
||||
{
|
||||
if(m.ToString() == role)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void userButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// add a new role
|
||||
using (FormGetInputString form = new FormGetInputString("请输入新的角色名称"))
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string role = form.InputString;
|
||||
if(!CheckRoleWhetherExisting(role))
|
||||
{
|
||||
// add
|
||||
listBox1.Items.Add(new RoleItem()
|
||||
{
|
||||
RoleName = role
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBox1.SelectedItem is RoleItem role)
|
||||
{
|
||||
// select account
|
||||
using (FormAccountSelect form = new FormAccountSelect(role.Accounts))
|
||||
{
|
||||
if(form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
role.Accounts = form.SelectAccounts.ConvertAll(m => m.UserName);
|
||||
listBox2.DataSource = role.Accounts;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
// save
|
||||
List<RoleItem> roles = new List<RoleItem>();
|
||||
foreach(var m in listBox1.Items)
|
||||
{
|
||||
if(m is RoleItem item)
|
||||
{
|
||||
roles.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(
|
||||
CommonHeadCode.SimplifyHeadCode.上传角色配置, JArray.FromObject(roles).ToString());
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show("上传数据成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("上传数据失败:"+result.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ClientsLibrary/Configuration/RolesConfiguration.resx
Normal file
120
ClientsLibrary/Configuration/RolesConfiguration.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -8,6 +8,7 @@ using CommonLibrary;
|
||||
using System.Net;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
@@ -35,7 +36,7 @@ namespace ClientsLibrary
|
||||
/// <summary>
|
||||
/// 本软件的当前版本,用来验证更新的关键依据
|
||||
/// </summary>
|
||||
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.170930");
|
||||
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171006");
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -106,6 +107,33 @@ namespace ClientsLibrary
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查当前账户是否有role角色的权限
|
||||
/// </summary>
|
||||
/// <param name="role">角色名称</param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckUserAccountRole(string role)
|
||||
{
|
||||
JObject json = new JObject
|
||||
{
|
||||
{ "Name", UserAccount.UserName },
|
||||
{ "Role", role }
|
||||
};
|
||||
HslCommunication.OperateResultString result = Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.检查角色权限,
|
||||
json.ToString());
|
||||
|
||||
if(result.IsSuccess)
|
||||
{
|
||||
if(result.Content.ToUpper() == "TRUE")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +183,10 @@ namespace ClientsLibrary
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 统一的窗体图标显示
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Icon GetFormWindowIcon()
|
||||
{
|
||||
return Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
35
CommonLibrary/AccountSupport/Attribute.cs
Normal file
35
CommonLibrary/AccountSupport/Attribute.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
*
|
||||
* 说明:本来考虑使用特性来给账户标注,但是考虑到以后将要实现多语言版本,那么特性支持就
|
||||
* 不是个好选择,所以放弃了,保留了特性类
|
||||
*
|
||||
*************************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public class HslDisplayAttribute : Attribute
|
||||
{
|
||||
public string m_display;
|
||||
|
||||
|
||||
public HslDisplayAttribute(string display)
|
||||
{
|
||||
m_display = display;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
CommonLibrary/AccountSupport/RoleAssign.cs
Normal file
105
CommonLibrary/AccountSupport/RoleAssign.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using HslCommunication;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
|
||||
/**********************************************************************************
|
||||
*
|
||||
* 说明:本系统的角色设计
|
||||
*
|
||||
* 角色功能的设计就是针对一些特殊功能权限的账户设计的,我们希望实现对某一个功能的角色可以
|
||||
* 任意的配置账户
|
||||
*
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
public class RoleAssign : HslCommunication.BasicFramework.SoftFileSaveBase
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
public RoleAssign()
|
||||
{
|
||||
// 添加一个初始化的测试例子
|
||||
m_roles.Add(new RoleItem()
|
||||
{
|
||||
RoleName = "审计员",
|
||||
Accounts = new List<string>()
|
||||
{
|
||||
"admin"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override Method
|
||||
|
||||
public override string ToSaveString()
|
||||
{
|
||||
string json = string.Empty;
|
||||
hybirdLock.Enter();
|
||||
json = JArray.FromObject(m_roles).ToString();
|
||||
hybirdLock.Leave();
|
||||
return json;
|
||||
}
|
||||
|
||||
public override void LoadByString(string content)
|
||||
{
|
||||
hybirdLock.Enter();
|
||||
m_roles = JArray.Parse(content).ToObject<List<RoleItem>>();
|
||||
hybirdLock.Leave();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Method
|
||||
|
||||
public bool IsAllowAccountOperate(string role,string name)
|
||||
{
|
||||
bool result = false;
|
||||
hybirdLock.Enter();
|
||||
|
||||
for (int i = 0; i < m_roles.Count; i++)
|
||||
{
|
||||
if (m_roles[i].RoleName == role)
|
||||
{
|
||||
if(m_roles[i].Accounts.Contains(name))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hybirdLock.Leave();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
private List<RoleItem> m_roles = new List<RoleItem>();
|
||||
private SimpleHybirdLock hybirdLock = new SimpleHybirdLock();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public class RoleItem
|
||||
{
|
||||
public string RoleName { get; set; }
|
||||
public List<string> Accounts { get; set; } = new List<string>();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return RoleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
120
CommonLibrary/BasicSupport/FormGetInputString.resx
Normal file
120
CommonLibrary/BasicSupport/FormGetInputString.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -47,6 +47,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AccountSupport\Attribute.cs" />
|
||||
<Compile Include="AccountSupport\FormAccountManage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -65,6 +66,7 @@
|
||||
<Compile Include="AccountSupport\FormPasswordModify.designer.cs">
|
||||
<DependentUpon>FormPasswordModify.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AccountSupport\RoleAssign.cs" />
|
||||
<Compile Include="AccountSupport\ServerAccount.cs" />
|
||||
<Compile Include="AccountSupport\UserAccount.cs" />
|
||||
<Compile Include="BasicSupport\FormSuper.cs">
|
||||
@@ -86,6 +88,9 @@
|
||||
<DependentUpon>FormVersionControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BasicSupport\SoftSettings.cs" />
|
||||
<Compile Include="LocalizationSupport\ChineseLocalization.cs" />
|
||||
<Compile Include="LocalizationSupport\EnglishLocalization.cs" />
|
||||
<Compile Include="LocalizationSupport\Localization.cs" />
|
||||
<Compile Include="ProtocolSupport\CommonProtocol.cs" />
|
||||
<Compile Include="ProtocolSupport\CustomerCode.cs" />
|
||||
<Compile Include="OrderSupport\ClassGoods.cs" />
|
||||
@@ -117,6 +122,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
47
CommonLibrary/LocalizationSupport/ChineseLocalization.cs
Normal file
47
CommonLibrary/LocalizationSupport/ChineseLocalization.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
|
||||
public class ChineseLocalization : ILocalization
|
||||
{
|
||||
public string FormateDateTime { get; set; } = "yyyy-MM-dd HH:mm:ss";
|
||||
public string ButtonEnsure { get; set; } = "确认";
|
||||
|
||||
|
||||
|
||||
|
||||
public string AccountSelect { get; set; } = "选择";
|
||||
|
||||
public string AccountName { get; set; } = "用户名";
|
||||
public string AccountAlias { get; set; } = "别名";
|
||||
public string AccountPassword { get; set; } = "密码";
|
||||
public string AccountFactory { get; set; } = "部门"; // 可以在此处修改为部门
|
||||
public string AccountGrade { get; set; } = "权限";
|
||||
public string AccountRegisterTime { get; set; } = "注册时间";
|
||||
public string AccountLoginEnable { get; set; } = "是否允许登录";
|
||||
public string AccountForbidMessage { get; set; } = "禁止登录原因";
|
||||
public string AccountLoginFrequency { get; set; } = "总登录次数";
|
||||
public string AccountLastLoginTime { get; set; } = "上次登录时间";
|
||||
public string AccountLastLoginIpAddress { get; set; } = "上次登录地址";
|
||||
public string AccountLoginFailedCount { get; set; } = "登录失败次数";
|
||||
public string AccountLastLoginWay { get; set; } = "上次登录方式";
|
||||
public string AccountPortrait { get; set; } = "头像";
|
||||
public string AccountDetails { get; set; } = "账户详细信息";
|
||||
|
||||
|
||||
#region 配置相关
|
||||
|
||||
public string SettingsText { get; set; } = "配置系统的参数";
|
||||
public string SettingsSystem { get; set; } = "系统相关";
|
||||
public string SettingsGeneral { get; set; } = "常规配置";
|
||||
public string SettingsAccountFactory { get { return "配置" + AccountFactory + "信息"; } set { } }
|
||||
public string SettingsTrustClient { get; set; } = "信任客户端列表";
|
||||
public string SettingsRoleAssign { get; set; } = "配置角色信息";
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
47
CommonLibrary/LocalizationSupport/EnglishLocalization.cs
Normal file
47
CommonLibrary/LocalizationSupport/EnglishLocalization.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
public class EnglishLocalization : ILocalization
|
||||
{
|
||||
public string FormateDateTime { get; set; } = "yyyy/MM/dd HH:mm:ss";
|
||||
public string ButtonEnsure { get; set; } = "Sure";
|
||||
|
||||
|
||||
|
||||
|
||||
public string AccountSelect { get; set; } = "Select";
|
||||
|
||||
public string AccountName { get; set; } = "Name";
|
||||
public string AccountAlias { get; set; } = "Alias";
|
||||
public string AccountPassword { get; set; } = "Password";
|
||||
public string AccountFactory { get; set; } = "Factory"; // 可以在此处修改为部门
|
||||
public string AccountGrade { get; set; } = "Authority";
|
||||
public string AccountRegisterTime { get; set; } = "Register Time";
|
||||
public string AccountLoginEnable { get; set; } = "Login Enable";
|
||||
public string AccountForbidMessage { get; set; } = "Forbid Reason";
|
||||
public string AccountLoginFrequency { get; set; } = "Login Totle";
|
||||
public string AccountLastLoginTime { get; set; } = "Login Last Time";
|
||||
public string AccountLastLoginIpAddress { get; set; } = "Login Last Ip";
|
||||
public string AccountLoginFailedCount { get; set; } = "Login Failed Totle";
|
||||
public string AccountLastLoginWay { get; set; } = "Login Last Way";
|
||||
public string AccountPortrait { get; set; } = "Portrait";
|
||||
public string AccountDetails { get; set; } = "Account Details";
|
||||
|
||||
|
||||
#region 配置相关
|
||||
|
||||
public string SettingsText { get; set; } = "System parameters settings";
|
||||
public string SettingsSystem { get; set; } = "System Settings";
|
||||
public string SettingsGeneral { get; set; } = "General";
|
||||
public string SettingsAccountFactory { get { return AccountFactory + " List"; } set { } }
|
||||
public string SettingsTrustClient { get; set; } = "Trust Client";
|
||||
public string SettingsRoleAssign { get; set; } = "Role Assign";
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
90
CommonLibrary/LocalizationSupport/Localization.cs
Normal file
90
CommonLibrary/LocalizationSupport/Localization.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonLibrary
|
||||
{
|
||||
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* 说明:本地化策略机制,优先完成中文版适配
|
||||
*
|
||||
*******************************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// 整个软件系统的本地化策略
|
||||
/// </summary>
|
||||
public static class UserLocalization
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认的语言选项
|
||||
/// </summary>
|
||||
public static ILocalization Localization = new ChineseLocalization();
|
||||
|
||||
/// <summary>
|
||||
/// 设置系统的语言选项
|
||||
/// </summary>
|
||||
/// <param name="language">语言名称</param>
|
||||
public static void SettingLocalization(string language)
|
||||
{
|
||||
if(language.ToLower() == "chinese")
|
||||
{
|
||||
Localization = Chinese;
|
||||
}
|
||||
else
|
||||
{
|
||||
Localization = English;
|
||||
}
|
||||
}
|
||||
|
||||
private static ILocalization Chinese = new ChineseLocalization();
|
||||
private static ILocalization English = new EnglishLocalization();
|
||||
}
|
||||
|
||||
public interface ILocalization
|
||||
{
|
||||
string FormateDateTime { get; set; }
|
||||
|
||||
string ButtonEnsure { get; set; }
|
||||
|
||||
|
||||
#region 账户相关
|
||||
|
||||
|
||||
string AccountSelect { get; set; }
|
||||
string AccountName { get; set; }
|
||||
string AccountAlias { get; set; }
|
||||
string AccountPassword { get; set; }
|
||||
string AccountFactory { get; set; }
|
||||
string AccountGrade { get; set; }
|
||||
string AccountRegisterTime { get; set; }
|
||||
string AccountLoginEnable { get; set; }
|
||||
string AccountForbidMessage { get; set; }
|
||||
string AccountLoginFrequency { get; set; }
|
||||
string AccountLastLoginTime { get; set; }
|
||||
string AccountLastLoginIpAddress { get; set; }
|
||||
string AccountLoginFailedCount { get; set; }
|
||||
string AccountLastLoginWay { get; set; }
|
||||
string AccountPortrait { get; set; }
|
||||
string AccountDetails { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 配置相关
|
||||
|
||||
string SettingsText { get; set; }
|
||||
string SettingsSystem { get; set; }
|
||||
string SettingsGeneral { get; set; }
|
||||
string SettingsAccountFactory { get; set; }
|
||||
string SettingsTrustClient { get; set; }
|
||||
string SettingsRoleAssign { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace CommonLibrary
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.5.6");
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.6.0");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ namespace CommonLibrary
|
||||
public static NetHandle 上传信任客户端 { get; } = new NetHandle(1, 1, 00020);
|
||||
public static NetHandle 请求一般配置 { get; } = new NetHandle(1, 1, 00021);
|
||||
public static NetHandle 上传一般配置 { get; } = new NetHandle(1, 1, 00022);
|
||||
public static NetHandle 请求角色配置 { get; } = new NetHandle(1, 1, 00023);
|
||||
public static NetHandle 上传角色配置 { get; } = new NetHandle(1, 1, 00024);
|
||||
public static NetHandle 检查角色权限 { get; } = new NetHandle(1, 1, 00025);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
BIN
Design.xlsx
BIN
Design.xlsx
Binary file not shown.
Binary file not shown.
@@ -15,8 +15,10 @@
|
||||
<li>一个简单的意见反馈功能,允许客户端反馈软件的意见或是BUG,方便开发人员更改</li>
|
||||
<li>一个简单的右下角消息框弹出功能,在公告更改和新发消息的时候可以自由控制</li>
|
||||
<li>一个简单的版本日志提示窗口,在新版本更新后就会自动提示显示</li>
|
||||
<li>一个简单的角色管理器功能,对每个角色可以配置任意数量的账户名</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>服务器端的配置实时保存,以防止服务器电脑突然关机,断电造成的数据丢失问题</li>
|
||||
<li>一个完善的网络通信框架,包含一对多控制的tcp网络(服务器对客户端进行控制,并方便的群发数据),单独请求数据的同步网络,udp网络</li>
|
||||
<li>完善的自动升级的部署机制,服务器部署新版本后,所有客户端都将一键自动更新</li>
|
||||
<li>客户端提供开发人员远程更新服务器程序的能力,方便开发人员的操作</li>
|
||||
@@ -85,14 +87,13 @@
|
||||
</ul>
|
||||
|
||||
|
||||
## About HslCommunication.dll
|
||||
## HslCommunication.dll
|
||||
<p>本C-S项目的核心组件,该组件功能提供了一些基础功能类和整个C-S项目的网络支持,除此之外,该组件提供了访问三菱PLC和西门子PLC的数据功能。
|
||||
以下就是该库的部分子功能说明,您也可以只使用其中一部分的功能类,比如日志功能!完整的功能手册将在近期放出,方便理解整个系统的底层机制。</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/dathlin/ClientServerProject/blob/master/files/LogReadme.md">简单强大的日志记录功能使用</a></li>
|
||||
<li><a href="https://github.com/dathlin/ClientServerProject/blob/master/files/SimplifyNet.md">同步网络数据交互功能使用</a></li>
|
||||
<li><a href="https://github.com/dathlin/ClientServerProject/blob/master/files/SimplifyFileNet.md">共享文件管理功能使用</a></li>
|
||||
<li><a href="https://github.com/dathlin/ClientServerProject/blob/master/files/MelsecReadMe.md">三菱PLC数据读写介绍</a></li>
|
||||
<li><a href="https://github.com/dathlin/ClientServerProject/blob/master/files/SiemensReadMe.md">西门子PLC数据读写手册</a></li>
|
||||
</ul>
|
||||
@@ -130,6 +131,9 @@ using HslCommunication;
|
||||
|
||||

|
||||
|
||||
#### 系统的权限角色模型设计
|
||||

|
||||
|
||||
#### 系统的异常处理模型设计
|
||||

|
||||
|
||||
|
||||
BIN
img/Design7.png
Normal file
BIN
img/Design7.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -51,7 +51,12 @@ namespace 软件系统客户端Wpf
|
||||
*
|
||||
**************************************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************************
|
||||
*
|
||||
* 权限说明 在进行特定权限操作的业务逻辑时,应该提炼成一个角色,这样可以动态绑定带有这些功能的账户
|
||||
* 示例 if (UserClient.CheckUserAccountRole("审计员")) { dosomething(); }// 获取了审计员的角色,名字此处示例
|
||||
*
|
||||
******************************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ using HslCommunication.LogNet;
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 模版日期 2017-09-20
|
||||
* 模版日期 2017-10-06
|
||||
* 创建人 Richard.Hu
|
||||
* 版权所有 Richard.Hu
|
||||
* 授权说明 模版仅授权个人使用,如需商用,请联系hsl200909@163.com洽谈
|
||||
@@ -36,6 +36,13 @@ using HslCommunication.LogNet;
|
||||
*
|
||||
****************************************************************************************/
|
||||
|
||||
/*****************************************************************************************
|
||||
*
|
||||
* 权限说明 在进行特定权限操作的业务逻辑时,应该提炼成一个角色,这样可以动态绑定带有这些功能的账户
|
||||
* 示例 if (UserClient.CheckUserAccountRole("审计员")) { dosomething(); }// 获取了审计员的角色,名字此处示例
|
||||
*
|
||||
******************************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +72,7 @@ namespace 软件系统客户端模版
|
||||
{
|
||||
// udp测试
|
||||
// SendServerUdpData(0, "载入了窗体");
|
||||
|
||||
|
||||
//窗口载入
|
||||
label_userName.Text = UserClient.UserAccount.UserName;
|
||||
label_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade);
|
||||
|
||||
1
软件系统服务端模版/FormServerWindow.Designer.cs
generated
1
软件系统服务端模版/FormServerWindow.Designer.cs
generated
@@ -16,6 +16,7 @@
|
||||
//紧急存储数据
|
||||
UserServer.ServerSettings.SaveToFile();
|
||||
UserServer.ServerAccounts.SaveToFile();
|
||||
UserServer.ServerRoles.SaveToFile();
|
||||
Chats_Managment.SaveToFile();
|
||||
|
||||
if (disposing && (components != null))
|
||||
|
||||
@@ -18,12 +18,13 @@ using HslCommunication;
|
||||
|
||||
/********************************************************************************************
|
||||
*
|
||||
* 模版日期 2017-09-30
|
||||
* 模版日期 2017-10-06
|
||||
* 创建人 Richard.Hu
|
||||
* 版权所有 Richard.Hu
|
||||
* 授权说明 模版仅授权个人研究学习使用,如需商用,请联系hsl200909@163.com洽谈
|
||||
* 说明 JSON组件引用自james newton-king,遵循MIT授权协议
|
||||
* 网络组件 网络组件的版权由Richard.Hu所有
|
||||
* 免责声明 项目许可证为MIT,由于二次开发带来的经济损失,概不负责。
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -42,6 +43,7 @@ using HslCommunication;
|
||||
* 本项目模版不包含 《软件自动更新.exe》
|
||||
* 如需支持部署环境的自动升级 请联系hsl200909@163.com获取
|
||||
* 软件自动更新.exe 将绑定IP,端口和软件名称后授权销售,30元人民币一组,永久使用
|
||||
* 软件自动更新的部署提供长期的技术支持
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -96,47 +98,52 @@ namespace 软件系统服务端模版
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
//初始化默认的委托对象
|
||||
// 初始化默认的委托对象
|
||||
ActionInitialization();
|
||||
//邮件系统初始化
|
||||
// 邮件系统初始化
|
||||
SoftMailInitialization();
|
||||
//初始化日志工具
|
||||
// 初始化日志工具
|
||||
RuntimeLogHelper = new LogNetSingle(LogSavePath + @"\log.txt");
|
||||
//初始化反馈信息工具
|
||||
// 初始化反馈信息工具
|
||||
AdviceLogHelper = new LogNetSingle(LogSavePath + @"\advice_log.txt");
|
||||
//初始化客户端异常日志工具
|
||||
// 初始化客户端异常日志工具
|
||||
ClientsLogHelper = new LogNetSingle(LogSavePath + @"\clients_log.txt");
|
||||
//保存路径初始化
|
||||
// 初始化并加载账户信息
|
||||
UserServer.ServerSettings.FileSavePath = Application.StartupPath + @"\settings.txt";
|
||||
//加载参数
|
||||
UserServer.ServerSettings.LoadByFile();
|
||||
|
||||
// 初始化并加载角色规则
|
||||
UserServer.ServerRoles.FileSavePath = Application.StartupPath + @"\roles.txt";
|
||||
UserServer.ServerRoles.LoadByFile();
|
||||
|
||||
// 初始化版权信息
|
||||
toolStripStatusLabel_version.Text = UserServer.ServerSettings.SystemVersion.ToString();
|
||||
toolStripStatusLabel1.Text = $"本软件著作权归{SoftResources.StringResouce.SoftCopyRight}所有";
|
||||
label5.Text = SoftResources.StringResouce.SoftName;
|
||||
//加载账户信息
|
||||
// 加载账户信息
|
||||
UserServer.ServerAccounts.FileSavePath = Application.StartupPath + @"\accounts.txt";
|
||||
UserServer.ServerAccounts.LoadByFile();
|
||||
UserServer.ServerAccounts.ILogNet = RuntimeLogHelper;
|
||||
//初始化聊天信息
|
||||
// 初始化聊天信息
|
||||
ChatInitialization();
|
||||
}
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
//密码验证的示例,此处关闭窗口验证
|
||||
// 密码验证的示例,此处关闭窗口验证
|
||||
using (FormPasswordCheck fpc = new FormPasswordCheck("123456"))
|
||||
{
|
||||
if (fpc.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
IsWindowShow = false;
|
||||
Thread.Sleep(20);
|
||||
//关闭网络引擎
|
||||
// 关闭网络引擎
|
||||
net_socket_server.ServerClose();
|
||||
net_simplify_server.ServerClose();
|
||||
net_udp_server.ServerClose();
|
||||
}
|
||||
else
|
||||
{
|
||||
//取消关闭
|
||||
// 取消关闭
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
@@ -558,6 +565,7 @@ namespace 软件系统服务端模版
|
||||
string name = SoftBasic.GetValueFromJsonObject(json, UserAccount.UserNameText, "");
|
||||
string password = SoftBasic.GetValueFromJsonObject(json, UserAccount.PasswordText, "");
|
||||
UserServer.ServerAccounts.UpdatePassword(name, password);
|
||||
UserServer.ServerAccounts.SaveToFile();
|
||||
net_simplify_server.SendMessage(state, handle, "成功");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.更新版本)
|
||||
@@ -579,6 +587,7 @@ namespace 软件系统服务端模版
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.注册账号)
|
||||
{
|
||||
bool result = UserServer.ServerAccounts.AddNewAccount(data);
|
||||
if (result) UserServer.ServerAccounts.SaveToFile();
|
||||
net_simplify_server.SendMessage(state, handle, result ? "1" : "0");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.请求文件)
|
||||
@@ -652,6 +661,7 @@ namespace 软件系统服务端模版
|
||||
JObject json = JObject.Parse(data);
|
||||
UserServer.ServerSettings.WhetherToEnableTrustedClientAuthentication = json["TrustEnable"].ToObject<bool>();
|
||||
UserServer.ServerSettings.TrustedClientList = json["TrustList"].ToObject<List<string>>();
|
||||
UserServer.ServerSettings.SaveToFile();
|
||||
net_simplify_server.SendMessage(state, handle, "成功");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.请求一般配置)
|
||||
@@ -670,6 +680,23 @@ namespace 软件系统服务端模版
|
||||
UserServer.ServerSettings.AllowLoginWhenFramewordVersionNotCheck = SoftBasic.GetValueFromJsonObject(json, "AllowFrameLogin", false);
|
||||
net_simplify_server.SendMessage(state, handle, json.ToString());
|
||||
}
|
||||
else if(handle == CommonHeadCode.SimplifyHeadCode.请求角色配置)
|
||||
{
|
||||
net_simplify_server.SendMessage(state, handle, UserServer.ServerRoles.ToSaveString());
|
||||
}
|
||||
else if(handle == CommonHeadCode.SimplifyHeadCode.上传角色配置)
|
||||
{
|
||||
UserServer.ServerRoles.LoadByString(data);
|
||||
UserServer.ServerRoles.SaveToFile();
|
||||
net_simplify_server.SendMessage(state, handle, "1");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.检查角色权限)
|
||||
{
|
||||
JObject json = JObject.Parse(data);
|
||||
string name = SoftBasic.GetValueFromJsonObject(json, "Name", "");
|
||||
string role = SoftBasic.GetValueFromJsonObject(json, "Role", "");
|
||||
net_simplify_server.SendMessage(state, handle, UserServer.ServerRoles.IsAllowAccountOperate(role, name).ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
net_simplify_server.SendMessage(state, handle, data);
|
||||
|
||||
@@ -28,8 +28,9 @@ namespace 软件系统服务端模版
|
||||
/// 所有账户信息的存储对象,具体的账户类可以根据UserAccount进行扩充
|
||||
/// </summary>
|
||||
public static ServerAccounts<UserAccount> ServerAccounts { get; set; } = new ServerAccounts<UserAccount>(
|
||||
new List<UserAccount>() {
|
||||
//示例:新增一个默认的超级管理员
|
||||
new List<UserAccount>()
|
||||
{
|
||||
// 示例:新增一个默认的超级管理员
|
||||
new UserAccount()
|
||||
{
|
||||
UserName="admin",
|
||||
@@ -43,7 +44,13 @@ namespace 软件系统服务端模版
|
||||
LoginFrequency=0,
|
||||
LastLoginIpAddress="",
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// 角色信息管理器
|
||||
/// </summary>
|
||||
public static RoleAssign ServerRoles { get; set; } = new RoleAssign();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user