Пример #1
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());
				}

			}