//public String CreateProgrammDataSet (String SenderName, DateTime DayToCreate) // { // //WMB.Basics.IsTestRunLocal = true; // if (WMB.Basics.IsTestRun) // { // WMB.Basics.ReportInformationToEventViewer("Für den Sender \"" + SenderName + "\" wird die ProgrammGenerierung gestarted"); // } // String GenerationName = CreateProgrammDataSet(SenderName, DayToCreate, false); // if (WMB.Basics.IsTestRun) // { // WMB.Basics.ReportInformationToEventViewer("Für den Sender \"" + SenderName + "\" wird die ProgrammGenerierung bendet"); // } // //WMB.Basics.IsTestRunLocal = null; // return GenerationName; // } public String CreateProgrammDataSet (String SenderName, DateTime DayToCreate, bool calledForLocalPurpose) { ManagedProgrammData m_ManagedProgrammData = new ManagedProgrammData (); m_ManagedProgrammData.SenderName = SenderName; m_ManagedProgrammData.ProgrammDataSet = DataAccess.GetProgrammIndependentTables (SenderName); if (m_ManagedProgrammData.ProgrammDataSet == null) { WMB.Basics.ReportErrorToEventViewer ("ManagedProgrammManagement.CreateProgrammDataSet", "Für den Sender \"" + SenderName + "\" und den Zeitpunkt \"" + DayToCreate.ToString() + "\" konnten keine ProgrammIndependentTables gebildet werden"); return String.Empty; } DataSet TableDefinitionsDataSet = DataAddOnAccess.GetCommonDataSet ("Select * from TableDefinitions"); DataTable TableDefinitions = TableDefinitionsDataSet.Tables ["TableDefinitions"]; TableDefinitionsDataSet.Tables.Remove (TableDefinitions); m_ManagedProgrammData.ProgrammDataSet.Tables.Add (TableDefinitions); RemoveLastRecreationTime (m_ManagedProgrammData.ProgrammDataSet, SenderName); m_ManagedProgrammData.SchedulingDataSet = DataAccess.GetActuallScheduling (SenderName, DayToCreate, DayToCreate.AddDays (1)); DoDataSetTestManipulation(m_ManagedProgrammData.SchedulingDataSet); m_ManagedProgrammData.SchedulingDataSet.Tables.Remove(m_ManagedProgrammData.SchedulingDataSet.Tables["Sender"]); m_ManagedProgrammData.FutureSchedulingDataSet = DataAccess.GetActuallScheduling (SenderName, DayToCreate.AddDays (1), DayToCreate.AddYears (5)); DoDataSetTestManipulation(m_ManagedProgrammData.FutureSchedulingDataSet); //if (m_ManagedProgrammData.FutureSchedulingDataSet.Tables ["BeitraegeZuSendungen"].Rows.Count == 0) // throw new Exception ("m_ManagedProgrammData.FutureSchedulingDataSet.Tables [\"BeitraegeZuSendungen\"].Rows.Count == 0"); m_ManagedProgrammData.ProgrammDataSet.Tables.Remove (m_ManagedProgrammData.ProgrammDataSet.Tables ["Sendungen"]); m_ManagedProgrammData.ProgrammDataSet.Tables.Remove (m_ManagedProgrammData.ProgrammDataSet.Tables ["TimingTypen"]); WMB.Basics.AddTables (m_ManagedProgrammData.ProgrammDataSet, m_ManagedProgrammData.SchedulingDataSet); m_ManagedProgrammData.SenderID = m_ManagedProgrammData.ProgrammDataSet.Tables ["Sender"].Rows [0] ["SenderID"].ToString (); //InsertOrderedTableOfProgrammBlocks (m_ManagedProgrammData, DayToCreate); if (m_ManagedProgrammData.ProgrammDataSet.Tables ["Sender"].Rows [0] [ManagedProgrammData.PGM_SENDER_PREVIEW_SHOULD_PROCESSED].ToString () == "Yes") { DataTable PreviewIDDataTable = DataAccess.GetCommonDataSet ("Select BeitragID from Beitraege where " + "(Name = 'BlockPreview' or Name = 'BeitragPreView' or Name = 'BeitragPostView') " + "and BeitragsTyp = 'ExternesProgramm'").Tables ["Beitraege"]; foreach (DataRow PreviewRow in PreviewIDDataTable.Rows) { InsertFullBeitragsDaten (m_ManagedProgrammData, PreviewRow ["BeitragID"].ToString (), DayToCreate); } } AddAllSchedulingEntries (m_ManagedProgrammData, DayToCreate, DayToCreate.AddDays (1)); m_ManagedProgrammData.FillSchedulingDataSet (DayToCreate.Date); if (calledForLocalPurpose) { m_ActuallProgrammData = m_ManagedProgrammData; return ""; } String DataSetSerializationName = Path.Combine (Path.Combine (WMB.Basics.WPMediaServerRootDirectory, SenderName), CVM.CommonValues.SENDER_SUB_PATH_XML_PROGRAMM); //ToDo (m_CVM.WPMediaRoot, SenderName), CVM.CommonValues.SENDER_SUB_PATH_XML_PROGRAMM); if (!Directory.Exists (DataSetSerializationName)) Directory.CreateDirectory (DataSetSerializationName); DataSetSerializationName = Path.Combine(DataSetSerializationName, WMB.Basics.DATASET_PROGRAMM_SCHEMA_NAME); MemoryStream SerializedProgrammDataSet = WMB.Basics.SerializeObjectToMemoryStream (m_ManagedProgrammData); if (SerializedProgrammDataSet != null) { if (WMB.Basics.IsTheContentEqual (DataSetSerializationName, SerializedProgrammDataSet)) { return DataSetSerializationName; } } if (WMB.Basics.IsTestRun) { WMB.Basics.ReportInformationToEventViewer("Der File\r\n\"" + DataSetSerializationName + "\"\r\nmuß neu geschrieben werden"); } CommonDataBase.CommonBasics.SecureFileDelete (DataSetSerializationName, null); Stream DataSetSerializationFile = File.Open (DataSetSerializationName, FileMode.Create, FileAccess.Write); SerializedProgrammDataSet.WriteTo (DataSetSerializationFile); SerializedProgrammDataSet.Flush (); DataSetSerializationFile.Close (); return DataSetSerializationName; }