Example #1
0
		public void AddSlotContextMenuEntries(MMSlot mmSlotToProcess, ContextMenu CMenu)
			{
			String mmUsageText = "Verwendung in ...";
			MenuItem involvedMMSender = new MenuItem();
			involvedMMSender.Header = mmUsageText;
			foreach (MenuItem item in CMenu.Items)
				{
				if (item.Header.ToString().Contains(mmUsageText))
					{
					CMenu.Items.Remove(item);
					break;
					}
				}
			CMenu.Items.Add(involvedMMSender);
			FillMenuForMMSlotUsage(mmSlotToProcess, involvedMMSender);

			String mmUnitsText = "Beiträge ...";
			String noMMUnitsText = "Keine aktuellen Beiträge";
			foreach (MenuItem item in CMenu.Items)
				{
				if ((item.Header.ToString().Contains(mmUnitsText))
					|| (item.Header.ToString().Contains(noMMUnitsText)))
					{
					CMenu.Items.Remove(item);
					break;
					}
				}
			MenuItem assignedMMUnits = new MenuItem();
			CMenu.Items.Add(assignedMMUnits);
			if (FillMenuForMMUnitAssignments(mmSlotToProcess, assignedMMUnits))
				assignedMMUnits.Header = mmUnitsText;
			else
				assignedMMUnits.Header = noMMUnitsText;
			}
Example #2
0
		private void SendungenChangeRequested(MMSlot SendungenToChange)
			{
			Window mMSlotWindow = new Window();
			mMSlotWindow.SizeToContent = SizeToContent.WidthAndHeight;
			mMSlotWindow.Content = new MMSlotControl();
			if (SendungenToChange != MMSlotManagementModellInstance.MMSlotInstance)
				throw new Exception("SendungenToChange != MMSlotManagementModellInstance.SelectedSendungen");
			(mMSlotWindow.Content as MMSlotControl).MMSlotManagementModellInstance
				= MMSlotManagementModellInstance;
			(mMSlotWindow.Content as MMSlotControl).SendungenInstance = SendungenToChange;
			mMSlotWindow.Title = "Daten der Sendung \"" + SendungenToChange.NameId + "\"";
			mMSlotWindow.ShowDialog();
			if ((mMSlotWindow.Content as MMSlotControl).Return == true)
				{
				MMSlotManagementModellInstance.DataContext.MultiMedia.MMSlots.SaveChanges(new Object());
				MMSlotManagementModellInstance.DataContext.MultiMedia.MMSlots.AcceptChanges();
				}
			else
				{
				MMSlotManagementModellInstance.DataContext.MultiMedia.MMSlots.LoadThenFind(SendungenToChange.Id);
				MMSlotManagementModellInstance.DataContext.MultiMedia.MMSlots.AcceptChanges();
				}
			}
Example #3
0
		private void SendungenDeleteRequested(MMSlot SendungToDelete)
			{
			if (MessageBox.Show("Wollen Sie wirklich die Sendung\r\n\""
								 + SendungToDelete.NameId
								 + "\"\r\nund ihre Verknüpfungen zu Programm Blöcken löschen?") != MessageBoxResult.OK)
				return;
			if (SendungToDelete.MMUnitTimings.Count > 0)
				{
				MessageBox.Show($"Die Sendung\r\n{SendungToDelete.NameId} kann nicht gelöscht werden,\r\n" +
					$"weil noch MMUnitTimings zugeordnet sind");
				return;
				}
			MMSlotManagementModellInstance.DeleteMMSlot(SendungToDelete);
			}
Example #4
0
		public void PurgeSlot(MMSlot mmSlotToProcess, DateTime threshold)
			{
			Guid TimingTypId = MMTimingsTypen.Find_By_Name("VonBis").Id;
			MMUnitTiming[] RelatedTimings = MMUnitTimings.LoadThenFind_By_MMSlotId(mmSlotToProcess.Id).ToArray();
			foreach (MMUnitTiming relatedTiming in RelatedTimings)
				{
				if ((relatedTiming.TypId != TimingTypId)
					|| (((DateTime)relatedTiming.TimeA) > threshold))
					continue;
				MMUnit toDelete = relatedTiming.MMUnit;
				relatedTiming.Delete();
				MMUnitTimings.SaveChanges();
				MMUnitTimings.AcceptChanges();
				toDelete.Delete();
				SaveKatabolic(new Object());
				AcceptChanges();
				}
			}
Example #5
0
		double CreateScheduledPagesFromMMUnit(MMUnit mmunit, double relativeStartSecond, 
			ref List<PageSchedule> lastInsertedSchedules, MMSlot slot)
			{
			PageGroup pageGroup = new PageGroupGenerator(mmunit, PlayerDb).Generate();

			Guid pageGroupScheduledId = Guid.NewGuid();
			TimeSpan currentStartTime = TimeSpan.FromSeconds(relativeStartSecond);

			Page[] pages = pageGroup.Pages.OrderBy(x => x.SortOrder).ToArray();
			for (int i = 0; i < pages.Length; i++)
				{
				Page page = pages[i];

				if (currentStartTime > TimeSpan.FromDays(1))
					continue;

				PageSchedule pageSchedule = PlayerDb.PageSchedules.NewRow();
				pageSchedule.Id = Guid.NewGuid();
				pageSchedule.StartTime = TodayDate.Date.Add(currentStartTime);
				pageSchedule.DiagnosticText = $"{pageGroup.Name} Seite {i + 1}";
				pageSchedule.PageGroupScheduleId = pageGroupScheduledId;
				pageSchedule.Page = page;
				pageSchedule.RingMetaData = Ring;
				pageSchedule.SlotId = slot.Id;

				currentStartTime = currentStartTime.Add(TimeSpan.FromSeconds((double)pageSchedule.Page.ExpectedDuration));
				pageSchedule.Table.Rows.Add(pageSchedule);

				if (lastInsertedSchedules != null)
					lastInsertedSchedules.Add(pageSchedule);
				}
			if (pageGroup.DurationInSeconds == 0)
				Debug.WriteLine($"Duration = 0 Beitrag SchreenGroup {pageGroup.Name} ({pageGroup.Id})");

			return currentStartTime.TotalSeconds;
			}
Example #6
0
		bool FillMenuForMMUnitAssignments(MMSlot mmSlotToProcess, MenuItem parent)
			{
			int numberOfMMUnits = 0;
			if (!DataContext.MultiMedia.DistributionRoot
				.TodayActiveMMUnitsPerMMSlot.ContainsKey(mmSlotToProcess))
				{
				parent.Items.Add(new MenuItem() {Header = "keine Einträge vorhanden"});
				return true;
				}
			foreach (MMUnit actuallyActiveMMUnit in  DataContext.MultiMedia.DistributionRoot
				.TodayActiveMMUnitsPerMMSlot[mmSlotToProcess].Keys)  //mmSlotToProcess.Get_TodaysActiveMMUnits)
				{
				numberOfMMUnits++;
				MenuItem newAssignment = new MenuItem()
					{
					Header = actuallyActiveMMUnit.NameId,
					Tag = actuallyActiveMMUnit
					};
				newAssignment.Click += (sender, args) =>
				{
					MMUnit mmUnitToShow = (sender as MenuItem).Tag as MMUnit;
				if (StartMMUnitElementeDetails != null)
					StartMMUnitElementeDetails(mmUnitToShow);
				};
				parent.Items.Add(newAssignment);

				}
			return (numberOfMMUnits > 0);
			}
Example #7
0
		public void DeleteMMSlot(MMSlot toDelete)
			{
			toDelete.Delete();
			Data.DbServer3.MultiMedia.MMSlots.SaveChanges();
			Data.DbServer3.MultiMedia.MMSlots.AcceptChanges();
			}
Example #8
0
		void FillMenuForMMSlotUsage(MMSlot mmSlotToProcess, MenuItem parent)
			{
			MMSender OldSender = null;
			MenuItem activeSender = null;
			foreach (MMProgrammBlockToMMSlot mmSlotUsage in mmSlotToProcess.Get_MMSlotInMMProgrammBlocksUsages)
				{
				if (OldSender != mmSlotUsage.MMProgrammBlock.MMSender)
					{
					activeSender = new MenuItem()
						{
						Header = mmSlotUsage.MMProgrammBlock.MMSender.NameId,
						Tag = mmSlotUsage.MMProgrammBlock.MMSender
						};
					parent.Items.Add(activeSender);
					OldSender = mmSlotUsage.MMProgrammBlock.MMSender;
					}
				MenuItem newProgrammBlock = new MenuItem()
					{
					Header = mmSlotUsage.MMSlotInMMBlockUsageText,
					Tag = mmSlotUsage.MMProgrammBlock
					};
				activeSender.Items.Add(newProgrammBlock);
				}
			}
Example #9
0
		public MMUnitTiming InsertIfNotExist(MMSlot mmSlot, MMUnit mmUnit, String timingTypId,
				DateTime timeA, DateTime timeB, List<MMUnitTiming> existing = null)
			{
			if (existing == null)
				{
				existing = Load_via_MMUnitId(mmUnit.Id).ToList();
				}
			foreach (MMUnitTiming timing in existing)
				{
				if ((timing.MMSlot == mmSlot)
					&& (timing.MMUnit == mmUnit)
					&& (timing.TimingTypId == timingTypId)
					&& (timing.TimeA == timeA)
					&& (timing.TimeB == timeB))
					return timing;
				}
			MMUnitTiming newTiming = NewRow();
			newTiming.TimingsId = Guid.NewGuid();
			newTiming.MMSlot = mmSlot;
			newTiming.MMUnit = mmUnit;
			newTiming.TimingTypId = timingTypId;
			newTiming.TimeA = timeA;
			newTiming.TimeB = timeB;
			Add(newTiming);
			existing.Add(newTiming);
			return newTiming;
			}
Example #10
0
		public MMUnitTiming[] Load_ActiveMMSlotTimings(MMSlot mmSlot, DateTime programmDate)
			{
			String timingSelection = String.Format(TimingsBasics.SQL_PART_FOR_TIMEA_TIMEB_IM_ZEITRAUM_INCL_DAUER,
					programmDate.ToString(TimingsBasics.ISO_DATE_TIME_FORMAT),
					programmDate.ToString(TimingsBasics.ISO_DATE_TIME_FORMAT));
			return DownloadRows($"select * from {NativeName} where {timingSelection} and " +
								$"{MMUnitTimingsTable.MMSlotIdCol} = '{mmSlot.Id}'");
			}
Example #11
0
		public MMProgrammBlockToMMSlot InsertMMSlot(MMSlot entryToInsert, int newSortOrder)
			{
			MMProgrammBlockToMMSlot newEntry = DataSet.MMProgrammBlockToMMSlots.NewRow();
			newEntry.SortOrder = newSortOrder;
			newEntry.Id = Guid.NewGuid();
			newEntry.MMSlot = entryToInsert;
			newEntry.MMProgrammBlock = this;
			newEntry.MaximalDurationInSeconds = -1;
			newEntry.NameId = BlockNamePlusTiming + " " + entryToInsert.NameId;
			newEntry.MMProgrammBlockToMMSlotsPlayingTyp =
				DataSet.MMProgrammBlockToMMSlotsPlayingTyps.Find_By_Name("Standard");
			DataSet.MMProgrammBlockToMMSlots.Rows.Add(newEntry);
			ReorderMMSlots();
			DataSet.MMProgrammBlockToMMSlots.SaveChanges();
			DataSet.MMProgrammBlockToMMSlots.AcceptChanges();
			return newEntry;
			}