Exemple #1
0
        protected override ResultStatus Open()
        {
            base.Open();

            OSW_GRP_LookUpEdit = new RepositoryItemLookUpEdit();
            OSW_GRP_LookUpEdit.SetColumnLookUp(new OCFG().ListAll(), "OSW_GRP", "OSW_GRP_NAME", DevExpress.XtraEditors.Controls.TextEditStyles.Standard, null);
            OSW_GRP.ColumnEdit = OSW_GRP_LookUpEdit;
            CreateEmptyItem();
            b40042 = new B40042();
            Retrieve();
            //抓取交易日期
            string emdate = gvMain.GetRowCellValue(0, gvMain.Columns["DT_DATE"]).AsDateTime().ToString("yyyy/MM/dd");

            //交易日期
            DateLabel.Text = emdate;
            //狀態顯示
            StatusLabel.Text = b40042.Status(emdate);
#if DEBUG
            //DateLabel.Text = "2018/10/12";
            TestBtn.Visible = true;
#endif
            if (!FlagAdmin)
            {
                TestBtn.Visible = false;
            }
            else
            {
                TestBtn.Visible = true;
            }

            return(ResultStatus.Success);
        }
      protected override ResultStatus Export() {

         string saveFilePath = PbFunc.wf_copy_file(_ProgramID , _ProgramID);
         try {
            if (!StartExport()) {
               return ResultStatus.Fail;
            }
            b40042 = new B40042(saveFilePath , DateLabel.Text , GlobalInfo.USER_ID);
            MessageDisplay message = new MessageDisplay();

            ShowMsg($"{_ProgramID}_mg1-股票期貨保證金狀況表-標的證券為受益憑證 轉檔中...");
            message.OutputShowMessage = b40042.Wf40042();
            ShowMsg($"{_ProgramID}_40011_1-保證金狀況表 轉檔中...");
            message.OutputShowMessage = b40042.Wf40011Fut();
            ShowMsg($"{_ProgramID}_40011_2-保證金狀況表 轉檔中...");
            message.OutputShowMessage = b40042.Wf40011Opt();
            ShowMsg($"{_ProgramID}_40012_1-保證金狀況表 轉檔中...");
            message.OutputShowMessage = b40042.Wf40012Fut();
            ShowMsg($"{_ProgramID}_40012_2-保證金狀況表 轉檔中...");
            message.OutputShowMessage = b40042.Wf40012Opt();
            ShowMsg($"{_ProgramID}_40013_1-保證金狀況表 轉檔中...");
            message.OutputShowMessage = b40042.Wf40013Fut();
         } catch (Exception ex) {
            if (File.Exists(saveFilePath))
               File.Delete(saveFilePath);
            WriteLog(ex);
            return ResultStatus.Fail;
         } finally {
            EndExport();
         }

         return ResultStatus.Success;
      }