Esempio n. 1
0
        protected override ResultStatus Export()
        {
            if (!StartExport())
            {
                return(ResultStatus.Fail);
            }
            string saveFilePath = string.Empty;

            try {
                //資料來源
                DataTable dt = new D40050().GetData(emDate.Text.AsDateTime(), (emYear.Text + "/01/01").AsDateTime(), $"{oswGrpLookItem.EditValue.AsString()}%", $"{chgKind.EditValue.AsString()}%");
                if (dt.Rows.Count <= 0)
                {
                    MessageDisplay.Info(emDate.Text + ",讀取「保證金歷次調整紀錄」無任何資料!");
                    return(ResultStatus.Fail);
                }
                //複製template
                saveFilePath = PbFunc.wf_copy_file(_ProgramID, "40050");
                //呼叫邏輯類別
                b40050 = new B40050(saveFilePath, dt, emCount.Text.AsInt());
                MessageDisplay message = new MessageDisplay();
                /* Sheet:期貨data */
                ShowMsg("40051-期貨資料 轉檔中...");
                message.OutputShowMessage = b40050.Wf40051();
                /* Sheet:選擇權data */
                ShowMsg("40052-選擇權資料 轉檔中...");
                message.OutputShowMessage = b40050.Wf40052();
                /* Sheet:期貨股票類data */
                ShowMsg("40053-期貨股票類資料 轉檔中...");
                message.OutputShowMessage = b40050.Wf40053();
                /* Sheet:選擇權股票類data */
                ShowMsg("40054-選擇權股票類資料 轉檔中...");
                message.OutputShowMessage = b40050.Wf40054();

                //全部查無資料刪除檔案
                if (string.IsNullOrEmpty(message.OutputShowMessage))
                {
                    if (File.Exists(saveFilePath))
                    {
                        File.Delete(saveFilePath);
                    }
                    return(ResultStatus.Fail);
                }
            }
            catch (Exception ex) {
                if (File.Exists(saveFilePath))
                {
                    File.Delete(saveFilePath);
                }
                WriteLog(ex);
                return(ResultStatus.Fail);
            }
            finally {
                EndExport();
            }

            return(ResultStatus.Success);
        }
        public void Wf40052Test()
        {
            string isCorrect = b40050.Wf40052();

            Assert.IsNotNull(isCorrect);
        }