Example #1
0
		public void SetParentInstances (ITemplateElementeBackgroundFunctions ConnectedTemplateElementManagementParam,
										InformationenAddOn InfoAddOnParam)
			{
			if (ConnectedTemplateElementManagementParam != null)
				ConnectedTemplateElementManagement = ConnectedTemplateElementManagementParam as TemplateElementManagement;
			if (InfoAddOnParam != null)
				InfoAddOn = InfoAddOnParam;
			}
Example #2
0
		public static bool DoInformationenUpdate (Informationen ActuallInformation, ITemplateElementeBackgroundFunctions EntryToProcess)
			{
			//if (EntryToProcess.InfoAddOn.Informationen != ActuallInformation)
			//    throw new Exception ("EntryToProcess.InfoAddOn.Informationen != ActuallInformation");
			WCFStandards ExistenceCheck = new WCFStandards ();
			DataTable InformationenTable = ExistenceCheck.GetCommonDataSet ("Select * from Informationen where ID = '"
								 + ActuallInformation.ID.ToString () + "'").Tables ["Informationen"];
			if (InformationenTable.Rows.Count == 0)
				{
				ExistenceCheck.RunSQLBatch ("Insert into Informationen (ID, NameID, TypID, ModifyTimeStamp) values ('"
											+ ActuallInformation.ID.ToString () + "', 'Empty ActiveInformationen', '" 
											+ ActuallInformation.TypID.ToString () + "', '"
											+ DateTime.Now.ToString (WMB.Basics.ISO_DATE_TIME_FORMAT) + "')");
				}
			try
				{
				System.Guid? ProcessedEntityID = InsertOrModifyEntity (EntryToProcess, ActuallInformation);
				if (ProcessedEntityID == null)
					return false;
				return true;
				}
			catch (Exception Excp)
				{
				Basics.ReportErrorToEventViewer ("TemplateManagement.DoInformationenUpdate",
					"Beim Add/Modify für ActuallInformation \"" + ActuallInformation.ID.ToString ()
					+ "\" kam es zu folgendem Problem:\r\n"
					+ Excp.ToString ());
				return false;
				}
			}
Example #3
0
		public static Object GetTableEntryContent (ITemplateElementeBackgroundFunctions Entry, String ItemName)
			{
			Object EntryToProcess = GetEntity (Entry.InfoAddOn.Tabelle, (Guid) Entry.InfoAddOn.TabelleID);
			if (EntryToProcess == null)
				return null;
			Type ObjectType = EntryToProcess.GetType ();
			PropertyInfo PropInfo = ObjectType.GetProperty (ItemName, BindingFlags.Instance | BindingFlags.Public);
			if (PropInfo == null)
				return null;
			return PropInfo.GetValue (EntryToProcess, null);
			}
Example #4
0
		public static void DoTabelleDefaultModifications (ITemplateElementeBackgroundFunctions ConnectedITemplateElementeBackgroundFunctions,
						Object EntityToProcess, bool InsertIsTrueModifyIsFalse)
			{
			Type ObjectType = EntityToProcess.GetType ();
			String Tabelle = ObjectType.Name;
			String DefaultBereich = String.Empty;
			if (ConnectedITemplateElementeBackgroundFunctions == null)
				{
				foreach (FullDataElementeTemplates Entry in AllFullDataElementeTemplates.Values)
					{
					if (Entry.TabellenName == Tabelle)
						{
						DefaultBereich = Entry.Bereich;
						break;
						}
					}
				}
			else
				DefaultBereich = AllFullDataElementeTemplates [ConnectedITemplateElementeBackgroundFunctions.ActuallBezeichner].Bereich;
			if (InsertIsTrueModifyIsFalse)
				{
				if (InsertIDIfEmpty (ObjectType, EntityToProcess, "ID") == false)
					InsertIDIfEmpty (ObjectType, EntityToProcess, "TimingsID");
				InsertStringIfEmpty (ObjectType, EntityToProcess, "CreatedBy", CurrentUserName);
				InsertStringIfEmpty (ObjectType, EntityToProcess, "Bereich", DefaultBereich);
//				InsertLastUpdateToken (ObjectType, EntityToProcess, "LastUpdateToken", WMB.Basics.GetNextLastUpdateTokenHelperAsByteArray ());
				}

			InsertString (ObjectType, EntityToProcess, "LastModifiedBy", CurrentUserName);
			InsertDateTime (ObjectType, EntityToProcess, "ModifyTimeStamp", DateTime.Now);
			CheckForMaxLengthExceeded (ObjectType, EntityToProcess);
			}
Example #5
0
		public static System.Guid? InsertOrModifyEntity (ITemplateElementeBackgroundFunctions ConnectedITemplateElementeBackgroundFunctions,
			Object EntityToProcess, bool CheckForPreExistence = false)
			{
			if (EntityToProcess == null)
				{
				Basics.ReportErrorToEventViewer ("TemplateManagement.InsertOrModifyEntity",
												 "EntityToProcess == null\r\n"
												 + (new Exception ("EntityToProcess == null")).ToString ());
				return null;
				}
			Type ObjectType = EntityToProcess.GetType ();
			String TableName = ObjectType.Name;
			String IDName = "ID";
			PropertyInfo IDPropInfo = ObjectType.GetProperty (IDName);
			if (IDPropInfo == null)
				{
				IDName = "TimingsID";
				IDPropInfo = ObjectType.GetProperty (IDName);
				}
			if (IDPropInfo == null)
				{
				Basics.ReportErrorToEventViewer ("TemplateManagement.InsertOrModifyEntity",
												 "Keine ID (TimingsID) bei EntityToProcess\r\n"
												 + (new Exception ("Keine ID (TimingsID) bei EntityToProcess")).ToString ());
				return null;
				}
			Object IDValue = IDPropInfo.GetValue (EntityToProcess, null);
			bool InsertIsTrueModifyIsFalse = true;
			if (IDValue != null)
				{
				if (IDValue is System.Guid)
					{
					InsertIsTrueModifyIsFalse = ((Guid) IDValue == Guid.Empty);
					}
				else if (IDValue is System.Guid?)
					InsertIsTrueModifyIsFalse = ((Guid?) IDValue == Guid.Empty);
				}
			DoTabelleDefaultModifications (ConnectedITemplateElementeBackgroundFunctions,
										   EntityToProcess, InsertIsTrueModifyIsFalse);
			WCFStandards DataAccess = new WCFStandards ();
			if ((CheckForPreExistence)
				&& (IDValue != null))
				{
				DataTable CheckTable = DataAccess.GetCommonDataSet ("Select * from " + TableName + " where " + IDName + " = '"
																	+ (Guid) IDValue + "'").Tables [TableName];
				if (CheckTable.Rows.Count == 0)
					InsertIsTrueModifyIsFalse = true;
				}
			String SQLCommand = String.Empty;
			if (InsertIsTrueModifyIsFalse)
				{
				SQLCommand = WMB.Basics.CreateInsertStatement (TableName, EntityToProcess, EntityToProcess.GetType ().GetProperties());
				}
			else
				{
				SQLCommand = WMB.Basics.CreateModifyStatement (TableName, EntityToProcess, EntityToProcess.GetType ().GetProperties ());
				}
			IDValue = IDPropInfo.GetValue (EntityToProcess, null);
			DataAccess.RunSQLBatch (SQLCommand);
			return (System.Guid?) IDValue;
			}
Example #6
0
		public static void ProcessAddOnDeletion (ITemplateElementeBackgroundFunctions ConnectedITemplateElementeBackgroundFunctions)
			{
			if (ConnectedITemplateElementeBackgroundFunctions.InfoAddOn == null)
				return;
			WCFStandards DataAccess = new WCFStandards ();
			if (ConnectedITemplateElementeBackgroundFunctions.DataTemplatesDescriptionEntry.DeleteEntryIfNotUsed == "Yes")
				{
				if ((ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID != null)
					&& (ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID != Guid.Empty))
					{
					try
						{
						String IDName = "ID";
						if (ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.Tabelle == "Timings")
							IDName = "TimingsID";
						String TableEntryDeleteStatement = "Delete from " + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.Tabelle
							   + " where " + IDName + " = '" + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID.ToString () + "'";
						DataAccess.RunSQLBatch (TableEntryDeleteStatement);
						}
					catch (Exception Excp)
						{
						Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion",
								"Fehler bei Delete from " + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.Tabelle
								+ " von ID \"" + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID.ToString () + "\":\r\n"
								+ Excp.ToString());
						}
					ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID = null;
					ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.FreiText = String.Empty;
					}
				}
			if (ConnectedITemplateElementeBackgroundFunctions.IAddOnHandling_AsObject != null)
				ConnectedITemplateElementeBackgroundFunctions.IAddOnHandling_DoDelete ();
			int NumberOfEqualInfoAddOn = 0;
			foreach (ITemplateElementeBackgroundFunctions Element in ConnectedITemplateElementeBackgroundFunctions.ParentTemplateRuntime_AllITemplateElementeBackgroundFunctionsEntries)
				if (Element.ActuallBezeichner == ConnectedITemplateElementeBackgroundFunctions.ActuallBezeichner)
					NumberOfEqualInfoAddOn++;
			if (NumberOfEqualInfoAddOn < 2)
				{
				ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.FreiText = String.Empty;
				try
					{
					String AddOnUpdateLastEntryStatement = "Update InformationenAddOn set FreiText = '', TabelleID = NULL where ID = '"
												  + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.ID.ToString () + "'";
					DataAccess.RunSQLBatch (AddOnUpdateLastEntryStatement);
					}
				catch (Exception Excp)
					{
					Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion",
							"Fehler bei Update from InformationenAddOn von ID \""
							+ ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID.ToString () + "\":\r\n"
							+ Excp.ToString());
					}
				return;
				}
			try
				{
				String AddOnDeleteStatement = "Delete from InformationenAddOn where ID = '"
											  + ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.ID.ToString () + "'";
				DataAccess.RunSQLBatch (AddOnDeleteStatement);
				ConnectedITemplateElementeBackgroundFunctions.InfoAddOn = null;
				}
			catch (Exception Excp)
				{
				Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion",
						"Fehler bei Delete from InformationenAddOn von ID \""
						+ ConnectedITemplateElementeBackgroundFunctions.InfoAddOn.TabelleID.ToString () + "\":\r\n"
						+ Excp.ToString());
				}

			}