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

This commit is contained in:
dathlin
2017-10-07 21:32:23 +08:00
parent f248effb4c
commit 3cccf070ab
15 changed files with 387 additions and 112 deletions

View File

@@ -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;
}
}
}
}

View File

@@ -9,9 +9,50 @@ namespace CommonLibrary
public class ChineseLocalization : ILocalization
{
public string FormateDateTime { get; set; } = "yyyy-MM-dd HH:mm:ss";
public string ButtonEnsure { get; set; } = "确认";
/// <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; } = "配置系统的参数";

View File

@@ -8,12 +8,51 @@ namespace CommonLibrary
public class EnglishLocalization : ILocalization
{
public string FormateDateTime { get; set; } = "yyyy/MM/dd HH:mm:ss";
/// <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";

View File

@@ -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;
localization = English;
}
}
private static ILocalization Chinese = new ChineseLocalization();
private static ILocalization English = new EnglishLocalization();
/// <summary>
/// 获取当前指定的语言选项信息
/// </summary>
/// <param name="language"></param>
/// <returns></returns>
public static ILocalization GetSpecifiedLocalization(string language)
{
if (language.ToLower() == "chinese")
{
return Chinese;
}
else
{
return English;
}
}
/// <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; }
string ButtonEnsure { 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

View File

@@ -45,7 +45,7 @@ namespace CommonLibrary
*
**************************************************************************/
SoftBasic.FrameworkVersion = new SystemVersion("1.6.2");
SoftBasic.FrameworkVersion = new SystemVersion("1.6.3");
}