日期:2014-05-17 浏览次数:20504 次
string InRoles = "1;2;3;4";//得到角色 StringBuilder sb = new StringBuilder(); foreach (var item in InRoles.Split(';')) { switch (item) { case "1": sb.Append("管理员;"); break; case "2": sb.Append("普通用户;"); break; } } string _result = sb.ToString().TrimEnd(';');//管理员;普通用户
------解决方案--------------------
public string GetRole(string InRoles) { string roles = ""; foreach (string role in InRoles.Split(';')) { switch (role) { case "1": roles += "管理员角色;"; break; case "2": roles += "普通用户;"; break; case "3": roles += "录入人员;"; break; case "4": roles += "编辑人员;"; break; case "5": roles += "审核人员;"; break; case "6": roles += "签发人员;"; break; } } return roles.subString(0,roles.length-1); }