Exemplo n.º 1
0
	    private void InformationAddOnInstanceChanged(InformationAddOn OldValue,
		    InformationAddOn NewValue)
		    {
		    if (NewValue != null)
			    {
			    if (ProcessConnectorModellInstance == null)
				    {
					ProcessConnectorModell Helper = new ProcessConnectorModell();
				    Helper.InformationAddOnToProcess = NewValue;
					ProcessConnectorModellInstance = Helper;
					}
				else
					ProcessConnectorModellInstance.InformationAddOnToProcess = NewValue;

			    }
		    }
Exemplo n.º 2
0
		public InformationAddOn InsertNewSibling(InformationAddOn sibling)
			{
			InformationAddOn newEntry = DataContext.AltErlaaInfo.InformationenAddOns.NewRow();
			DbBasics.CopyRowContent(sibling, newEntry);
			newEntry.Id = Guid.NewGuid();
			newEntry.TabelleId = null;
			newEntry.FreiText = String.Empty;
			foreach (InformationAddOn informationAddOn in DataContext.AltErlaaInfo
						.InformationenAddOns.Where(sel => sel.DataDependencyId == sibling.DataDependencyId
								&& sel.SortOrder > sibling.SortOrder ))
				{
				informationAddOn.SortOrder++;
				}
			newEntry.SortOrder = sibling.SortOrder + 1;
			newEntry.Table.Rows.Add(newEntry);
			return newEntry;
			}
Exemplo n.º 3
0
	    private void InformationAddOnInstanceChanged(InformationAddOn OldValue,
		    InformationAddOn NewValue)
		    {
		    if (NewValue != null)
			    {
				TimingsModellInstance = new TimingsModell(NewValue);
//				TimingsModellInstance.RedrawMe();

				}
		    }
Exemplo n.º 4
0
		private void SetInputAllowence(InformationAddOn informationAddOn)
			{
			if (informationAddOn.Tabelle == "ProcessConnector")
				{
				ShowTableSelection = false;
				ShowFreitextInput = false;
				ShowFormInput = true;
				ShowTableModification = false;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaForm;
				}
			else
			if (informationAddOn.Tabelle == "Events")
				{
				ShowTableSelection = false;
				ShowFreitextInput = true;
				ShowFormInput = false;
				ShowTableModification = false;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaFreiText;
				}
			else
			if (informationAddOn.Tabelle == "Remarks")
				{
				ShowTableSelection = false;
				ShowFreitextInput = true;
				ShowFormInput = true;
				ShowTableModification = false;
				RequestedTypeOfInputForInformationAddOn
					= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaFreiText;
				}
			else
			if ((informationAddOn.Tabelle == "Adressen")
				|| (informationAddOn.Tabelle == "AdressenFull"))
				{
				ShowTableSelection = true;
				ShowFreitextInput = true;
				ShowFormInput = false;
				ShowTableModification = true;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaTable;
				}
			else
			if (informationAddOn.Tabelle == "Organisationen")
				{
				ShowTableSelection = true;
				ShowFreitextInput = true;
				ShowFormInput = false;
				ShowTableModification = true;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaTable;
				}
			else
			if (informationAddOn.Tabelle == "Materialien")
				{
				ShowTableSelection = false;
				ShowFreitextInput = false;
				ShowFormInput = true;
				ShowTableModification = false;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaForm;
				}
			else
			if (informationAddOn.Tabelle == "Timings")
				{
				ShowTableSelection = false;
				ShowFreitextInput = false;
				ShowFormInput = true;
				ShowTableModification = false;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaForm;
				}
			else
			if (informationAddOn.Tabelle == "Personen")
				{
				ShowTableSelection = true;
				ShowFreitextInput = true;
				ShowFormInput = true;
				ShowTableModification = true;
				RequestedTypeOfInputForInformationAddOn
						= InformationAddOnModell.TypeOfInputForInformationAddOn.ViaTable;
				}
			else
				{
				throw new Exception($"Bei {informationAddOn.Id} ist die Tabelle {informationAddOn.Tabelle}");
				}
			}
Exemplo n.º 5
0
		private void DoTimingsDefault(String TimingTypID, int PreShowDays, InformationAddOn sourceInfoAddOn)
			{
			Timing timing = GetOrCreate_ConnectedTiming();
			timing.TimingTypId = TimingTypID;
			timing.ConnectedType = "Informationen";
			timing.ConnectedId = (Guid) InformationenId;
			if (sourceInfoAddOn == null)
				sourceInfoAddOn =
					Information.InformationenAddOnsOrdered.Where(sel => sel.DataDependency
						.DataElementeTemplate.PhysicalDataElement.TabellenName == "Timings").FirstOrDefault();
			if (sourceInfoAddOn == null)
				return;
			Timing SourceTiming = sourceInfoAddOn.Get_ConnectedTiming;
			if (SourceTiming == null)
				return;
			timing.TimeB = (DateTime)SourceTiming.TimeB;
			timing.TimeA = ((DateTime)timing.TimeB).AddDays(PreShowDays).Date;
			if (timing.TimeA < DateTime.Now)
				timing.TimeA = DateTime.Now.Date;
			this.FreiText = timing.FreiText;
			}
Exemplo n.º 6
0
		private void ProcessFinalUpdates(InformationAddOn informationAddOn)
			{
			if (informationAddOn.Tabelle == "ProcessConnector")
				{
				ProcessConnector processConnector = informationAddOn.Get_ConnectedProcessConnector;
				if (processConnector != null)
					{
					informationAddOn.FreiText = processConnector.FreiText;
					}
				return;
				}
			if (informationAddOn.Tabelle == "Events")
				{
				Event eventEntry = informationAddOn.Get_ConnectedEvent;
				if (eventEntry != null)
					{
					informationAddOn.FreiText = eventEntry.FreiText;
					}
				return;
				}
			if (informationAddOn.Tabelle == "Remarks")
				{
				Remark remark = informationAddOn.Get_ConnectedRemark;
				if (remark != null)
					{
					informationAddOn.FreiText = remark.FreiText;
					}
				return;
				}
			if ((informationAddOn.Tabelle == "Adressen")
				|| (informationAddOn.Tabelle == "AdressenFull"))
				{
				Adresse adresse = informationAddOn.Get_ConnectedAdresse;
				if (adresse != null)
					{
					informationAddOn.FreiText = adresse.FreiText;
					}
				return;
				}
			if (informationAddOn.Tabelle == "Organisationen")
				{
				Organisation organisation = informationAddOn.Get_ConnectedOrganisation;
				if (organisation != null)
					{
					informationAddOn.FreiText = organisation.FreiText;
					}
				return;
				}
			if (informationAddOn.Tabelle == "Materialien")
				{
				Material material = informationAddOn.Get_ConnectedMaterial;
				if (material != null)
					{
					informationAddOn.FreiText = material.FreiText;
					}
				return;
				}
			if (informationAddOn.Tabelle == "Timings")
				{
				if ((informationAddOn.TabelleId != null)
					&& (informationAddOn.TabelleId != Guid.Empty))
					{
					Timing timing = Data.DbServer3.AltErlaaInfo.Timings.Find(informationAddOn.TabelleId);
					if (timing.FreiText != informationAddOn.FreiText)
						timing.RefreshAllConnectedInformationenAddOn();
					}
				return;
				}
			if (informationAddOn.Tabelle == "Personen")
				{
				Person person = informationAddOn.Get_ConnectedPerson;
				if (person != null)
					{
					informationAddOn.FreiText = person.FreiText;
					}
				return;
				}
			throw new Exception($"Bei {informationAddOn.Id} ist die Tabelle {informationAddOn.Tabelle}");

			}
Exemplo n.º 7
0
		// each Mapping is processed over all Data for one Information (= all InformationenAddOn)
		private void ProcessThisMapping(InformationAddOn InfoAddOn, DataRow NewRow, ProcessConnector ProcessConnectorToProcess,
			StandBildMapping Mapping, String PageIDToUse)
			{
			String InputString = GetInputString (InfoAddOn, Mapping);
			String TargetItemName = Mapping.TargetItem.Replace("?1", PageIDToUse);
			if (String.IsNullOrEmpty(TargetItemName))
				return;
			if (TargetItemName == "*")
				return;
			if (!NewRow.Table.Columns.Contains(TargetItemName))
				throw new Exception("Das TargetItem \"" + TargetItemName + "\" fehlt");
			if (NewRow.Table.Columns[TargetItemName] == null)
					return;
			
			int MaxTargetLength = Convert.ToInt32(Mapping.MaxTargetLength);
			String AddContentAllowed = Mapping.AddContentAllowed;

			MoveToOrAdd (NewRow, TargetItemName, InputString, Mapping);
			}
Exemplo n.º 8
0
		private bool ProcessSingleEntryFilling(DefaultFilling Filling, Information info,
						InformationAddOn sourceInfoAddOn)
			{
			switch (Filling.ContentTypProperty)
				{
				case DefaultFilling.ContentTyp.BannerConnector:
					DoConnectorDefaults("Banner", "BannerData", "WPMediaAddOnDataConnectionString");
					break;
				case DefaultFilling.ContentTyp.StandBildConnector:
					DoConnectorDefaults("StandBild", "WohnParkInfo", "WPMediaAddOnDataConnectionString");
					break;
				case DefaultFilling.ContentTyp.BerichtConnector:
					DoConnectorDefaults("StandBild", "LiesingInfo", "WPMediaAddOnDataConnectionString");
					break;
				case DefaultFilling.ContentTyp.BeitragConnector:
					DoConnectorDefaults("Beitrag", "Beitrag", "WPMediaConnectionString");
					break;
				case DefaultFilling.ContentTyp.FillConnectedTiming:
					DoConnectedTimingsDefaults();
					break;
				case DefaultFilling.ContentTyp.AdjustChapterStructures:
					DoAdjustChapterStructures();
					break;
				case DefaultFilling.ContentTyp.BannerTiming:
					DoTimingsDefault("BannerVonBis", -3, sourceInfoAddOn);
					break;
				case DefaultFilling.ContentTyp.StandBildTiming:
					DoTimingsDefault("AnzVonBis", -14, sourceInfoAddOn);
					break;
				case DefaultFilling.ContentTyp.BeitragTiming:
					DoTimingsDefault("AnzVonBis", -14, sourceInfoAddOn);
					break;

				case DefaultFilling.ContentTyp.EventTimings:
					DoEventTimingsDefault("EventVonBis", 0);
					break;
				case DefaultFilling.ContentTyp.BerichtTimings:
					DoBerichtTimingsDefault("AktivVonBis", 14);
					break;
				}
			return true;
			}
Exemplo n.º 9
0
		private String GetInputString (InformationAddOn InfoAddOn, StandBildMapping Mapping)
			{
			String RawInput = String.Empty;
			switch (Mapping.WhereTheDataIsTakenFromProperty)
				{
				case StandBildMapping.WhereTheDataIsTakenFrom.FreiText:
					RawInput = InfoAddOn.FreiText;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.Static:
					RawInput = Mapping.SourceContent;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.Title:
					RawInput = InfoAddOn.Information.Titel;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.BannerTitle:
					RawInput = InfoAddOn.Information.BannerTitel;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.BannerHeuteTitle:
					RawInput = InfoAddOn.Information.BannerHeuteTitel;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.Typ:
					RawInput = InfoAddOn.Information.Typ.NameId;
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.Table:
					{
					DataRow RootTableRow = (DataRow) InfoAddOn.Get_ConnectedRootClass;
					if (RootTableRow != null)
						{
						RawInput = RootTableRow[Mapping.SourceItem].ToString();
						}
					}
					break;
				case StandBildMapping.WhereTheDataIsTakenFrom.TemplateID:
					RawInput = Mapping.SourceContent;
					break;
				}

			if (String.IsNullOrEmpty (RawInput))
				return RawInput;
			switch (Mapping.SplittingRulesProperty)
				{
				case StandBildMapping.SplittingRules.None:
					return RawInput;
					break;
				case StandBildMapping.SplittingRules.Word:
					{
					String [] allWords = RawInput.Replace ("\r\n", " ").Replace ("  ", " ").Trim ().Split (' ');
					int numberOfWords = (int)((Mapping.TargetItemSplittingParameter1 <= allWords.Length)
						? Mapping.TargetItemSplittingParameter1
						: allWords.Length);
					return String.Join (" ", allWords, 0, numberOfWords);
					}
					break;
				case StandBildMapping.SplittingRules.Line:
					{
					RawInput = RawInput.Replace ("\r\n", "\n");
					String [] lines = RawInput.Split ('\n');
					int lineNumber = (int) Mapping.TargetItemSplittingParameter1;
					if (lineNumber > 0)
						{
						if (lines.Length >= lineNumber)
							return lines [lineNumber - 1];

						else
							return String.Empty;
						}
					else
						{
						int StartingLine = lines.Length + lineNumber;
						if (StartingLine >= lines.Length)
							return String.Empty;
						else
							return lines [StartingLine];
						}

					}
					break;
				case StandBildMapping.SplittingRules.Between:
					{
					RawInput = RawInput.Replace ("\r\n", "\n");
					String [] Lines = RawInput.Split ('\n');
					int StartIndex = (int)Mapping.TargetItemSplittingParameter1;
					int EndIndex = 0;
					if (Mapping.TargetItemSplittingParameter2 < 0)
						EndIndex = (int)(Lines.Length - 1 + Mapping.TargetItemSplittingParameter2);
					else
						EndIndex = (int)(Mapping.TargetItemSplittingParameter2);
					if ((StartIndex > EndIndex)
						|| (EndIndex >= Lines.Length))
						return String.Empty;
					StringBuilder Result = new StringBuilder ();
					int RunningIndex = StartIndex;
					while (RunningIndex <= EndIndex)
						Result.AppendLine (Lines [RunningIndex++].Trim ());
					return Result.ToString ().Trim (new char [] {' ', '\r', '\n', '\t'});
					}
					break;
				case StandBildMapping.SplittingRules.TakeAfter:
					{
					String TakeAfterString = Mapping.SourceContent;
					int Index = RawInput.IndexOf(TakeAfterString);
					if (Index == -1)
						return String.Empty;
					return RawInput.Substring(Index + TakeAfterString.Length).Trim(new char[] { ' ', '\r', '\n', '\t' });
					}
					break;
				}
			return String.Empty;
			}
Exemplo n.º 10
0
		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;
			}
Exemplo n.º 11
0
		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);
			}
Exemplo n.º 12
0
		public TimingsModell(InformationAddOn parentInformationAddOn)
			{
			TimingToProcess = parentInformationAddOn.Get_ConnectedTiming;
			ParentInformationAddOn = parentInformationAddOn;
			}
Exemplo n.º 13
0
		public ProcessConnectorModell(InformationAddOn parentInformationAddOn)
			{
			ProcessConnectorToProcess = parentInformationAddOn.Get_ConnectedProcessConnector;
			InformationAddOnToProcess = parentInformationAddOn;
			}