예제 #1
0
        public void WF30780four全部Test()
        {
            b30780 = new B30780(destinationFilePath, "2018/10", "%", new DateTime(2018, 11, 09));
            string msgText = b30780.WF30780four();

            Assert.IsNotNull(msgText);
        }
예제 #2
0
        protected override ResultStatus Export()
        {
            if (!StartExport())
            {
                return(ResultStatus.Fail);
            }
            string         lsFile  = PbFunc.wf_copy_file(_ProgramID, "30780");
            MessageDisplay message = new MessageDisplay();

            try {
                //交易時段
                string lsMarketCode = string.Empty;
                switch (rgTime.EditValue.ToString())
                {
                case "rb_market0":
                    lsMarketCode = "0";
                    break;

                case "rb_market1":
                    lsMarketCode = "1";
                    break;

                default:
                    lsMarketCode = "%";
                    break;
                }
                //em_end_date.text = string(relativedate(date(em_month.text + "/01"), 31), 'yyyy/mm') + "/10";
                DateTime endDate = PbFunc.relativedate(emMonth.Text.AsDateTime("yyyy/MM"), 31);
                //下個月10日
                endDate = new DateTime(endDate.Year, endDate.Month, 10);

                b30780 = new B30780(lsFile, emMonth.Text, lsMarketCode, new D30780().MaxDate(endDate));


                ShowMsg("30780_1-附表1_期貨暨選擇權最近2個月市場成交量變動比較表 轉檔中...");
                message.OutputShowMessage = b30780.WF30780one();
                ShowMsg("30780_2-附表2_期貨暨選擇權最近6個月市場成交量彙總表 轉檔中...");
                message.OutputShowMessage = b30780.WF30780two();
                ShowMsg("30780_4-附表4_國內期貨市場主要期貨商月市占率概況表(依成交量排序) 轉檔中...");
                message.OutputShowMessage = b30780.WF30780four();
                ShowMsg("30780_5-附表5_國內期貨市場期貨商月成交量成長暨衰退概況表 轉檔中...");
                message.OutputShowMessage = b30780.WF30780five();

                //沒有任何資料時刪除檔案
                if (string.IsNullOrEmpty(message.OutputShowMessage))
                {
                    //要跳四次無任何資料才能刪除
                    if (File.Exists(lsFile))
                    {
                        File.Delete(lsFile);
                    }
                    return(ResultStatus.Fail);
                }
            }
            catch (Exception ex) {
                if (File.Exists(lsFile))
                {
                    File.Delete(lsFile);
                }
                WriteLog(ex);
                return(ResultStatus.Fail);
            }
            finally {
                EndExport();
            }

            return(ResultStatus.Success);
        }