Exemple #1
0
        /// <summary>
        /// 批量删除(parentid=0不能删)
        /// </summary>
        /// <param name="ids">逗号分隔的字符串</param>
        public string Del(string ids)
        {
            StringBuilder str = new StringBuilder();

            int[] rightIds = CommonClass.StringHander.Common.GetIntArrayByStringArray(ids.Split(','));
            if (rightIds.Length > 0)
            {
                for (int i = 0; i < rightIds.Length; i++)
                {
                    if (rightIds[i] <= 0)
                    {
                        continue;
                    }
                    else
                    {
                        Eastcom.Model.Sys_Power_Right rightModel = this.GetModel(rightIds[i]);
                        if (null != rightModel && rightModel.ParentId == 0)
                        {
                            continue;
                        }
                    }
                    this.Delete(rightIds[i]);
                }
            }
            return(str.ToString());
        }
Exemple #2
0
    /// <summary>
    /// 权限检查--地区
    /// </summary>
    /// <param name="parentName">父类名 如:(用户管理)</param>
    /// <param name="rightName">权限名,如:新增用户</param>
    /// <param name="isWriteMsg">停止当页执行并输出信息</param>
    /// <returns>ture:有权限</returns>
    public bool CheckRight(string parentName, string rightName, params bool[] isWriteMsg)
    {
        bool flag = false;

        Eastcom.BLL.Sys_Power_Right   rightBLL   = new Eastcom.BLL.Sys_Power_Right();
        Eastcom.Model.Sys_Power_Right rightModel = rightBLL.GetModel(parentName, rightName);

        if (null != rightModel)
        {
            if (CurrentRightModelList != null)
            {
                flag = this.CurrentRightModelList.Exists(m => m.RightID == rightModel.RightID);
            }
        }
        else
        {
            throw new Exception(string.Format("权限配置【{0}——{1}】不存在!", parentName, rightName));
        }
        #region 没有权限的强制登陆
        if (!flag && null != isWriteMsg && isWriteMsg.Length > 0)
        {
            if (isWriteMsg[0])
            {
                NoRightsInfo();
            }
        }
        #endregion
        return(flag);
    }
Exemple #3
0
 /// <summary>
 /// 根据父类ID和权限名,返回model
 /// </summary>
 /// <param name="parentId">父类ID</param>
 /// <param name="rightName">权限名</param>
 /// <returns></returns>
 public Eastcom.Model.Sys_Power_Right GetModel(int parentId, string rightName)
 {
     Eastcom.Model.Sys_Power_Right model = null;
     if (!string.IsNullOrEmpty(rightName))
     {
         List <Eastcom.Model.Sys_Power_Right> lst = this.GetModelList(string.Format("ParentID={0} and RightName='{1}'", parentId, rightName.Trim()));
         if (null != lst && lst.Count > 0)
         {
             model = lst[0];
         }
     }
     return(model);
 }
Exemple #4
0
 /// <summary>
 /// 根据权限类别和权限名返回model
 /// </summary>
 /// <param name="parentName">父类权限,如“用户管理”</param>
 /// <param name="rightName">子类权限,如“新增用户”</param>
 /// <returns></returns>
 public Eastcom.Model.Sys_Power_Right GetModel(string parentName, string rightName)
 {
     Eastcom.Model.Sys_Power_Right model = null;
     if (parentName == "0")
     {
         model = this.GetModel(0, rightName.Trim());
     }
     if (!string.IsNullOrEmpty(parentName) && !string.IsNullOrEmpty(rightName))
     {
         Eastcom.Model.Sys_Power_Right parentModel = this.GetModel(0, parentName.Trim());
         if (null != parentModel)
         {
             model = this.GetModel(parentModel.RightID, rightName);
         }
     }
     return(model);
 }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Eastcom.Model.Sys_Power_Right model)
 {
     return(dal.Update(model));
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Eastcom.Model.Sys_Power_Right model)
 {
     return(dal.Add(model));
 }