예제 #1
0
파일: RingManger.cs 프로젝트: heinzsack/DEV
		/// <summary>
		///     Generates a complete new ring into the provided <paramref name="ring" /> dataset. This should produce a complete 24 hour active ring which has no
		///     other logic then playing the right things at the right time, independet of the past.
		/// </summary>
		/// <param name="server">The source database</param>
		/// <param name="computerName">The name of the computer this ring is generated for.</param>
		/// <param name="ring">The target ring where all the generated data should be inserted at.</param>
		/// <remarks>
		///     Things which need to be done:
		///     <para>Set <see cref="RingMetaData.SenderId" /> to the targeting sender id.</para>
		///     <para>Generate <see cref="PageGroup" />s inside the database.</para>
		///     <para>
		///         Generate <see cref="Page" />s with the associated content (<see cref="Text" />, <see cref="Image" /> <see cref="Video" />,
		///         <see cref="DoubleTransition" />).
		///     </para>
		///     <para>
		///         Generate <see cref="PageSchedule" />s. <see cref="PageSchedule" />s in sequence which belongs to the same <see cref="PageGroup" /> needs to
		///         have the same <see cref="PageSchedule.PageGroupScheduleId" />.
		///     </para>
		/// </remarks>

		public void Generate(IServer server, string computerName, RingMetaData ring)
			{
			//if (DateTime.Now - server.Load<DateTime>("LastRefresh") > TimeSpan.FromDays(1))
			//	server.Save(StorageEnum.MultiMedia, null);

			//server.Save(StorageEnum.MultiMedia, null); //TODO Clears the current multimedia db


			MultiMedia db = GetMultiMedia(server);
			MMSender sender = GetMMSenderFromSenderOrComputerName(db, computerName);
			ring.Occasion = sender.NameId;
			ring.SenderId = sender.Id;
			sender.DataSet.SetHasBeenLoaded();
			DistributionRoot DistributionRootInstance = new DistributionRoot(db,ring.TargetDate);
			DistributionRootInstance.PreloadAllForAllTodayAndTomorrowMMunitsIfNotHasBeenLoaded();
			BalancerUsage balancerUsage = new BalancerUsage(sender, ring, ring.TargetDate)
				{
				TodaysActiveMMUnitsPerMMSlot = DistributionRootInstance.TodayActiveMMUnitsPerMMSlot
				};
			balancerUsage.LoadActuallBalancers(sender);
			RingGenerator ringGenerator = new RingGenerator(sender, ring, ring.TargetDate)
				{
				DistributionRootInstance = DistributionRootInstance,
				TodaysBalancers = (balancerUsage.TodaysBalancersPerSender.ContainsKey(sender))
						? balancerUsage.TodaysBalancersPerSender[sender] : null
				};

			ringGenerator.Generate();
			}
예제 #2
0
파일: RingManger.cs 프로젝트: heinzsack/DEV
		/// <summary>
		///     Generates a complete new ring into the provided <paramref name="ring" /> dataset. This should produce a complete 24 hour active ring which has no
		///     other logic then playing the right things at the right time, independet of the past.
		/// </summary>
		/// <param name="db">The source database</param>
		/// <param name="computerName">The name of the computer this ring is generated for.</param>
		/// <param name="ring">The target ring where all the generated data should be inserted at.</param>
		/// <remarks>
		///     Things which need to be done:
		///     <para>Set <see cref="RingMetaData.SenderId" /> to the targeting sender id.</para>
		///     <para>Generate <see cref="PageGroup" />s inside the database.</para>
		///     <para>
		///         Generate <see cref="Page" />s with the associated content (<see cref="Text" />, <see cref="Image" /> <see cref="Video" />,
		///         <see cref="DoubleTransition" />).
		///     </para>
		///     <para>
		///         Generate <see cref="PageSchedule" />s. <see cref="PageSchedule" />s in sequence which belongs to the same <see cref="PageGroup" /> needs to
		///         have the same <see cref="PageSchedule.PageGroupScheduleId" />.
		///     </para>
		/// </remarks>
		public void Generate(MultiMedia db, string computerName, RingMetaData ring)
			{
			MMSender sender = GetMMSenderFromSenderOrComputerName(db, computerName);
			ring.SenderId = sender.Id;
			sender.DataSet.SetHasBeenLoaded();
			DistributionRoot DistributionRootInstance = new DistributionRoot(db, ring);
			DistributionRootInstance.PreloadAllForAllTodayAndTomorrowMMunitsIfNotHasBeenLoaded();
			DistributionRootInstance.LoadActuallBalancers(sender);
			RingGenerator ringGenerator = new RingGenerator(sender, ring, DateTime.Now);
			ringGenerator.Generate();
			}
예제 #3
0
파일: RingManger.cs 프로젝트: heinzsack/DEV
	    /// <summary>
		///     Generates a complete new ring into the provided <paramref name="ring" /> dataset. This should produce a complete 24 hour active ring which has no
		///     other logic then playing the right things at the right time, independet of the past.
		/// </summary>
		/// <param name="db">The source database</param>
		/// <param name="computerName">The name of the computer this ring is generated for.</param>
		/// <param name="ring">The target ring where all the generated data should be inserted at.</param>
		/// <remarks>
		///     Things which need to be done:
		///     <para>Set <see cref="RingMetaData.SenderId" /> to the targeting sender id.</para>
		///     <para>Generate <see cref="PageGroup" />s inside the database.</para>
		///     <para>
		///         Generate <see cref="Page" />s with the associated content (<see cref="Text" />, <see cref="Image" /> <see cref="Video" />,
		///         <see cref="DoubleTransition" />).
		///     </para>
		///     <para>
		///         Generate <see cref="PageSchedule" />s. <see cref="PageSchedule" />s in sequence which belongs to the same <see cref="PageGroup" /> needs to
		///         have the same <see cref="PageSchedule.PageGroupScheduleId" />.
		///     </para>
		/// </remarks>
		public void Generate(MultiMedia db, string computerName, RingMetaData ring)
			{
			MMSender sender = GetMMSenderFromSenderOrComputerName(db, computerName);
			ring.SenderId = sender.Id;
			sender.DataSet.SetHasBeenLoaded();
			DistributionRoot DistributionRootInstance = new DistributionRoot(db,ring.TargetDate);
			DistributionRootInstance.PreloadAllForAllTodayAndTomorrowMMunitsIfNotHasBeenLoaded();
			BalancerUsage balancerUsage = new BalancerUsage(sender, ring, ring.TargetDate)
				{
				TodaysActiveMMUnitsPerMMSlot = DistributionRootInstance.TodayActiveMMUnitsPerMMSlot
				};
			balancerUsage.LoadActuallBalancers(sender);
			RingGenerator ringGenerator = new RingGenerator(sender, ring, ring.TargetDate)
				{
				DistributionRootInstance = DistributionRootInstance,
				TodaysBalancers = balancerUsage.TodaysBalancersPerSender[sender]
				};

			ringGenerator.Generate();
			}