权限
2015-10-14 14:38
169 查看
#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
相关文章推荐
- C#.NET获取拨号连接的宽带连接方法
- PowerShell中使用.NET将程序集加入全局程序集缓存
- .net(c#)中的new关键字详细介绍
- 由vbs sort引发.NET Framework之间的关系说明
- C#难点逐个击破(6):C#数据类型与.net framework数据类型
- .NET中的async和await关键字使用及Task异步调用实例
- .Net中的json操作类用法分析
- .net实现序列化与反序列化实例解析
- .NET中的Timer类型用法详解
- 关于.net(C#)中的跨进程访问的问题
- .NET实现父窗体关闭而不影响子窗体的方法
- 基于.Net中的数字与日期格式化规则助记词的使用详解
- .NET微信公众号开发之公众号消息处理
- .Net下的签名与混淆图文分析
- .NET 扩展实现代码
- .NET实现定时发送邮件代码(两种方式)
- .net实现文件读写的几种常用方法
- .net文件上传时实现通过文件头确认文件类型的方法
- 四个常用的.NET的SQLHELPER方法实例
- .net中前台javascript与后台c#函数相互调用问题