Esempio n. 1
0
        /// <summary>
        /// 角色列表
        /// </summary>
        /// <returns></returns>
        public IEnumerable <RoleEntity> GetList()
        {
            var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_Role where 1=1 and Category=@0 and EnabledMark=1 and DeleteMark=0", (int)QSDMS.Model.Enums.RoleCategoryEnum.角色);

            sql.Append(" order by CreateDate desc");
            var list = Base_Role.Query(sql);

            return(EntityConvertTools.CopyToList <Base_Role, RoleEntity>(list.ToList()));
        }
Esempio n. 2
0
        /// <summary>
        /// 角色名称不能重复
        /// </summary>
        /// <param name="fullName">名称</param>
        /// <param name="keyValue">主键</param>
        /// <returns></returns>
        public bool ExistFullName(string fullName, string keyValue)
        {
            var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_Role where 1=1 and Category=@0", (int)QSDMS.Model.Enums.RoleCategoryEnum.角色);

            if (!string.IsNullOrEmpty(fullName))
            {
                sql.Append(" and FullName=@0", fullName);
            }
            if (!string.IsNullOrEmpty(keyValue))
            {
                sql.Append(" and RoleId!=@0", keyValue);
            }
            return(Base_Role.Query(sql).Count() == 0 ? true : false);
        }