Skip to content

Commit 9ed7e37

Browse files
committed
新增角色管理功能,初步新增多语言版本功能,更新readme,v1.6.0
1 parent 64e9d19 commit 9ed7e37

36 files changed

+1899
-123
lines changed

ClientsLibrary/AccountSupport/AccountLogin.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ namespace ClientsLibrary
1414
/*********************************************************************************
1515
*
1616
* 统一的账户登录模型
17-
*
17+
* 包含的功能有
18+
* 1、维护状态检查
19+
* 2、账户检查
20+
* 3、框架版本检查、
21+
* 4、系统版本号检查
22+
* 5、初始化数据
1823
*
1924
*********************************************************************************/
2025

@@ -78,9 +83,11 @@ string clientType
7883
// 延时
7984
Thread.Sleep(200);
8085

81-
//===================================================================================
86+
//=======================================================================================
87+
//
8288
// 根据实际情况校验,选择数据库校验或是将用户名密码发至服务器校验
8389
// 以下展示了服务器校验的方法,如您需要数据库校验,请删除下面并改成SQL访问验证的方式
90+
// 如果还有其他数据一并传到服务器进行验证的,都在下面进行数据包装
8491

8592
// 包装数据
8693
JObject json = new JObject
@@ -146,6 +153,7 @@ string clientType
146153
}
147154
else
148155
{
156+
// 超级管理员可以使用超前版本进行登录
149157
if (UserClient.CurrentVersion < sv)
150158
{
151159
// 保存新版本信息
@@ -182,7 +190,7 @@ string clientType
182190
{
183191
// 服务器返回初始化的数据,此处进行数据的提取,有可能包含了多个数据
184192
json = JObject.Parse(result.Content);
185-
// 例如公告数据
193+
// 例如公告数据和分厂数据
186194
UserClient.Announcement = SoftBasic.GetValueFromJsonObject(json, nameof(UserClient.Announcement), "");
187195
if (json[nameof(UserClient.SystemFactories)] != null)
188196
{

ClientsLibrary/AccountSupport/FormAccountDetails.Designer.cs

Lines changed: 90 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ClientsLibrary/AccountSupport/FormAccountDetails.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ private void AccountDetails_Shown(object sender, EventArgs e)
5252

5353
// 加载文件列表
5454
DownloadUserFileNames();
55+
56+
// 本地化显示
57+
UILocalization();
5558
}
5659

5760
private void AccountDetails_Load(object sender, EventArgs e)
@@ -66,6 +69,32 @@ private void AccountDetails_Load(object sender, EventArgs e)
6669
treeView1.Nodes[0].SelectedImageIndex = 0;
6770
}
6871

72+
#endregion
73+
74+
#region Localization Support
75+
76+
/// <summary>
77+
/// 本地化显示的操作,还未完成
78+
/// </summary>
79+
private void UILocalization()
80+
{
81+
Text = UserLocalization.Localization.AccountDetails;
82+
groupBox1.Text = UserLocalization.Localization.AccountDetails;
83+
label12.Text = UserLocalization.Localization.AccountPortrait + ":";
84+
label1.Text = UserLocalization.Localization.AccountName + ":";
85+
label2.Text = UserLocalization.Localization.AccountAlias + ":";
86+
label3.Text = UserLocalization.Localization.AccountFactory + ":";
87+
label4.Text = UserLocalization.Localization.AccountGrade + ":";
88+
label5.Text = UserLocalization.Localization.AccountRegisterTime + ":";
89+
label6.Text = UserLocalization.Localization.AccountLoginEnable + ":";
90+
label7.Text = UserLocalization.Localization.AccountLoginFrequency + ":";
91+
label8.Text = UserLocalization.Localization.AccountLastLoginTime + ":";
92+
label9.Text = UserLocalization.Localization.AccountLastLoginIpAddress + ":";
93+
label10.Text = UserLocalization.Localization.AccountLastLoginWay + ":";
94+
label11.Text = UserLocalization.Localization.AccountLoginFailedCount + ":";
95+
}
96+
97+
6998
#endregion
7099

71100
#region Load Portrait

ClientsLibrary/AccountSupport/FormAccountSelect.Designer.cs

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
using CommonLibrary;
2+
using HslCommunication;
3+
using Newtonsoft.Json.Linq;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.ComponentModel;
7+
using System.Data;
8+
using System.Drawing;
9+
using System.Linq;
10+
using System.Text;
11+
using System.Windows.Forms;
12+
13+
namespace ClientsLibrary
14+
{
15+
public partial class FormAccountSelect : Form
16+
{
17+
#region Constructor
18+
19+
20+
public FormAccountSelect(List<string> selected = null)
21+
{
22+
InitializeComponent();
23+
24+
Icon = UserClient.GetFormWindowIcon();
25+
m_selected = selected;
26+
}
27+
28+
29+
#endregion
30+
31+
#region Form Load
32+
33+
34+
private void FormAccountSelect_Load(object sender, EventArgs e)
35+
{
36+
// 初始化
37+
38+
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.获取账户, "");
39+
if (result.IsSuccess)
40+
{
41+
List<UserAccount> accounts = JArray.Parse(result.Content).ToObject<List<UserAccount>>();
42+
// 添加到数据表
43+
44+
foreach (var m in accounts)
45+
{
46+
DataGridViewRow dgvr = dataGridView1.Rows[dataGridView1.Rows.Add()];
47+
if(m_selected != null)
48+
{
49+
if(m_selected.Contains(m.UserName))
50+
{
51+
dgvr.Cells[0].Value = true;
52+
}
53+
}
54+
55+
dgvr.Cells[1].Value = m.UserName;
56+
dgvr.Cells[2].Value = m.NameAlias;
57+
dgvr.Cells[3].Value = m.Factory;
58+
dgvr.Cells[4].Value = m.RegisterTime.ToString();
59+
dgvr.Tag = m;
60+
}
61+
}
62+
else
63+
{
64+
MessageBox.Show("请求服务器失败,请稍后重试!");
65+
66+
}
67+
68+
// 本地化
69+
UILocalization();
70+
71+
dataGridView1.RowsDefaultCellStyle.SelectionBackColor = dataGridView1.RowsDefaultCellStyle.BackColor;
72+
dataGridView1.RowsDefaultCellStyle.SelectionForeColor = dataGridView1.RowsDefaultCellStyle.ForeColor;
73+
}
74+
75+
76+
#endregion
77+
78+
#region Localization Support
79+
80+
private void UILocalization()
81+
{
82+
83+
Text = UserLocalization.Localization.AccountSelect;
84+
Column1.HeaderText = UserLocalization.Localization.AccountSelect;
85+
Column2.HeaderText = UserLocalization.Localization.AccountName;
86+
Column3.HeaderText = UserLocalization.Localization.AccountAlias;
87+
Column4.HeaderText = UserLocalization.Localization.AccountFactory;
88+
Column5.HeaderText = UserLocalization.Localization.AccountRegisterTime;
89+
90+
userButton_login.UIText = UserLocalization.Localization.ButtonEnsure;
91+
}
92+
93+
#endregion
94+
95+
#region Public Property
96+
/// <summary>
97+
/// 返回已经选择的账户
98+
/// </summary>
99+
public List<UserAccount> SelectAccounts
100+
{
101+
get
102+
{
103+
return m_result;
104+
}
105+
}
106+
107+
#endregion
108+
109+
#region Button Click
110+
111+
private void userButton_login_Click(object sender, EventArgs e)
112+
{
113+
m_result = new List<UserAccount>();
114+
115+
for (int i = 0; i < dataGridView1.Rows.Count; i++)
116+
{
117+
DataGridViewRow dgvr = dataGridView1.Rows[i];
118+
if(dgvr.Cells[0].Value != null)
119+
{
120+
if ((bool)dgvr.Cells[0].Value)
121+
{
122+
m_result.Add((UserAccount)dgvr.Tag);
123+
}
124+
}
125+
}
126+
127+
DialogResult = DialogResult.OK;
128+
}
129+
130+
131+
132+
#endregion
133+
134+
#region Private Members
135+
136+
137+
private List<string> m_selected;
138+
private List<UserAccount> m_result;
139+
140+
#endregion
141+
142+
143+
}
144+
}

0 commit comments

Comments
 (0)