private void SaveTeamOfficial(TeamOfficial official, int position) { TeamOfficial official1 = new TeamOfficial() { id = (official == null) ? 0 : official.id, firstName = txtFirstName1.Text, lastName = txtLastName1.Text, position = new StaffPosition() { positionID = (short)position, }, team = team }; if (TeamOfficialHelper.SaveTeamOfficial(official1) == 0) { MessageBox.Show("Error Saving Team Official"); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnSave_Click(object sender, EventArgs e) { TeamOfficial official1 = new TeamOfficial() { id = (official == null) ? 0 : official.id, firstName = txtFirstName1.Text, lastName = txtLastName1.Text, position = new StaffPosition() { positionID = (short)cmbPosition.SelectedValue, positionDetail = cmbPosition.SelectedItem.ToString(), }, team = team }; if (TeamOfficialHelper.SaveTeamOfficial(official1) == 0) { MessageBox.Show("Error Saving Team Official"); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnSave_Click(object sender, EventArgs e) { if (txtFirstName1.Text == "" || txtFirstName2.Text == "" || txtFirstName3.Text == "" || txtLastName1.Text == "" || txtLastName2.Text == "" || txtLastName3.Text == "") { MessageBox.Show("Fill up the empty blank"); return; } if (!SaveTeam()) { return; } team = Team.GetTeamByName(tournament, txtName.Text); int id1 = 0; int id2 = 0; int id3 = 0; if (!(teamOfficialByTeam.Count <= 0)) { id1 = (teamOfficialByTeam[0] == null) ? 0 : teamOfficialByTeam[0].id; id2 = (teamOfficialByTeam[1] == null) ? 0 : teamOfficialByTeam[1].id; id3 = (teamOfficialByTeam[2] == null) ? 0 : teamOfficialByTeam[2].id; } TeamOfficial coach = new TeamOfficial() { id = id1, firstName = txtFirstName1.Text, lastName = txtLastName1.Text, position = new StaffPosition() { positionID = 1, positionDetail = "Coach", }, team = new Team() { teamID = team.teamID } }; TeamOfficial assistant_coach = new TeamOfficial() { id = id2, firstName = txtFirstName2.Text, lastName = txtLastName2.Text, position = new StaffPosition() { positionID = 2, positionDetail = "Assistant Coach" }, team = new Team() { teamID = team.teamID } }; TeamOfficial manager = new TeamOfficial() { id = id3, firstName = txtFirstName3.Text, lastName = txtLastName3.Text, position = new StaffPosition() { positionID = 3, positionDetail = "Manager" }, team = new Team() { teamID = team.teamID } }; TeamOfficialHelper.SaveTeamOfficial(coach); TeamOfficialHelper.SaveTeamOfficial(assistant_coach); TeamOfficialHelper.SaveTeamOfficial(manager); }