Exemple #1
0
        protected override ResultStatus Export()
        {
            if (!StartExport())
            {
                return(ResultStatus.Fail);
            }
            Workbook workbook = new Workbook();
            string   lsFile   = PbFunc.wf_copy_file(_ProgramID, "30393");

            //載入Excel
            workbook.LoadDocument(lsFile);
            try {
                b30393 = new B30393(workbook, emMonth.Text);
                //前月倒數2天交易日
                DateTime StartDate = PbFunc.f_get_last_day("AI3", "RHF", emMonth.Text, 2);
                //抓當月最後交易日
                DateTime EndDate = PbFunc.f_get_end_day("AI3", "RHF", emMonth.Text);

                //RHF
                ShowMsg("30393-「RHF」期貨契約價量資料 轉檔中...");
                OutputShowMessage = b30393.Wf30393(StartDate, EndDate, "RHF", "30393_1(RHF)");
                ShowMsg("30397-「黃金」期貨契約價量資料(買賣方比重) 轉檔中...");
                OutputShowMessage = b30393.Wf30393abc("RHF", "data_30393_1abc");

                //RTF
                ShowMsg("30393-「RTF」期貨契約價量資料 轉檔中...");
                OutputShowMessage = b30393.Wf30393(StartDate, EndDate, "RTF", "30393_2(RTF)");
                ShowMsg("30397-「黃金」期貨契約價量資料(買賣方比重) 轉檔中...");
                OutputShowMessage = b30393.Wf30393abc("RTF", "data_30393_2abc");

                //XEF
                ShowMsg("30393-「XEF」期貨契約價量資料 轉檔中...");
                OutputShowMessage = b30393.Wf30393(StartDate, EndDate, "XEF", "30393_3(XEF)");
                ShowMsg("30397-「黃金」期貨契約價量資料(買賣方比重) 轉檔中...");
                OutputShowMessage = b30393.Wf30393abc("XEF", "data_30393_3abc");

                //XJF
                ShowMsg("30393-「XJF」期貨契約價量資料 轉檔中...");
                OutputShowMessage = b30393.Wf30393(StartDate, EndDate, "XJF", "30393_4(XJF)");
                ShowMsg("30397-「黃金」期貨契約價量資料(買賣方比重) 轉檔中...");
                OutputShowMessage = b30393.Wf30393abc("XJF", "data_30393_4abc");
            }
            catch (Exception ex) {
                File.Delete(lsFile);
                WriteLog(ex);
                return(ResultStatus.Fail);
            }
            finally {
                //存檔
                workbook.SaveDocument(lsFile);
                EndExport();
            }
            return(ResultStatus.Success);
        }
        public void Wf30393RHF_Test()
        {
            string isCorrect = b30393.Wf30393(_StartDate, _EndDate, "RHF", "30393_1(RHF)");

            Assert.IsNotNull(isCorrect);
        }