コード例 #1
0
ファイル: Main.cs プロジェクト: bmiller1009/LinkedInMiner
        /// <summary>
        /// Initializes the log.
        /// </summary>
        private static void InitializeLog()
        {
            _logger = Logger.Instance;

             		_fileLogger = new FileLogger(Global.LogFilePath);
              	_fileLogger.Init();

              	_logger.RegisterObserver(_fileLogger);

            _logger.AddLogMessage("Begin Scraping...");
        }
コード例 #2
0
        public static void DBConnect()
        {
            if (BaseTableAdapter.conn == null)
            {
                Logger filelogger = new FileLogger("DB");
                LogManager.GetInstance().AddLogger(filelogger, "DB", false);
                string connstring = ConfigurationManager.ConnectionStrings["SM_Remote_DB_Conn"].ConnectionString.Trim();
                if (connstring == null)
                {
                    System.Windows.Forms.MessageBox.Show(MissDBParam);
                    throw(new Exception(MissDBParam));
                }

                try
                {
                    BaseTableAdapter.conn = new SAConnection(ConfigurationManager.ConnectionStrings["SM_Remote_DB_Conn"].ConnectionString.Trim());
                    BaseTableAdapter.conn.Open();
                }
                catch (Exception e)
                {
                    string errstr = String.Format("{0} ConnectionString={1}", WrongDBParam, connstring);
                    System.Windows.Forms.MessageBox.Show(errstr);
                    throw (e);
                }
            }
        }