public static CommonSelectionControl CreateSelectionControl (InformationenAddOn InfoAddOn, TemplateElementManagement ConnectedTemplateElementManagement, TemplateManagement.AuswahlSelection EntriesToShow, TemplateManagement.AuswahlSortOrder SortOrder) { CommonSelectionControl SelectionControl = new CommonSelectionControl (); SelectionControl.InfoAddOn = InfoAddOn; SelectionControl.ConnectedTemplateElementManagement = ConnectedTemplateElementManagement; if (SelectionControl.Create (EntriesToShow, SortOrder) == false) return null; return SelectionControl; }
public List<SelectionDataClass> GetSelectionData(String BereichToUse, String ActiveUser, InformationenAddOn InfoAddOnParameter, TemplateElementManagement ConnectedTemplateElementManagement, TemplateManagement.AuswahlSelection EntriesToShow, TemplateManagement.AuswahlSortOrder SortOrder) { SortingItemsForSelection = TemplateManagement.GetInterface [InfoAddOnParameter.Tabelle].GetSortingItemsForSelection (); ItemsToSelectForSelection = TemplateManagement.GetInterface [InfoAddOnParameter.Tabelle].GetItemsToSelectForSelection (); ViewNameForSelection = TemplateManagement.GetInterface [InfoAddOnParameter.Tabelle].GetViewNameForSelection (); ItemsToFillHinweisColumn = TemplateManagement.GetInterface [InfoAddOnParameter.Tabelle].GetItemsToFillHinweisColumn (); if ((SortingItemsForSelection.Length == 0) && (ItemsToSelectForSelection.Length == 0) && (ItemsToFillHinweisColumn.Length == 0) && (String.IsNullOrEmpty (ViewNameForSelection))) return null; switch (EntriesToShow) { case TemplateManagement.AuswahlSelection.AllFromType: { return LoadTypeSelectionData (InfoAddOnParameter, BereichToUse, ConnectedTemplateElementManagement.ParentTemplateRuntime.TypID, EntriesToShow, SortOrder); } break; case TemplateManagement.AuswahlSelection.Used: case TemplateManagement.AuswahlSelection.My: { return LoadMyOrUsedSelectionData (InfoAddOnParameter, BereichToUse, EntriesToShow, SortOrder); } break; case TemplateManagement.AuswahlSelection.All: { return LoadAllSelectionData (InfoAddOnParameter, BereichToUse); } break; } return null; }
public List<SelectionDataClass> GetSelectionData (String BereichToUse, String ActiveUser, InformationenAddOn InfoAddOnParameter, TemplateElementManagement ConnectedTemplateElementManagement, TemplateManagement.AuswahlSelection EntriesToShow, TemplateManagement.AuswahlSortOrder SortOrder) { AltErlaaInfoEntities WebAccess = new AltErlaaInfoEntities (); IQueryable<Timings> TimingsDaten = from Tim in WebAccess.Timings where Tim.ConnectedID == InfoAddOnParameter.InformationenID orderby Tim.TimeA descending select Tim; List<SelectionDataClass> Result = new List<SelectionDataClass> (); foreach (Timings SelectionEntry in TimingsDaten) { SelectionDataClass SelectionData = new SelectionDataClass (); SelectionData.ID = SelectionEntry.TimingsID; SelectionData.ZurAuswahl = FormatFreitext (SelectionEntry, FreiTextFormat.Full); Result.Add (SelectionData); } return Result; }
void CreateLayoutGroupForOneInformationAddOnEntry (TemplateElementManagement.UpdateStatus UpdateStatusFunction) { String TableName = InfoAddOn.Tabelle; if (String.IsNullOrEmpty (TableName)) return; ReadWriteInterface = TemplateManagement.GetInterface [TableName]; ListViewItem SelectionListViewItem = null; if (TemplateManagement.AllFullDataElementeTemplates [InfoAddOn.ActuallBezeichner].UseSelector == "Yes") { SelectionControl = CreateSelectionControl (InfoAddOn, ConnectedTemplateElementManagement, ActuallAuswahlSelection, ActuallAuswahlSortOrder); if (SelectionControl != null) { if (ConnectedTemplateElementManagement.LocallyModifiedTableEntry == null) SelectionControl.ProcessDoubleClickedCall = new ProcessDoubleClickedEvent (ProcessDoubleClickedHandler_ForSelectionControl); CompleteEntryStackPanel.Children.Add (SelectionControl); } } ListViewItem ContentListViewItem = null; if ((TemplateManagement.AllFullDataElementeTemplates [InfoAddOn.ActuallBezeichner].UseControl == "Yes") || (ConnectedTemplateElementManagement.LocallyModifiedTableEntry != null)) { ITemplateReadWrite NewInstance = ReadWriteInterface.GetNewInstance (); ConnectedTemplateElementManagement.ReadWriteInterfaceActuallyInstatiated = NewInstance; NewInstance.SetParentInstances (ConnectedTemplateElementManagement, InfoAddOn); if (ConnectedTemplateElementManagement.LocallyModifiedTableEntry != null) NewInstance.SetWorkingData (ConnectedTemplateElementManagement.LocallyModifiedTableEntry); ContentControl = NewInstance.GetControl (); if (SelectionControl != null) SelectionControl.Tag = ContentControl; else { if (InfoAddOn != null) (ContentControl as ITemplateReadWrite).DoEdit (InfoAddOn); } CompleteEntryStackPanel.Children.Add (ContentControl); if ((UpdateStatusFunction == TemplateElementManagement.UpdateStatus.NothingUpdated) && (TemplateManagement.AllFullDataElementeTemplates [InfoAddOn.ActuallBezeichner].UseSelector == "Yes") && (SelectionControl != null)) ContentControl.Visibility = Visibility.Collapsed; } ListViewItem FreitextListViewItem = null; if (TemplateManagement.AllFullDataElementeTemplates [InfoAddOn.ActuallBezeichner].UseText == "Yes") { GroupBox FreitextGroupBox = new GroupBox (); FreitextGroupBox.HorizontalContentAlignment = HorizontalAlignment.Stretch; FreitextGroupBox.Header = "Fertiger Eintrag"; FreiTextControl = new TextBox (); FreiTextControl.IsReadOnly = true; FreitextGroupBox.Content = FreiTextControl; FreiTextControl.TextWrapping = TextWrapping.Wrap; FreiTextControl.Text = InfoAddOn.FreiText; FreiTextControl.AcceptsReturn = true; FreiTextControl.AcceptsTab = true; FreiTextControl.GotKeyboardFocus += new KeyboardFocusChangedEventHandler (FreiTextControl_GotKeyboardFocus); FreiTextControl.LostKeyboardFocus += new KeyboardFocusChangedEventHandler (FreiTextControl_LostKeyboardFocus); if (ContentControl != null) ContentControl.Tag = FreiTextControl; CompleteEntryStackPanel.Children.Add (FreitextGroupBox); } UpdateLayout (); }
private void CheckForInsertDragDrop (TemplateElementManagement TemplateElement, Button UpdateButton, TextBlock FreitextBlock) { if (TemplateElement.DescID == System.Guid.Parse ("10D6859F-31DE-4AB7-A8FC-A03CC21F6115")) { UpdateButton.AllowDrop = true; UpdateButton.DragEnter += new DragEventHandler (ConnectorDragDrop_DragEnterHandler); UpdateButton.DragLeave += new DragEventHandler (ConnectorDragDrop_DragLeaveHandler); UpdateButton.Drop += new DragEventHandler (ConnectorDragDrop_DropHandler); } }
public static void ChangeTheOthersToRootViewWhenOpen (TemplateElementManagement ElementNotToProcess) { foreach (TemplateElementManagement Element in (ElementNotToProcess).ParentTemplateRuntime.AllTemplateElementManagementEntries) { if (Element == ElementNotToProcess) { continue; } Element.ChangeToRootViewWhenOpen (); } }
public GroupBox CreateViewLayout (TemplateElementManagement.UpdateStatus UStatus) { GroupBoxForOneInfoAddOn = new GroupBox (); GroupBoxForOneInfoAddOn.HorizontalContentAlignment = HorizontalAlignment.Stretch; if ((String.Compare (WMB.Basics.GetComputerName (), "Heinz64", true) == 0) && (WMB.WPMediaApplicationState.Instance.Properties.Keys.Contains ("TestOptionForDebugging"))) { GroupBoxForOneInfoAddOn.Header = ActuallBezeichner + " (IAddOn= " + this.InfoAddOn.ID.ToString() + ", " + "Desc= " + this.DataTemplatesDescriptionEntry.ID.ToString() + ", Elem= " + DataTemplatesDescriptionEntry.DataElementTemplateID.ToString() + ", " + TemplateHandling.TemplateManagement.AllDataTemplates [(System.Guid)DataTemplatesDescriptionEntry.RootDataTemplatesID].NameID + ", " + TemplateHandling.TemplateManagement.AllDataElement [(System.Guid)DataTemplatesDescriptionEntry.PhysicalDataElementID].Bezeichner + ", " + DataTemplatesDescriptionEntry.Visibility + ")"; } else GroupBoxForOneInfoAddOn.Header = ActuallBezeichner; GroupBoxForOneInfoAddOn.Tag = this; Grid LineGrid = new Grid (); GroupBoxForOneInfoAddOn.Content = LineGrid; LineGrid.ColumnDefinitions.Add (new ColumnDefinition ()); LineGrid.ColumnDefinitions.Add (new ColumnDefinition ()); LineGrid.ColumnDefinitions.Add (new ColumnDefinition ()); LineGrid.ColumnDefinitions [0].Width = (GridLength) GLConverter.ConvertFromString ("20"); if (UpdateMode == true) { LineGrid.ColumnDefinitions [1].Width = (GridLength) GLConverter.ConvertFromString ("*"); LineGrid.ColumnDefinitions [2].Width = (GridLength) GLConverter.ConvertFromString ("80"); } else { LineGrid.ColumnDefinitions [1].Width = (GridLength) GLConverter.ConvertFromString ("*"); LineGrid.ColumnDefinitions [2].Width = (GridLength) GLConverter.ConvertFromString ("0"); } TextBlock FreitextBlock = new TextBlock (); FreitextBlock.TextWrapping = TextWrapping.Wrap; FreitextBlock.FontWeight = FontWeights.Bold; LineGrid.Children.Add (FreitextBlock); Grid.SetColumn (FreitextBlock, 1); if (InfoAddOn != null) { FreitextBlock.Text = InfoAddOn.FreiText; } if (UpdateMode) { ButtonStackPanel = new StackPanel (); LineGrid.Children.Add (ButtonStackPanel); Grid.SetColumn (ButtonStackPanel, 2); Grid.SetRow (ButtonStackPanel, 0); Button InsertOrUpdateItem = new Button (); ButtonStackPanel.Children.Add (InsertOrUpdateItem); InsertOrUpdateItem.Tag = GroupBoxForOneInfoAddOn; InsertOrUpdateItem.Click += new RoutedEventHandler (InsertOrUpdateButton_Click); if (String.IsNullOrEmpty(FreitextBlock.Text)) { InsertOrUpdateItem.Content = "Eintragen"; Binding RootEntryCompletedBinding = new Binding("RootEntryCompleted"); RootEntryCompletedBinding.Source = ParentTemplateRuntime; InsertOrUpdateItem.SetBinding(Button.IsEnabledProperty, RootEntryCompletedBinding); } else { InsertOrUpdateItem.Content = "Ändern"; CheckForInsertDragDrop (this, InsertOrUpdateItem, FreitextBlock); } } return GroupBoxForOneInfoAddOn; }
public ChapterBase (TemplateElementManagement ElementSourceParameter) { ElementSource = ElementSourceParameter; }
public static bool DoInformationenUpdate (Informationen ActuallInformation, TemplateElementManagement EntryToProcess) { //if (EntryToProcess.InfoAddOn.Informationen != ActuallInformation) // throw new Exception ("EntryToProcess.InfoAddOn.Informationen != ActuallInformation"); AltErlaaInfoEntities UpdateContext = new AltErlaaInfoEntities (ServiceSource); Informationen StoredInformationen = (from Inf in UpdateContext.Informationen where Inf.ID == ActuallInformation.ID select Inf).FirstOrDefault (); if ((StoredInformationen == null) || (StoredInformationen.ID == Guid.Empty)) { try { DoTabelleDefaultModifications (EntryToProcess, ActuallInformation, true); UpdateContext.MergeOption = MergeOption.AppendOnly; UpdateContext.AddObject ("Informationen", ActuallInformation); DataServiceResponse Response = UpdateContext.SaveChanges (); } catch (Exception Excp) { Basics.ReportErrorToEventViewer ("TemplateManagement.DoCompleteUpdate", "Beim AddObject für ActuallInformation \"" + ActuallInformation.ID.ToString () + "\" kam es zu folgendem Problem:\r\n" + Excp.Message); return false; } } else { try { DoTabelleDefaultModifications (EntryToProcess, ActuallInformation, false); UpdateContext.MergeOption = MergeOption.AppendOnly; Type TargetType = StoredInformationen.GetType (); foreach (PropertyInfo Prop in TargetType.GetProperties ()) { Prop.SetValue (StoredInformationen, Prop.GetValue (ActuallInformation, null), null); } UpdateContext.UpdateObject (StoredInformationen); DataServiceResponse Response = UpdateContext.SaveChanges (); } catch (Exception Excp) { Basics.ReportErrorToEventViewer ("TemplateManagement.DoCompleteUpdate", "Beim UpdateObject für ActuallInformation \"" + ActuallInformation.ID.ToString () + "\" kam es zu folgendem Problem:\r\n" + Excp.Message); return false; } } return true; }
public static Object GetTableEntryContent (TemplateElementManagement 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); }
public static void DoTabelleDefaultModifications (TemplateElementManagement ConnectedTemplateElementManagement, Object EntityToProcess, bool InsertIsTrueModifyIsFalse) { Type ObjectType = EntityToProcess.GetType (); String Tabelle = ObjectType.Name; String DefaultBereich = String.Empty; if (ConnectedTemplateElementManagement == null) { foreach (FullDataElementeTemplates Entry in FullElementeTemplates.Values) { if (Entry.TabellenName == Tabelle) { DefaultBereich = Entry.Bereich; break; } } } else DefaultBereich = FullElementeTemplates [ConnectedTemplateElementManagement.ActuallBezeichner].Bereich; if (InsertIsTrueModifyIsFalse == true) { if (InsertIDIfEmpty (ObjectType, EntityToProcess, "ID") == false) InsertIDIfEmpty (ObjectType, EntityToProcess, "TimingsID"); InsertStringIfEmpty (ObjectType, EntityToProcess, "CreatedBy", CurrentUserName); InsertStringIfEmpty (ObjectType, EntityToProcess, "Bereich", DefaultBereich); } InsertString (ObjectType, EntityToProcess, "LastModifiedBy", CurrentUserName); InsertDateTime (ObjectType, EntityToProcess, "ModifyTimeStamp", DateTime.Now); CheckForMaxLengthExceeded (ObjectType, EntityToProcess); }
public static void ProcessAddOnDeletion (TemplateElementManagement ConnectedTemplateElementManagement) { if (ConnectedTemplateElementManagement.InfoAddOn == null) return; WCFStandards DataAccess = new WCFStandards (); if (ConnectedTemplateElementManagement.DataTemplatesDescriptionEntry.DeleteEntryIfNotUsed == "Yes") { if ((ConnectedTemplateElementManagement.InfoAddOn.TabelleID != null) && (ConnectedTemplateElementManagement.InfoAddOn.TabelleID != Guid.Empty)) { try { String IDName = "ID"; if (ConnectedTemplateElementManagement.InfoAddOn.Tabelle == "Timings") IDName = "TimingsID"; String TableEntryDeleteStatement = "Delete from " + ConnectedTemplateElementManagement.InfoAddOn.Tabelle + " where " + IDName + " = '" + ConnectedTemplateElementManagement.InfoAddOn.TabelleID.ToString () + "'"; DataAccess.RunSQLBatch (TableEntryDeleteStatement); } catch (Exception Excp) { Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion", "Fehler bei Delete from " + ConnectedTemplateElementManagement.InfoAddOn.Tabelle + " von ID \"" + ConnectedTemplateElementManagement.InfoAddOn.TabelleID.ToString () + "\":\r\n" + Excp.Message); } ConnectedTemplateElementManagement.InfoAddOn.TabelleID = null; ConnectedTemplateElementManagement.InfoAddOn.FreiText = String.Empty; } } if (ConnectedTemplateElementManagement.IAddOnHandling != null) ConnectedTemplateElementManagement.IAddOnHandling.DoDelete (); int NumberOfEqualInfoAddOn = 0; foreach (TemplateElementManagement Element in ConnectedTemplateElementManagement.ParentTemplateRuntime.AllTemplateElementManagementEntries) if (Element.ActuallBezeichner == ConnectedTemplateElementManagement.ActuallBezeichner) NumberOfEqualInfoAddOn++; if (NumberOfEqualInfoAddOn < 2) { ConnectedTemplateElementManagement.InfoAddOn.FreiText = String.Empty; try { String AddOnUpdateLastEntryStatement = "Update InformationenAddOn set FreiText = '', TabelleID = DBNull where ID = '" + ConnectedTemplateElementManagement.InfoAddOn.ID.ToString () + "'"; DataAccess.RunSQLBatch (AddOnUpdateLastEntryStatement); } catch (Exception Excp) { Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion", "Fehler bei Update from InformationenAddOn von ID \"" + ConnectedTemplateElementManagement.InfoAddOn.TabelleID.ToString () + "\":\r\n" + Excp.Message); } return; } try { String AddOnDeleteStatement = "Delete from InformationenAddOn where ID = '" + ConnectedTemplateElementManagement.InfoAddOn.ID.ToString () + "'"; DataAccess.RunSQLBatch (AddOnDeleteStatement); ConnectedTemplateElementManagement.InfoAddOn = null; } catch (Exception Excp) { Basics.ReportErrorToEventViewer ("TemplateManagement.ProcessAddOnDeletion", "Fehler bei Delete from InformationenAddOn von ID \"" + ConnectedTemplateElementManagement.InfoAddOn.TabelleID.ToString () + "\":\r\n" + Excp.Message); } }