Example #1
0
        /// <summary>
        /// Read a file from OCF
        /// </summary>
        /// <param name="entry">The entry in the OCF</param>
        /// <returns>The contents of the file as a string</returns>
        protected string GetEntryAsString(ZipEntry entry)
        {
            StringBuilder sb = null;

            using (Stream st = OCF.GetInputStream(entry))
            {
                try
                {
                    byte[] buffer = new byte[8192];
                    int    bytesRead;

                    sb = new StringBuilder(8192);
                    while ((bytesRead = st.Read(buffer, 0, buffer.Length)) != 0)
                    {
                        sb.Append(ASCIIEncoding.ASCII.GetString(buffer, 0, bytesRead));
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            if (sb != null)
            {
                return(sb.ToString().Trim());
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        public bool setPrevOCF(DateTime OCF_PREV_DATE, string DB_TYPE, string USER_ID)
        {
            OCF ocf = new OCF(DB_TYPE);

            //更新OCF_DATE
            return(ocf.UpdatePrevDate(OCF_PREV_DATE));
        }
Example #3
0
 public ServicePrefix1()
 {
     daoTXF     = new TXF();
     daoLOGSP   = new LOGSP();
     daoLOGS    = new LOGS();
     daoTXEMAIL = new TXEMAIL();
     daoTXF1    = new TXF1();
     daoTXF2    = new TXF2();
     daoJRF     = new JRF();
     daoOCF     = new OCF();
 }
 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();
 }
Example #5
0
 public ServicePrefix1()
 {
     daoTXF         = new TXF();
     daoLOGSP       = new LOGSP();
     daoLOGS        = new LOGS();
     daoTXEMAIL     = new TXEMAIL();
     daoTXF1        = new TXF1();
     daoTXF2        = new TXF2();
     daoJRF         = new JRF();
     daoOCF         = new OCF();
     serviceCommon  = new ServiceCommon();
     daoFutAHOCFUPD = new OCFUPD("futAH");
     daoOptAHOCFUPD = new OCFUPD("optAH");
 }
Example #6
0
        /// <summary>
        /// Load the OPF object from the XDocument.  This document is presumed to be a OPF Package file
        /// </summary>
        /// <param name="xd">The OCF container to load from.</param>
        public bool Load(Container con)
        {
            // Get the name of the package file
            var pub = (from p in con.RootFiles
                       where p.MediaType == "application/oebps-package+xml"
                       select p.Name).First();

            // Set the OCF and the ZipEntry and parse the class members from the package file
            if (con.OCF != null)
            {
                OCF = con.OCF;
                if (OCF.FindEntry(pub, false) > -1)
                {
                    ZipEntry = OCF[OCF.FindEntry(pub, false)];

                    // Now parse the package file and load to the child objects
                    Load(XDocument.Parse(GetEntryAsString(ZipEntry)));
                }
            }
            return(true);
        }
Example #7
0
        public bool setOCF(DateTime OCF_DATE, string DB_TYPE, string USER_ID)
        {
            OCF    ocf   = new OCF(DB_TYPE);
            BO_OCF boOCF = ocf.GetOCF();

            if (boOCF == null)
            {
                MessageDisplay.Error("交易日期檔(OCF)讀取錯誤!");
                return(false);
            }

            if (DB_TYPE == "futAH" || DB_TYPE == "optAH")
            {
                if (MessageDisplay.Choose($"請確定交易日期({boOCF.OCF_DATE.AsString("yyyy/MM/dd")}) 沒有例外而遞延日期?\r\n(eg.颱風,災害...)") == System.Windows.Forms.DialogResult.No)
                {
                    return(false);
                }
            }

            //清除異動紀錄檔
            daoFutAHOCFUPD.Delete();
            daoOptAHOCFUPD.Delete();

            if (DB_TYPE == "futAH")
            {
                daoFutAHOCFUPD.Insert(boOCF.OCF_PREV_DATE, boOCF.OCF_DATE, OCF_DATE, USER_ID);
                ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(DB_TYPE);
                ResultData     resultData     = serviceCommon.ExecuteStoredProcedure(connectionInfo, "futAH.sp_FAH_chg_OCF_Hdata", null, false);
            }
            else if (DB_TYPE == "optAH")
            {
                daoOptAHOCFUPD.Insert(boOCF.OCF_PREV_DATE, boOCF.OCF_DATE, OCF_DATE, USER_ID);
                ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(DB_TYPE);
                ResultData     resultData     = serviceCommon.ExecuteStoredProcedure(connectionInfo, "optAH.sp_OAH_chg_OCF_Hdata", null, false);
            }

            //更新OCF_DATE
            return(ocf.UpdateDate(OCF_DATE));
        }