/// <summary>
 /// Constructor linking to a Logger method
 /// </summary>
 /// <param name="loggingMethod"></param>
 public FieldInformationManager(LogMethod loggingMethod)
 {
     this.Log = loggingMethod;
     this.tables = new Dictionary<string, Dictionary<string, FieldInformation>>();
     dbHandler = null;
     slxModelHandler = null;
 }
        /// <summary>
        /// Default Constructor
        /// </summary>
        public FieldInformationManager()
        {
            this.tables = new Dictionary<string, Dictionary<string, FieldInformation>>();
            dbHandler = null;
            slxModelHandler = null;

            // no logger: log to console
            this.Log = delegate(string Msg) { Console.WriteLine(Msg); };
        }
 /// <summary>
 /// Setup the connection to the database
 /// </summary>
 /// <param name="dbHandler"></param>
 public void LinkToDb(DbHandler dbHandler)
 {
     this.dbHandler = dbHandler;
 }
Exemplo n.º 4
0
        private void btnTestDb_Click(object sender, EventArgs e)
        {
            DbHandler dbHandler;
            this.CleanLog();

            try
            {
                this.Log("Performing Db Test...");
                dbHandler = new DbHandler(txtServer.Text, txtDatabase.Text, txtUser.Text, txtPassword.Text);
            }
            catch (Exception exc)
            {
                this.Log("Test Failed! Logged Exception:");
                this.Log(exc.Message);
                isDbHandlerInitialized = false;

                return;
            }

            isDbHandlerInitialized = true;

            fields.LinkToDb(dbHandler);

            this.RefreshLoadButton();

            this.Log("Database Connection Completed!\r\nTest Ok");
        }