public PageGroup CreatePlayerPageGroup(MMUnit mMUnit, bool doNotRecreate = true, bool storeAsDataSet = true)
			{
			PageGroup newPageGroup;
			newPageGroup  = ActuallPlayerDb.PageGroups.Find(mMUnit.Id);
			if (newPageGroup != null)
				{
				if (doNotRecreate)
					return newPageGroup;
				newPageGroup.Delete();
				ActuallPlayerDb.AcceptChanges();
				}
			//			Data.DbServer3.MultiMedia.PreLoadAllForOneMMUnit(mMUnit.Id);

			newPageGroup = ActuallPlayerDb.PageGroups.NewRow();
			newPageGroup.Id = mMUnit.Id;
			newPageGroup.NameId = mMUnit.NameId;
			newPageGroup.ForeignTypDescription = $"{mMUnit.MMForeignUnitTyp.TypNameId} - {mMUnit.MMForeignUnitTyp.Id}";
			newPageGroup.ForeignInstanceId = mMUnit.Id;


			ActuallPlayerDb.PageGroups.Rows.Add(newPageGroup);


			foreach (MMPart mmPart in mMUnit.MMParts.OrderBy(ord => ord.SortOrder))
				{
				CreatePlayerPage(mmPart, newPageGroup);
				}
			if (storeAsDataSet)
				CreateAndStorePageGroupAsDataSet(newPageGroup);
			return newPageGroup;
			}
Exemplo n.º 2
0
//		public int RunningIndex { get; set; }

		public MMUnitPresentationDataEntry(Information infoParent, 
			ProcessConnector connector)
			{
			InfoParent = infoParent;
			Connector = connector;
			MMUnitToPresent = InfoParent.DataContext.MultiMedia.MMUnits.FindOrLoad(Connector.TableId);
			}
		public MMUnitTimingsPresentationDataEntry
			(MMUnit mMUnitParent, MMUnitTiming mMUnitTiming, int runningIndex)
			{
			MMUnitParent = mMUnitParent;
			MMUnitTimingEntry = mMUnitTiming;
			RunningIndex = runningIndex;
			}
Exemplo n.º 4
0
		private void MMUnitToProcesssInstanceChanged(MMUnit OldValue,
			MMUnit NewValue)
			{
			if (NewValue != null)
				{
				Data.DbServer3.MultiMedia.PreLoadAllForOneMMUnit(NewValue.Id);
				MMUnitElementeDetailsModellInstance = new MMUnitElementeDetailsModell()
					{
					MMUnitToProcess = NewValue
					};
				InformationenPresentationModellInstance = new InformationenPresentationModell();
				InformationenPresentationModellInstance.InformationToProcess
					= Data.DbServer3.AltErlaaInfo.Informationen.FindOrLoad(NewValue.MMInformationenId);
				}
			}
Exemplo n.º 5
0
		private PageGroupGenerator(MMUnit mmUnitSource, RingPlayerDb targetPlayerDb)
			{
			MMUnitSource = mmUnitSource;
			TargetPlayerDb = targetPlayerDb;

			//ContractCollection<MMPart> sourceListe = source.MMParts;
			//List<Page> targetListe = TargetPageGroup.Pages.ToList();

			//ListAssimilator<Page, MMPart> assimilator = new ListAssimilator<Page, MMPart>(targetListe, sourceListe);
			//assimilator.EqualFunc = (page, part) => page.Id == part.Id;
			//assimilator.ConvertFunc = part =>
			//	{
			//	return new Page(part);
			//	};
			//assimilator.OnPairFound = DoUpdates;
			//assimilator.OnRemoved = page => page.Delete();
			//assimilator.Execute();

			}
Exemplo n.º 6
0
		public void CreateWPMediaDummyInformation(MMUnit mMUnit, bool updateDataBase = true)
			{
			Information CreatedInformation = Data.DbServer3.AltErlaaInfo.CreateDummyInformation
				(mMUnit.Id, mMUnit.MMForeignUnitTyp.TechnicalTyp, mMUnit.MMForeignUnitTyp.TypNameId,
				mMUnit.NameId, (DateTime)mMUnit.LastModified, true);
			MMInformation mMInformation = Data.DbServer3.MultiMedia.MMInformationen.NewRow();
			mMInformation.Id = CreatedInformation.Id;
			mMInformation.NameId = CreatedInformation.NameId;
			mMInformation.Title = CreatedInformation.Titel;
			mMInformation.TypId = CreatedInformation.TypId;
			mMUnit.MMInformation = mMInformation;
			Data.DbServer3.MultiMedia.MMInformationen.Rows.Add(mMInformation);
			if (updateDataBase == false)
				return;
			Data.DbServer3.AltErlaaInfo.SaveAnabolic(new Object());
			Data.DbServer3.AltErlaaInfo.AcceptChanges();
			Data.DbServer3.MultiMedia.MMInformationen.SaveChanges();
			Data.DbServer3.MultiMedia.MMInformationen.AcceptChanges();
			return;
			}
Exemplo n.º 7
0
		public static BitmapSource UnitThumbPicture(MMUnit unit)
			{
			Rect fullPageDrawingRect = new Rect(new Size((double)unit.MMUnitTyp.TargetPictureWidth / 5, (double)unit.MMUnitTyp.TargetPictureHeight / 5));
			RenderTargetBitmap finalDrawingBitmap = new RenderTargetBitmap((int)fullPageDrawingRect.Width,
							(int)fullPageDrawingRect.Height, 96, 96, PixelFormats.Pbgra32);
			DrawingVisual DrawingBoard = new DrawingVisual();
			DrawingContext BoardContext = DrawingBoard.RenderOpen();
			BoardContext.DrawRectangle(Brushes.Gray, null, fullPageDrawingRect);
			int numberOfPages = unit.MMParts.Count();
			List<Rect> DrawingRects = CreateAllDrawingRects(fullPageDrawingRect, numberOfPages);
			int DrawingIndex = 0;
            foreach (MMPart mPart in unit.MMParts.OrderByDescending(ord => ord.SortOrder))
				{
				BoardContext.DrawImage(mPart.ThumbBitmapSource, DrawingRects[DrawingIndex]);
				BoardContext.DrawRectangle(null, new Pen(new SolidColorBrush(Colors.Black), 2), DrawingRects[DrawingIndex++]);
				}
			BoardContext.Close();           // by sac
			DrawingGroup drawing = DrawingBoard.Drawing;
			finalDrawingBitmap.Render(DrawingBoard);
			return (BitmapSource)BitmapFrame.Create(finalDrawingBitmap);
			}
Exemplo n.º 8
0
		public CommonSearchClass(MMUnit BasicElement)
			: base((DataRow)BasicElement)
			{
			ID = BasicElement.Id;
			OriginalTypeOfInput = TypeOfEntry.MMUnit;
			}
Exemplo n.º 9
0
		public static void DebugMMUnit(MMUnit root)
			{
			Debug.WriteLine($"\tU : {root.NameId}");
			foreach (DbEntities.dbserver3.multimedia.rows.Page page in root.Pages.OrderBy(ord => ord.SortOrder))
				{
				DebugLoop(page, 1);
				}
			}
Exemplo n.º 10
0
		private void MMSlotManagementModellInstance_StartMMUnitElementeDetails(MMUnit obj)
			{
			throw new NotImplementedException();
			}
Exemplo n.º 11
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;
			}
Exemplo n.º 12
0
		public static PageGroup GetOrCreatePageGroup(MMUnit source, RingPlayerDb targetDb)
			{
			return new PageGroupGenerator(source, targetDb).Generate();
			}
Exemplo n.º 13
0
		public String CreatePageGroupFromMMUnit(MMUnit mMUnit, bool doNotRecreate = true)
			{
			PageGroup pageGroup = CreatePlayerPageGroup(mMUnit, doNotRecreate);
			return CreateAndStorePageGroupAsDataSet(pageGroup);
			}
Exemplo n.º 14
0
		private void MMSlotManagementModellInstance_StartMMUnitElementeDetails(MMUnit obj)
			{
			}
Exemplo n.º 15
0
		private String GetBannerTextFromMMUnit(MMUnit mmUnitToProcess)
			{
			bool takeLastSendingDay = false;
			foreach (MMUnitTiming actuallTiming in MultiMediaDb.MMUnitTimings
				.Where(whe => whe.TypId == VonBisTimingTypGuid
							|| whe.TypId == AnzVonBisTimingTypGuid))
				{
				if (((DateTime) actuallTiming.TimeB).Date == DateTime.Now.Date)
					takeLastSendingDay = true;
				}
			if (mmUnitToProcess.Pages == null)
				{
				List<String> result = new List<string>();
				if (takeLastSendingDay)
					{
					result = mmUnitToProcess.GetPagesTexte(new List<Guid?>()
						{
						MultiMediaDb
							.MMUnitContentEntryTypen.Find_By_Name("ActuallDayBanner").Id
						});
					}
				else
					{
					result = mmUnitToProcess.GetPagesTexte(new List<Guid?>()
						{
						MultiMediaDb
							.MMUnitContentEntryTypen.Find_By_Name("Banner").Id
						});
					}
				if ((result == null)
					|| (result.Count == 0))
					return String.Empty;
				return String.Join(", ", result);
				}

			String CommonText = String.Empty;
			String LastSendingDayText = String.Empty;
			foreach (MMElement mmElement in mmUnitToProcess.MMElemente)
				{
				if (mmElement.TextId == "Text")
					CommonText = mmElement.LocalText;
				if (mmElement.TextId == "TextForTheLastSendingDay")
					LastSendingDayText = mmElement.LocalText;
				}
			if ((takeLastSendingDay)
				&& (!String.IsNullOrEmpty(LastSendingDayText)))
				return LastSendingDayText;
			if (String.IsNullOrEmpty(CommonText))
				return $"{mmUnitToProcess.NameId} fehlt";
			return CommonText;
			}
Exemplo n.º 16
0
		void ActualizeBalancers(StatisticalBalancer<MMUnit> balancer,
			MMUnit[] involvedMMUnitsShouldBeInBalancer)
			{
			foreach (MMUnit mmUnit in involvedMMUnitsShouldBeInBalancer)
				{
				if (balancer.Entries.ContainsKey(mmUnit))
					continue;
				int importance = 1;
				balancer.Add(mmUnit, TimeSpan.FromSeconds(mmUnit.PlayingDurationSum), importance);
				}
			foreach (MMUnit entriesKey in balancer.Entries.Keys)
				{
				if (involvedMMUnitsShouldBeInBalancer.Contains(entriesKey))
					continue;
				balancer.Remove(entriesKey);
				}
			}
Exemplo n.º 17
0
		private void MMSlotManagementModell_StartMMUnitElementeDetails(MMUnit mmUnitToShow)
			{
			Window DetailWindow = new Window();
			DetailWindow.Content = new MMUnitElementeDetails();
			(DetailWindow.Content as MMUnitElementeDetails)
						.MMUnitToProcesssInstance = mmUnitToShow;
			DetailWindow.ShowDialog();
			}
Exemplo n.º 18
0
		private void InsertSimplePagedText(MMUnit mmUnit, String text, bool IsTextOrLastDayText)
			{
			bool isAddedBefore = false;
			DbEntities.dbserver3.multimedia.rows.Page bannerPage
					= mmUnit.SetOrCheckOneSimplePage(ref isAddedBefore);
			if (!isAddedBefore)
				{
				bannerPage.SortOrder = 100;
				bannerPage.HasFixedRatio = false;
				bannerPage.RatioX = 10;
				bannerPage.RatioY = 1;
				if (IsTextOrLastDayText)
					{
					bannerPage.DiagnosticText = $"{mmUnit.NameId} - Banner";
					bannerPage.ExpectedDuration = 6;
					}
				else
					{
					bannerPage.DiagnosticText = $"{mmUnit.NameId} - LastDayBanner";
					bannerPage.ExpectedDuration = 5;
					}
				bannerPage.Table.Rows.Add(bannerPage);
				Data.DbServer3.MultiMedia.Pages.SaveChanges();
				Data.DbServer3.MultiMedia.Pages.AcceptChanges();
				}
			DbEntities.dbserver3.multimedia.rows.Text bannerText
					= bannerPage.SetOrCheckOneSimpleText(ref isAddedBefore);
			if (isAddedBefore)
				{
				if (bannerText.TextColumn == text)
					return;
				}
			bannerText.TextColumn = text;
			if (IsTextOrLastDayText)
				{
				bannerText.DiagnosticText = $"{mmUnit.NameId} - Banner";
				}
			else
				{
				bannerText.DiagnosticText = $"{mmUnit.NameId} - LastDayBanner";
				}
			bannerText.SortOrder = 500;
			bannerText.Table.Rows.Add(bannerText);
			Data.DbServer3.MultiMedia.Texts.SaveChanges();
			Data.DbServer3.MultiMedia.Texts.AcceptChanges();
			}
		private void SelectedMMUnitChanged(MMUnit OldValue,
			MMUnit NewValue)
			{
			}
Exemplo n.º 20
0
		public PageGroup GeneratePageGroup(MMUnit mmUnit, RingMetaData ring)
		    {
		    throw new NotImplementedException();
		    }
Exemplo n.º 21
0
		private void CreateMismatchedMessages(List<TabellenBasics> allBasicDataForTable,
				MMUnit[] mmUnitsPerTabelle, StreamWriter protokollFile, StreamWriter dataFile)
			{
			Guid[] existingMMUnitIds = mmUnitsPerTabelle.Select(sel => sel.Id).ToArray();
			foreach (TabellenBasics tabellenBasics in allBasicDataForTable)
				{
				if (!existingMMUnitIds.Contains(tabellenBasics.Id))
					{
					protokollFile.WriteLine($"für {tabellenBasics.TableName} " +
							$"Id = {tabellenBasics.Id} Modified = {tabellenBasics.ModifyTimeStamp} fehlt die MMUNit");
					}
				}
			}
Exemplo n.º 22
0
		double AddPlayerScreenGroupToPlayList(RingMetaData ringMetaData, Guid slotId, MMUnit mmUnit, 
			double relativeStartSecond, ref List<PageSchedule> lastInsertedSchedules)
			{
			PageGroup pageGroup = ActualRing.DataSet.PageGroups.Find(mmUnit.Id);
			if (pageGroup == null)
				{
				pageGroup = new PageGroupGenerator(mmUnit, ActualRing.DataSet).Generate();
				if (pageGroup.DurationInSeconds == 0)
					throw new Exception($"screenGroup.DurationInSeconds == 0 bei {pageGroup.Name} ({pageGroup.Id})");
				}
			//Debug.WriteLine($"PlayListTime = {playList.RelativeStartSeconds} CurentStartTime = {currentStartTime.TotalSeconds}");
			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 = pageGroup.DataSet.PageSchedules.NewRow();
				pageSchedule.Id = Guid.NewGuid();
				pageSchedule.StartTime = DateTime.Now.Date.Add(currentStartTime);
				pageSchedule.DiagnosticText = $"{pageGroup.Name} Seite {i+1}";
				pageSchedule.PageGroupScheduleId = pageGroupScheduledId;
				pageSchedule.Page = page;
				pageSchedule.RingMetaData = ringMetaData;
				pageSchedule.SlotId = slotId;
				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;
			}
Exemplo n.º 23
0
		public bool? UpdateForMMUnitsForInformationenIsRequired(Information informationInstance, MMUnit unit)
			{
			if (unit == null)
				return true;
			if (informationInstance != null)
				{
				unit.MMInformationenId = CheckOrInsertMMInformation(informationInstance).Id;
				}
			if ((unit.MMInformationenId != null)
				&& (unit.MMInformation.Version != null)
				&& (unit.Version != unit.MMInformation.Version))
				{
				unit.Version = unit.MMInformation.Version;
				return true;
				}
			return false;
			}
Exemplo n.º 24
0
		public CommonSearchClass(CommonSearchClassList parent, MMUnit BasicElement)
			{
			Parent = parent;
			MMUnitConnectedEntry = BasicElement;
			}
Exemplo n.º 25
0
	    void StartPreloadAllMMUnitElements(MMUnit[] activeMMUnits)
		    {
		    Data.DbServer3.MultiMedia.PreLoadAllForAllMMUnits(activeMMUnits.Select(sel => sel.Id).ToList());
		    }
Exemplo n.º 26
0
		public ActiveMMUnitInTime(MMUnit mMUnit, int sortOrder)
			: base(mMUnit, sortOrder)
			{
			MMUnitEntry = mMUnit;
			TimingSortOrder = sortOrder;
			}
Exemplo n.º 27
0
		public PageGroupGenerator(MMUnit mmUnitSource, RingPlayerDb targetPlayerDb)
			{
			MMUnitSource = mmUnitSource;
			TargetPlayerDb = targetPlayerDb;
			}
Exemplo n.º 28
0
		public LastProcessedMMUnit(MMUnit mMUnit, int sortOrder)
			: base(mMUnit, sortOrder)
			{
			MMUnitEntry = mMUnit;
			TimingSortOrder = sortOrder;
			}
Exemplo n.º 29
0
		double CreateScheduledPagesFromMMUnit(MMUnit mmunit, double relativeStartSecond, 
			ref List<PageSchedule> lastInsertedSchedules)
			{
			PageGroup pageGroup = PageGroupGenerator.GetOrCreatePageGroup(mmunit, TargetDb);

			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 = TargetDb.PageSchedules.NewRow();
				pageSchedule.Id = Guid.NewGuid();
				pageSchedule.StartTime = TargetDate.Date.Add(currentStartTime);
				pageSchedule.DiagnosticText = $"{pageGroup.Name} Seite {i + 1}";
				pageSchedule.PageGroupScheduleId = pageGroupScheduledId;
				pageSchedule.Page = page;
				pageSchedule.RingMetaData = TargetRing;
				pageSchedule.SlotId = Guid.Empty;

				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;
			}
Exemplo n.º 30
0
		public MMUnitBase(MMUnit mMUnit, int sortOrder)
			{
			MMUnitEntry = mMUnit;
			TimingSortOrder = sortOrder;
			}