Example #1
0
		private void GenerateFileAccessRing_Click(object sender, RoutedEventArgs e)
			{
			Cursor = Cursors.Wait;
//			IRingManager MVCInterface = null;

			RingPlayerDb player = new RingPlayerDb();
			player.Set_DbProxy(new DbEntitiesAccess.Proxys.DbServer3
				.DirectHsServerSqlConnector()
				{ Catalog = RingPlayerDb.NativeName });
			player.LoadSchema();
			player.SetHasBeenLoaded();
			RingMetaData ringMetaData = player.RingMetaDatas.NewRow();
			ringMetaData.SenderId = SelectedSender.Id;
			//ringMetaData.ComputerId = Guid.NewGuid();
			//ringMetaData.ComputerName = Environment.MachineName;
			//ringMetaData.Description = $"{Process.GetCurrentProcess().ProcessName} created Ring";
			//ringMetaData.CreatorNameId = $"ich";
			//ringMetaData.RingId = 1;
			//ringMetaData.StatusNumber = 100;
			ringMetaData.CreationDate = DateTime.Now;
			ringMetaData.Table.Add(ringMetaData);
			ringMetaData.Table.AcceptChanges();
//			MVCInterface.Generate(dataContext, SelectedSender.NameId, ringMetaData);
			RingPlayerDb dataSet = ringMetaData.DataSet;
			RingPlayerDb.SetInstance(this, dataSet);
			Cursor = Cursors.Arrow;
			}
Example #2
0
		public RingMetaData CreateNewRingInstance()
			{
			RingPlayerDb playerDb = new RingPlayerDb();
			playerDb.Set_DbProxy(new DirectHsServerSqlConnector { Catalog = RingPlayerDb.NativeName });
			playerDb.LoadConstraints();
			playerDb.SetHasBeenLoaded();

			RingMetaData ring = playerDb.RingMetaDatas.NewRow();
			ring.Id = 1;
			ring.SenderId = Guid.Empty;
			ring.CreationDate = DateTime.MinValue;
			ring.TargetDate = DateTime.MinValue;
			ring.Occasion = "";
			ring.AddToTable();
			return ring;
			}
Example #3
0
		public void TesMMUnitTimingFunctions()
			{
			Data.DbServer3.MultiMedia.LoadAll_IfHasNotBeenLoaded();
			DistributionRoot DistributionRootInstance 
				= new DistributionRoot
				(Data.DbServer3.MultiMedia, DateTime.Now);
			DistributionRootInstance.PreloadAllForAllTodayAndTomorrowMMunitsIfNotHasBeenLoaded();
			Dictionary<MMSlot, Dictionary<MMUnit, List<MMUnitTiming>>> ToDayAndTomorrowInvolvedMMUnitsPerMMSlot
				= DistributionRootInstance.ToDayAndTomorrowInvolvedMMUnitsPerMMSlot;
			Debug.WriteLine($"");
			Debug.WriteLine($"ToDayAndTomorrowInvolvedMMUnitsPerMMSlot");

			foreach (MMSlot mmSlot in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");						}
						}
				}

			Debug.WriteLine($"");
			Debug.WriteLine($"TodayActiveMMUnitsPerMMSlo");

			foreach (MMSlot mmSlot in DistributionRootInstance.TodayActiveMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");
						}
					}
				}

			Debug.WriteLine($"");
			Debug.WriteLine($"TomorrowActiveMMUnitsPerMMSlot");

			foreach (MMSlot mmSlot in DistributionRootInstance.TomorrowActiveMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");
						}
					}
				}
			MMSender mmSender = Data.DbServer3.MultiMedia.MMSenders.FindOrLoad_via_NameId("Haus");
			RingPlayerDb ActuallPlayerDb = new RingPlayerDb();
			ActuallPlayerDb.Set_DbProxy(new DirectHsServerSqlConnector(){ Catalog = RingPlayerDb.NativeName });
			ActuallPlayerDb.LoadSchema();
			ActuallPlayerDb.SetHasBeenLoaded();

			RingMetaData testRingMetaData = ActuallPlayerDb.RingMetaDatas.NewRow();
			testRingMetaData.SenderId = mmSender.Id;
			//ringMetaData.ComputerId = Guid.NewGuid();
			//ringMetaData.ComputerName = Environment.MachineName;
			testRingMetaData.TargetDate = DateTime.Now;
			testRingMetaData.CreationDate = DateTime.Now;
			testRingMetaData.Id = 1;

			//AddOnRingDistribution.DataCollector.BalancerUsage balancerUsage
			//	= new AddOnRingDistribution.DataCollector.BalancerUsage(mmSender, testRingMetaData, DateTime.Now)
			//	{
			//	TodaysActiveMMUnitsPerMMSlot = DistributionRootInstance.TodayActiveMMUnitsPerMMSlot,
			//	TomorrowsActiveMMUnitsPerMMSlot = DistributionRootInstance.TomorrowActiveMMUnitsPerMMSlot
			//	};
			//balancerUsage.LoadActuallBalancers(mmSender);
			//RingUpdater ringUpdater = new RingUpdater(mmSender, testRingMetaData, DateTime.Now)
			//	{
			//	DistributionRootInstance = DistributionRootInstance,
			//	TodaysBalancers = balancerUsage.TodaysBalancersPerSender[mmSender]
			//	};

			}
		private void MMUnitImageClicked_OnClick(object sender, RoutedEventArgs e)
			{
			MMUnit selectedMMUnit = (sender as Button).DataContext as MMUnit;

			//CREATE DATABASE
			RingPlayerDb ActuallPlayerDb = new RingPlayerDb();
			ActuallPlayerDb.Set_DbProxy(new DirectHsServerSqlConnector{ Catalog = RingPlayerDb.NativeName });
			ActuallPlayerDb.LoadConstraints();
			ActuallPlayerDb.SetHasBeenLoaded();
			//***************

			//CREATE CONTENT
			new PageGroupGenerator(selectedMMUnit, ActuallPlayerDb).Generate();
			//**************

			var downloader = ActuallPlayerDb.GetDependencyDownloader();
			if (downloader == null)
				{
				OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) ");
				return;
				}

			Window wind = new Window() { Content = "Downloading" };
			wind.Show();
			downloader.Start().ContinueWith(t =>
			{
				wind.Close();

				if (t.Exception != null)
					MessageBox.Show($"Der download war nicht erfolgreich: {t.Exception.MostInner()?.Message}");
				else
					OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) ");
			}, TaskScheduler.FromCurrentSynchronizationContext());
			


			}