/// <summary> /// Saves entered Signed Up Team /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveSignedUpTeam(object sender, RoutedEventArgs e) { if (CheckInput()) { newTeam.suTeamPlayerFirstNames[0] = tbx_iSUTP1Firstname.Text; newTeam.suTeamPlayerLastNames[0] = tbx_iSUTP1Lastname.Text; newTeam.suTeamPlayerFirstNames[1] = tbx_iSUTP2Firstname.Text; newTeam.suTeamPlayerLastNames[1] = tbx_iSUTP2Lastname.Text; newTeam.Setter(); ClearTbx(); btn_MultiCreate.Visibility = Visibility.Visible; tbx_iMultiCreate.Visibility = Visibility.Hidden; lbl_sMultiCreate.Visibility = Visibility.Hidden; btn_ClsMultiCreate.Visibility = Visibility.Hidden; SignUpTeams_Loaded(sender, e); } else { mainWindow.MessageBar(MainWindow.ErrorMessage, "Fehlende Informationen", "Einige Informationen die zur Voranmeldung eines Teams benötigt werden fehlen!" + "\nBitte verfolständigen Sie diese!"); multiCreate = 0; } }
/// <summary> /// Delete Team-Section from .ini-File /// </summary> /// <param name="i_deleteTeam"></param> public void deleteSignedUpTeam(SignedUpTeam i_deleteTeam) { INIFile sutIni = new INIFile(iniPath); int suTeamCnt = Convert.ToInt32(sutIni.GetValue(Const.fileSec, SignedUpTeam.fsX_suTeamCnt)); if (suTeamCnt == i_deleteTeam.suTeamId) { //Last Team in ini-File! No switching needed string o_deleteString = "[" + SignedUpTeam.suTeamSec + i_deleteTeam.suTeamId + "]"; sutIni.DeleteFromIni(iniPath, o_deleteString, suTeamSec_Length); } else { SignedUpTeam switch_Team = new SignedUpTeam(); for (int i = i_deleteTeam.suTeamId; i < suTeamCnt; i++) { switch_Team.Getter(i + 1); switch_Team.suTeamId = i; switch_Team.Setter(); } string o_deletestring = "[" + SignedUpTeam.suTeamSec + Convert.ToInt32(suTeamCnt) + "]"; sutIni.DeleteFromIni(iniPath, o_deletestring, suTeamSec_Length); } sutIni.SetValue(Const.fileSec, fsX_suTeamCnt, Convert.ToString(suTeamCnt - 1)); }
/// <summary> /// Saves Multiple Teams from entered Data with identifining postfix added to the teamname /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="i_multiCreate"></param> private void SaveSignedUpTeam(object sender, RoutedEventArgs e, int i_multiCreate) { string teamName = ""; if (CheckInput()) { btn_MultiCreate.Visibility = Visibility.Visible; tbx_iMultiCreate.Visibility = Visibility.Hidden; lbl_sMultiCreate.Visibility = Visibility.Hidden; btn_ClsMultiCreate.Visibility = Visibility.Hidden; for (int i = 1; i <= multiCreate; i++) { if (i == 1) { newTeam.suTeamPlayerFirstNames[0] = tbx_iSUTP1Firstname.Text; newTeam.suTeamPlayerLastNames[0] = tbx_iSUTP1Lastname.Text; newTeam.suTeamPlayerFirstNames[1] = tbx_iSUTP2Firstname.Text; newTeam.suTeamPlayerLastNames[1] = tbx_iSUTP2Lastname.Text; teamName = newTeam.suTeamName; newTeam.suTeamName = newTeam.suTeamName + Convert.ToString(i); newTeam.Setter(); } else { SignedUpTeam multiTeam = new SignedUpTeam(true); for (int member = 0; member < 2; member++) { multiTeam.suTeamPlayerFirstNames[member] = newTeam.suTeamPlayerFirstNames[member]; multiTeam.suTeamPlayerLastNames[member] = newTeam.suTeamPlayerLastNames[member]; } multiTeam.suTeamName = teamName + Convert.ToString(i); multiTeam.Setter(); } } ClearTbx(); btn_MultiCreate.Visibility = Visibility.Visible; tbx_iMultiCreate.Visibility = Visibility.Hidden; lbl_sMultiCreate.Visibility = Visibility.Hidden; SignUpTeams_Loaded(sender, e); } else { mainWindow.MessageBar(MainWindow.ErrorMessage, "Fehlende Informationen", "Einige Informationen die zur Voranmeldung eines Teams benötigt werden fehlen!" + "\nBitte verfolständigen Sie diese!"); } }