Example #1
0
        /// <summary>
        /// 修改系统权限数据
        /// </summary>
        /// <param name="model">系统权限数据实体</param>
        /// <returns>返回受影响行数</returns>
        public int UpdateSysPermission(EyouSoft.Model.SystemStructure.SysPermission model)
        {
            if (model == null)
            {
                return(0);
            }

            return(dal.UpdateSysPermission(model));
        }
Example #2
0
        /// <summary>
        /// 获取权限列表
        /// </summary>
        /// <param name="CategoryId">权限大类编号(小于等于0不作条件)</param>
        /// <param name="ClassId">权限类别编号(小于等于0不作条件)</param>
        /// <returns>返回系统权限数据实体集合</returns>
        public virtual IList <Model.SystemStructure.SysPermission> GetSysPermissionList(int CategoryId, int ClassId)
        {
            IList <Model.SystemStructure.SysPermission> List = new List <Model.SystemStructure.SysPermission>();
            string strWhere = Sql_SysPermission_Select + " where 1 = 1 ";

            if (CategoryId > 0)
            {
                strWhere += string.Format(" and CategoryId = {0} ", CategoryId);
            }
            if (ClassId > 0)
            {
                strWhere += string.Format(" and ClassId = {0} ", ClassId);
            }

            DbCommand dc = base.SystemStore.GetSqlStringCommand(strWhere);

            using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore))
            {
                Model.SystemStructure.SysPermission model = null;
                while (dr.Read())
                {
                    model = new EyouSoft.Model.SystemStructure.SysPermission();
                    if (!dr.IsDBNull(0))
                    {
                        model.Id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        model.CategoryId = dr.GetInt32(1);
                    }
                    if (!dr.IsDBNull(2))
                    {
                        model.ClassId = dr.GetInt32(2);
                    }
                    model.PermissionName = dr[3].ToString();
                    if (!dr.IsDBNull(4))
                    {
                        model.SortId = dr.GetInt32(4);
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsEnable")) && dr["IsEnable"].ToString().Equals("1"))
                    {
                        model.IsEnable = true;
                    }
                    else
                    {
                        model.IsEnable = false;
                    }

                    List.Add(model);
                }
            }
            return(List);
        }
Example #3
0
        /// <summary>
        /// 新增系统权限数据
        /// </summary>
        /// <param name="model">系统权限数据实体</param>
        /// <returns>返回受影响行数</returns>
        public virtual int AddSysPermission(EyouSoft.Model.SystemStructure.SysPermission model)
        {
            DbCommand dc = base.SystemStore.GetSqlStringCommand(Sql_SysPermission_Add);

            #region 参数赋值

            base.SystemStore.AddInParameter(dc, "CategoryId", DbType.Int32, model.CategoryId);
            base.SystemStore.AddInParameter(dc, "ClassId", DbType.Int32, model.ClassId);
            base.SystemStore.AddInParameter(dc, "PermissionName", DbType.String, model.PermissionName);
            base.SystemStore.AddInParameter(dc, "SortId", DbType.Int32, model.SortId);
            base.SystemStore.AddInParameter(dc, "IsEnable", DbType.String, model.IsEnable ? "1" : "0");

            #endregion

            return(DbHelper.ExecuteSql(dc, base.SystemStore));
        }
Example #4
0
        /// <summary>
        /// 获取系统权限数据实体
        /// </summary>
        /// <param name="SysPermissionId">系统权限ID</param>
        /// <returns>返回系统权限数据实体</returns>
        public virtual EyouSoft.Model.SystemStructure.SysPermission GetSysPermission(int SysPermissionId)
        {
            Model.SystemStructure.SysPermission model = new EyouSoft.Model.SystemStructure.SysPermission();

            string    strWhere = Sql_SysPermission_Select + " where [Id] = @Id ";
            DbCommand dc       = base.SystemStore.GetSqlStringCommand(strWhere);

            base.SystemStore.AddInParameter(dc, "Id", DbType.Int32, SysPermissionId);

            using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore))
            {
                if (dr.Read())
                {
                    if (!dr.IsDBNull(0))
                    {
                        model.Id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        model.CategoryId = dr.GetInt32(1);
                    }
                    if (!dr.IsDBNull(2))
                    {
                        model.ClassId = dr.GetInt32(2);
                    }
                    model.PermissionName = dr[3].ToString();
                    if (!dr.IsDBNull(4))
                    {
                        model.SortId = dr.GetInt32(4);
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsEnable")) && dr["IsEnable"].ToString().Equals("1"))
                    {
                        model.IsEnable = true;
                    }
                    else
                    {
                        model.IsEnable = false;
                    }
                }
            }

            return(model);
        }