Example #1
0
		public static String GetAGText(WCFStandardsNS.WCFStandards DataBase, String ID)
			{
			if (String.IsNullOrEmpty (ID))
				return String.Empty;
			DataRow AGRow =
				DataBase.GetCommonDataSet ("Select * from ArbeitsGruppen where ID = '" + ID + "'").Tables ["ArbeitsGruppen"].Rows [0];
			return AGRow ["NameID"].ToString () + "-" + AGRow ["Beschreibung"].ToString ();
			}
Example #2
0
		public static String GetOrtsTeilText(WCFStandardsNS.WCFStandards DataBase, String ID)
			{
			if (String.IsNullOrEmpty (ID))
				return String.Empty;
			return DataBase.GetCommonDataSet ("Select * from Orte where ID = '" + ID + "'")
				.Tables ["Orte"].Rows [0] ["OrtsTeil"].ToString ();
			}
Example #3
0
        public bool SetData(WCFStandardsNS.WCFStandards ParentsDataBase, ControlUserData UserDataParameter, DataSet SchemaDataSet,
            TableLayoutDefinition TableLayoutDefinition, String RecordIDToProcess)
            {
            m_TableHelper = new CVM.TableUserControlHelper ();
            m_TableHelper.DataBase = ParentsDataBase;
            m_Bereich = "";
            m_SchemaDataSet = SchemaDataSet;
            LayoutDefinition = TableLayoutDefinition;
            DataBase = ParentsDataBase;
	
            m_ActiveID = RecordIDToProcess;
            m_RefreshmentRoutine = UserDataParameter.m_RefreshFunctionName;
            m_PrimaryKeyName = UserDataParameter.m_PrimaryKeyName;
            m_TableHelper.TableName = UserDataParameter.m_TableName;
            m_ProcessingDataSet = DataBase.GetCommonDataSet (
                "Select * from " + UserDataParameter.m_TableName + " where " + m_PrimaryKeyName + " = '" + m_ActiveID + "'");
            if (UserDataParameter.m_UpdateAble)
                SetRowToProcess (m_ProcessingDataSet.Tables [0].Rows [0], "Bitte ändern Sie ggf. diese \""
                                                                          + UserData.m_TableName + "\" Daten", UserDataParameter.m_UpdateAble);
            else
                SetRowToProcess (m_ProcessingDataSet.Tables [0].Rows [0], "", UserData.m_UpdateAble);

            if (LayoutDefinition == null)
                {
                m_TableHelper.LayoutDefinitionsPropertyToken = "CommonUserInterfaceWindow_";
                LayoutDefinition = m_TableHelper.LayoutDefinition;
                }
            return true;
            }
Example #4
0
		public static String GetIDForOrtsTeil(WCFStandardsNS.WCFStandards DataBase, String OrtsTeil)
			{
			return DataBase.GetCommonDataSet("Select * from Orte where OrtsTeil = '"
							 + OrtsTeil + "' and (NameID = 'Gesamter Ortsteil' or NameID = 'Liesing Bezirk')")
								.Tables ["Orte"].Rows [0] ["ID"].ToString ();
			}
Example #5
0
		public static bool MirrorDataSetTo(WCFStandardsNS.WCFStandards TargetDataBase, DataSet DataSetToMirror)
			{
			if (DataSetToMirror == null)
				return true;
			foreach (DataTable SourceTable in DataSetToMirror.Tables)
				{
				DataTable DeletedRows = SourceTable.GetChanges(DataRowState.Deleted);
				if (DeletedRows != null)
					foreach (DataRow ToDelete in DeletedRows.Rows)
						{
						if (TargetDataBase.GetCommonDataSet
							("Select ID from " + SourceTable.TableName
											   + " where ID = '" + ToDelete["ID"].ToString() + "'")
											   .Tables[SourceTable.TableName].Rows.Count > 0)
							{
							String DeleteCommand = "Delete from " + SourceTable.TableName
												   + " where ID = '" + ToDelete["ID"].ToString() + "'";
							TargetDataBase.RunSQLBatch(DeleteCommand);
							}
						}
				List<String> SourceIDs = new List<string>();
				foreach (DataRow SourceRow in SourceTable.Rows)
					if (SourceRow.RowState != DataRowState.Deleted)
						SourceIDs.Add(SourceRow["ID"].ToString());
				if (SourceIDs.Count == 0)
					continue;
				String WhereClause = " where (ID = '" + String.Join("' or ID = '", SourceIDs.ToArray()) + "') ";
				DataSet TargetDataSet = TargetDataBase.GetCommonDataSet("Select * from "
									+ SourceTable.TableName + WhereClause);
				if (TargetDataSet == null)
					{
					WMB.Basics.ReportErrorToEventViewer("MBRStatics.MirrorDataSetTo",
							"Bei der Table \"" + SourceTable.TableName + "\" konnte nichts gelesen werden");
					return false;
					}
				foreach (DataRow SourceRow in SourceTable.Rows)
					{
					DataRow[] TargetRows = TargetDataSet.Tables[SourceTable.TableName]
						.Select("ID = '" + SourceRow["ID"].ToString() + "'");
					if (TargetRows.Length > 1)
						{
						WMB.Basics.ReportErrorToEventViewer("MBRStatics.MirrorDataSetTo",
								"Bei der Table \"" + SourceTable.TableName + "\" für die ID \""
								+ SourceRow["ID"].ToString() + "\" gibt es mehr als einen Record!!!");
						return false;
						}
					if (TargetRows.Length > 1)
						{
						WMB.Basics.ReportErrorToEventViewer("MBRStatics.MirrorDataSetTo",
							"Bei der Tabelle \"" + SourceTable.TableName + "\"\r\n"
							+ "Bei der ID \"" + SourceRow["ID"].ToString() +
							"\" tritt ein Datenbank Fehler auf.\r\n"
							+ "Mehr als ein Record für diese ID");
						continue;
						}
					DataRow TargetRow = null;
					if (TargetRows.Length < 1)
						{
						TargetRow = TargetDataSet.Tables[SourceTable.TableName].NewRow();
						TargetRow["ID"] = SourceRow["ID"].ToString();
						TargetRow["LastUpdateToken"] = WMB.Basics.GetNextLastUpdateTokenHelper();
						TargetDataSet.Tables[SourceTable.TableName].Rows.Add(TargetRow);
						}
					else
						{
						TargetRow = TargetRows[0];
						}
					foreach (DataColumn Col in TargetDataSet.Tables[SourceTable.TableName].Columns)
						{
						if (Col.ColumnName != "ID")
							if (String.Compare(TargetRow[Col.ColumnName].ToString(),
												SourceRow[Col.ColumnName].ToString()) != 0)
								{
								if (Convert.IsDBNull(SourceRow[Col.ColumnName]) == true)
									TargetRow[Col.ColumnName] = Convert.DBNull;
								else
									TargetRow[Col.ColumnName] = SourceRow[Col.ColumnName].ToString();
								}
						}
					}
				String ReturnMessage = TargetDataBase.SetCommonDataSet(TargetDataSet);
				if (!String.IsNullOrEmpty(ReturnMessage))
					{
					WMB.Basics.ReportErrorToEventViewer("MBRStatics.MirrorDataSetTo",
						"Bei der Table \"" + SourceTable.TableName + "\" kam es zu folgendem Fehler:\r\n"
						+ ReturnMessage);
					return false;
					}
				}
			return true;
			}
Example #6
0
		private DataSet CreateDefaultFrameDataSet (WCFStandardsNS.WCFStandards m_DataBase,
						String TableNameParameter)
			{
			DataSet ReturnDataSet =
				m_DataBase.GetCommonDataSet("Select * from TableDefinitions where TableName = '" + TableNameParameter
				+ "' and DefinitionNameToCreate IS NULL");
			if ((ReturnDataSet.Tables.Count != 1)
				|| (ReturnDataSet.Tables [0].Rows.Count != 1))
				return null;
			// by sac - remove the following two lines when the Change to new Format procedure is finished

			//ReturnDataSet.Tables ["TableDefinitions"].Rows [0] ["TargetWidth"] = 1920;
			//ReturnDataSet.Tables ["TableDefinitions"].Rows [0] ["TargetHeight"] = 1080;
			String TableID = ReturnDataSet.Tables [0].Rows [0] ["ID"].ToString ();
			String FormattingTemplate = ReturnDataSet.Tables [0].Rows [0] ["FormattingTemplate"].ToString ();
			if (String.IsNullOrEmpty (FormattingTemplate))
				FormattingTemplate = "DefaultKartei";
			DataSet TableDataSet =
				m_DataBase.GetCommonMultiDataSet (new String [] {
				  "Select * from FrameContent where FormattingTemplate = '"
				  + FormattingTemplate + "' order by MultiPageIndex, FrameOrder"
					});
			ReturnDataSet.DataSetName = "FrameDefinitions";
			DataTable FrameContent = TableDataSet.Tables ["FrameContent"];
			TableDataSet.Tables.Remove (FrameContent);
			ReturnDataSet.Tables.Add (FrameContent);

			List<String> RequiredPageIDs = new List<string> ();
			List<String> RequiredFrameIDs = new List<string> ();
			foreach (DataRow FrameContentRow in ReturnDataSet.Tables ["FrameContent"].Rows)
				{
				if (String.IsNullOrEmpty (FrameContentRow ["FrameID"].ToString ()))
					{
					Basics.ReportErrorToEventViewer ("GraphicsHandling.CreateDefaultFrameDataSet",
						"Beim FrameContentEintrag \"" + FrameContentRow ["ID"].ToString ()
						+ "\" ist der KarteiID Eintrag leer");
					continue;
					}
				if (!RequiredPageIDs.Contains (FrameContentRow ["PageID"].ToString ()))
					RequiredPageIDs.Add (FrameContentRow ["PageID"].ToString ());
				if (!RequiredFrameIDs.Contains (FrameContentRow ["FrameID"].ToString ()))
					RequiredFrameIDs.Add (FrameContentRow ["FrameID"].ToString ());
				}
			String PageWhereClause = " (ID = '" + String.Join ("' or ID = '", RequiredPageIDs.ToArray ()) + "')";
			String FrameWhereClause = " (ID = '" + String.Join ("' or ID = '", RequiredFrameIDs.ToArray ()) + "')";
			DataSet PagesAndFrames = m_DataBase.GetCommonMultiDataSet (new string [] {
		                        "Select * from Pages where " + PageWhereClause,
		                        "Select * from Frames where " + FrameWhereClause
		                    });
			DataTable PagesDataTable = PagesAndFrames.Tables ["Pages"];
			PagesAndFrames.Tables.Remove (PagesDataTable);
			ReturnDataSet.Tables.Add (PagesDataTable);
			DataTable FramesDataTable = PagesAndFrames.Tables ["Frames"];
			PagesAndFrames.Tables.Remove (FramesDataTable);
			ReturnDataSet.Tables.Add (FramesDataTable);

			return ReturnDataSet;
			}
Example #7
0
	void RemoveUnusedVideoFileEntries (WCFStandardsNS.WCFStandards WPMediaDataBase,
		DataTable VideoFiles, String ArchiveID)
		{
		foreach (DataRow VideoFileRow in VideoFiles.Rows)
			{
			DataTable MaterialTable = WPMediaDataBase.GetCommonDataSet (String.Format
				("Select * from  StructuredMaterialDataBase where FileID = '{0}' and ArchiveID = '{1}'",
					VideoFileRow ["FileID"].ToString (), ArchiveID)).Tables [0];
			if (MaterialTable.Rows.Count == 0)
				VideoFileRow.Delete ();
			}
		VideoFiles.AcceptChanges ();
		}
Example #8
0
		public static bool IsFremdProject(WCFStandardsNS.WCFStandards DataBase, String ProjectID)
			{
			if (String.IsNullOrEmpty (ProjectID))
				return false;
			String Zustaendig =
				DataBase.GetCommonDataSet ("Select * from Projekte where ID = '" + ProjectID + "'")
					.Tables ["Projekte"].Rows [0] ["Zustaendig"].ToString ();
			if (String.IsNullOrEmpty (Zustaendig))
				return false;
			if (Zustaendig == "Fremd")
				return true;
			return false;
			}
Example #9
0
	double InsertOrCheckStructuredMaterial (WCFStandardsNS.WCFStandards WPMediaDataBase, String FileID,
							String ArchiveID, String ArchiveSubPathAndFileName,
							String InsertEntryAs, DataRow BeitragsTypenRow = null)
		{
		String FullFileName = CheckAccessabilityOfThisFile (WPMediaDataBase, ArchiveID, ArchiveSubPathAndFileName);
		if (FullFileName == "")
			{
			WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices::InsertOrCheckStructuredMaterial",
				"Der VideoFile \"" + FullFileName + "\" War nicht existent oder nicht zugreifbar");
			return 0;
			}
		FileInfo Info = new FileInfo (FullFileName);
		int LengthInKB = (int) (Info.Length / 1024);
		DateTime LastWriteTime = Info.LastWriteTime;
		double PlayableFileLength = GetPlayableLengthOfThisFileViaFullName (FullFileName);
		if (PlayableFileLength < 0)
			{
			WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices::InsertOrCheckStructuredMaterial",
					"Für den FileNamen \"" + FullFileName
						+ "\" konnte keine Länge ermittelt werden");
			return 0;
			}
		String PlayableFileLengthString = Convert.ToString (PlayableFileLength);
		String FileSizeInkB = Convert.ToString (LengthInKB);
		DataSet StructuredDataBaseDataSet = WPMediaDataBase.GetCommonDataSet (String.Format
					("Select * from StructuredMaterialDataBase where FileID = '{0}'",
						FileID));
		DataTable StructuredDataBaseDataTable = StructuredDataBaseDataSet.
									Tables ["StructuredMaterialDataBase"];
		bool StructuredMaterialDataBaseMustBeWrittenBack = true;
		bool MaterialFound = false;
		foreach (DataRow StructuredMaterial in StructuredDataBaseDataTable.Rows)
			{
			if (String.Compare (StructuredMaterial [PATH_SUB_PATH_AND_NAME].ToString (), ArchiveSubPathAndFileName, true) == 0)
				{
				MaterialFound = true;
				StructuredMaterialDataBaseMustBeWrittenBack = false;
				if (StructuredMaterial ["FileSizeInkB"].ToString () != FileSizeInkB)
					{
					StructuredMaterial ["FileSizeInkB"] = FileSizeInkB;
					StructuredMaterialDataBaseMustBeWrittenBack = true;
					}
				if (StructuredMaterial ["PlayingDurationInSeconds"].ToString () != PlayableFileLengthString)
					{
					StructuredMaterial ["PlayingDurationInSeconds"] = PlayableFileLengthString;
					StructuredMaterialDataBaseMustBeWrittenBack = true;
					}
				if ((Convert.IsDBNull (StructuredMaterial ["ModifyTimeStamp"]))
					|| (Convert.ToDateTime (StructuredMaterial ["ModifyTimeStamp"]) != LastWriteTime))
					{
					StructuredMaterial ["ModifyTimeStamp"] = LastWriteTime;
					StructuredMaterialDataBaseMustBeWrittenBack = true;
					}
				if (StructuredMaterialDataBaseMustBeWrittenBack == true)
					StructuredMaterial ["LastFoundTimeStamp"] = DateTime.Now;

				break;
				}
			}

		if  (!MaterialFound)
			{
			List<String> MaterialTypenArray = GetMaterialTypenArray(WPMediaDataBase);
			DataRow NewStructuredMaterial = StructuredDataBaseDataTable.NewRow();
			NewStructuredMaterial ["ID"] = System.Guid.NewGuid ();
			NewStructuredMaterial ["FileID"] = FileID;
			NewStructuredMaterial ["ArchiveID"] = ArchiveID;
			NewStructuredMaterial [PATH_SUB_PATH_AND_NAME] = ArchiveSubPathAndFileName;
			NewStructuredMaterial ["FoldedArchivePath"] = CVM.CommonValues.GetPureCoreName
						(ArchiveSubPathAndFileName, MaterialTypenArray, BeitragsTypenRow).ToUpper ();
			NewStructuredMaterial ["FileSizeInkB"] = FileSizeInkB;
			NewStructuredMaterial ["PlayingDurationInSeconds"] = PlayableFileLengthString;
			NewStructuredMaterial ["ModifyTimeStamp"] = LastWriteTime;
			NewStructuredMaterial ["TechnicalTyp"] = InsertEntryAs;
			NewStructuredMaterial ["LastFoundTimeStamp"] = DateTime.Now;
			StructuredDataBaseDataTable.Rows.Add (NewStructuredMaterial);
			StructuredMaterialDataBaseMustBeWrittenBack = true;
			}


		if (StructuredMaterialDataBaseMustBeWrittenBack)
			{
			WPMediaDataBase.SetCommonDataSet (StructuredDataBaseDataSet);
			}
		return PlayableFileLength;
		}
Example #10
0
	String CheckAccessabilityOfThisFile (WCFStandardsNS.WCFStandards WPMediaDataBase,
		String ArchiveID, String SubFileName)
		{
		DataTable ArchivEntry = WPMediaDataBase.GetCommonDataSet
			(String.Format ("Select * from PhysicalArchivePaths where ArchiveID = '{0}'", ArchiveID))
						.Tables ["PhysicalArchivePaths"];
		if (ArchivEntry.Rows.Count != 1)
			{
			WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices::CheckAccessabilityOfThisFile",
				"Die ArchiveID \"" + ArchiveID + "\" konnte in der Datenbank nicht gefunden werden");
			return "";
			}
		String ArchivePhysicalPath =  ArchivEntry.Rows [0] [PATH_HANDLING_ARCHIVE_PHYSICAL_PATH].ToString ();
		String FullFileName = Path.Combine (ArchivePhysicalPath, SubFileName);
		if (!WMB.Basics.IsThisFileAccessable (FullFileName))
			{
			WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices::CheckAccessabilityOfThisFile",
				"Auf den File \"" + FullFileName + "\" konnte nicht zugegriffen werden");
			return "";
			}
		return FullFileName;
		}
Example #11
0
	void FillAndAddNewTableToDataSetAccordingToSqlStatement (WCFStandardsNS.WCFStandards WPMediaDataBase,
		DataSet NewParent, String SelectStatement)
		{
		DataSet Helper = WPMediaDataBase.GetCommonDataSet (SelectStatement);
		DataTable Intermediate = Helper.Tables [0];
		Helper.Tables.Remove (Intermediate);
		NewParent.Tables.Add (Intermediate);
		}
Example #12
0
	bool GetVideoFileEntry (WCFStandardsNS.WCFStandards WPMediaDataBase,
							String ArchiveID, String ArchiveSubPathAndFileName, String InsertEntryAs,
							double PlayableLengthInSeconds, bool CheckFileParameter,
							DataRow BeitragsTypenRow = null)
		{
		// ------------------------------------------------------------------------------------
		//WMB.Basics.ReportInformationToEventViewer("Eingang von GetVideoFileEntry\r\n"
		//	+ "ArchiveID = \"" + ArchiveID + "\"\r\n"
		//	+ "ArchiveSubPathAndFileName = \"" + ArchiveSubPathAndFileName + "\"");
		bool DataSetMustBeWrittenBack = false;
		bool StructuredMaterialDataBaseMustBeWrittenBack = false;
		bool NewVideoFileInserted = false;
		String MaterialType = GetTechnicalTypFromFileName (ArchiveSubPathAndFileName);
		if (String.IsNullOrEmpty (InsertEntryAs))
			InsertEntryAs = MaterialType;
		List<String> MaterialTypenArray = GetMaterialTypenArray(WPMediaDataBase);
		String CoreName = CVM.CommonValues.GetPureCoreName(ArchiveSubPathAndFileName, MaterialTypenArray, BeitragsTypenRow);
		DataSet ResultedVideoFileEntry = null;
		if (String.IsNullOrEmpty (InsertEntryAs))
			{
			ResultedVideoFileEntry = WPMediaDataBase.GetCommonDataSet (String.Format
				("Select * from VideoFiles where FoldedArchivePath = '{0}'",
					CoreName.ToUpper ()));
			}
		else
			{
			ResultedVideoFileEntry = WPMediaDataBase.GetCommonDataSet (String.Format
				("Select * from VideoFiles where FoldedArchivePath = '{0}' and BeitragsTyp = '{1}'",
					CoreName.ToUpper (), InsertEntryAs));
			}

/*
		bool OnlyCheckCall = true;
		if (MaterialTypenArray.Contains (InsertEntryAs))
			OnlyCheckCall = false;
		if (OnlyCheckCall == true)
			{
			foreach (DataRow CheckVideoFileRow in ResultedVideoFileEntry.Tables ["VideoFiles"].Rows)
				{
				CheckVideoFileRow ["ModifyTimeStamp"] = RenewConversionStatus (CheckVideoFileRow);
				}
			m_DataBase.SetCommonDataSet (ResultedVideoFileEntry);
			return true;
			}

		if ((String.IsNullOrEmpty(ArchiveID))
			&& (String.IsNullOrEmpty(InsertEntryAs)))
			{
			foreach (DataRow EmptyVideoFileRow in ResultedVideoFileEntry.Tables ["VideoFiles"].Rows)
				{
				EmptyVideoFileRow ["ModifyTimeStamp"] = RenewConversionStatus (EmptyVideoFileRow);
				}
			m_DataBase.SetCommonDataSet (ResultedVideoFileEntry);
			return true;
			}
*/



		DataRow VideoFileRow = null;
		String ProcessedFileID = String.Empty;
		if (ResultedVideoFileEntry.Tables ["VideoFiles"].Rows.Count == 0)
			{
			// ------------------------------------------------------------------------------------
			//WMB.Basics.ReportInformationToEventViewer("ResultedVideoFileEntry.Tables [\"VideoFiles\"].Rows.Count == 0\r\n"
			//	+ "ArchiveID = \"" + ArchiveID + "\"\r\n"
			//	+ "ArchiveSubPathAndFileName = \"" + ArchiveSubPathAndFileName + "\"");
			DataSetMustBeWrittenBack = true;
			VideoFileRow = ResultedVideoFileEntry.Tables ["VideoFiles"].NewRow ();
			ProcessedFileID = System.Guid.NewGuid ().ToString ();
			VideoFileRow ["FileID"] = ProcessedFileID;
			VideoFileRow ["Type"] = PGM_BEITRAG;
			VideoFileRow ["Availability"] = "archived";
			VideoFileRow ["Name"] = CoreName;
			VideoFileRow ["FoldedArchivePath"] = CoreName.ToUpper ();
			VideoFileRow ["BeitragsTyp"] = GetBeitragsTypFromTechnicalTyp (InsertEntryAs);
			VideoFileRow ["ConversionStatus"] = "    ";
			NewVideoFileInserted = true;
			VideoFileRow ["LengthInSeconds"] = Convert.ToString (PlayableLengthInSeconds);
			VideoFileRow ["ModifyTimeStamp"] = System.DateTime.Now;
			ResultedVideoFileEntry.Tables ["VideoFiles"].Rows.Add (VideoFileRow);
			WPMediaDataBase.SetCommonDataSet (ResultedVideoFileEntry);
			ResultedVideoFileEntry = WPMediaDataBase.GetCommonDataSet (String.Format
			("Select * from VideoFiles where FileID = '{0}'",
				ProcessedFileID));
			VideoFileRow = ResultedVideoFileEntry.Tables ["VideoFiles"].Rows [0];
			}
		else
			{
			// ------------------------------------------------------------------------------------
			//WMB.Basics.ReportInformationToEventViewer("vor RemoveUnusedVideoFileEntries\r\n"
			//	+ "ArchiveID = \"" + ArchiveID + "\"\r\n"
			//	+ "ArchiveSubPathAndFileName = \"" + ArchiveSubPathAndFileName + "\"");

			RemoveUnusedVideoFileEntries(WPMediaDataBase, ResultedVideoFileEntry.Tables["VideoFiles"], ArchiveID);
			if (ResultedVideoFileEntry.Tables ["VideoFiles"].Rows.Count == 0)
				{
				WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices::InsertOrCheckStructuredMaterial",
					"Beim RemoveUnusedVideoFileEntries für \"" + ArchiveSubPathAndFileName + "\" kamen 0 Rows zurück");
//				VideoFileRow ["LengthInSeconds"] = 0;
				WPMediaDataBase.SetCommonDataSet (ResultedVideoFileEntry);
				return false;
				}
			VideoFileRow = ResultedVideoFileEntry.Tables ["VideoFiles"].Rows [0];
			ProcessedFileID = VideoFileRow ["FileID"].ToString ();
			}

		double LengthInSeconds = -1;
		try 
			{
			//if (PlayableLengthInSeconds == 0)
			//	{
			//	System.Drawing.Rectangle AVIRect = new System.Drawing.Rectangle();
			//	PlayableLengthInSeconds = ManagedProgrammManagement.GetDurationOfWMVFileInSeconds(FileName, ref AVIRect);
			//	}
			LengthInSeconds = InsertOrCheckStructuredMaterial(WPMediaDataBase, ProcessedFileID,
											ArchiveID, ArchiveSubPathAndFileName, MaterialType, BeitragsTypenRow);
			}
		catch (Exception Excp)
			{
			WMB.Basics.ReportErrorToEventViewer("Bei InsertOrCheckStructuredMaterial\r\n"
				+ "ArchiveID = \"" + ArchiveID + "\"\r\n"
				+ "ArchiveSubPathAndFileName = \"" + ArchiveSubPathAndFileName + "\"\r\n"
				+ "MaterialType = \"" + MaterialType + "\"\r\ntart folgender Fehler auf:\r\n"
				+ Excp.ToString ());
			}
		
		VideoFileRow ["LengthInSeconds"] = Convert.ToString (LengthInSeconds);
		VideoFileRow ["ModifyTimeStamp"] = RenewConversionStatus (WPMediaDataBase, VideoFileRow);
		double LengthInSecondsFromRenewConversionStatus = Convert.ToDouble (VideoFileRow ["LengthInSeconds"]);
		if ((LengthInSeconds <= 0.1)
			&& (LengthInSecondsFromRenewConversionStatus <= 0.1))
				VideoFileRow ["LengthInSeconds"] = Convert.ToString (PlayableLengthInSeconds);

		WPMediaDataBase.SetCommonDataSet (ResultedVideoFileEntry);
		return true;
		}
Example #13
0
	public void ActualizeFileDataBaseEntries (WCFStandardsNS.WCFStandards WPMediaDataBase,
			WCFStandardsNS.WCFStandards WPMediaAddOnDataBase,
			String ArchiveIDs, String BeitragsTypToSearchFor,
			DateTime DateBack, DataSet EntriesToClearBeforeActualize)
		{
		List<String> AutoControlFileBeitragsTypen = GetAutoControlFileBeitragsTypen (WPMediaDataBase);
	
		if (EntriesToClearBeforeActualize != null)
			{
			DataTable EntriesToActualize = EntriesToClearBeforeActualize.Tables ["EntriesToActualize"];
			if ((EntriesToActualize != null)
				&& (EntriesToActualize.Rows.Count > 0))
				{
				String [] FileIDs = new String [ (EntriesToActualize.Rows.Count)];
				int Index = 0;
				foreach (DataRow Entry in EntriesToActualize.Rows)
					{
					if (Entry != null)
						{
						FileIDs [Index] =  Entry ["FileID"].ToString ();
						Index++; 
						}
					}
				String SelectString = "Select * from VideoFiles where FileID = '"
					+ System.String.Join ("' OR FileID = '", FileIDs) + "'";
				DataSet EntriesToSetToZero = WPMediaDataBase.GetCommonDataSet (SelectString);
				foreach (DataRow Entry in EntriesToSetToZero.Tables ["VideoFiles"].Rows)
					Entry ["ModifyTimeStamp"] = DateBack.AddHours (-1);
				WPMediaDataBase.SetCommonDataSet (EntriesToSetToZero);
				}
			}


		DataSet ActualizingDataSet = new DataSet();
		ActualizingDataSet.DataSetName = "Actualizing";
		int NumberOfUpdatedRows = 0;
		if (String.IsNullOrEmpty (ArchiveIDs))
			return;

// ------------------- Get searchable Extensions, SubPaths and SystemPaths
		Char [] Delimitter = new Char [] {';', ',', ':'};
		DataTable TypenDataTable = WPMediaDataBase.GetCommonDataSet
					("Select * from BeitragsTypen where BeitragsTyp = '"
					+ BeitragsTypToSearchFor + "'").Tables ["BeitragsTypen"];
		if (TypenDataTable.Rows.Count != 1)
			{
			WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralService::ActualizeFileDataBaseEntries",
				"Es wurde für den BeitragsTyp  \"" + BeitragsTypToSearchFor + "\" kein Eintrag gefunden");
			return;
			}
		List<String> SearchSubPaths = InsertSenderParameterizedEntries(WPMediaDataBase, WPMediaAddOnDataBase,
					TypenDataTable.Rows[0][PGM_BEITRAG_SUB_PATH].ToString());
		List<String> SearchSystemPaths = InsertSenderParameterizedEntries(WPMediaDataBase, WPMediaAddOnDataBase,
					TypenDataTable.Rows[0][PGM_BEITRAG_SYSTEM_PATH].ToString());
		String [] Extensions = TypenDataTable.Rows [0] ["FileExtension"].ToString ().Split (Delimitter);
		List<String> MaterialTypenArray = GetMaterialTypenArray (WPMediaDataBase);
		String [] ArchiveIDsToProcess = ArchiveIDs.Split (';');

		List<String> CombinedSearchPaths = new List<string> ();
		foreach (String SearchPath in SearchSystemPaths)
			foreach (String SearchSubPath in SearchSubPaths)
				{
				if (!String.IsNullOrEmpty (SearchSubPath))
					{
					if (!String.IsNullOrEmpty (SearchPath))
						{
						CombinedSearchPaths.Add (Path.Combine (SearchPath, SearchSubPath));
						}
					else
						{
						CombinedSearchPaths.Add (SearchSubPath);
						}
					}
				else
					{
					CombinedSearchPaths.Add (SearchPath);
					}
				}

		foreach (String ArchiveIDToProcess in ArchiveIDsToProcess)
			{
			//if (WMB.Basics.IsTestRun == true)
			//    WMB.Basics.ReportInformationToEventViewer ("WPMediaCentralService::ActualizeFileDataBaseEntries",
			//            "ArchiveIDToProcess = \"" + ArchiveIDToProcess + "\"");
			FillAndAddNewTableToDataSetAccordingToSqlStatement
				(WPMediaDataBase, ActualizingDataSet, 
				String.Format ("Select * from PhysicalArchivePaths where ArchiveID = '{0}'", ArchiveIDToProcess));
			if (ActualizingDataSet.Tables ["PhysicalArchivePaths"].Rows.Count == 0)
				{
				WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralService::ActualizeFileDataBaseEntries",
					"Es wurde für den ArchiveID-Eintrag \"" + ArchiveIDToProcess + "\" keine physische Adresse gefunden");
				continue;
				}
			//String ArchivePathRoot = ActualizingDataSet.Tables ["PhysicalArchivePaths"].
			//							Rows [0] ["ArchivePhysicalPath"].ToString ();

			if (BeitragsTypToSearchFor != "PlayingPackage")
				{
				FillAndAddNewTableToDataSetAccordingToSqlStatement
					(WPMediaDataBase, ActualizingDataSet, String.Format
						                                      ("Select * from VideoFiles where ModifyTimeStamp > " +
						                                       WMB.Basics.GetSQLFormattedDateTime (DateBack)
						                                       + " and BeitragsTyp = '{0}'", BeitragsTypToSearchFor));
				}

			String PhysicalArchivePathName = ActualizingDataSet.Tables["PhysicalArchivePaths"].Rows[0]
					[PATH_HANDLING_ARCHIVE_PHYSICAL_PATH].ToString ();


			List<FileInfo> ExistingFileInfoEntriesToCheck = new List<FileInfo> ();
			foreach (String SearchSubPath in CombinedSearchPaths)
				{
				if (WMB.Basics.IsTestRun == true)
					WMB.Basics.ReportInformationToEventViewer("WPMediaCentralService::ActualizeFileDataBaseEntries",
							"SearchSubPath = \"" + SearchSubPath + "\",\r\nBeitragsTypToSearchFor = \"" + BeitragsTypToSearchFor + "\"");
				if (BeitragsTypToSearchFor == "PlayingPackage")
					{
					FillAndAddNewTableToDataSetAccordingToSqlStatement
						(WPMediaDataBase, ActualizingDataSet, String.Format ("Select * from VideoFiles where ModifyTimeStamp > " +
							WMB.Basics.GetSQLFormattedDateTime(DateBack) + " and BeitragsTyp = '{0}' and Name like '{1}%'",
							BeitragsTypToSearchFor, Path.GetFileName(SearchSubPath)));
					}
				String BeitragsSearchPath;
				if (!String.IsNullOrEmpty (SearchSubPath))
					BeitragsSearchPath = Path.Combine(PhysicalArchivePathName, SearchSubPath);
				else
					BeitragsSearchPath = PhysicalArchivePathName;
				ExistingFileInfoEntriesToCheck.AddRange (WMB.Basics.GetFileInfoEntriesFromDirectory
															(BeitragsSearchPath, Extensions, -1,
															DateBack, false));

				if (ExistingFileInfoEntriesToCheck.Count > 0)
					{
					DataView EntriesForThisBeitragsIDAndTyp = null;
					try
						{
						if (ActualizingDataSet.Tables ["VideoFiles"] == null)
							{
							WMB.Basics.ReportErrorToEventViewer ("Bei SearchSubPath = \"" + SearchSubPath
							                                     + "\",\r\nBeitragsTypToSearchFor = \"" + BeitragsTypToSearchFor +
							                                     "\" war keine \"VideoFiles\" Tabelle vorhanden");
							continue;
							}
						EntriesForThisBeitragsIDAndTyp = new DataView(ActualizingDataSet.Tables["VideoFiles"],
							"", "", System.Data.DataViewRowState.CurrentRows);
						}
					catch (Exception Excp)
						{
						WMB.Basics.ReportErrorToEventViewer ("Bei SearchSubPath = \"" + SearchSubPath
							+ "\",\r\nBeitragsTypToSearchFor = \"" + BeitragsTypToSearchFor + "\" trat folgender Fehler auf:\r\n"
							+ Excp.ToString ());
						continue;
						}
					try
						{
						ActualizeFileDataBaseEntryGroup(WPMediaDataBase, "Beitrag", BeitragsTypToSearchFor, ExistingFileInfoEntriesToCheck,
							EntriesForThisBeitragsIDAndTyp, ActualizingDataSet, ArchiveIDToProcess,
							PhysicalArchivePathName, MaterialTypenArray, TypenDataTable.Rows[0]);
						ExistingFileInfoEntriesToCheck.Clear();

						}
					catch (Exception Excp)
						{
						WMB.Basics.ReportErrorToEventViewer ("Bei SearchSubPath = \"" + SearchSubPath
							+ "\",\r\nBeitragsTypToSearchFor = \"" + BeitragsTypToSearchFor + "\"\r\nArchiveIDToProcess = \""
							+ ArchiveIDToProcess + "\"\r\ntrat folgender Fehler auf:\r\n"
							+ Excp.ToString ());
						continue;
						}
					}
				}

			}

		}
Example #14
0
		public static String GetProjektText(WCFStandardsNS.WCFStandards DataBase, String ID)
			{
			if (String.IsNullOrEmpty (ID))
				return String.Empty;
			DataRow ProjectRow = DataBase.GetCommonDataSet ("Select * from Projekte where ID = '" + ID + "'")
				.Tables ["Projekte"].Rows [0];
			DataRow OrtsRow = DataBase.GetCommonDataSet ("Select * from Orte where ID = '" + ProjectRow ["OrteID"].ToString () + "'")
				.Tables ["Orte"].Rows [0];
			return OrtsRow ["NameID"].ToString () + "-" + ProjectRow ["NameID"].ToString ();
			}
Example #15
0
	DateTime RenewConversionStatus (WCFStandardsNS.WCFStandards WPMediaDataBase, DataRow VideoFile)
		{
		DataSet MaterialTypeDataSet = WPMediaDataBase.GetCommonDataSet ("Select * from MaterialType");
		DataTable MaterialTypeDataTable = MaterialTypeDataSet.Tables ["MaterialType"];
		DataSet StructuredMaterialDataSet = WPMediaDataBase.GetCommonDataSet 
			("Select * from StructuredMaterialdataBase where FileID = '"
			+ VideoFile ["FileID"].ToString () + "'");
		Char [] FinalTable = START_VALUE_FOR_MATERIAL_TYPE;
		DateTime NewestModifyTimeStamp = DateTime.MinValue;
		double PlayingLengthInSeconds = 0;
		String TVPlayAbleCode = "99";
		foreach (DataRow Material in StructuredMaterialDataSet.Tables
								["StructuredMaterialdataBase"].Rows)
			{
			DataRow [] Typen = MaterialTypeDataTable.Select ("TechnicalTyp = '"
								+ Material ["TechnicalTyp"].ToString () + "'");
			if (Typen.Length == 0)
				continue;
			String MaterialTVPlayAbleCode = Typen [0] ["TVPlayAbleCode"].ToString ();
			if (String.Compare (MaterialTVPlayAbleCode, TVPlayAbleCode) < 0)
				{
				TVPlayAbleCode = MaterialTVPlayAbleCode;
				String PlayingDurationInSecondsString = Material ["PlayingDurationInSeconds"].ToString ();
				if (!String.IsNullOrEmpty(PlayingDurationInSecondsString))
					{
					PlayingLengthInSeconds = Convert.ToDouble (PlayingDurationInSecondsString);
					}
				}
			FinalTable [Convert.ToInt32 (Typen [0] ["FinalizingIndicator"])] = '1';
			if (!Convert.IsDBNull (Material ["ModifyTimeStamp"]))
				if (Convert.ToDateTime (Material ["ModifyTimeStamp"]) > NewestModifyTimeStamp)
					NewestModifyTimeStamp = Convert.ToDateTime (Material ["ModifyTimeStamp"]);
			}
		VideoFile ["ConversionStatus"] = new String (FinalTable);
		VideoFile ["LengthInSeconds"] = PlayingLengthInSeconds;
		return NewestModifyTimeStamp;
		}
Example #16
0
		public static List<String> GetExistingKeyWords(WCFStandardsNS.WCFStandards DataBase)
			{
			DataTable KeyWordsTable =
				DataBase.GetCommonDataSet ("Select * from Material where not KeyWords Is null and not KeyWords = ''").Tables ["Material"];
			List<String> KeyWords = new List<string> ();
			foreach (DataRow KeyWordsRow in KeyWordsTable.Rows)
				{
				if (String.IsNullOrEmpty (KeyWordsRow ["KeyWords"].ToString ()))
					continue;
				String [] StoredKeyWords = KeyWordsRow ["KeyWords"].ToString ().Split (';');
				foreach (String KeyWord in StoredKeyWords)
					{
					if (KeyWords.Contains (KeyWord) == false)
						{
						KeyWords.Add (KeyWord);
						}
					}
				}
			return KeyWords;
			}
Example #17
0
	List<String> GetAutoControlFileBeitragsTypen (WCFStandardsNS.WCFStandards WPMediaDataBase)
			{
			String [] AutoControlFileExtensions = AUTO_CONTROL_FILE_EXTENSIONS;
			String OrClause = "(FileExtension = '" + System.String.Join ("') or (FileExtension = '", AutoControlFileExtensions) + "')";
			DataTable BeitragsTypenTable = WPMediaDataBase.GetCommonDataSet("SELECT BeitragsTyp FROM  BeitragsTypen WHERE " + OrClause)
							.Tables["BeitragsTypen"];
			List<String> BeitragsTypen = new List<String> ();
			foreach (DataRow BeitragsTypenRow in BeitragsTypenTable.Rows)
				{
				BeitragsTypen.Add(BeitragsTypenRow ["BeitragsTyp"].ToString ());
				}
			return BeitragsTypen;
			}
Example #18
0
	public DataSet GetFormatierDataSet(WCFStandardsNS.WCFStandards WPMediaAddOnDataDataBase,
						String DefinitionNameToCreate, String TableName, String ID, String WPMediaRoot)
		{
		DataSet TableDataSet;
		if (String.IsNullOrEmpty (DefinitionNameToCreate))
			TableDataSet = WPMediaAddOnDataDataBase.GetCommonDataSet("Select * from TableDefinitions where TableName = '" + TableName + "' and "
				+ "(DefinitionNameToCreate is NUll or DefinitionNameToCreate = '')");
		else
			{
			TableDataSet = WPMediaAddOnDataDataBase.GetCommonDataSet("Select * from TableDefinitions where TableName = '" + TableName
					+ "' and DefinitionNameToCreate = '" + DefinitionNameToCreate + "'");
			}
		if (TableDataSet.Tables.Count != 1)
			return null;
		if (TableDataSet.Tables [0].Rows.Count != 1)
			return null;
		String Type = TableDataSet.Tables ["TableDefinitions"].Rows [0] ["Type"].ToString ();
		DataSet PageDataSet = WPMediaAddOnDataDataBase.GetCommonDataSet("Select * from PageDefinitions where TableID = '"
			  + TableDataSet.Tables [0].Rows [0] ["ID"].ToString () + "' order by PagePlayingOrder");
		if (PageDataSet.Tables.Count != 1)
			return null;
		if (PageDataSet.Tables [0].Rows.Count < 1)
			{
			PageDataSet = WPMediaAddOnDataDataBase.GetCommonDataSet("Select * from PageDefinitions where TableID = '"
			  + TableDataSet.Tables [0].Rows [0] ["TableIDForFormattingUsages"].ToString () + "' order by PagePlayingOrder");
			if (PageDataSet.Tables [0].Rows.Count < 1)
				return null;
			}
		List<String> PageIDs = new List<string> ();
		foreach (DataRow PageRow in PageDataSet.Tables [0].Rows)
			{
			PageIDs.Add (PageRow ["ID"].ToString ());
			}
		if (String.IsNullOrEmpty (ID))		// deliver all but without TableData
			ID = System.Guid.Empty.ToString ();
		String WhereClause = " where ((PageID = '" + String.Join ("') Or (PageID = '", PageIDs.ToArray ()) + "'))";
		DataSet PictureDefinitions = WPMediaAddOnDataDataBase.GetCommonMultiDataSet(new String[] {
				"Select * from " + TableName + " where ID = '" + ID + "'",
				"Select * from PictureDefinitions " + WhereClause + " order by PicturePlayingOrder",
				"Select * from TextDefinitions " + WhereClause + " order by TextPlayingOrder",
				"Select * from BlockDefinitions " + WhereClause + " order by BlockPlayingOrder"});
		DataTable TableDataTable = TableDataSet.Tables [0];
		TableDataSet.Tables.Remove (TableDataTable);
		PictureDefinitions.Tables.Add (TableDataTable);
		DataTable PageDataTable = PageDataSet.Tables [0];
		PageDataSet.Tables.Remove (PageDataTable);
		PictureDefinitions.Tables.Add (PageDataTable);
		if (ID == System.Guid.Empty.ToString ())
			return PictureDefinitions;
		return ActualizeContentDataInFormatierDataSet(WPMediaAddOnDataDataBase,
					PictureDefinitions, TableName, ID, WPMediaRoot);
		}
Example #19
0
	private List<String> GetMaterialTypenArray(WCFStandardsNS.WCFStandards WPMediaDataBase)
			{
			List<String> MaterialTypenArray = new List<string>();
			DataTable MaterialTypeTable = WPMediaDataBase.GetCommonDataSet("Select TechnicalTyp from MaterialType").Tables["MaterialType"];
			foreach (DataRow MaterialTypRow in MaterialTypeTable.Rows)
				MaterialTypenArray.Add(MaterialTypRow["TechnicalTyp"].ToString());
			return MaterialTypenArray;
			}
Example #20
0
		private bool UpdateFromDataBaseOccured(WCFStandardsNS.WCFStandards m_DataBase, 
			DataSet FrameDataSet, String TableNameParameter)
			{
			if ((m_DataBase == null)
				|| (ActuallContentRow.Table.Columns ["ModifyTimeStamp"] == null)
				|| (ActuallContentRow ["ModifyTimeStamp"] == Convert.DBNull))
				return false;

			DateTime ExistingModifyTimeStamp = Convert.ToDateTime (ActuallContentRow ["ModifyTimeStamp"]);
			DataSet DataBaseEntry =
				m_DataBase.GetCommonDataSet("Select ID, ModifyTimeStamp from " + TableNameParameter + " where ID = '"
					                            + ActuallContentRow ["ID"].ToString () + "'");
			if ((DataBaseEntry == null)
				|| (DataBaseEntry.Tables.Count != 1)
				|| (DataBaseEntry.Tables[TableNameParameter] == null)
				|| (DataBaseEntry.Tables[TableNameParameter].Rows.Count != 1))
				{
				Basics.ReportErrorToEventViewer ("GraphicsHandling.UpdateFromDataBaseOccured",
					"Bei der Table \"" + TableNameParameter + "\" bei der ID \"" + ActuallContentRow["ID"].ToString()
					+ "\" konnte kein übereinstimmender Datebank Eintrag gefunden werden");
				return false;
				}
			if (DataBaseEntry.Tables [0].Rows [0] ["ModifyTimeStamp"] == Convert.DBNull)
				return false;
			DateTime DataBaseModifyTimeStamp = Convert.ToDateTime (DataBaseEntry.Tables [0].Rows [0] ["ModifyTimeStamp"]);
			if (DataBaseModifyTimeStamp == ExistingModifyTimeStamp)
				return false;
			DataRow NewRow =
					m_DataBase.GetCommonDataSet("Select * from " + TableNameParameter + " where ID = '"
													+ ActuallContentRow ["ID"].ToString () + "'").Tables [0].Rows [0];
			foreach (DataColumn Col in NewRow.Table.Columns)
				{
				if ((NewRow.Table.Columns [Col.ColumnName] != null)
					&& (ActuallContentRow.Table.Columns [Col.ColumnName] != null))
					ActuallContentRow [Col.ColumnName] = NewRow [Col.ColumnName];
				}
			return true;
			}
Example #21
0
	List<String> InsertSenderParameterizedEntries (WCFStandardsNS.WCFStandards WPMediaDataBase,
				WCFStandardsNS.WCFStandards WPMediaAddOnDataBase, String InputString)
		{
		String [] RootEntries = InputString.Split (new Char [] {';', ',', ':'});
		if ((InputString.IndexOf (CONFIG_SENDER_MACRO) == -1)
			&& (InputString.IndexOf (CONFIG_WPMEDIA_ADD_ON_DATA_TABLE_MACRO) == -1))
			return new List<String> (RootEntries);
		List<String> ExpandedEntries = new List<string>();
		if (InputString.IndexOf(CONFIG_SENDER_MACRO) != -1)
			{
			DataTable SenderTable = WPMediaDataBase.GetCommonDataSet ("Select * from Sender").Tables ["Sender"];
			foreach (String Entry in RootEntries)
				{
				if (Entry.IndexOf (CONFIG_SENDER_MACRO) != -1)
					{
					foreach (DataRow SenderRow in SenderTable.Rows)
						{
						ExpandedEntries.Add (Entry.Replace (CONFIG_SENDER_MACRO, SenderRow ["Name"].ToString ()));
						}
					}
				else
					{
					ExpandedEntries.Add (Entry);
					}
				}
			}
		if (InputString.IndexOf (CONFIG_WPMEDIA_ADD_ON_DATA_TABLE_MACRO) != -1)
			{
			foreach (String Entry in RootEntries)
				{
				if (Entry.IndexOf(CONFIG_WPMEDIA_ADD_ON_DATA_TABLE_MACRO) != -1)
					{
					foreach (DataRow TableRow in WMB.DataWrapper.Instance.AllTabellen.Rows)
						{
						ExpandedEntries.Add(Entry.Replace(CONFIG_WPMEDIA_ADD_ON_DATA_TABLE_MACRO, TableRow["TableName"].ToString()));
						}
					}
				else
					{
					ExpandedEntries.Add(Entry);
					}
				}
			}
		return ExpandedEntries;
		}
Example #22
0
		public bool SetInstanceDataIntoFrameDataSet (DataSet FrameDataSet, WCFStandardsNS.WCFStandards m_DataBase,
						String TableNameParameter, String ID)
			{
			DataSet InstanceDataSet =
				m_DataBase.GetCommonDataSet("Select * from " + TableNameParameter + " where ID = '" + ID + "'");
			DataTable InstanceDataTable = InstanceDataSet.Tables[TableNameParameter];
			InstanceDataSet.Tables.Remove (InstanceDataTable);
			if (m_FrameDataDataSet == null)
				m_FrameDataDataSet = m_Pkg.GetDataSetFromDataSetName ("FrameDefinitions");
			if (FrameDataSet.Tables[TableNameParameter] != null)
				FrameDataSet.Tables.Remove(FrameDataSet.Tables[TableNameParameter]);
			FrameDataSet.Tables.Add (InstanceDataTable);
			m_FrameDataDataSet = FrameDataSet;
			return RenewFrameDataSet ();
			}
Example #23
0
        public bool SetData (WCFStandardsNS.WCFStandards ParentsDataBase, Object Sender, String Bereich, DataSet SchemaDataSet,
            TableLayoutDefinition TableLayoutDefinition)
            {
            m_TableHelper = new CVM.TableUserControlHelper ();
            m_TableHelper.DataBase = ParentsDataBase;
            m_Bereich = Bereich;
            m_SchemaDataSet = SchemaDataSet;
            LayoutDefinition = TableLayoutDefinition;
            DataBase = ParentsDataBase;
            if (Sender.GetType () == typeof (ListBox))
                {
                ListBox ListBoxToProcess = (ListBox)Sender;
                UserData = (ControlUserData)ListBoxToProcess.Tag;
                if (ListBoxToProcess.SelectedIndex == -1)
                    {
                    return false;
                    }
                m_ActiveID = ((ListBoxItem)ListBoxToProcess.Items
                    [ListBoxToProcess.SelectedIndex]).Tag.ToString ();
                }
            if (Sender.GetType () == typeof (DataGrid))
                {
                DataGrid DataGridToProcess = (DataGrid) Sender;
                UserData = (ControlUserData)DataGridToProcess.Tag;
                if (DataGridToProcess.SelectedIndex == -1)
                    {
                    return false;
                    }
                m_ActiveID = ((DataRowView)DataGridToProcess.SelectedItems [0]).Row ["ID"].ToString ();
                }
            if (Sender.GetType () == typeof (TreeView))
                {
                TreeView TreeViewToProcess = (TreeView)Sender;
                UserData = (ControlUserData)TreeViewToProcess.Tag;
                if (TreeViewToProcess.SelectedItem == null)
                    {
                    return false;
                    }
                m_ActiveID = ((TreeViewItem)TreeViewToProcess.SelectedItem).Tag.ToString ();
                }
            m_RefreshmentRoutine = UserData.m_RefreshFunctionName;
            m_PrimaryKeyName = UserData.m_PrimaryKeyName;
            m_TableHelper.TableName = UserData.m_TableName;
            if (String.IsNullOrEmpty (m_ActiveID))
                {
                if (GetMissingIDToModifyCall != null)
                    m_ActiveID = GetMissingIDToModifyCall (UserData.m_TableName, Sender);
                if (String.IsNullOrEmpty (m_ActiveID))
                    {
                    MessageBox.Show ("In der Tabelle \"" + UserData.m_TableName + "\" war keine ID zum starten der Änderungen zu finden");
                    return false;
                    }
                }
            m_ProcessingDataSet = DataBase.GetCommonDataSet (
                "Select * from " + UserData.m_TableName + " where " + m_PrimaryKeyName + " = '" + m_ActiveID + "'");
            if (UserData.m_UpdateAble)
                SetRowToProcess (m_ProcessingDataSet.Tables [0].Rows [0], "Bitte ändern Sie ggf. diese \""
                                                                          + UserData.m_TableName + "\" Daten", UserData.m_UpdateAble);
            else
                SetRowToProcess (m_ProcessingDataSet.Tables [0].Rows [0], "", UserData.m_UpdateAble);

            if (LayoutDefinition == null)
                {
                m_TableHelper.LayoutDefinitionsPropertyToken = "CommonUserInterfaceWindow_";
                LayoutDefinition = m_TableHelper.LayoutDefinition;
                }
            return true;
            }