Exemple #1
0
		public void ProcessCorrelatedTimings(Timing[] CorrelatedTimings)
			{
			}
Exemple #2
0
		public CommonSearchClass(CommonSearchClassList parent, Timing BasicElement)
			{
			Parent = parent;
			if (BasicElement == null)
				TimingConnectedEntry = BasicElement;
			else
				{
				TimingConnectedEntry = CommonSearchClassList.dataContext
					.AltErlaaInfo.Timings.Find(BasicElement.TimingsId);
				}
			//			RedaktionSymbol = redaktionSymbol;
			}
		private bool CreateStandBildTableEntry (InformationAddOn infoAddOn, ProcessConnector connector, ExternalControlClient StartUpParameter,
			Timing actuallTerminEntry, int DaysBackForAnzeigeTiming)
			{
			if ((connector.TableId != null)
			    && (connector.TableId != System.Guid.Empty))
				{
				MessageBox.Show ("der gewählte Eintrag ist technisch nicht in Ordnung\r\n"
				                 + "\"Connector.TableID != null\r\n"
				                 + "Bitte löschen Sie diesen Eintrag, oder treten Sie diesbezüglich\r\n"
				                 + "mit WPMedia in Kontakt");
				return false;
				}
			if (connector.InformationenId != InformationToProcess.Id)
				{
				MessageBox.Show("Ein Schwerer Fehler ist aufgetreten\r\n" +
				                "connector.InformationenID != DataModell.ActiveInformationen.ID\r\n" +
				                "Abbruch!!");
				throw new Exception("connector.InformationenID != DataModell.ActiveInformationen.ID");
				}
			ProcessConnectorToWorkWith = connector;
			CsDbTableBase DynamicTargetTable = Data.DbServer3.WPMediaAddOnData.GetTableByName(connector.TableName);

			List<DataRow> RowsToDelete = new List<DataRow>();
			foreach (DataRow dataRow in DynamicTargetTable.Rows)
				{
				RowsToDelete.Add(dataRow);
				}
			foreach (DataRow dataRow in RowsToDelete)
				{
				dataRow.Delete();
				}
			DynamicTargetTable.AcceptChanges();
			DynamicTargetTable.HasBeenLoaded = true;
			DynamicTargetTable.Generic_DownloadRows
				($"Select * from {connector.TableName} where NameID = '{connector.NameId.Replace("'", "''")}'");
			DynamicTargetTable.HasBeenLoaded = true;
			foreach (DataRow dataRow in DynamicTargetTable.Rows)
				{
				if (dataRow["NameID"].ToString() == connector.NameId)
					{
					MessageBox.Show($"Der Eintrag\r\n\"{connector.NameId}\"\r\nist schon vorhanden, " +
									$"diesen Namen bitte ändern");
					return false;
					}
				}
			connector.TableId = System.Guid.NewGuid ();
			DataRow NewRow = DynamicTargetTable.NewRow ();
			NewRow ["ID"] = connector.TableId;
			NewRow ["NameID"] = connector.NameId;
			Profile.ActiveTyp = InformationToProcess.Typ;
			if (Profile.ActiveRedaktion != connector.Redaktion)
				throw new Exception ("Profile.ActiveRedaktion != Connector.Redaktion");
			try
				{
				ProcessThisMappingGroup(Profile.ActiveTyp.Id, NewRow, connector);
				}
			catch (Exception Excp)
				{
				throw new Exception("ProcessThisMappingGroup (Version 2.0) brachte Fehler:\r\n"
										+ Excp.ToString());
				}
			if (NewRow.Table.Columns.Contains("TemplateName"))
				{
				if (!String.IsNullOrEmpty(connector.TemplateNameDecorated))
					NewRow["TemplateName"] = connector.TemplateNameDecorated;
				}
			if (NewRow.Table.Columns.Contains("LastUpdateToken"))
				NewRow ["LastUpdateToken"] = Basics.GetNextLastUpdateTokenHelper ();
			NewRow ["ModifyTimeStamp"] = DateTime.Now;
			NewRow ["ProcessingStatus"] = "InternetPublishingPending;TVPublishingPending";
			NewRow.Table.Rows.Add (NewRow);

			CreateAndLocallyImportStandBildTimingsEntry (Data.DbServer3.WPMediaAddOnData.Timings, NewRow, actuallTerminEntry, DaysBackForAnzeigeTiming);

			DynamicTargetTable.DataSet.SaveAnabolic(new Object());
			DynamicTargetTable.DataSet.AcceptChanges();


			CreatedStandBildGuid = connector.TableId = (Guid) NewRow ["ID"];
			
			CommonSearchClass HandledEntry = null;
			infoAddOn.FreiText = connector.FreiText;
			if ((connector.InformationenId != InformationToProcess.Id)
				|| (connector.InformationenAddOnId != infoAddOn.Id))
				throw new Exception("((connector.InformationenId != InformationToProcess.Id)\r\n" +
									"|| (connector.InformationenAddOnId = infoAddOn.Id))");
			Data.DbServer3.AltErlaaInfo.SaveUnspecific(new Object());
			Data.DbServer3.AltErlaaInfo.AcceptChanges();
			//if (!RunningAsOldToNew)
			//	DataModell.UpdateWorkDataSet (RequiredUpdateFunction.Modify, ref HandledEntry);
			//else
			//	DataModell.WorkDataSet.AcceptChanges();

			String WPMediaPackageRoot = System.IO.Path.Combine (Basics.GetLocalWPMediaRoot (),
				Basics.XML_AUTO_CONTENT_SOURCE);
			String LocalPackageFileName = System.IO.Path.Combine (WPMediaPackageRoot,
				System.IO.Path.Combine (WPMediaPackageRoot,
				Path.Combine (connector.TableName, NewRow ["ID"].ToString () + ".pkg")));

			int NumberOfPlayablePages;
			if (String.Compare (LocalPackageFileName, CreateLocalPackage (connector.TableName,
				((System.Guid) connector.TableId).ToString (), out NumberOfPlayablePages),
				StringComparison.InvariantCultureIgnoreCase) != 0)
				throw new Exception ("StandBildCreation - LocalPackageFileName != CreatedName");

			SetNumberOfPages (connector.TableName, ((System.Guid) connector.TableId).ToString (),
				NewRow, NumberOfPlayablePages);

			if ((NewRow.Table.Columns ["TemplateName"] != null)
			    && (!String.IsNullOrEmpty (NewRow ["TemplateName"].ToString ())))
				CreatePackageCheckAndDoTemplatingIfRequired (LocalPackageFileName, NewRow);

			List<String> PictureElementeForThisInformationID = InformationToProcess.Get_MaterialElemente(connector);
			CheckAndDoPictureImportIfRequired (NewRow, PictureElementeForThisInformationID);

			WMB.DataWrapper.Instance.DoCentralFileUpdate (LocalPackageFileName);

			DoStandBildProgrammActivities (connector);
			return true;
			}
		private void CreateAndLocallyImportStandBildTimingsEntry (DataTable timingsDataTable, DataRow NewRow, Timing actuallTerminEntry, int DaysBack)
			{
			DateTime UsedStopTime = DateTime.Now.AddDays (DaysBack - 1).Date.AddMinutes (1439);
			DateTime UsedStartTime = UsedStopTime.Date.AddDays (-(DaysBack)).AddMinutes (1);
			if (actuallTerminEntry != null)
				{
				if ((actuallTerminEntry.TimingTypId == "AnzVonBis")
				    || (actuallTerminEntry.TimingTypId == "BannerVonBis")
				    || (actuallTerminEntry.TimingTypId == "AktivVonBis"))
					{
					if (actuallTerminEntry.TimeB != null)
						UsedStopTime = ((DateTime) actuallTerminEntry.TimeB).Date.AddMinutes (1439);
					if (DaysBack == -1)
						{
						if (actuallTerminEntry.TimeA != null)
							UsedStartTime = ((DateTime) actuallTerminEntry.TimeA).Date.AddMinutes (1);
						}
					else
						UsedStartTime = UsedStopTime.Date.AddDays (-(DaysBack)).AddMinutes (1);
					}
				else
					{
					if (actuallTerminEntry.TimeB != null)
						UsedStopTime = ((DateTime) actuallTerminEntry.TimeB).Date.AddMinutes (1439);
					if (actuallTerminEntry.TimeA != null)
						UsedStartTime = ((DateTime) actuallTerminEntry.TimeA).Date.AddDays (-(DaysBack)).AddMinutes (1);
					}
				}

			DataRow NewTimingsRow = timingsDataTable.NewRow ();
			NewTimingsRow ["TimingsID"] = System.Guid.NewGuid ();
			NewTimingsRow ["ConnectedType"] = NewRow.Table.TableName;
			NewTimingsRow ["ConnectedID"] = NewRow ["ID"];
			NewTimingsRow ["TimingTypID"] = "VonBis";
			NewTimingsRow ["TimeA"] = UsedStartTime;
			NewTimingsRow ["TimeB"] = UsedStopTime;
			if (NewTimingsRow.Table.Columns.Contains ("LastUpdateToken"))
				NewTimingsRow ["LastUpdateToken"] = Basics.GetNextLastUpdateTokenHelper ();
			timingsDataTable.Rows.Add (NewTimingsRow);
			}
		public bool CreateStandbildEntryForOneProcessConnector (InformationAddOn InfoAddOn,
			int DaysBackForAnzeigeTiming, Timing timingsToUse)
			{
			DbEntities.dbserver3.alterlaainfo.rows.ProcessConnector connector
							= InfoAddOn.Get_ConnectedProcessConnector;
			if (String.IsNullOrEmpty (connector.TableName))
				{
				Basics.ReportErrorToEventViewer ("Connector TableName ist nicht gesetzt\r\n"
				                                 + "bitte zuerst setzten, dann können\r\n"
				                                 + "Sie einen Eintrag anlegen");
				ErrorMessages.Add ("Connector TableName ist nicht gesetzt\r\n"
				                   + "bitte zuerst setzten, dann können\r\n"
				                   + "Sie einen Eintrag anlegen");
				return false;
				}
			if ((connector.TableId != null)
			    && (connector.TableId != System.Guid.Empty))
				{
				Basics.ReportErrorToEventViewer ("ConnectorRow [\"TableID\"] != Convert.DBNull\r\n"
				                                 + "|| ConnectorRow [\"TableID\"] != System.Guid.Empty\r\n"
				                                 + "d.h. Es ist schon vorher ein Eintrag angelegt worden\r\n"
				                                 + "bitte zuerst löschen, dann können\r\n"
				                                 + "Sie einen Eintrag anlegen");
				ErrorMessages.Add ("ConnectorRow [\"TableID\"] != Convert.DBNull\r\n"
				                   + "|| ConnectorRow [\"TableID\"] != System.Guid.Empty\r\n"
				                   + "d.h. Es ist schon vorher ein Eintrag angelegt worden\r\n"
				                   + "bitte zuerst löschen, dann können\r\n"
				                   + "Sie einen Eintrag anlegen");
				return false;
				}
			return CreateStandBildTableEntry (InfoAddOn, connector, ExternalControlClient.HandlerList ["StandBild"],
				timingsToUse, DaysBackForAnzeigeTiming);
			}
		private ObservableCollection<CommonSearchClass> ReadSearchDataAdvanced(List<String> dataTemplateStrings,
			List<String> dataTimingTypeStrings, DateTime? activeFrom, DateTime? activeTo,
			DateTime? modifiedFrom, DateTime? modifiedTo, String specificWhereAddOn, int maxNumberOfEntries = -1)
			{
			List<Guid> InformationenToProcessIds = new List<Guid>();
			List<System.Guid> InformationenTypen = dataContext.AltErlaaInfo
				.Typen.GetInformationenTypenFromDataTemplateNameIds(dataTemplateStrings);
			Timing[] TimingsToProcess = new Timing[0];
			if ((activeFrom != null)
				&& (activeTo != null))
				{
				TimingsToProcess = dataContext.AltErlaaInfo.Timings
					.Load_Between((DateTime) activeFrom, (DateTime) activeTo, dataTimingTypeStrings);
				foreach (Timing timing in TimingsToProcess)
					{
					Debug.Assert(timing.ConnectedId != null, "timing.ConnectedId != null");
					if (!InformationenToProcessIds.Contains((Guid)timing.ConnectedId))
						InformationenToProcessIds.Add((Guid) timing.ConnectedId);
					}
				}
			Information[] informationenToProcess = dataContext.AltErlaaInfo.Informationen
				.Load_via_Ids(InformationenToProcessIds, specificWhereAddOn, modifiedFrom, modifiedTo);
			InformationenToProcessIds.Clear();
			foreach (Information information in informationenToProcess)
				{
				InformationenToProcessIds.Add(information.Id);
				}
			ObservableCollection<CommonSearchClass> Result = new ObservableCollection<CommonSearchClass>();
			if (TimingsToProcess.Length > 0)
				foreach (Timing timing in TimingsToProcess.Where(sel => 
					InformationenToProcessIds.Contains((Guid) sel.ConnectedId)))
					{
					Result.Add(new CommonSearchClass(this, timing)
						{
						InformationenConnectedEntry = dataContext.AltErlaaInfo
							.Informationen.Find(timing.ConnectedId)
						});
					}
			else
				{
				foreach (Information information in informationenToProcess)
					{
					Timing[] ConnectedTimings = dataContext.AltErlaaInfo.Timings.Load_via_ConnectedId(information.Id);
					if (ConnectedTimings.Length > 0)
						foreach (Timing timing in ConnectedTimings)
							{
							if (dataTimingTypeStrings.Contains( timing.TimingTypId))
								Result.Add(new CommonSearchClass(this, timing)
									{
									InformationenConnectedEntry = information
									});
							}
					else
						{
						Result.Add(new CommonSearchClass(this, (Timing) null)
							{
							InformationenConnectedEntry = information
							});
						}

					}
				}
			return Result;
			}