public ActionResult GetRole(string keyValue)
        {
            TCRuleBLL bll  = new TCRuleBLL();
            var       data = bll.GetEntity(keyValue);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="infotype"></param>
        /// <param name="authId"></param>
        /// <returns></returns>
        public ActionResult GetTCRuleList(int infotype, string authId)
        {
            TCRuleBLL bll  = new TCRuleBLL();
            var       data = bll.GetList(infotype, authId);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
 public ActionResult RemoveRule(string keyValue)
 {
     try
     {
         TCRuleBLL tCRuleBLL = new TCRuleBLL();
         tCRuleBLL.Delete(keyValue);
         return(Success("成功"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Esempio n. 4
0
        public object GetAuthorizeInfo([FromBody] JObject json)
        {
            try
            {
                string res = json.Value <string>("json");
                MenuConfigRequestModel dy = JsonConvert.DeserializeObject <MenuConfigRequestModel>(res);
                string registcode         = dy.registcode;
                string userId             = dy.userId;
                //获取用户基本信息
                MenuAuthorizeBLL           authorizeBLL = new MenuAuthorizeBLL();
                List <MenuAuthorizeEntity> data         = authorizeBLL.GetListByRegistCode(registcode);
                if (!string.IsNullOrWhiteSpace(userId))
                {
                    UserEntity          user         = new UserBLL().GetEntity(userId);
                    var                 userRoleIds  = user.RoleId.Split(',');
                    TCRuleBLL           tCRuleBLL    = new TCRuleBLL();
                    List <TCRuleEntity> ruleEntities = tCRuleBLL.GetList(data.Select(p => p.Id).ToList());
                    if (data != null && data.Count > 0)
                    {
                        data.ForEach(m =>
                        {
                            List <TCRuleEntity> ts = ruleEntities.Where(x => x.AuthorizCodeId == m.Id).ToList();
                            try
                            {
                                m.ThemeType = ts.FirstOrDefault(p => p.InfoType == 1 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.ThemeType : Convert.ToInt32(ts.FirstOrDefault(p => p.InfoType == 1 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue);
                            }
                            catch (Exception)
                            {
                                m.ThemeType = m.ThemeType;
                            }
                            m.CulturalUrl = ts.FirstOrDefault(p => p.InfoType == 2 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.CulturalUrl : ts.FirstOrDefault(p => p.InfoType == 2 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue;
                            m.IndexUrl    = ts.FirstOrDefault(p => p.InfoType == 3 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.IndexUrl : ts.FirstOrDefault(p => p.InfoType == 3 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue;
                        });
                    }
                }

                return(new { Code = 0, data.Count, Info = "获取数据成功", data });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Info = "获取数据失败", ex.Message });
            }
        }
 public ActionResult SaveRuleForm(string keyValue, TCRuleEntity entity)
 {
     try
     {
         TCRuleBLL tCRuleBLL = new TCRuleBLL();
         if (!string.IsNullOrWhiteSpace(keyValue))
         {
             //修改
             tCRuleBLL.Update(keyValue, entity);
         }
         else
         {
             //新增
             tCRuleBLL.Insert(entity);
         }
         return(Success("成功"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }