Beispiel #1
0
        public DataTable GetDbfFile()
        {
            DataTable dtResult  = NewDataTable();
            DateTime  endDate   = Convert.ToDateTime(AkConfig.EndDate);
            DateTime  startDate = Convert.ToDateTime(AkConfig.StartDate);
            int       days      = (endDate - startDate).Days;

            for (int day = 0; day <= days; day++)
            {
                DataTable curTable = null;
                string    curDate  = endDate.AddDays(-day).ToString("yyyyMMdd");
                if (curDate == DateTime.Now.ToString("yyyyMMdd"))
                {
                    curTable = DbfHelper.OpenDbfFile();
                }
                else
                {
                    curTable = DbfHelper.OpenDbfFile(curDate);
                }

                if (curTable != null)
                {
                    UnitTable(curTable, dtResult);
                }
            }
            return(dtResult);
        }
        /// <summary>
        /// 获取周期内字段“ITEM”起始字符为1的所有dbf记录
        /// </summary>
        /// <returns></returns>
        //private DataTable GetDbfFile()
        //{
        //    DataTable dtResult = NewDataTable();

        //    string date = string.Empty;

        //    //时间以前一天为基点(不含当天),取周期内的数据。
        //    //比如:周期设为1周,当前为 2018-3-10,则时间取:2018-3-03 至 2018-3-09 日,7天时间
        //    string StartDate = DateTime.Now.AddDays(-AkConfig.PeriodNum).ToString("yyyyMMdd");
        //    string EndDate = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");

        //    for (int i = 1; i <= AkConfig.PeriodNum; i++)
        //    {
        //        date = DateTime.Now.AddDays(-i).ToString("yyyyMMdd");
        //        DataTable curTable = DbfHelper.OpenDbfFile(date);
        //        if (curTable != null)
        //        {
        //            UnitTable(curTable, dtResult);
        //        }
        //    }
        //    return dtResult;
        //}

        /// <summary>
        /// 获取周期内字段“ITEM”起始字符为1的所有dbf记录
        /// </summary>
        /// <returns></returns>
        private DataTable GetDbfFile()
        {
            DataTable dtResult = NewDataTable();
            DataTable curTable = DbfHelper.OpenDbfFile();

            if (curTable != null)
            {
                UnitTable(curTable, dtResult);
            }
            return(dtResult);
        }