예제 #1
0
public bool SetData (String ManagedProgrammDataFileName)
	{
	m_CVM = new CommonValues();
	m_ManagedProgrammDataFileName = ManagedProgrammDataFileName;
	m_ManagedProgrammData = WMB.Basics.DeSerializeObjectFromFile
				(m_ManagedProgrammDataFileName) as ManagedProgrammData;
	if (m_ManagedProgrammData == null)
		{
		WMB.Basics.ReportErrorToEventViewer ("HTMLCreator.SetData",
			"Aus dem File \"" + m_ManagedProgrammDataFileName
			+ "\" konnte kein \"ManagedProgrammManagement\" Element erzeugt werden");
		return false;
		}
	m_HTMLDirectory = Path.Combine(System.IO.Path.GetDirectoryName (System.IO.Path.GetDirectoryName (ManagedProgrammDataFileName)),
		CVM.CommonValues.SENDER_SUB_PATH_HTML_PROGRAMM);
	//m_HTMLDirectory = Path.Combine (m_HTMLDirectory, "NewVersion");
	if (!Directory.Exists (m_HTMLDirectory))
		Directory.CreateDirectory (m_HTMLDirectory);
	m_HTMLFileNameToCreate = Path.Combine (m_HTMLDirectory, HTML_PROGRAMM_SCHEMA_NAME);
	m_DataHandling = new DataHandling ();
	return true;

	}
예제 #2
0
		private bool StartPlayableEntry (ManagedProgrammData ProgrammData, DataRow ActuallRowToStart)
			{
			NameValueCollection ControlInformations = ProgrammData.GetPlayableControlInformations (ActuallRowToStart);
			if (ControlInformations == null)
				{
				WMB.Basics.ReportErrorToEventViewer ("PlayingDataPlayer.StartPlayableEntry",
					"Der Beitrag \"" + ActuallRowToStart ["Name"].ToString () + "\" mit der ID \""
					+ ActuallRowToStart ["ConnectedID"].ToString () + "\" und dem Typ \""
					+ ActuallRowToStart ["ConnectedIDTyp"].ToString () + "\" konnte nicht gestared werden");
				return false;
				
				}
			String ProcessorName = ControlInformations [ManagedProgrammData.Param_ProcessorFileName];
			ControlInformations.Add (CVM.CommonValues.WPMEDIA_STOP_TIME_PARAMETER.Replace ("/", "").Replace ("=", ""),
								ActuallRowToStart ["BisTime"].ToString ());
			ControlInformations.Add (ManagedProgrammData.Param_OrderNumber, ActuallRowToStart ["OrderNumber"].ToString ());
			if (m_CVM.UseTestTime == true)
				{
				m_CVM.AddTestTimeControlInformations (ControlInformations);
				
				}
			List<String> ParameterEntries = ProgrammData.CreateParameterList (ControlInformations);

			String Parameter = String.Join (" ", ParameterEntries.ToArray ());


			try
				{
				StartPlayerProgramm (ProcessorName, Parameter);
				}
			catch (Exception Excp)
				{
				WMB.Basics.ReportErrorToEventViewer ("PlayingDataPlayer.StartPlayableEntry",
					"Der Beitrag \"" + ActuallRowToStart ["Name"].ToString () + "\" mit der ID \""
					+ ActuallRowToStart ["ConnectedID"].ToString () + "\" und dem Typ \""
					+ ActuallRowToStart ["ConnectedIDTyp"].ToString () + "\" brachte folgene Exception:\r\n"
					+ Excp.ToString());
				} 
			return true;
			}
예제 #3
0
		public bool LoadThisBeitragFull (ManagedProgrammData m_ManagedProgrammData, String BeitragID)
			{
			DataSet FullBeitragsDaten = DataAccess.GetSchedulingEntry (m_ManagedProgrammData.SenderName,
							new Guid (BeitragID), true, false, false);
			RemoveLastRecreationTime (FullBeitragsDaten, m_ManagedProgrammData.SenderName);
			m_ManagedProgrammData.FullBeitragList.Add (BeitragID, FullBeitragsDaten);
			return true;
			}
예제 #4
0
		public ManagedProgrammData LoadProgrammData (String ProgrammDataSetFileName)
			{
			if (!File.Exists (ProgrammDataSetFileName))
				return null;
			m_ProgrammData = WMB.Basics.DeSerializeObjectFromFile
							(ProgrammDataSetFileName) as ManagedProgrammData;
			if (m_ProgrammData == null)
				{
				WMB.Basics.ReportErrorToEventViewer ("ManagedProgrammManagement.LoadProgrammData",
					"Der ProgrammDataSetFileName\r\n\"" + ProgrammDataSetFileName + "\\r\nkann nicht geladen werden");
				return null;
				}
			if (m_ProgrammData.IAmCorrect ())
				return m_ProgrammData;
			WMB.Basics.ReportErrorToEventViewer ("ManagedProgrammManagement.LoadProgrammData",
				"Das ProgrammDataSet aus dem ProgrammDataSetFileName\r\n\"" + ProgrammDataSetFileName + "\\r\nist nicht korekt");
			return null;
			}
예제 #5
0
		private bool InsertFullBeitragsDaten (ManagedProgrammData m_ManagedProgrammData,
			String BeitragID, DateTime RunningDay)
			{
			if (String.IsNullOrEmpty (BeitragID))
				return false;
			if (m_ManagedProgrammData.FullBeitragList == null)
				m_ManagedProgrammData.FullBeitragList = new Dictionary<string, DataSet> ();
			if (m_ManagedProgrammData.FullBeitragList.ContainsKey (BeitragID))
				return true;
			
			DataSet VonBisTimingsForThisBeitrag = DataAccess.GetCommonDataSet (String.Format (
					"Select BeitragID, Name from BeitraegeImZeitraum where BeitragID = '{0}' and "
					+ "(TimeB >= {1} And TimeA <= {1}) and "
					+ "ZuordnungsID = '{2}'",
					BeitragID, WMB.Basics.GetSQLFormattedDateTime(RunningDay), m_ManagedProgrammData.SenderID));

			if (VonBisTimingsForThisBeitrag.Tables ["BeitraegeImZeitraum"].Rows.Count > 0)
				{
				return LoadThisBeitragFull (m_ManagedProgrammData, BeitragID);
				}
			return false;
			}
예제 #6
0
		private void AddAllSchedulingEntries (ManagedProgrammData m_ManagedProgrammData, DateTime GlobalFrom, DateTime GlobalTo)
			{
			InsertOrderedTableOfProgrammBlocks (m_ManagedProgrammData, GlobalFrom);

			bool InsertPixel = true;
			double RunningDay = 0;
			while (GlobalFrom.AddDays (RunningDay) <= GlobalTo)
				{
				DateTime RunningStartTime = GlobalFrom.AddDays (RunningDay);
				if (WMB.Basics.IsTestRun)
					WMB.Basics.ReportInformationToEventViewer ("ManagedProgrammManagement.AddAllSchedulingEntries",
					"RunningStartTime (" + m_ManagedProgrammData .SenderName + ") = "
						+ RunningStartTime.ToString ("yyyy.MM.dd HH:mm.ss"));
				DataView OrderedTableOfProgrammBlocks = m_ManagedProgrammData.GetOrderedViewOfProgrammBlocks ();
				int BlockIndex = 0;
				foreach (DataRowView BlockRowView in OrderedTableOfProgrammBlocks)
					{
					String BlockID = BlockRowView.Row ["BlockID"].ToString ();
					String FillBeitragID = BlockRowView.Row
									[CVM.CommonValues.PGM_FILL_BEITRAG_ID].ToString ();
					if (!String.IsNullOrEmpty (FillBeitragID))
						InsertFullBeitragsDaten (m_ManagedProgrammData, FillBeitragID, RunningStartTime);
					DataView SendungenDefinedForThisBlock = new DataView (m_ManagedProgrammData.ProgrammDataSet.
						Tables ["SendungenZuProgrammBloecke"],
						String.Format ("BlockID = '{0}'", BlockID),
						"Reihenfolge", DataViewRowState.CurrentRows);
					foreach (DataRowView SendungRow in SendungenDefinedForThisBlock)
						{
						String SendungID = SendungRow.Row ["SendungID"].ToString ();
						DataView BeitraegeDefinedForThisSendung = new DataView (m_ManagedProgrammData.ProgrammDataSet.
							Tables ["BeitraegeZuSendungen"],
							String.Format ("SendungID = '{0}'", SendungID),
							"", DataViewRowState.CurrentRows);
						foreach (DataRowView BeitragRow in BeitraegeDefinedForThisSendung)
							{
							String BeitragID = BeitragRow.Row ["BeitragID"].ToString ();
							InsertFullBeitragsDaten (m_ManagedProgrammData, BeitragID, RunningStartTime);
							}
						}
					}
				List<String> EntriesToAdd = new List<string> ();
				if (m_ManagedProgrammData.FullBeitragList != null)
					{
					foreach (String BeitragID in m_ManagedProgrammData.FullBeitragList.Keys)
						{
						if (m_ManagedProgrammData.FullBeitragList.ContainsKey (BeitragID))
							{
							String [] OptionsStrings = m_ManagedProgrammData.FullBeitragList [BeitragID].Tables
								["Beitraege"].Rows [0] ["BeitragProperties"].
								ToString ().Split (';');
							foreach (String OptionString in OptionsStrings)
								{
								String [] SingleOption = OptionString.Trim (new Char [] {'(', ')', ' '}).Split (':');
								if (SingleOption.Length == 2)
									{
									if (SingleOption [0] == CVM.DataHandling.OPTION_BACKGROUND_BEITRAG)
										{
										if (!String.IsNullOrEmpty (SingleOption [1]))
											{
											String [] Elements = SingleOption [1].Split ('|');
											if (Elements.Length == 2)
												if (!EntriesToAdd.Contains (Elements [1]))
													EntriesToAdd.Add (Elements [1]);
											}
										}
									if (SingleOption [0] == CVM.DataHandling.OPTION_FOREGROUND_BEITRAG)
										{
										if (!String.IsNullOrEmpty (SingleOption [1]))
											{
											String [] Elements = SingleOption [1].Split ('|');
											if (Elements.Length == 2)
												if (!EntriesToAdd.Contains (Elements [1]))
													EntriesToAdd.Add (Elements [1]);
											}
										}
									}
								}
							}
						}
					}
				foreach (String EntryToAdd in EntriesToAdd)
					{
					InsertFullBeitragsDaten (m_ManagedProgrammData, EntryToAdd, RunningStartTime);
					}
				RunningDay += 1.0;
				}
			}
예제 #7
0
		private void InsertOrderedTableOfProgrammBlocks
			(ManagedProgrammData m_ManagedProgrammData, DateTime StartTime)
			{
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks = new DataTable ("OrderedTableOfProgrammBlocks");
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("BlockID", typeof (System.Guid));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("ProgrammBlockName", typeof (System.String));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("Order", typeof (System.String));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("Von", typeof (DateTime));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("Bis", typeof (DateTime));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add (CVM.CommonValues.PGM_MAXIMAL_LOOP_COUNT, typeof (System.String));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add (CVM.CommonValues.PGM_FILL_BEITRAG_ID, typeof (System.String));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("BlockPreviewPosition", typeof (System.String));
			m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Columns.Add ("BeitraegePreviewPosition", typeof (System.String));

			foreach (DataRow ProgrammBloeckeRow in m_ManagedProgrammData.ProgrammDataSet.Tables ["ProgrammBloecke"].Rows)
				{
				if (ProgrammBloeckeRow.Table.Columns["SenderID"] != null)
					if (ProgrammBloeckeRow ["SenderID"].ToString () != m_ManagedProgrammData.SenderID)
						continue;
				DataRow OrderTableNewRow = m_ManagedProgrammData.OrderedTableOfProgrammBlocks.NewRow ();
				OrderTableNewRow ["BlockID"] = ProgrammBloeckeRow ["BlockID"];
				OrderTableNewRow ["ProgrammBlockName"] = ProgrammBloeckeRow ["Name"].ToString ();
				OrderTableNewRow ["BlockPreviewPosition"] = ProgrammBloeckeRow ["BlockPreviewPosition"].ToString ();
				OrderTableNewRow ["BeitraegePreviewPosition"] = ProgrammBloeckeRow ["BeitraegePreviewPosition"].ToString ();
				OrderTableNewRow [CVM.CommonValues.PGM_MAXIMAL_LOOP_COUNT] = ProgrammBloeckeRow ["MaximalLoops"].ToString ();
				OrderTableNewRow [CVM.CommonValues.PGM_FILL_BEITRAG_ID] = ProgrammBloeckeRow ["BeitragID"].ToString ();
				DataRow [] SingleBlockGroup = m_ManagedProgrammData.ProgrammDataSet.Tables ["Timings"].Select
							("ConnectedID = '" + ProgrammBloeckeRow ["BlockID"].ToString () + "'");

				DateTime [] ResultedTimings = CommonDataBase.CommonBasics.GetResultedTiming (StartTime, SingleBlockGroup);
				if (ResultedTimings.Length > 1)
					{
					foreach (DataRow Entry in SingleBlockGroup)
						{
						String TimingTypID = Entry ["TimingTypID"].ToString ();
						if (TimingTypID == "ZeitVonBis")
							{
							DateTime Von = ResultedTimings [0];
							DateTime TimeA = Convert.ToDateTime (Entry ["TimeA"]);
							if (Von.TimeOfDay != TimeA.TimeOfDay)
								{
								Von = new DateTime (Von.Year, Von.Month, Von.Day,
												TimeA.Hour, TimeA.Minute, TimeA.Second);
								}
							OrderTableNewRow ["Von"] = Von;
							DateTime Bis = ResultedTimings [1];
							DateTime TimeB = Convert.ToDateTime (Entry ["TimeB"]);
							if (Bis.TimeOfDay != TimeB.TimeOfDay)
								{
								Bis = new DateTime (Bis.Year, Bis.Month, Bis.Day,
												TimeB.Hour, TimeB.Minute, TimeB.Second);
								}
							OrderTableNewRow ["Bis"] = Bis;
							m_ManagedProgrammData.OrderedTableOfProgrammBlocks.Rows.Add (OrderTableNewRow);
							break;
							}
						}
					}
				}
			}
예제 #8
0
		//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;
			}
예제 #9
0
	private void CreateBeitragsSerializationEntries (ManagedProgrammData ProgrammData, String BeitragSerializationDirectory)
		{
		if (!Directory.Exists (BeitragSerializationDirectory))
			Directory.CreateDirectory (BeitragSerializationDirectory);
		List<String> ExistingVideoEntries = WMB.Basics.GetFilesFromDirectory (BeitragSerializationDirectory, new String [] { "*.ser" }, 1);
		if (ProgrammData.FullBeitragList == null)
			return;
		foreach (String BeitragsID in ProgrammData.FullBeitragList.Keys)
			{
			WPMediaVideoPlayingData VideoPlayingData = new WPMediaVideoPlayingData ();
			DataSet FullBeitragsDataSet = ProgrammData.FullBeitragList [BeitragsID];
			String BeitragsTyp = FullBeitragsDataSet.Tables ["Beitraege"].Rows [0] ["BeitragsTyp"].ToString ();
			if (BeitragsTyp != "Video")
				continue;
			String VideoEntryFileName = Path.Combine (BeitragSerializationDirectory, BeitragsID + ".ser");
			if (ExistingVideoEntries.Contains (VideoEntryFileName))
				ExistingVideoEntries.Remove (VideoEntryFileName);
			VideoPlayingData.FullBeitragDataSet = FullBeitragsDataSet;
			String DurationString = Convert.ToString (FullBeitragsDataSet.Tables ["Beitraege"].Rows [0] ["LastCalculatedDuration"]);

			MemoryStream SerializationContent = AssembleContentOfPlayingData (VideoPlayingData,
				DurationString, ProgrammData.SenderName, "VideoTV");
			if (WMB.Basics.IsTheContentEqual (VideoEntryFileName, SerializationContent))
				continue;
			bool CorrectDeleted = true;
			if (File.Exists (VideoEntryFileName))
				{
				CorrectDeleted = CommonDataBase.CommonBasics.SecureFileDelete (VideoEntryFileName, null);
				}
			if (CorrectDeleted)
				SerializationContent.WriteTo (File.Open (VideoEntryFileName, FileMode.Create, FileAccess.Write));
			SerializationContent.Close ();

			}
		foreach (String UnusedVideoEntry in ExistingVideoEntries)
			{
			CommonDataBase.CommonBasics.SecureFileDelete (UnusedVideoEntry, null);
			}
		}