示例#1
0
		public Sender CloneSender(Sender SenderToClone, String NewSenderName)
			{
			if (String.IsNullOrEmpty(NewSenderName))
				NewSenderName = "Clone von " + SenderToClone.Name;
			Sender newSender = DataContext.WPMedia.Senders.NewRow();
			Guid savedSenderId = newSender.SenderId;
			DbBasics.CopyRowContent((DataRow)SenderToClone, (DataRow) newSender);

			newSender.SenderId = savedSenderId;
			newSender.Name = NewSenderName;
			newSender.IsActive = "No";
			DataContext.WPMedia.Senders.Rows.Add(newSender);
			DataContext.WPMedia.Senders.SaveChanges(new Object());
			DataContext.WPMedia.Senders.AcceptChanges();

			foreach (ProgrammBlock OldEntry in SenderToClone.ProgrammBloecke)
				{
				ProgrammBlock newProgrammBlock = DataContext.WPMedia.ProgrammBloecke.NewRow();
				Guid savedBlockId = newProgrammBlock.BlockId;
				DbBasics.CopyRowContent(OldEntry, newProgrammBlock);

				newProgrammBlock.BlockId = savedBlockId;
				newProgrammBlock.SenderIdOld = newSender.SenderId;
				Timing newTiming = DataContext.WPMedia.Timings.NewRow();
				Guid savedTimingId = newTiming.TimingsId;
				DbBasics.CopyRowContent(OldEntry.NamingTiming, newTiming);
				newTiming.TimingsId = savedTimingId;
				newTiming.ConnectedId = newProgrammBlock.BlockId;

				DataContext.WPMedia.ProgrammBloecke.Rows.Add(newProgrammBlock);
				DataContext.WPMedia.ProgrammBloecke.SaveChanges(new Object());
				DataContext.WPMedia.ProgrammBloecke.AcceptChanges();

				DataContext.WPMedia.Timings.Rows.Add(newTiming);
				DataContext.WPMedia.Timings.SaveChanges();
				DataContext.WPMedia.Timings.AcceptChanges();
				List<SendungZuProgrammBlock> listToAdd = new List<SendungZuProgrammBlock>();
				foreach (SendungZuProgrammBlock sendungZuProgrammBlock in OldEntry.SendungenZuProgrammBloecke)
					{
					SendungZuProgrammBlock newSendungZuProgrammBlock = DataContext
								.WPMedia.SendungenZuProgrammBloecke.NewRow();
					Guid savedSendungZuProgrammBlock = (Guid)newSendungZuProgrammBlock.SendungenZuProgrammBloeckeId;
					DbBasics.CopyRowContent(sendungZuProgrammBlock, newSendungZuProgrammBlock);
					newSendungZuProgrammBlock.SendungenZuProgrammBloeckeId = savedSendungZuProgrammBlock;
					newSendungZuProgrammBlock.Id = savedSendungZuProgrammBlock;
					newSendungZuProgrammBlock.BlockId = newProgrammBlock.BlockId;
					listToAdd.Add(newSendungZuProgrammBlock);
					}
				foreach (SendungZuProgrammBlock sendungZuProgrammBlock in listToAdd)
					{
					DataContext.WPMedia.SendungenZuProgrammBloecke.Rows.Add(sendungZuProgrammBlock);
					}
				DataContext.WPMedia.SendungenZuProgrammBloecke.SaveChanges();
				DataContext.WPMedia.SendungenZuProgrammBloecke.AcceptChanges();
				}
			DataContext.WPMedia.Senders.Get_AllSender = null;
			return newSender;
			}
示例#2
0
		public void DeleteSender(Sender SenderToDelete)
			{
			foreach (ProgrammBlock programmBlock in SenderToDelete.ProgrammBloecke)
				{
				foreach (Timing timing in DataContext.WPMedia.Timings.Load_via_ConnectedId(programmBlock.BlockId))
					{
					timing.Delete();
					}
				}
			DataContext.WPMedia.Timings.SaveChanges();
			DataContext.WPMedia.Timings.AcceptChanges();
			SenderToDelete.Delete();
			DataContext.WPMedia.Senders.SaveChanges(new Object ());
			DataContext.WPMedia.Senders.AcceptChanges();
			DataContext.WPMedia.Senders.Get_AllSender = null;
			}
示例#3
0
		private void SenderDeleteRequested (Sender SenderToDelete)
			{
			if (MessageBox.Show ("Wollen Sie wirklich den Sender\r\n\""
								 + SenderToDelete.Name
								 + "\"\r\nund seine Verknüpfungen zu\r\nden ProgrammBlöcken und den Sendungen löschen?") != MessageBoxResult.OK)
				return;
			if (SenderToDelete.IsActive != "No")
				{
				MessageBox.Show($"Sie können Sender nur dann löschen,\r\nwenn Sie nicht aktiv sind!!");
				return;
				}
			SenderManagementModellInstance.DeleteSender(SenderToDelete);
			}
示例#4
0
		public List<String> GetWrongAssignedProgrammBlocks(Sender senderToCheck)
			{
			List<String> errors = new List<string>();

			return errors;
			}
示例#5
0
		private void SenderChangeRequested(Sender SenderToChange)
			{
			Window SenderWindow = new Window ();
			SenderWindow.SizeToContent = SizeToContent.WidthAndHeight;
			SenderWindow.Content = new SenderControl();
			if (SenderToChange != SenderManagementModellInstance.SenderInstance)
				throw new Exception ("SenderToChange != SchedulingDataModellInstance.SelectedSender");
			(SenderWindow.Content as SenderControl).SenderManagementModellInstance.SenderInstance = SenderToChange;
			SenderWindow.Title = "Daten des Senders \"" + SenderToChange.Name + "\"";
			SenderWindow.ShowDialog ();
			if ((SenderWindow.Content as SenderControl).Return == true)
				{
				}
			}