예제 #1
0
        /// <summary>
        /// Replaces a Coach at the specified index with the specified parameter.
        /// </summary>
        /// <param name="indexOfCoach">Specifies ate which index the replacement will occur.</param>
        /// <param name="coach">The Coach object which will replace the current object.</param>
        /// <param name="picture">The picture of the Coach</param>
        public void ReplaceCoach(int indexOfCoach, Coach coach, Image picture)
        {
            if (indexOfCoach > coachList.Count - 1 || indexOfCoach < 0)
            {
                throw new IndexOutOfRangeException();
            }

            File.Delete(CoachPictureFolder + "\\" + coachList[indexOfCoach].FullNameAndID + fileType);

            coachList[indexOfCoach] = coach;
            this.Save();
            string filePath = CoachPictureFolder + "\\" + coach.FullNameAndID + fileType;

            Tennis_Management_Software.Imaging.ImageHandling.SaveImage(picture, filePath, System.Drawing.Imaging.ImageFormat.Png);
        }
예제 #2
0
        /// <summary>
        /// Initialises a new instance of the Tennis_Management_Software.CoachForm class.
        /// </summary>
        public CoachForm(Coach coach, Image picture)
        {
            if (coach.TennisPlayerInfo.TimetableList != null)
            {
                this.coachTimetableList = coach.TennisPlayerInfo.TimetableList;
            }
            else
            {
                this.coachTimetableList = new List <CoachTimetable>();
            }


            this.coachID = coach.ID;
            InitializeComponent();
            FIllInformation(coach, picture);
        }
예제 #3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (inputInformation.SetupInformation())
            {
                Coach coach = new Coach(coachID, inputInformation.PersonInfo.Name, inputInformation.PersonInfo.Surname,
                                        inputInformation.PersonInfo.Gender, inputInformation.PersonInfo.Email, inputInformation.PersonInfo.PhoneNumber, inputInformation.PersonInfo.HomePhoneNumber,
                                        inputInformation.PersonInfo.HomeAddress, inputInformation.PersonInfo.DateOfBirth, (float)Math.Round(hourlyPaymentRateNumUpDown.Value, 2),
                                        (float)Math.Round(extraHourlyPaymentRateNumUpDown.Value, 2), coachTimetableList);

                RaiseSaveCoachEvent(coach, searchPicture.MainPictureBoxImage);

                this.Close();
            }
            else
            {
                MessageBox.Show("Not all the fields have been completed correctly.", "Tennis Management Software", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }