public string GetRoleIds(string userId) { string roleIds = string.Empty; if (!string.IsNullOrEmpty(userId)) { try { List <YnRole> listYnRole = YnRoleService.GetInstance().GetListInUser(userId); if (listYnRole != null && listYnRole.Count > 0) { foreach (YnRole ynRole in listYnRole) { if (!string.IsNullOrEmpty(roleIds)) { roleIds += ","; } roleIds += ynRole.id; } } } catch (Exception ex) { throw ex; } } return(roleIds); }
public string GetUserRoleName(string userName) { string userRole = string.Empty; try { List <YnRole> listYnRole = YnRoleService.GetInstance().GetListInUser(userName); if (listYnRole != null && listYnRole.Count > 0) { foreach (YnRole ynRole in listYnRole) { if (!string.IsNullOrEmpty(userRole)) { userRole += ","; } userRole += ynRole.name; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询用户角色(Search YnRole)", ex); throw ex; } return(userRole); }
public void DeleteRole(string ticket, int roleId, ref string message) { try { message = ""; if (!IsTicketValid(ticket)) { throw new Exception("票证验证失败!"); } YnRoleService.GetInstance().Delete(roleId); } catch (Exception ex) { message = ex.Message; } }
public string GetRoleListInUser(string ticket, string userId, ref string message) { try { message = ""; if (!IsTicketValid(ticket)) { throw new Exception("票证验证失败!"); } List <YnRole> listYnRole = YnRoleService.GetInstance().GetListInUser(userId); return(YnBaseClass2.Helper.ObjectHelper.Serialize(listYnRole)); } catch (Exception ex) { message = ex.Message; } return(null); }
public bool UpdateRole(string ticket, string _ynRole, ref string message) { try { message = ""; if (!IsTicketValid(ticket)) { throw new Exception("票证验证失败!"); } YnRole ynRole = (YnRole)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnRole), _ynRole); //ynUser.lastLoginDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); YnRoleService.GetInstance().Update(ynRole); return(true); } catch (Exception ex) { message = ex.Message; } return(false); }
public string SaveRole(string ticket, string _ynRole, ref string message) { try { message = ""; if (!IsTicketValid(ticket)) { throw new Exception("票证验证失败!"); } YnRole ynRole = (YnRole)YnBaseClass2.Helper.ObjectHelper.Deserialize(typeof(YnRole), _ynRole); YnRoleService.GetInstance().Save(ynRole); return(YnBaseClass2.Helper.ObjectHelper.Serialize(ynRole)); } catch (Exception ex) { message = ex.Message; } return(null); }