Example #1
0
        /// <summary>
        /// 按主键数组获取列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">组织机构主键</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByIds(BaseUserInfo userInfo, string[] ids)
        {
            var dt = new DataTable(BaseDepartmentEntity.TableName);

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var manager  = new BaseDepartmentManager(dbHelper, userInfo);
                dt           = manager.GetDataTable(BaseDepartmentEntity.FieldId, ids, BaseDepartmentEntity.FieldSortCode);
                dt.TableName = BaseDepartmentEntity.TableName;
            });
            return(dt);
        }
Example #2
0
        /// <summary>
        /// 获取部门列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="parameters">参数</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTable(BaseUserInfo userInfo, List <KeyValuePair <string, object> > parameters)
        {
            var dt = new DataTable(BaseDepartmentEntity.TableName);

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                // 获得组织机构列表
                var manager         = new BaseDepartmentManager(dbHelper, userInfo);
                dt                  = manager.GetDataTable(parameters, BaseDepartmentEntity.FieldSortCode);
                dt.DefaultView.Sort = BaseDepartmentEntity.FieldSortCode;
                dt.TableName        = BaseDepartmentEntity.TableName;
            });
            return(dt);
        }
Example #3
0
        /// <summary>
        /// 按父节点获取列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="parentId">父节点</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByParent(BaseUserInfo userInfo, string parentId)
        {
            var dt = new DataTable(BaseDepartmentEntity.TableName);

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                // 这里可以缓存起来,提高效率
                var manager = new BaseDepartmentManager(dbHelper, userInfo);
                // 这里是条件字段
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseDepartmentEntity.FieldParentId, parentId));
                parameters.Add(new KeyValuePair <string, object>(BaseDepartmentEntity.FieldEnabled, 1));
                parameters.Add(new KeyValuePair <string, object>(BaseDepartmentEntity.FieldDeletionStateCode, 0));
                // 获取列表,指定排序字段
                dt = manager.GetDataTable(parameters, BaseDepartmentEntity.FieldSortCode);
                dt.DefaultView.Sort = BaseDepartmentEntity.FieldSortCode;
                dt.TableName        = BaseDepartmentEntity.TableName;
            });

            return(dt);
        }