예제 #1
0
        /// <summary>
        /// 根据条件获取数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="parameters">参数</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByValues(UserInfo userInfo, List <KeyValuePair <string, object> > parameters)
        {
            DataTable dataTable = new DataTable(LinkManTable.TableName);

            using (IDbProvider dbProvider = DbFactoryProvider.GetProvider(BusinessDbType))
            {
                try
                {
                    dbProvider.Open(BusinessDbConnection);
                    // 根据条件获取数据
                    LinkManManager manager = new LinkManManager(dbProvider, userInfo);
                    dataTable           = manager.GetDT(parameters);
                    dataTable.TableName = LinkManTable.TableName;
                }
                catch (Exception ex)
                {
                    CiExceptionManager.LogException(dbProvider, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbProvider.Close();
                }
            }
            return(dataTable);
        }
예제 #2
0
        /// <summary>
        /// 根据主键数组获取数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主鍵</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByIds(UserInfo userInfo, string[] ids)
        {
            DataTable dataTable = new DataTable(LinkManTable.TableName);

            using (IDbProvider dbProvider = DbFactoryProvider.GetProvider(BusinessDbType))
            {
                try
                {
                    dbProvider.Open(BusinessDbConnection);
                    LinkManManager manager = new LinkManManager(dbProvider, userInfo);
                    dataTable           = manager.GetDT(LinkManTable.FieldId, ids, LinkManTable.FieldSortCode);
                    dataTable.TableName = LinkManTable.TableName;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    dbProvider.Close();
                }
            }

            return(dataTable);
        }