/// <summary> /// Das Erstellen einer neuen SB-Vorlage abbrechen /// </summary> /// <param name="btn">sendender Button</param> private void cancelFormletterTemplate(Button btn) { KPage pageFormletterAdmin = new KöTaf.WPFApplication.Views.Formletter.pFormletterAdministration(); SinglePage singlePage = new SinglePage(IniParser.GetSetting("FORMLETTER", "formletterAdmin"), pageFormletterAdmin); }
/// <summary> /// Button-Klick-Funktion für "Serienbrief-Vorlage speichern"-Button /// </summary> /// <param name="senderButton">die Instanz des sendenden Buttons</param> private void saveFormletterTemplate(Button senderButton) { try { // When using tabs, you can retrieve a page instance included in a tab using this function, giving the page type pFormletterFilterSelection pageFilter = getPageFromTabs <pFormletterFilterSelection>(); pFormletterFileLinking pageFile = getPageFromTabs <pFormletterFileLinking>(); pFormletterTextFields pageText = getPageFromTabs <pFormletterTextFields>(); // Prüfe ob alle Eingaben richtig sind if (pageFilter.allFilterSets.Count == 0) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noFilterSet")); pageFilter.parentTabControl.SelectedIndex = 0; return; } if (pageFile.lbFileName.Content.Equals("")) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noFormletter")); pageFile.parentTabControl.SelectedIndex = 1; return; } if (!pageFile.validateLinkings()) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noAssignment")); pageFile.parentTabControl.SelectedIndex = 1; return; } if (!pageText.validateTextFields()) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noTextField")); pageText.parentTabControl.SelectedIndex = 2; return; } // Hole alle Filter-Sets List <FilterSetModel> filterSets = pageFilter.allFilterSets; // Neues FormletterPatternModelDB (Serienbriefvorlage) anlegen string pName = pageText.tbPatternName.Text; string saluationM = pageText.tbSaluationM.Text; string saluationF = pageText.tbSaluationF.Text; string saluationN = pageText.tbSaluationN.Text; string filename = pageFile.tbFileName.Text.Replace(System.IO.Directory.GetCurrentDirectory(), "%PROGRAMPATH%"); string text = ""; int frmltrPatternID = FormletterPattern.Add(pName, saluationM, saluationF, saluationN, filename, text); // Bearbeite alle FilterSets foreach (var set in filterSets) { string name = ""; // Für Filter-Sets leer, nur von Listen/Statistiken verwendet string linking = set.linkingType; int filterSetID = FilterSet.Add(name, linking, frmltrPatternID); // Bearbeite alle Filter zu jedem Set foreach (var filter in set.filterList) { string table = filter.group.ToString(); string type = filter.criterion.ToString(); string operation = filter.operation.ToString(); string value = filter.value; int filterID = Filter.Add(filterSetID, table, type, operation, value); } } // Hole alle Spaltenzuordnungen List <FormletterColumnCsvDocumentAssignment> list = pageFile.getAssignments(); // Schreibe Spaltenzuordnungen in die Datenbank foreach (var assignment in list) { string csvColumn = assignment.csv_col_name; string databaseTable = assignment.formletterTableAssignment.group.ToString(); string databaseColumn = assignment.formletterTableAssignment.field.ToString(); ColumnAssignment.Add(frmltrPatternID, csvColumn, databaseTable, databaseColumn); } //Leere Formular pageFilter.resetEverything(); pageFile.resetEverything(); pageText.resetEverything(); KPage pageFormletterAdmin = new KöTaf.WPFApplication.Views.Formletter.pFormletterAdministration(); SinglePage singlePage = new SinglePage(IniParser.GetSetting("FORMLETTER", "formletterAdmin"), pageFormletterAdmin); } catch { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "formletterCreate")); } }
/// <summary> /// Button-Klick-Funktion für "Serienbrief-Vorlage speichern"-Button /// </summary> /// <param name="senderButton">die Instanz des sendenden Buttons</param> private void saveFormletterTemplate(Button senderButton) { try { // When using tabs, you can retrieve a page instance included in a tab using this function, giving the page type pFormletterFilterSelection pageFilter = getPageFromTabs<pFormletterFilterSelection>(); pFormletterFileLinking pageFile = getPageFromTabs<pFormletterFileLinking>(); pFormletterTextFields pageText = getPageFromTabs<pFormletterTextFields>(); // Prüfe ob alle Eingaben richtig sind if (pageFilter.allFilterSets.Count == 0) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noFilterSet")); pageFilter.parentTabControl.SelectedIndex = 0; return; } if (pageFile.lbFileName.Content.Equals("")) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noFormletter")); pageFile.parentTabControl.SelectedIndex = 1; return; } if (!pageFile.validateLinkings()) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noAssignment")); pageFile.parentTabControl.SelectedIndex = 1; return; } if (!pageText.validateTextFields()) { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "noTextField")); pageText.parentTabControl.SelectedIndex = 2; return; } // Hole alle Filter-Sets List<FilterSetModel> filterSets = pageFilter.allFilterSets; // Neues FormletterPatternModelDB (Serienbriefvorlage) anlegen string pName = pageText.tbPatternName.Text; string saluationM = pageText.tbSaluationM.Text; string saluationF = pageText.tbSaluationF.Text; string saluationN = pageText.tbSaluationN.Text; string filename = pageFile.tbFileName.Text.Replace(System.IO.Directory.GetCurrentDirectory(), "%PROGRAMPATH%"); string text = ""; int frmltrPatternID = FormletterPattern.Add(pName, saluationM, saluationF, saluationN, filename, text); // Bearbeite alle FilterSets foreach (var set in filterSets) { string name = ""; // Für Filter-Sets leer, nur von Listen/Statistiken verwendet string linking = set.linkingType; int filterSetID = FilterSet.Add(name, linking, frmltrPatternID); // Bearbeite alle Filter zu jedem Set foreach (var filter in set.filterList) { string table = filter.group.ToString(); string type = filter.criterion.ToString(); string operation = filter.operation.ToString(); string value = filter.value; int filterID = Filter.Add(filterSetID, table, type, operation, value); } } // Hole alle Spaltenzuordnungen List<FormletterColumnCsvDocumentAssignment> list = pageFile.getAssignments(); // Schreibe Spaltenzuordnungen in die Datenbank foreach (var assignment in list) { string csvColumn = assignment.csv_col_name; string databaseTable = assignment.formletterTableAssignment.group.ToString(); string databaseColumn = assignment.formletterTableAssignment.field.ToString(); ColumnAssignment.Add(frmltrPatternID, csvColumn, databaseTable, databaseColumn); } //Leere Formular pageFilter.resetEverything(); pageFile.resetEverything(); pageText.resetEverything(); KPage pageFormletterAdmin = new KöTaf.WPFApplication.Views.Formletter.pFormletterAdministration(); SinglePage singlePage = new SinglePage(IniParser.GetSetting("FORMLETTER", "formletterAdmin"), pageFormletterAdmin); } catch { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "formletterCreate")); } }