Пример #1
0
        public PagingDataInfo(IPagingDataInfo pdata,string tableName,string filter,string fields)
        {
            this.SortedFields = pdata.SortedFields;
            this.PageIndex = pdata.PageIndex;
            this.PageSize = pdata.PageSize;

            this.TableName = tableName;
            this.Filter = filter;
            this.Fields = fields;
        }
Пример #2
0
 public PagingDataInfo(IPagingDataInfo pdata)
 {
     this.SortedFields = pdata.SortedFields;
     this.PageIndex = pdata.PageIndex;
     this.PageSize = pdata.PageSize;
 }
Пример #3
0
        /// <summary>
        /// 执行相应读取分页数据方法.
        /// </summary>
        /// <param name="type">类.写法:typeof(namespace.Class);</param>
        /// <param name="methodName">方法名.</param>
        /// <param name="pDataInfo">分页参数.</param>
        /// <param name="parameters">方法需要用到的参数.</param>
        /// <returns></returns>
        public static DataTable Execute(Type type, string methodName, IPagingDataInfo pDataInfo, object parameters)
        {
            object obj = Activator.CreateInstance(type);
            MethodInfo mo = type.GetMethod(methodName);

            object[] param = { pDataInfo };
            object[] param1 = { pDataInfo, parameters };

            if (parameters != null)
            {
                //此处将参数分开用了逗号,如果现实中逗号不能满足可能需要更改.
                object[] param2 = parameters.ToString().Split(',');
                //add by wzy 2009-01-15 start
                if (parameters.ToString().IndexOf("DATEDIFF") > -1)
                {
                    param2 = parameters.ToString().Split('^');
                }
                //add by wzy 2009-01-15 end
                if (param2.Length > 1)
                {
                    ArrayList arr = new ArrayList();
                    arr.Insert(0, pDataInfo);

                    for (int i = 1; i < param2.Length + 1; i++)
                    {
                        arr.Insert(i, param2[i - 1]);
                    }

                    param = new object[arr.Count];
                    for (int i = 0; i < arr.Count; i++)
                    {
                        param[i] = arr[i];
                    }
                }
                else
                {
                    param = param1;
                }
            }

            return (DataTable)mo.Invoke(obj, param);
        }