示例#1
0
        /// <summary>
        /// //取得前一季月份
        /// </summary>
        /// <returns></returns>
        public string LastQuarter(DateTime ocfYMD)
        {
            DateTime dateTime = ocfYMD;
            //取得前一季月份
            int month = dateTime.Month;
            int num   = 0;

            if (month % 3 > 0)
            {
                num = (month / 3) + 1;
            }
            else if ((month % 3) == 0)
            {
                num = month / 3;
            }

            DateTime ymd = new DateTime();

            if (num == 1)
            {
                num   = 4;
                month = num * 3;
                ymd   = new DateTime(dateTime.Year - 1, month, 1);
            }
            else
            {
                month = (num - 1) * 3;
                ymd   = new DateTime(dateTime.Year, month, 1);
            }

            //取得前一季月底最後交易日
            DateTime maxDate = new AOCF().GetMaxDate(ymd.ToString("yyyyMM01"), ymd.ToString("yyyyMM31"));

            return(maxDate.ToString("yyyy/MM/dd"));
        }
 public ServiceCommon()
 {
     daoOCF      = new OCF();
     daoAOCF     = new AOCF();
     daoTXN      = new TXN();
     daoTXFPARM  = new TXFPARM();
     daoJSW      = new JSW();
     daoDataGate = new DataGate();
     daoUPF      = new UPF();
     daoDPT      = new DPT();
     daoRPT      = new RPT();
 }
示例#3
0
        /// <summary>
        /// f_20110_SP (同20110的f_20110_SP)
        /// </summary>
        /// <param name="date"></param>
        /// <param name="txnId"></param>
        /// <returns></returns>
        private string RunSP(DateTime date, string txnId)
        {
            string prodType = "M"; //ls_prod_type
            int    rtn;            //li_return

            //轉統計資料TDT
            if (dao20110.sp_U_gen_H_TDT(date, prodType).Status != ResultStatus.Success)
            {
                MessageBox.Show("執行SP(sp_U_gen_H_TDT(" + prodType + "))錯誤! ", "錯誤訊息", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return("E");
            }
            else
            {
                rtn = 0;
            }
            WriteLog("執行sp_U_gen_H_TDT(" + prodType + ")", "Info", "E");

            //Austin 20190813 判斷AOCF該日如無交易不轉統計資料
            AOCF   daoAOCF   = new AOCF();
            string sdate     = date.ToString("yyyyMMdd");
            int    AOCFcount = daoAOCF.GetAOCFDates(sdate, sdate);

            if (AOCFcount > 0)
            {
                /*******************
                *  轉統計資料AI3
                *******************/
                if (dao20110.sp_H_stt_AI3(date).Status != ResultStatus.Success)
                {
                    MessageBox.Show("執行SP(sp_H_stt_AI3)錯誤! ", "錯誤訊息", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return("E");
                }
                else
                {
                    rtn = 0;
                }
                WriteLog("執行sp_H_stt_AI3", "Info", "E");

                /*******************
                *  更新AI6 (震幅波動度)
                *******************/
                if (dao20110.sp_H_gen_AI6(date).Status != ResultStatus.Success)
                {
                    MessageBox.Show("執行SP(sp_H_gen_AI6)錯誤! ", "錯誤訊息", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return("E");
                }
                else
                {
                    rtn = 0;
                }
                WriteLog("執行sp_H_gen_AI6", "Info", "E");

                /*******************
                *  更新AA3
                *******************/
                if (dao20110.sp_H_upd_AA3(date).Status != ResultStatus.Success)
                {
                    MessageBox.Show("執行SP(sp_H_upd_AA3)錯誤! ", "錯誤訊息", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return("E");
                }
                else
                {
                    rtn = 0;
                }
                WriteLog("執行sp_H_upd_AA3", "Info", "E");

                /*******************
                *  更新AI8
                *******************/
                if (dao20110.sp_H_gen_H_AI8(date).Status != ResultStatus.Success)
                {
                    MessageBox.Show("執行SP(sp_H_gen_H_AI8)錯誤! ", "錯誤訊息", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return("E");
                }
                else
                {
                    rtn = 0;
                }
                WriteLog("執行sp_H_gen_H_AI8", "Info", "E");
            }
            return("");
        }