/// <summary> /// Button zum hinzufügen eines neuen Kunden, laden der jeweiligen Tabseiten und festlegen des ToolbarContents /// /// Author: Antonios Fesenmeier /// </summary> /// <param name="Button"></param> private void pbNewClient_Click(Button Button) { /* var keyValueList = ClientDataGrid.ToKeyValueList(); * KöTaf.Utils.Printer.CSVExporter csv = new Utils.Printer.CSVExporter(keyValueList); * var header = csv.GetHeader(); * var content = csv.GetData(); * var csvFull = csv.GetCsv(); * csv.Write(); */ // Adding a new tab with the according page shown under this tab KPage person = new KöTaf.WPFApplication.Views.Client.pNewClientPerson(); SimpleTabItem tabPerson = new SimpleTabItem(IniParser.GetSetting("CLIENT", "personalData"), person); this._myTabList.Add(tabPerson); KPage partnerChild = new KöTaf.WPFApplication.Views.Client.pNewClientPartnerChild(); SimpleTabItem tabPartnerChild = new SimpleTabItem(IniParser.GetSetting("CLIENT", "partnerAndChildren"), partnerChild); this._myTabList.Add(tabPartnerChild); KPage revenues = new KöTaf.WPFApplication.Views.Client.pNewClientRevenues(); SimpleTabItem tabRevenues = new SimpleTabItem(IniParser.GetSetting("CLIENT", "revenue"), revenues); this._myTabList.Add(tabRevenues); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); SinglePage singlePage = new SinglePage(this, IniParser.GetSetting("CLIENT", "createNewClient"), this._myTabList); }
/// <summary> /// Button zum hinzufügen eines neuen Kunden, laden der jeweiligen Tabseiten und festlegen des ToolbarContents /// /// Author: Antonios Fesenmeier /// </summary> /// <param name="Button"></param> private void pbNewClient_Click(Button Button) { /* var keyValueList = ClientDataGrid.ToKeyValueList(); KöTaf.Utils.Printer.CSVExporter csv = new Utils.Printer.CSVExporter(keyValueList); var header = csv.GetHeader(); var content = csv.GetData(); var csvFull = csv.GetCsv(); csv.Write(); */ // Adding a new tab with the according page shown under this tab KPage person = new KöTaf.WPFApplication.Views.Client.pNewClientPerson(); SimpleTabItem tabPerson = new SimpleTabItem(IniParser.GetSetting("CLIENT", "personalData"), person); this._myTabList.Add(tabPerson); KPage partnerChild = new KöTaf.WPFApplication.Views.Client.pNewClientPartnerChild(); SimpleTabItem tabPartnerChild = new SimpleTabItem(IniParser.GetSetting("CLIENT", "partnerAndChildren"), partnerChild); this._myTabList.Add(tabPartnerChild); KPage revenues = new KöTaf.WPFApplication.Views.Client.pNewClientRevenues(); SimpleTabItem tabRevenues = new SimpleTabItem(IniParser.GetSetting("CLIENT", "revenue"), revenues); this._myTabList.Add(tabRevenues); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabPerson.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabPartnerChild.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "cancel"), pbAbort_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "back"), pbBack_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "next"), pbNext_Click); tabRevenues.toolbar.addButton(IniParser.GetSetting("BUTTONS", "save"), pbSave_Click); SinglePage singlePage = new SinglePage(this, IniParser.GetSetting("CLIENT", "createNewClient"), this._myTabList); }
private void pbAddDelChild_Click(object sender, RoutedEventArgs e) { _PartnerChildIsValid = true; pNewClientPerson pPerson = getPageFromTabs <pNewClientPerson>(); var row = dtgChildren.SelectedCells.ElementAt(0); var currentSelectedRow = row.Item as ChildModel; int rowId = dtgChildren.Items.IndexOf(currentSelectedRow); DataGridRow currRow = dtgChildren.GetRow(rowId); if (currentSelectedRow.isAdded == false) { ////Prüfen des Kindes //if (CheckChildDataGrid()) //{ if (currentSelectedRow != null) { ContentPresenter cpGender = dtgChildren.Columns[3].GetCellContent(currRow) as ContentPresenter; var combobox = DataGridHelper.GetVisualChild <ComboBox>(cpGender); CBItem cbGenderItem = (CBItem)combobox.SelectedItem; if (cbGenderItem.Name == "Männlich") { currentSelectedRow.IsFemale = false; } else { currentSelectedRow.IsFemale = true; } //Combobox umsortieren CBItem male = new CBItem(); male.Name = "Männlich"; CBItem female = new CBItem(); female.Name = "Weiblich"; List <CBItem> newGenderTypes = new List <CBItem>(); if (currentSelectedRow.IsFemale) { newGenderTypes.Add(female); newGenderTypes.Add(male); } else { newGenderTypes.Add(male); newGenderTypes.Add(female); } currentSelectedRow.genderType = newGenderTypes; currentSelectedRow.isAdded = true; dtgChildren.CommitEdit(); dtgChildren.Items.Refresh(); dtgChildren.Visibility = System.Windows.Visibility.Visible; addNewChildtoDatagrid(); pPerson.pbNewChild.Visibility = System.Windows.Visibility.Hidden; } //} //else //{ // getErrorMsg(); //} } else { var message = "Soll der gewählte Datensatz gelöscht werden?"; var dialogResult = MessageBox.Show(message, "Bestätigung erfordert", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (dialogResult == MessageBoxResult.OK) { this._Childs.RemoveAt(rowId); dtgChildren.ItemsSource = this._Childs; if (dtgChildren.Items.Count == 0) { addNewChildtoDatagrid(); } dtgChildren.CommitEdit(); dtgChildren.Items.Refresh(); } } pPerson.setNumberOfChild((this._Childs.Count - 1).ToString()); }