diff --git a/ClientsLibrary/AccountSupport/FormAccountSelect.cs b/ClientsLibrary/AccountSupport/FormAccountSelect.cs
index 1dbd707..dea842c 100644
--- a/ClientsLibrary/AccountSupport/FormAccountSelect.cs
+++ b/ClientsLibrary/AccountSupport/FormAccountSelect.cs
@@ -12,6 +12,25 @@ using System.Windows.Forms;
namespace ClientsLibrary
{
+
+ /**************************************************************************************************
+ *
+ * 时间: 2017年10月17日 08:02:15
+ * 功能说明: 本窗口提供一个账户选择的功能,比如在分配任务时,需要支持分配给某个部门的人,或是分配给
+ * 某个角色权限的人,可以在此处进行账户选择,根据实例化参数的不同来区分
+ * 举例: 选择某个工厂的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("分厂示例一",1,1,null)
+ * 选择某个角色的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("2487f33a8f22408ca4bbca5456a7eecb",1,1,null)
+ * 两者区分的条件是判断字符串的长度是否大于等于16
+ * 如果允许选择所有的账户的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("",1,1,null)
+ * 当然也支持选择多个账户,直至选择完成所有的账户
+ *
+ ***************************************************************************************************/
+
+
+
+ ///
+ /// 账户选择器的类,支持从服务器的账户数据上选择我们需要的账户
+ ///
public partial class FormAccountSelect : Form
{
#region Constructor
@@ -19,15 +38,19 @@ namespace ClientsLibrary
///
/// 实例化一个选择服务器账户的窗口,该窗口可以根据工厂属性或是角色属性来筛选
///
- ///
- ///
- public FormAccountSelect(string condition = null, List selected = null)
+ /// 筛选条件
+ /// 选择账户数量的下限
+ /// 选择账户数量的上限
+ /// 已选择的账户名
+ public FormAccountSelect(string condition = null, int minSelected = 0, int maxSelected = int.MaxValue, List selected = null)
{
InitializeComponent();
Icon = UserSystem.GetFormWindowIcon();
m_selected = selected;
m_condition = condition;
+ m_MaxSelected = maxSelected;
+ m_MinSelected = minSelected;
}
@@ -120,7 +143,7 @@ namespace ClientsLibrary
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewRow dgvr = dataGridView1.Rows[i];
- if(dgvr.Cells[0].Value != null)
+ if (dgvr.Cells[0].Value != null)
{
if ((bool)dgvr.Cells[0].Value)
{
@@ -129,6 +152,12 @@ namespace ClientsLibrary
}
}
+ if (m_result.Count < m_MinSelected || m_result.Count > m_MaxSelected)
+ {
+ MessageBox.Show(string.Format(UserLocalization.Localization.FormateBetweenTwoSize, m_MinSelected, m_MaxSelected));
+ return;
+ }
+
DialogResult = DialogResult.OK;
}
@@ -142,6 +171,8 @@ namespace ClientsLibrary
private List m_selected;
private List m_result;
private string m_condition;
+ private int m_MaxSelected = int.MaxValue;
+ private int m_MinSelected = 0;
#endregion
diff --git a/ClientsLibrary/Configuration/RolesConfiguration.cs b/ClientsLibrary/Configuration/RolesConfiguration.cs
index c9ae7a1..ff6fa22 100644
--- a/ClientsLibrary/Configuration/RolesConfiguration.cs
+++ b/ClientsLibrary/Configuration/RolesConfiguration.cs
@@ -183,7 +183,7 @@ namespace ClientsLibrary.Configuration
if (listBox1.SelectedItem is RoleItem role)
{
// select account
- using (FormAccountSelect form = new FormAccountSelect(null, role.Accounts))
+ using (FormAccountSelect form = new FormAccountSelect(null, 0, int.MaxValue, role.Accounts))
{
if (form.ShowDialog() == DialogResult.OK)
{
diff --git a/ClientsLibrary/UserClient.cs b/ClientsLibrary/UserClient.cs
index 96e4b92..43d8eff 100644
--- a/ClientsLibrary/UserClient.cs
+++ b/ClientsLibrary/UserClient.cs
@@ -37,7 +37,7 @@ namespace ClientsLibrary
///
/// 本软件的当前版本,用来验证更新的关键依据
///
- public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171015");
+ public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171017");
///
diff --git a/CommonLibrary/LocalizationSupport/ChineseLocalization.cs b/CommonLibrary/LocalizationSupport/ChineseLocalization.cs
index a34d430..2e9e530 100644
--- a/CommonLibrary/LocalizationSupport/ChineseLocalization.cs
+++ b/CommonLibrary/LocalizationSupport/ChineseLocalization.cs
@@ -23,6 +23,11 @@ namespace CommonLibrary
public string GeneralDescription { get; set; } = "描述";
public string GeneralAllowLoginList { get; set; } = "允许登录列表";
+ #region 格式化文本
+
+ public string FormateBetweenTwoSize { get; set; } = "选择的数量范围为 {0} - {1}";
+
+ #endregion
#region 复选框
diff --git a/CommonLibrary/LocalizationSupport/EnglishLocalization.cs b/CommonLibrary/LocalizationSupport/EnglishLocalization.cs
index 7c470fe..e72a778 100644
--- a/CommonLibrary/LocalizationSupport/EnglishLocalization.cs
+++ b/CommonLibrary/LocalizationSupport/EnglishLocalization.cs
@@ -23,6 +23,12 @@ namespace CommonLibrary
public string GeneralAllowLoginList { get; set; } = "Allow login list";
+ #region 格式化文本
+
+ public string FormateBetweenTwoSize { get; set; } = "Select count should between {0} and {1}";
+
+ #endregion
+
#region 复选框
public string CheckBoxAllowUserMulti { get; set; } = "Allow an account to log if online (except admin)";
diff --git a/CommonLibrary/LocalizationSupport/Localization.cs b/CommonLibrary/LocalizationSupport/Localization.cs
index 8669fad..228aaf8 100644
--- a/CommonLibrary/LocalizationSupport/Localization.cs
+++ b/CommonLibrary/LocalizationSupport/Localization.cs
@@ -93,6 +93,12 @@ namespace CommonLibrary
string GeneralAllowLoginList { get; set; }
+ #region 格式化文本
+
+ string FormateBetweenTwoSize { get; set; }
+
+ #endregion
+
#region 复选框
string CheckBoxAllowUserMulti { get; set; }
diff --git a/CommonLibrary/UserSystem.cs b/CommonLibrary/UserSystem.cs
index cf5dd96..33bf722 100644
--- a/CommonLibrary/UserSystem.cs
+++ b/CommonLibrary/UserSystem.cs
@@ -43,7 +43,7 @@ namespace CommonLibrary
**************************************************************************/
- SoftBasic.FrameworkVersion = new SystemVersion("1.6.17");
+ SoftBasic.FrameworkVersion = new SystemVersion("1.6.18");
}