Exemplo n.º 1
0
 public void Load()
 {
     using (DBL.DBDatabase_Factory oFactory = new DBL.DBDatabase_Factory())
     {
         oFactory.LoadSingleDatabase(this);
     }
 }
Exemplo n.º 2
0
        private void SetDB()
        {
            //What server are we scanning?
            AGENT.DBServerAgent_Factory oServerAgent = new AGENT.DBServerAgent_Factory(m_ConnectionString);
            string sServerName = oServerAgent.GetServerName();

            //Does this server exist? If not, create it.
            BLL.Server oServer = null;

            DBL.DBServer_Factory oServerFactory = new DBL.DBServer_Factory();
            m_ServerID = oServerFactory.GetServerID(sServerName);
            if (m_ServerID == Guid.Empty)
            {
                //Create new server record.
                oServer      = new BLL.Server();
                oServer.Name = sServerName;
                oServer.Save();

                m_ServerID = oServer.ServerID;
            }
            else
            {
                //load existing server
                oServer = new BLL.Server(m_ServerID);
                oServer.Load();
            }

            //What database are we scanning?
            AGENT.DBDatabaseAgent_Factory oDatabaseAgent = new AGENT.DBDatabaseAgent_Factory(m_ConnectionString);
            string sDatabaseName = oDatabaseAgent.GetDatabaseName();

            //Does this database exist? If not, create it.
            BLL.Database oDatabase = null;

            DBL.DBDatabase_Factory oDatabaseFactory = new DBL.DBDatabase_Factory();
            m_DBID = oDatabaseFactory.GetDatabaseID(m_ServerID, sDatabaseName);
            if (m_DBID == Guid.Empty)
            {
                //Create new database record
                oDatabase      = new BLL.Database(oServer.ServerID);
                oDatabase.Name = sDatabaseName;
                oDatabase.Save();

                m_DBID = oDatabase.DBID;
            }
            else
            {
                //Load existing database
                oDatabase = new BLL.Database(m_ServerID, m_DBID);
                oDatabase.Load();
            }
        }
Exemplo n.º 3
0
 public void Save()
 {
     using (DBL.DBDatabase_Factory oFactory = new DBL.DBDatabase_Factory())
     {
         if (this.DBID == Guid.Empty)
         {
             this.DBID = System.Guid.NewGuid();
             oFactory.InsertSingleDatabase(this);
         }
         else
         {
             oFactory.UpdateSingleDatabase(this);
         }
     }
 }