コード例 #1
0
ファイル: Engines.cs プロジェクト: stellar1/PlayoutAutomation
 public void Save()
 {
     try
     {
         _db.Open(ConnectionStringPrimary, ConnectionStringSecondary);
         EngineList.ForEach(e =>
         {
             if (e.IsModified)
             {
                 if (e.Id == 0)
                 {
                     _db.DbInsertEngine(e);
                 }
                 else
                 {
                     _db.DbUpdateEngine(e);
                 }
             }
         });
         DeletedEngines.ForEach(s => { if (s.Id > 0)
                                       {
                                           _db.DbDeleteEngine(s);
                                       }
                                });
     }
     finally
     {
         _db.Close();
     }
 }
コード例 #2
0
ファイル: Engines.cs プロジェクト: stellar1/PlayoutAutomation
 public Engines(string connectionStringPrimary, string connectionStringSecondary)
 {
     ConnectionStringPrimary   = connectionStringPrimary;
     ConnectionStringSecondary = connectionStringSecondary;
     _db = DatabaseProviderLoader.LoadDatabaseProvider();
     _db.Open(connectionStringPrimary, connectionStringSecondary);
     ArchiveDirectories = new ArchiveDirectories(_db);
     try
     {
         _db.Open();
         EngineList = _db.DbLoadEngines <Engine>();
         Servers    = _db.DbLoadServers <CasparServer>();
         Servers.ForEach(s =>
         {
             s.Channels.ForEach(c => c.Owner  = s);
             s.Recorders.ForEach(r => r.Owner = s);
         });
         EngineList.ForEach(e =>
         {
             e.IsNew              = false;
             e.Servers            = Servers;
             e.ArchiveDirectories = ArchiveDirectories;
         });
     }
     finally
     {
         _db.Close();
     }
 }
コード例 #3
0
 public void Save()
 {
     EngineList.ForEach(e =>
     {
         if (e.IsModified)
         {
             if (e.Id == 0)
             {
                 _db.InsertEngine(e);
             }
             else
             {
                 _db.UpdateEngine(e);
             }
         }
     });
     DeletedEngines.ForEach(s =>
     {
         if (s.Id > 0)
         {
             _db.DeleteEngine(s);
         }
     });
 }