/// <summary> /// Nach dem Editieren wird auf Korrektheit geprüft und ggfs. in die DB gespeichert /// Author: Antonios Fesenmeier /// </summary> /// <param name="button"></param> private void pbSave_Click(Button button) { _Validator.clearSB(); // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden! CheckForm(); var isCompany = chBIsCompany.IsChecked; if (_IsValid == false) { MessageBoxEnhanced.Error(_Validator.getErrorMsg().ToString()); } else { var title = cbTitle.SelectedItem as DB.Title; var fundingType = cBFundType.SelectedItem as DB.FundingType; if (isCompany == true) { DB.Sponsor.Update(_CurrentSponsor.SponsorID, title.TitleID, fundingType.FundingTypeID, txtStreet.Text, txtCity.Text, Convert.ToInt32(txtZipCode.Text), txtFirstName.Text, txtLastName.Text, txtCompanyName.Text, txtMobileNo.Text, txtTelNo.Text, txtFax.Text, txtEMail.Text, null, isCompany.Value); } else { DB.Sponsor.Update(_CurrentSponsor.SponsorID, title.TitleID, fundingType.FundingTypeID, txtStreet.Text, txtCity.Text, Convert.ToInt32(txtZipCode.Text), txtFirstName.Text, txtLastName.Text, "", txtMobileNo.Text, txtTelNo.Text, txtFax.Text, txtEMail.Text, null, isCompany.Value); } KPage pageSponsorAdministration = new KöTaf.WPFApplication.Views.pSponsorAdministration(pagingStartValue); SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "sponsorAdministration"), pageSponsorAdministration); } _Validator.clearSB(); }
/// <summary> /// Speichern-Button /// </summary> /// <param name="button"></param> private void pbSave_Click(Button button) { _Validator.clearSB(); CheckForm(); if (_IsValid == false) { MessageBox.Show(_Validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK, MessageBoxImage.Hand); } else { try { var teamId = this._CurrentTeamMember.TeamID; var teamTitle = cbTitle.SelectedItem as DataModel.Title; var teamFunction = cBFunction.SelectedItem as TeamFunction; var dateOfBirth = (DateTime)dpBirthday.SelectedDate; var firstName = txtFirstName.Text; var lastName = txtLastName.Text; var street = txtStreet.Text; var zipCode = int.Parse(txtZipCode.Text); var city = txtCity.Text; var mobileNo = txtMobileNo1.Text; var phoneNo = txtTelNo1.Text; var email = txtEMail1.Text; var isFormletterAllowed = (bool)chBIsFormletterAllowed.IsChecked; Team.Update(teamId, dateOfBirth, teamTitle.TitleID, teamFunction.TeamFunctionID, firstName, lastName, street, zipCode, city, mobileNo, phoneNo, email, isFormletterAllowed); if (cbIsActive.IsChecked == true) { Team.Activate(teamId); } else { Team.Deactivate(teamId); } KPage pageTeamAdministration = new KöTaf.WPFApplication.Views.pTeamAdministration(pagingStartValue); SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "teamAdministration"), pageTeamAdministration); } catch { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common")); } } _Validator.clearSB(); }
/// <summary> /// Überprüft alle Felder auf Korrektheit, anschließend entweder Fehlerausgabe oder speichern der Daten /// Author: Antonios Fesenmeier /// </summary> /// <param name="button"></param> private void pbSave_Click(Button button) { _Validator.clearSB(); // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden! CheckForm(); if (_IsValid == false) { MessageBox.Show(_Validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK, MessageBoxImage.Hand); } else { try { var title = cbTitle.SelectedItem as DataModel.Title; var teamFunction = cBFunction.SelectedItem as TeamFunction; var firstName = txtFirstName.Text; var lastName = txtLastName.Text; var street = txtStreet.Text; var zipCode = int.Parse(txtZipCode.Text); var city = txtCity.Text; var dateOfBirth = (DateTime)dpBirthday.SelectedDate; var mobileNo = txtMobileNo1.Text; var phoneNo = txtTelNo1.Text; var email = txtEMail1.Text; var isFormLetterAllowed = (bool)chBIsFormletterAllowed.IsChecked; var teamId = Team.Add(title.TitleID, teamFunction.TeamFunctionID, firstName, lastName, street, zipCode, city, dateOfBirth, mobileNo, phoneNo, email, isFormLetterAllowed); if (teamId > 0) { KPage pageTeamAdministration = new KöTaf.WPFApplication.Views.pTeamAdministration(); SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "teamAdministration"), pageTeamAdministration); } else { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "saveDataRecord")); } } catch { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common")); } } _Validator.clearSB(); }
/// <summary> /// Nach Validierung der einzelnen Felder wird der Sponsor in der DB abgelegt /// Author: Anotnios Fesenmeier /// </summary> /// <param name="button"></param> private void pbSave_Click(Button button) { // bool formLetter = false; _Validator.clearSB(); // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden! CheckForm(); if (!this._IsValid) { MessageBoxEnhanced.Error(_Validator.getErrorMsg().ToString()); } else { var fundingType = cBFundingTyp.SelectedItem as FundingType; var title = cbTitle.SelectedItem as Title; var isFormLetterAllowed = chBformLetter.IsChecked; var isCompany = chBIsCompany.IsChecked; int _sponsorID; if (isCompany == true) { _sponsorID = Sponsor.Add(fundingType.FundingTypeID, title.TitleID, txtFirstName.Text, txtLastName.Text, txtCity.Text, txtStreet.Text, Convert.ToInt32(txtZipCode.Text), isFormLetterAllowed.Value, txtCompanyName.Text, null, txtEMail.Text, txtFax.Text, txtMobileNo.Text, txtTelNo.Text, isCompany.Value); } else { _sponsorID = Sponsor.Add(fundingType.FundingTypeID, title.TitleID, txtFirstName.Text, txtLastName.Text, txtCity.Text, txtStreet.Text, Convert.ToInt32(txtZipCode.Text), isFormLetterAllowed.Value, txtCompanyName.Text, null, txtEMail.Text, txtFax.Text, txtMobileNo.Text, txtTelNo.Text, isCompany.Value); } if (_sponsorID > 0) { KPage pageSponsorAdministration = new KöTaf.WPFApplication.Views.pSponsorAdministration(); SinglePage singlePage = new SinglePage("Sponsorverwaltung", pageSponsorAdministration); } else { MessageBoxEnhanced.Error("Es ist ein Fehler beim speichern des Datensatzes aufgetreten"); } } _Validator.clearSB(); }