Ejemplo n.º 1
0
        public void Delete(OneDaySession mySession)
        {
            if (IsEmpty == true)
            {
                MessageBox.Show("Session list is empty.");
                return;
            }
            else
            {
                bool isIn = SessionsList.Contains(mySession);

                if (isIn == true)
                {
                    int index = SessionsList.IndexOf(mySession);
                    WhenIHaveToWorkout[mySession.Day] = false;
                    SessionsList.RemoveAt(index);
                    UpdateRoutine();
                }
                else
                {
                    MessageBox.Show("This session (" + mySession.SessionName + ") does not exist on session list.");
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        public void Add(OneDaySession mySession)
        {
            bool isConfirmed = CheckDayAndName(mySession);

            if (isConfirmed == true)
            {
                SessionsList.Add(mySession);
                WhenIHaveToWorkout[mySession.Day] = true;
                UpdateRoutine();
            }
        }
Ejemplo n.º 3
0
        public bool CheckDayAndName(OneDaySession mySession)
        {
            bool isIn        = false;
            bool isConfirmed = true;

            foreach (OneDaySession oneDaySession in SessionsList)
            {
                if (oneDaySession.SessionName == mySession.SessionName)
                {
                    isIn = true;
                }
            }

            if (isIn == true)
            {
                MessageBox.Show("This session (" + mySession.SessionName + ") has been added before.");
                isConfirmed = false;;
            }
            else
            {
                bool isBusy;

                if (WhenIHaveToWorkout[mySession.Day] == true)
                {
                    isBusy = true;
                }
                else
                {
                    isBusy = false;
                }

                if (isBusy == true)
                {
                    MessageBox.Show("This day (" + mySession.Day.ToString() + ") is busy.");
                    isConfirmed = false;
                }
            }

            if (isConfirmed == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }