Exemple #1
0
        /// <summary>
        /// Sets the Datasource to be Mock or SQL
        /// </summary>
        /// <param name="dataSourceEnum"></param>
        public static void SetDataSource(DataSourceEnum dataSourceEnum)
        {
            if (dataSourceEnum == DataSourceEnum.SQL)
            {
                // SQL not hooked up yet...
                throw new NotImplementedException();
            }

            // Default is to use the Mock
            DataSource = ArchiveDataSourceMock.Instance;
        }
Exemple #2
0
        private void IniConfigSetting()
        {
            Config config = new Config();
            dsArchiveID = new DataSet();
            string arcConnString = config.GetConnectionString("ArcConnectionString");
            string copyConnString = config.GetConnectionString("CopyConnectionString");
            string deleteConnString = config.GetConnectionString("DeleteConnectionString");
            bool isTest = config.GetValue("IsTest") == "Y" ? true : false;
            if (isTest)
            {
                arcConnString = config.GetConnectionString("TestArcConnectionString");
                copyConnString = config.GetConnectionString("TestCopyConnectionString");
                deleteConnString = config.GetConnectionString("TestDeleteConnectionString");

            }



            _arcSqlCon = new SqlConnection(arcConnString);
            _copySqlCon = new SqlConnection(copyConnString);
            _deleteSqlCon = new SqlConnection(deleteConnString);



            _archiveDay = int.Parse(config.GetValue("Day"));
            _cdtDay = int.Parse(config.GetValue("CdtDay"));
            _logDay = int.Parse(config.GetValue("KeepLogDay"));
            _deleteRows = int.Parse(config.GetValue("DeleteRows"));
            _selepTime = config.GetValue("SelepTime");
            _deleteTimeOut = int.Parse(config.GetValue("DeleteTimeOut"));
            //    _checkMinDiffCount = int.Parse(config.GetValue("CheckMinDiffCount"));
            string logPath = config.GetValue("LogPath");
            _xmlPath = config.GetValue("XMLPath");
            _continuteDeleteDay = int.Parse(config.GetValue("ContinueDeleteDay"));
            _infoLog = new Log(logPath, LogType.Info);
            _errorLog = new Log(logPath, LogType.Error);
            _timeStamp = DateTime.Now.ToString("yyyyMMddHHmm");
            //   _isNeedExportXML = config.GetValue("IsNeedExportToXML") == "Y" ? true : false;
            _isDeletSrcData = config.GetValue("IsDeleteSrcData") == "Y" ? true : false;
            _mail = new Mail();
            _dbName = config.GetValue("DBName");
            _mailErrTitle = "Archive " + _dbName + " Error :";

            string ddlPath = System.AppDomain.CurrentDomain.BaseDirectory + _dbName + ".dll";
            Assembly asmb = Assembly.LoadFrom(ddlPath);
            _objDBSetting = (IArchiveInterface)asmb.CreateInstance("DBSetting." + _dbName);
        }