示例#1
0
        /// <summary>
        /// The class constructor. </summary>
        ///  <param name="fileconfig">Database config filepath.</param>
        public DBConfig(string fileconfig)
        {
            //reset the flag
            isInitialized = false;

            try
            {
                //Change ConfigurationManager file to the DBConfig Path.
                DBconfigMap = new ExeConfigurationFileMap();
                DBconfigMap.ExeConfigFilename = fileconfig;
                DBconfigFile = ConfigurationManager.OpenMappedExeConfiguration(DBconfigMap, ConfigurationUserLevel.None);

                //Open the server definitions in the DB config file.
                //MainServer = new ServerSect("ServerMain", DBconfigFile);
                MainServer = (ServerSect)DBconfigFile.GetSection("ServerMain");
                //BackupServer = new ServerSect("ServerBackup", DBconfigFile);
                BackupServer = (ServerSect)DBconfigFile.GetSection("ServerBackup");

                //Initialize the History Object Config.
                //HistMaster = new HistoricsSett("HistoricsMaster", DBconfigFile);
                HistMaster = (HistoricsSett)DBconfigFile.GetSection("HistoricsMaster");
                HistBackup = (HistoricsSett)DBconfigFile.GetSection("HistoricsBackup");

                if ((MainServer != null) && (HistMaster != null))
                {
                    isInitialized = true;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
示例#2
0
 /// <summary>
 /// The class constructor.
 /// Requires to specify the section to be opened. </summary>
 /// <param name="sect"> Section to Open in the Config File.</param>
 /// <param name="DBconfigFile"> Configuration file mapped.</param>
 public ServerSect(string sect, Configuration DBconfigFile)
 {
     settings = DBconfigFile.GetSection(sect) as ServerSect;
 }
示例#3
0
 /// <summary>
 /// The class default constructor. </summary>
 public ServerSect()
 {
     settings = null;
 }