/// <summary> /// Ensures that the user's entered id matches that of an existing player, /// displays the additional player info form, and notifies the user of a successful /// edit. /// </summary> private void editDatabase() { if (!ensurePlayerID()) { errorProviderOfficials.SetError(txtPlayerID, "Invalid Player ID"); lblStatus.Text = "Entered player ID does not belong to an existing player!"; return; } if (checkPlayerInfo()) { return; } int id = int.Parse(txtPlayerID.Text); getInput(); Player playerToEdit = new Player(id, name, position, school, standing); frmAdditionalPlayerInfo aPI = new frmAdditionalPlayerInfo(); aPI.setEdit(true); aPI.setPlayer(playerToEdit); aPI.Show(); lblStatus.Text = "You have successfully edited a player from the database!"; }
/// <summary> /// Displays the additional player info form. /// And notifies the user when the player has /// successfully been added to the database. /// </summary> private void addToDatabase() { if (checkPlayerInfo()) { return; } getInput(); Player playerToAdd = new Player(name, position, school, standing); frmAdditionalPlayerInfo aPI = new frmAdditionalPlayerInfo(); aPI.setEdit(false); aPI.setPlayer(playerToAdd); aPI.Show(); lblStatus.Text = "You have successfully added a player from the database!"; }