Ejemplo n.º 1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(SettingDragons.Instance.Setting.Database.CiUserAp);

            GlobalDaoSetting.Set(connectionInfo);

            reportDirectoryPath = Path.Combine(Environment.CurrentDirectory.Replace("PhoenixCITests", "PhoenixCI"), "Report", DateTime.Now.ToString("yyyyMMdd"));
            Directory.CreateDirectory(reportDirectoryPath);

            string excelTemplateDirectoryPath = Path.Combine(Environment.CurrentDirectory.Replace("PhoenixCITests", "PhoenixCI"), "Excel_Template", "30540.xls");

            destinationFilePath = Path.Combine(reportDirectoryPath, "30540_" + DateTime.Now.ToString("yyyy.MM.dd") + "-" + DateTime.Now.ToString("hh.mm.ss") + "Test.xls");

            File.Copy(excelTemplateDirectoryPath, destinationFilePath, true);
        }
Ejemplo n.º 2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(SettingDragons.Instance.Setting.Database.CiUserAp);

            GlobalDaoSetting.Set(connectionInfo);

            reportDirectoryPath = Path.Combine(Environment.CurrentDirectory.Replace("PhoenixCITests", "PhoenixCI"), "Report", DateTime.Now.ToString("yyyyMMdd"));
            Directory.CreateDirectory(reportDirectoryPath);

            string excelTemplateDirectoryPath = Path.Combine(Environment.CurrentDirectory.Replace("PhoenixCITests", "PhoenixCI"), "Excel_Template", "30393.xlsx");

            destinationFilePath = Path.Combine(reportDirectoryPath, "30393_" + DateTime.Now.ToString("yyyy.MM.dd") + "-" + DateTime.Now.ToString("hh.mm.ss") + "Test.xlsx");

            File.Copy(excelTemplateDirectoryPath, destinationFilePath, true);

            //前月倒數2天交易日
            _StartDate = PbFunc.f_get_last_day("AI3", "RHF", "2018/10", 2);
            //抓當月最後交易日
            _EndDate  = PbFunc.f_get_end_day("AI3", "RHF", "2018/10");
            _workbook = new Workbook();
            //載入Excel
            _workbook.LoadDocument(destinationFilePath);
        }
Ejemplo n.º 3
0
        public static void DBTest(TestContext testContext)
        {
            ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(SettingDragons.Instance.Setting.Database.CiUserAp);

            GlobalDaoSetting.Set(connectionInfo);
        }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            // 將App.config檔裡面DevExpress的設定讀進來
            DevExpress.XtraEditors.WindowsFormsSettings.LoadApplicationSettings();

            #region Log設定

            SingletonLogger.Instance.Severity = (LogSeverity)Enum.Parse(typeof(LogSeverity), SettingDragons.Instance.Setting.Log.LogSeverity, true);

            ILog log = new ObserverLogToDatabase();
            SingletonLogger.Instance.Attach(log);

            log = new ObserverLogToFile("Debug.txt");
            SingletonLogger.Instance.Attach(log);

            log = new ObserverLogToConsole();
            SingletonLogger.Instance.Attach(log);

            #endregion Log設定

            #region GlobalSetting

            SystemStatus.SystemType = SystemType.CI;

            ConnectionInfo connectionInfo = SettingDragons.Instance.GetConnectionInfo(SettingDragons.Instance.Setting.Database.CiUserAp);
            GlobalDaoSetting.Set(connectionInfo);
#if DEBUG
            GlobalInfo.USER_ID       = "I0001";
            GlobalInfo.USER_NAME     = "菲魯特";
            GlobalInfo.USER_DPT_ID   = "J";
            GlobalInfo.USER_DPT_NAME = "資訊規劃部";
#endif

            string reportDirectoryPath = "";

            if (GlobalDaoSetting.GetConnectionInfo.ConnectionName == "CIN2" || Application.StartupPath.IndexOf(@"C:\CI") < 0)
            {
                reportDirectoryPath = Path.Combine(Application.StartupPath, "Report", DateTime.Now.ToString("yyyyMMdd"));
            }
            else
            {
                reportDirectoryPath = Path.Combine(Application.StartupPath, "Excel_Report", DateTime.Now.ToString("yyyyMMdd"));
            }


            string excelTemplateDirectoryPath = "";
            excelTemplateDirectoryPath = Path.Combine(Application.StartupPath, "Excel_Template");

            string batchErrSPDirectoryPath = Path.Combine(Application.StartupPath, "ErrSP");

            Directory.CreateDirectory(reportDirectoryPath);
            GlobalInfo.DEFAULT_REPORT_DIRECTORY_PATH = reportDirectoryPath;

            Directory.CreateDirectory(excelTemplateDirectoryPath);
            GlobalInfo.DEFAULT_EXCEL_TEMPLATE_DIRECTORY_PATH = excelTemplateDirectoryPath;

            Directory.CreateDirectory(batchErrSPDirectoryPath);
            GlobalInfo.DEFAULT_BATCH_ErrSP_DIRECTORY_PATH = batchErrSPDirectoryPath;

            #endregion GlobalSetting

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            // 如果有傳參數進來
            if (args.Length != 0)
            {
                string userID   = args[0];
                string userName = args[1];
                string txnID    = args[2];
                string txnName  = args[3];

                GlobalInfo.USER_ID   = userID;
                GlobalInfo.USER_NAME = userName;
                if (userID.ToUpper() == GlobalDaoSetting.GetConnectionInfo.ConnectionName)
                {
                    GlobalInfo.USER_DPT_ID = " ";
                }
                else
                {
                    DataTable user = new UPF().ListDataByUserId(userID);
                    GlobalInfo.USER_DPT_ID = user.Rows[0]["UPF_DPT_ID"].AsString();
                }
                Application.Run(new FormMain(txnID, txnName));
            }
            else
            {
#if DEBUG
                Application.Run(new FormMain());
#else
                Application.Run(new FormLogin());
#endif
            }
        }