#region 权限
#region 获取权限集合 [1:(1,2,3)|1:(1,2,3) ]
/// <summary>
/// 获取权限集合 [1:(1,2,3)|1:(1,2,3) ]
/// </summary>
/// <param name="str">权限字符串</param>
/// <returns>返回结果的数据集</returns>
public static List<RoleKeyValue> GetRole(string str)
{
List<RoleKeyValue> result = new List<RoleKeyValue>();
RoleKeyValue model = null;
if (!string.IsNullOrEmpty(str))
{
string[] s = str.Split('|');
if (s != null)
{
string[] s1 = null;
s = s.Take(s.Length - 1).ToArray();
for (int i = 0; i < s.Length; i++)
{
s1 = s[i].Split(':');
model = new RoleKeyValue()
{
key = s1[0],
value = s1[1]
};
result.Add(model);
}
}
}
return result;
}
#endregion
public class RoleKeyValue
{
public string key { get; set; }
public string value { get; set; }
}
#endregion
#region 获取权限集合 [1:(1,2,3)|1:(1,2,3) ]
/// <summary>
/// 获取权限集合 [1:(1,2,3)|1:(1,2,3) ]
/// </summary>
/// <param name="str">权限字符串</param>
/// <returns>返回结果的数据集</returns>
public static List<RoleKeyValue> GetRole(string str)
{
List<RoleKeyValue> result = new List<RoleKeyValue>();
RoleKeyValue model = null;
if (!string.IsNullOrEmpty(str))
{
string[] s = str.Split('|');
if (s != null)
{
string[] s1 = null;
s = s.Take(s.Length - 1).ToArray();
for (int i = 0; i < s.Length; i++)
{
s1 = s[i].Split(':');
model = new RoleKeyValue()
{
key = s1[0],
value = s1[1]
};
result.Add(model);
}
}
}
return result;
}
#endregion
public class RoleKeyValue
{
public string key { get; set; }
public string value { get; set; }
}
#endregion