Beispiel #1
0
        public override void AddCompleteJob(TseJob job)
        {
            List <DateTime> dateList = null;

            if (this._subTypeToFileList.TryGetValue(job.SubDirName, out dateList))
            {
                dateList.Add(job.JobDate);
            }
            //TODO:把TseJob Map成MiIndexMeta  然後寫入檔案內

            MiMarginMeta meta = new MiMarginMeta
            {
                St     = job.SubDirName,
                Dd     = job.JobDate,
                IsH    = job.IsSaturdayOrSunday,
                IsE    = job.IsComplete,
                HasErr = job.WithErr
            };

            string metaRow = JsonConvert.SerializeObject(meta);

            using (StreamWriter sw = new StreamWriter("./Data/TseMeta/MI_MARGIN.txt", true))
            {
                sw.WriteLine(metaRow);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 建立一個MiMargin類型的TseJob
        /// </summary>
        /// <returns></returns>
        public override TseJob CreateJob()
        {
            string   subType = RandomSelectSubType();
            DateTime?jobDate = GetJobDate(subType);

            if (jobDate.HasValue == false)
            {
                return(null);
            }

            string url = string.Format("http://www.tse.com.tw/exchangeReport/MI_MARGN?response=json&date={0}&selectType={1}&", jobDate.Value.ToString("yyyyMMdd"), subType);
            TseJob job = new TseJob
            {
                CreatorType        = JobCreatorType.MiMargin,
                JobType            = "MI_MARGIN",
                HttpHeader         = this._httpHeader,
                Url                = url,
                MainDirName        = this._mainDir,
                SubDirName         = subType,
                JobDate            = jobDate.Value,
                IsSaturdayOrSunday = (jobDate.Value.DayOfWeek == DayOfWeek.Saturday || jobDate.Value.DayOfWeek == DayOfWeek.Sunday) ? true : false,
                FilePath           = string.Format("./{0}/{1}/{2}.json", this._mainDir, subType, jobDate.Value.ToString("yyyy_MM_dd"))
            };

            return(job);
        }
Beispiel #3
0
        public override TseJob CreateJob()
        {
            DateTime?jobMonth = GetJobMonth();

            if (jobMonth.HasValue == false)
            {
                return(null);
            }

            string url = string.Format("http://www.tse.com.tw/exchangeReport/FMTQIK?response=json&date={0}&", jobMonth.Value.ToString("yyyyMMdd"));

            TseJob job = new TseJob
            {
                CreatorType        = JobCreatorType.Fmtqik,
                JobType            = "FMTQIK",
                HttpHeader         = this._httpHeader,
                Url                = url,
                MainDirName        = this._mainDir,
                JobDate            = jobMonth.Value,
                IsSaturdayOrSunday = (jobMonth.Value.DayOfWeek == DayOfWeek.Saturday || jobMonth.Value.DayOfWeek == DayOfWeek.Sunday) ? true : false,
                FilePath           = string.Format("./{0}/{1}.json", this._mainDir, jobMonth.Value.ToString("yyyy_MM"))
            };

            return(job);
        }
Beispiel #4
0
        public override void AddCompleteJob(TseJob job)
        {
            List <DateTime> dateList = null;

            Console.WriteLine("[ AddCompleteJob ] 把任務的次類型[ {0} ]設定為已完成,任務日期[ {1} ]", job.SubDirName, job.JobDate.ToString("yyyy-MM-dd"));
            if (this._subTypeToFileList.TryGetValue(job.SubDirName, out dateList))
            {
                dateList.Add(job.JobDate);
            }
            //TODO:把TseJob Map成MiIndexMeta  然後寫入檔案內

            Twt72uMeta meta = new Twt72uMeta
            {
                St     = job.SubDirName,
                Dd     = job.JobDate,
                IsH    = job.IsSaturdayOrSunday,
                IsE    = job.IsComplete,
                HasErr = job.WithErr
            };

            string metaRow = JsonConvert.SerializeObject(meta);

            using (StreamWriter sw = new StreamWriter("./Data/TseMeta/TWT72U.txt", true))
            {
                Console.WriteLine("[ AddCompleteJob ] 把任務的次類型[ {0} ]的完成資訊寫入檔案,任務日期[ {1} ]", job.SubDirName, job.JobDate.ToString("yyyy-MM-dd"));
                sw.WriteLine(metaRow);
            }
        }
Beispiel #5
0
        public override void AddCompleteJob(TseJob job)
        {
            this._monthFileList.Add(job.JobDate);

            FmtqikMeta meta = new FmtqikMeta
            {
                Dm     = job.JobDate,
                HasErr = job.WithErr,
                IsE    = job.IsComplete,
                IsH    = job.IsSaturdayOrSunday
            };
            string metaRow = JsonConvert.SerializeObject(meta);

            UpdateMetaRecord(job.MainDirName, metaRow);
        }
Beispiel #6
0
 public override void AddCompleteJob(TseJob job)
 {
     throw new NotImplementedException();
 }