Пример #1
0
        public List <Department> GetDepResult(string parentDepId, string keyword, bool isEnabled)
        {
            var list = new List <Department>();
            var sql  = new Sql("SELECT * from org_t_department WHERE IsEnabled =" + isEnabled);

            if (parentDepId == "")
            {
                sql.Append("AND parentDepId IS NULL");
            }
            else if (parentDepId != null)
            {
                sql.Append("AND parentDepId = @0", parentDepId);
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                sql.AppendLike("AND DepName LIKE @0", keyword);
            }
            sql.Append("ORDER BY DepName collate Chinese_PRC_CS_AS_KS_WS ASC");
            list = db.Fetch <Department>(sql);
            foreach (var item in list)
            {
                item.NodeList         = GetDepNodeList(item.ID);
                item.ParentDepartment = GetById(item.ParentDepID);
            }

            return(list);
        }
Пример #2
0
        /// <summary>
        /// 获取应用列表
        /// </summary>
        /// <param name="applicationName"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public List <RightApplication> GetApplicationList(string applicationName, int?pageIndex, int?pageSize, out int total)
        {
            var sql = new Sql(@"
                        SELECT Id,
                            ApplicationId,
                            ApplicationName
                        FROM RM_T_RightApplication
                        WHERE 1=1");

            if (!string.IsNullOrEmpty(applicationName))
            {
                sql.AppendLike("AND ApplicationName LIKE @0", applicationName);
            }
            List <RightApplication> result;

            if (pageIndex.HasValue && pageSize.HasValue)
            {
                result = Util.FetchPage <RightApplication>(db, sql, pageIndex.Value, pageSize.Value, "ORDER BY Id", out total);
            }
            else
            {
                result = db.Fetch <RightApplication>(sql);
                total  = result.Count;
            }
            return(result);
        }