提交 3cccf070 编写于 作者: Richard__Hu's avatar Richard__Hu

代码优化重构,角色配置小问题修复,继续优化中英文支持,v1.6.3

上级 f248effb
......@@ -122,6 +122,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FormInputNewRole";
this.Load += new System.EventHandler(this.FormInputNewRole_Load);
this.Shown += new System.EventHandler(this.FormInputNewRole_Shown);
this.ResumeLayout(false);
this.PerformLayout();
......
......@@ -28,7 +28,33 @@ namespace ClientsLibrary
#endregion
#region Form Load
#region Localization Support
/// <summary>
/// 本地化显示的操作,还未完成
/// </summary>
private void UILocalization()
{
if(m_RoleItem == null)
{
Text = UserLocalization.Localization.AccountRoleAdd;
}
else
{
Text = UserLocalization.Localization.AccountRoleEdit;
}
label1.Text = UserLocalization.Localization.GeneralUniqueID + ":";
label2.Text = UserLocalization.Localization.GeneralName + ":";
label3.Text = UserLocalization.Localization.GeneralDescription + ":";
userButton_login.UIText = UserLocalization.Localization.ButtonEnsure;
}
#endregion
#region Form Load Show
private void FormInputNewRole_Load(object sender, EventArgs e)
......@@ -39,6 +65,11 @@ namespace ClientsLibrary
}
}
private void FormInputNewRole_Shown(object sender, EventArgs e)
{
UILocalization();
}
#endregion
......@@ -49,7 +80,7 @@ namespace ClientsLibrary
{
// 此处是编辑
m_RoleItem = roleItem;
if (m_RoleItem != null)
{
textBox1.Text = m_RoleItem.RoleCode;
......@@ -107,5 +138,7 @@ namespace ClientsLibrary
}
#endregion
}
}
......@@ -67,7 +67,7 @@
this.listBox1.ItemHeight = 17;
this.listBox1.Location = new System.Drawing.Point(3, 51);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(435, 327);
this.listBox1.Size = new System.Drawing.Size(552, 344);
this.listBox1.TabIndex = 2;
//
// userButton_delete
......@@ -77,10 +77,10 @@
this.userButton_delete.CustomerInformation = "";
this.userButton_delete.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_delete.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_delete.Location = new System.Drawing.Point(444, 51);
this.userButton_delete.Location = new System.Drawing.Point(477, 23);
this.userButton_delete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton_delete.Name = "userButton_delete";
this.userButton_delete.Size = new System.Drawing.Size(111, 27);
this.userButton_delete.Size = new System.Drawing.Size(78, 25);
this.userButton_delete.TabIndex = 9;
this.userButton_delete.UIText = "删除选中项";
this.userButton_delete.Click += new System.EventHandler(this.userButton_delete_Click);
......@@ -89,9 +89,9 @@
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(3, 391);
this.textBox1.Location = new System.Drawing.Point(3, 406);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(435, 23);
this.textBox1.Size = new System.Drawing.Size(552, 23);
this.textBox1.TabIndex = 10;
//
// userButton1
......@@ -101,10 +101,10 @@
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(444, 389);
this.userButton1.Location = new System.Drawing.Point(98, 436);
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton1.Name = "userButton1";
this.userButton1.Size = new System.Drawing.Size(111, 27);
this.userButton1.Size = new System.Drawing.Size(98, 25);
this.userButton1.TabIndex = 11;
this.userButton1.UIText = "添加客户端标识";
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
......@@ -116,10 +116,10 @@
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(444, 354);
this.userButton2.Location = new System.Drawing.Point(3, 436);
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton2.Name = "userButton2";
this.userButton2.Size = new System.Drawing.Size(111, 27);
this.userButton2.Size = new System.Drawing.Size(89, 25);
this.userButton2.TabIndex = 12;
this.userButton2.UIText = "获取本机标识";
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
......@@ -131,10 +131,10 @@
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(444, 434);
this.userButton3.Location = new System.Drawing.Point(477, 436);
this.userButton3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton3.Name = "userButton3";
this.userButton3.Size = new System.Drawing.Size(111, 27);
this.userButton3.Size = new System.Drawing.Size(78, 25);
this.userButton3.TabIndex = 13;
this.userButton3.UIText = "保存";
this.userButton3.Click += new System.EventHandler(this.userButton3_Click);
......
......@@ -30,8 +30,8 @@
{
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.panel1 = new System.Windows.Forms.Panel();
this.userButton2 = new HslCommunication.Controls.UserButton();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.userButton2 = new HslCommunication.Controls.UserButton();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
......@@ -55,9 +55,19 @@
this.panel1.Controls.Add(this.checkBox1);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(561, 391);
this.panel1.Size = new System.Drawing.Size(561, 397);
this.panel1.TabIndex = 1;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(3, 30);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(231, 21);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "是否允许框架版本不匹配的客户端登录";
this.checkBox2.UseVisualStyleBackColor = true;
//
// userButton2
//
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
......@@ -65,24 +75,14 @@
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(503, 398);
this.userButton2.Location = new System.Drawing.Point(480, 404);
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton2.Name = "userButton2";
this.userButton2.Size = new System.Drawing.Size(55, 27);
this.userButton2.Size = new System.Drawing.Size(78, 25);
this.userButton2.TabIndex = 10;
this.userButton2.UIText = "保存";
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(3, 30);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(231, 21);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "是否允许框架版本不匹配的客户端登录";
this.checkBox2.UseVisualStyleBackColor = true;
//
// GeneralConfiguration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......
......@@ -67,10 +67,10 @@
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(3, 415);
this.userButton_login.Location = new System.Drawing.Point(3, 417);
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(55, 27);
this.userButton_login.Size = new System.Drawing.Size(78, 25);
this.userButton_login.TabIndex = 7;
this.userButton_login.UIText = "新增";
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
......@@ -82,10 +82,10 @@
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(64, 415);
this.userButton1.Location = new System.Drawing.Point(87, 417);
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton1.Name = "userButton1";
this.userButton1.Size = new System.Drawing.Size(55, 27);
this.userButton1.Size = new System.Drawing.Size(78, 25);
this.userButton1.TabIndex = 8;
this.userButton1.UIText = "删除";
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
......@@ -97,15 +97,15 @@
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(442, 415);
this.userButton2.Location = new System.Drawing.Point(419, 417);
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton2.Name = "userButton2";
this.userButton2.Size = new System.Drawing.Size(55, 27);
this.userButton2.Size = new System.Drawing.Size(78, 25);
this.userButton2.TabIndex = 9;
this.userButton2.UIText = "保存";
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
//
// FactoryConfiguration
// ArrayConfiguration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
......@@ -115,7 +115,7 @@
this.Controls.Add(this.dataGridView1);
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 = "FactoryConfiguration";
this.Name = "ArrayConfiguration";
this.Size = new System.Drawing.Size(500, 446);
this.Load += new System.EventHandler(this.FactoryConfiguration_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
......
......@@ -120,4 +120,7 @@
<metadata name="Factory.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Factory.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
\ No newline at end of file
......@@ -35,13 +35,13 @@
this.userButton2 = new HslCommunication.Controls.UserButton();
this.userButton1 = new HslCommunication.Controls.UserButton();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.userButton5 = new HslCommunication.Controls.UserButton();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
......@@ -151,16 +151,57 @@
this.splitContainer1.SplitterDistance = 264;
this.splitContainer1.TabIndex = 8;
//
// textBox2
//
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox2.Location = new System.Drawing.Point(71, 396);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(189, 23);
this.textBox2.TabIndex = 10;
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(2, 399);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 9;
this.label4.Text = "描述:";
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(71, 371);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(189, 23);
this.textBox1.TabIndex = 8;
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(2, 374);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 7;
this.label3.Text = "代码:";
//
// 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.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 17;
this.listBox1.ItemHeight = 21;
this.listBox1.Location = new System.Drawing.Point(3, 23);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(257, 327);
this.listBox1.Size = new System.Drawing.Size(257, 340);
this.listBox1.TabIndex = 6;
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
//
......@@ -169,8 +210,9 @@
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.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listBox2.FormattingEnabled = true;
this.listBox2.ItemHeight = 17;
this.listBox2.ItemHeight = 21;
this.listBox2.Location = new System.Drawing.Point(3, 23);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(258, 361);
......@@ -191,46 +233,6 @@
this.userButton5.UIText = "编辑";
this.userButton5.Click += new System.EventHandler(this.userButton5_Click);
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(2, 367);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 7;
this.label3.Text = "代码:";
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(62, 364);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(198, 23);
this.textBox1.TabIndex = 8;
//
// textBox2
//
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox2.Location = new System.Drawing.Point(62, 396);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(198, 23);
this.textBox2.TabIndex = 10;
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(2, 399);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 9;
this.label4.Text = "描述:";
//
// RolesConfiguration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......
......@@ -14,13 +14,23 @@ namespace ClientsLibrary.Configuration
{
public partial class RolesConfiguration : UserControl
{
#region Constructor
public RolesConfiguration()
{
InitializeComponent();
}
#endregion
#region Control Load
private void RolesConfiguration_Load(object sender, EventArgs e)
{
UILocalization();
// 初始化
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求角色配置, "");
......@@ -40,6 +50,11 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Role Select
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if(listBox1.SelectedItem is RoleItem role)
......@@ -50,6 +65,11 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Role Delete
private void userButton2_Click(object sender, EventArgs e)
{
// delete list item
......@@ -63,6 +83,12 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Role Exist Check
private bool CheckRoleWhetherExisting(string roleName)
{
foreach(var m in listBox1.Items)
......@@ -89,6 +115,11 @@ namespace ClientsLibrary.Configuration
return false;
}
#endregion
#region Role Add
private void userButton1_Click(object sender, EventArgs e)
{
using (FormInputNewRole form = new FormInputNewRole())
......@@ -109,6 +140,11 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Role Edit
private void userButton5_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItem is RoleItem role)
......@@ -131,11 +167,21 @@ namespace ClientsLibrary.Configuration
textBox1.Text = role.RoleCode;
textBox2.Text = role.Description;
// refresh
//for (int i = 0; i < listBox1.Items.Count; i++)
// listBox1.Items[i] = listBox1.Items[i];
listBox1.Items[listBox1.SelectedIndex] = listBox1.Items[listBox1.SelectedIndex];
}
}
}
}
#endregion
#region Role Account Edit
private void userButton3_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItem is RoleItem role)
......@@ -152,6 +198,10 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Role Upload Server
private void userButton4_Click(object sender, EventArgs e)
{
// save
......@@ -176,5 +226,30 @@ namespace ClientsLibrary.Configuration
}
}
#endregion
#region Localization Support
/// <summary>
/// 本地化显示的操作,还未完成
/// </summary>
private void UILocalization()
{
label1.Text = UserLocalization.Localization.AccountRoleNameList;
label2.Text = UserLocalization.Localization.AccountRoleAccountList;
label3.Text = UserLocalization.Localization.GeneralUniqueID;
label4.Text = UserLocalization.Localization.GeneralDescription;
userButton1.UIText = UserLocalization.Localization.ButtonAdd;
userButton5.UIText = UserLocalization.Localization.ButtonEdit;
userButton2.UIText = UserLocalization.Localization.ButtonDelete;
userButton3.UIText = UserLocalization.Localization.ButtonEdit;
userButton4.UIText = UserLocalization.Localization.ButtonSave;
}
#endregion
}
}
......@@ -110,14 +110,14 @@ namespace ClientsLibrary
/// <summary>
/// 检查当前账户是否有role角色的权限
/// </summary>
/// <param name="role">角色名称</param>
/// <param name="roleCode">角色名称</param>
/// <returns></returns>
public static bool CheckUserAccountRole(string role)
public static bool CheckUserAccountRole(string roleCode)
{
JObject json = new JObject
{
{ "Name", UserAccount.UserName },
{ "Role", role }
{ "Role", roleCode }
};
HslCommunication.OperateResultString result = Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.检查角色权限,
json.ToString());
......
......@@ -62,18 +62,21 @@ namespace CommonLibrary
#region Public Method
public bool IsAllowAccountOperate(string role,string name)
public bool IsAllowAccountOperate(string roleCode,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].RoleCode == roleCode)
{
if(m_roles[i].Accounts.Contains(name))
if (m_roles[i].Accounts != null)
{
result = true;
if (m_roles[i].Accounts.Contains(name))
{
result = true;
}
}
}
}
......
......@@ -9,8 +9,49 @@ namespace CommonLibrary
public class ChineseLocalization : ILocalization
{
public string FormateDateTime { get; set; } = "yyyy-MM-dd HH:mm:ss";
/// <summary>
/// 唯一标识
/// </summary>
public string GeneralUniqueID { get; set; } = "唯一标识";
/// <summary>
/// 名称
/// </summary>
public string GeneralName { get; set; } = "名称";
/// <summary>
/// 描述
/// </summary>
public string GeneralDescription { get; set; } = "描述";
#region 按钮相关
/// <summary>
/// 确认
/// </summary>
public string ButtonEnsure { get; set; } = "确认";
/// <summary>
/// 新增
/// </summary>
public string ButtonAdd { get; set; } = "新增";
/// <summary>
/// 编辑
/// </summary>
public string ButtonEdit { get; set; } = "编辑";
/// <summary>
/// 删除
/// </summary>
public string ButtonDelete { get; set; } = "删除";
/// <summary>
/// 保存
/// </summary>
public string ButtonSave { get; set; } = "保存";
/// <summary>
/// 取消
/// </summary>
public string ButtonCancel { get; set; } = "取消";
#endregion
#region 账户相关
......@@ -33,10 +74,12 @@ namespace CommonLibrary
public string AccountPortrait { get; set; } = "头像";
public string AccountDetails { get; set; } = "账户详细信息";
public string AccountRegisterTitle { get; set; } = "注册一个新的账户";
public string AccountRoleAdd { get; set; } = "角色新增";
public string AccountRoleEdit { get; set; } = "角色编辑";
public string AccountRoleNameList { get; set; } = "角色名称列表";
public string AccountRoleAccountList { get; set; } = "关联账户列表";
#endregion
#region 配置相关
public string SettingsText { get; set; } = "配置系统的参数";
......
......@@ -8,12 +8,51 @@ namespace CommonLibrary
public class EnglishLocalization : ILocalization
{
public string FormateDateTime { get; set; } = "yyyy/MM/dd HH:mm:ss";
public string ButtonEnsure { get; set; } = "Sure";
/// <summary>
/// 唯一标识
/// </summary>
public string GeneralUniqueID { get; set; } = "Unique ID";
/// <summary>
/// 名称
/// </summary>
public string GeneralName { get; set; } = "Name";
/// <summary>
/// 描述
/// </summary>
public string GeneralDescription { get; set; } = "Descrition";
#region 按钮相关
/// <summary>
/// 确认
/// </summary>
public string ButtonEnsure { get; set; } = "Sure";
/// <summary>
/// 新增
/// </summary>
public string ButtonAdd { get; set; } = "Add";
/// <summary>
/// 编辑
/// </summary>
public string ButtonEdit { get; set; } = "Edit";
/// <summary>
/// 删除
/// </summary>
public string ButtonDelete { get; set; } = "Delete";
/// <summary>
/// 保存
/// </summary>
public string ButtonSave { get; set; } = "Save";
/// <summary>
/// 取消
/// </summary>
public string ButtonCancel { get; set; } = "Cancel";
#endregion
#region 账户相关
public string AccountSelect { get; set; } = "Select";
......@@ -33,11 +72,12 @@ namespace CommonLibrary
public string AccountPortrait { get; set; } = "Portrait";
public string AccountDetails { get; set; } = "Account Details";
public string AccountRegisterTitle { get; set; } = "Register a new account";
public string AccountRoleAdd { get; set; } = "Role add new";
public string AccountRoleEdit { get; set; } = "Role edit";
public string AccountRoleNameList { get; set; } = "Roles List";
public string AccountRoleAccountList { get; set; } = "Account of selected role";
#endregion
#region 配置相关
public string SettingsText { get; set; } = "System parameters settings";
......
......@@ -17,10 +17,6 @@ namespace CommonLibrary
/// </summary>
public static class UserLocalization
{
/// <summary>
/// 默认的语言选项
/// </summary>
public static ILocalization Localization = new ChineseLocalization();
/// <summary>
/// 设置系统的语言选项
......@@ -30,24 +26,99 @@ namespace CommonLibrary
{
if(language.ToLower() == "chinese")
{
Localization = Chinese;
localization = Chinese;
}
else
{
localization = English;
}
}
/// <summary>
/// 获取当前指定的语言选项信息
/// </summary>
/// <param name="language"></param>
/// <returns></returns>
public static ILocalization GetSpecifiedLocalization(string language)
{
if (language.ToLower() == "chinese")
{
return Chinese;
}
else
{
Localization = English;
return English;
}
}
private static ILocalization Chinese = new ChineseLocalization();
private static ILocalization English = new EnglishLocalization();
/// <summary>
/// 默认的语言选项
/// </summary>
public static ILocalization Localization
{
get { return localization; }
}
private static ILocalization Chinese = new ChineseLocalization(); // 中文语言
private static ILocalization English = new EnglishLocalization(); // 英文语言
private static ILocalization localization = Chinese; // 当前语言
}
/// <summary>
/// 所有支持的语言必须从本接口继承
/// </summary>
public interface ILocalization
{
string FormateDateTime { get; set; }
/// <summary>
/// 唯一标识
/// </summary>
string GeneralUniqueID { get; set;}
/// <summary>
/// 名称
/// </summary>
string GeneralName { get; set; }
/// <summary>
/// 描述
/// </summary>
string GeneralDescription { get; set; }
#region 按钮相关
/// <summary>
/// 确认
/// </summary>
string ButtonEnsure { get; set; }
/// <summary>
/// 新增
/// </summary>
string ButtonAdd { get; set; }
/// <summary>
/// 编辑
/// </summary>
string ButtonEdit { get; set; }
/// <summary>
/// 删除
/// </summary>
string ButtonDelete { get; set; }
/// <summary>
/// 保存
/// </summary>
string ButtonSave { get; set; }
/// <summary>
/// 取消
/// </summary>
string ButtonCancel { get; set; }
#endregion
#region 账户相关
......@@ -69,6 +140,10 @@ namespace CommonLibrary
string AccountPortrait { get; set; }
string AccountDetails { get; set; }
string AccountRegisterTitle { get; set; }
string AccountRoleAdd { get; set; }
string AccountRoleEdit { get; set; }
string AccountRoleNameList { get; set; } // 角色名称列表
string AccountRoleAccountList { get; set; } //关联账户列表
#endregion
......
......@@ -45,7 +45,7 @@ namespace CommonLibrary
*
**************************************************************************/
SoftBasic.FrameworkVersion = new SystemVersion("1.6.2");
SoftBasic.FrameworkVersion = new SystemVersion("1.6.3");
}
......
......@@ -697,8 +697,8 @@ namespace 软件系统服务端模版
{
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());
string roleCode = SoftBasic.GetValueFromJsonObject(json, "Role", "");
net_simplify_server.SendMessage(state, handle, UserServer.ServerRoles.IsAllowAccountOperate(roleCode, name).ToString());
}
else
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册