Beispiel #1
0
		public void DeleteStandBildMapping (StandBildMapping standBildMappingToWorkFor)
			{
			standBildMappingToWorkFor.Delete();
			DbDataContext.AltErlaaInfo.SaveKatabolic();
			DbDataContext.AltErlaaInfo.AcceptChanges();
			}
		private void AddNewMappingEntry_OnClick (object Sender, RoutedEventArgs E)
			{
			StandBildMappingToWorkFor = CommonProfileModellInstance.CreateNewStandBildMapping (DataDependencyToWorkFor);
			}
		private void DeleteMappingEntry_OnClick (object Sender, RoutedEventArgs E)
			{
			if (StandBildMappingToWorkFor == null)
				return;
			CommonProfileModellInstance.DeleteStandBildMapping(StandBildMappingToWorkFor);
			StandBildMappingToWorkFor = null;
			}
		private void StandBildMappingToWorkForChanged(StandBildMapping OldValue,
			StandBildMapping NewValue)
			{
			CommonProfileModellInstance.StandBildMappingToWorkFor = NewValue;
			}
		private void StandBildMappingForDataDependency_OnSelectionChanged (object Sender, SelectionChangedEventArgs E)
			{
			E.Handled = true;
			if (E.AddedItems.Count == 0)
				{
				StandBildMappingToWorkFor = null;
				return;
				
				}
			if (E.AddedItems [0].GetType () != typeof (StandBildMapping))
				{
				StandBildMappingToWorkFor = null;
				return;
				}
			StandBildMappingToWorkFor = (StandBildMapping) E.AddedItems [0];
			if (StandBildMappingToWorkFor == null)
				return;
			CommonProfileModellInstance.Profile.ActiveStandBildMapping
				= StandBildMappingToWorkFor;
			CommonProfileModellInstance.Profile.ActiveRedaktion
				= CommonProfileModellInstance.Profile.ActiveStandBildMapping.TargetRedaktion;
			CommonProfileModellInstance.DataModell.UpdateDataSetForProfileManagement();
			CommonProfileModellInstance.DataModell.StandBildMappingCacheInstance.SendPropertyChanged
				("CorrectOrderedStandBildMappingForActiveTypAndRedaktion");
			}
Beispiel #6
0
		public void SetCorrectStandBildMappingEntries(StandBildMapping Trigger)
			{
			ActiveDataElementeTemplates = Trigger.DataDependency.DataElementeTemplate;
			}
Beispiel #7
0
		private void DoMappingTrace (String Where, DataRow NewRow, StandBildMapping Mapping)
			{
			Debug.WriteLine (Where + " - " + NewRow.Table.TableName + " - " + Mapping.NameId);
			TraceFilledDataRowItems ("Daten des Resultat Eintrages", NewRow);
			Debug.WriteLine ("---");
			TraceFilledDataRowItems ("Daten des Mapping Eintrages", Mapping);
			}
Beispiel #8
0
		private void MoveToOrAdd(DataRow NewRow, String TargetItem, String NewInputContent,
				StandBildMapping Mapping)
			{
			if (String.IsNullOrEmpty(NewInputContent))
				NewInputContent = String.Empty;
			if (Basics.IsTestRun)
				Basics.ShowDataRowContent(NewRow, "MoveToOrAdd  \"" + NewInputContent + "\"");
			//if (String.IsNullOrEmpty(NewInputContent))
			//	return;
			String AddContentAllowed = Mapping.AddContentAllowed;
			int MaxTargetLength = (int) Mapping.MaxTargetLength;

			if (AddContentAllowed != "Yes")
				{
				if (NewInputContent.Length < MaxTargetLength)
					NewRow[TargetItem] = NewInputContent;
				else
					NewRow[TargetItem] = NewInputContent.Substring(0, MaxTargetLength);
				}
			else
				{
				if (String.IsNullOrEmpty(NewRow[TargetItem].ToString()))
					{
					if (NewInputContent.Length < MaxTargetLength)
						NewRow[TargetItem] = NewInputContent;
					else
						NewRow[TargetItem] = NewInputContent.Substring(0, MaxTargetLength);
					}
				else
					{
					int RemainingLength = MaxTargetLength - NewRow[TargetItem].ToString().Length - 2;
					if (RemainingLength > 2)
						{
						if (NewInputContent.Length < RemainingLength)
							NewRow[TargetItem] = NewRow[TargetItem].ToString() + "\r\n" + NewInputContent;
						else
							NewRow[TargetItem] = NewRow[TargetItem].ToString() + "\r\n" + NewInputContent.Substring(0, RemainingLength);
						}
					}
				}
			switch (Mapping.PostProcessingsProperty)
				{
				case StandBildMapping.PostProcessings.SingleSpaces:
					NewRow[TargetItem] = NewRow[TargetItem].ToString().Replace("\n", " ").Replace("\r", " ").Replace("  ", " ");
					break;
				case StandBildMapping.PostProcessings.SkipCRLF:
					NewRow[TargetItem] = NewRow[TargetItem].ToString().Replace("\r\n", " ");
					break;
				}
			}
Beispiel #9
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);
			}
Beispiel #10
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;
			}