예제 #1
0
 public void Load()
 {
     using (DBL.DBServer_Factory oFactory = new DBL.DBServer_Factory())
     {
         oFactory.LoadSingleServer(this);
     }
 }
예제 #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();
            }
        }
예제 #3
0
 public void Save()
 {
     using (DBL.DBServer_Factory oFactory = new DBL.DBServer_Factory())
     {
         if (this.ServerID == Guid.Empty)
         {
             this.ServerID = System.Guid.NewGuid();
             oFactory.InsertSingleServer(this);
         }
         else
         {
             oFactory.UpdateSingleServer(this);
         }
     }
 }