示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 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;
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }