Beispiel #1
0
        /// <summary>
        /// William Clark
        /// Created: 2021/03/04
        ///
        /// Constructer that accepts an IRoutineManager and a RoutineVM
        /// </summary>
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="routineManager">The IRoutineManager Logic Layer class</param>
        /// <param name="selectedRoutine">The RoutineVM for which to view details</param>
        public AddEditDetailRoutine(IRoutineManager routineManager, RoutineVM selectedRoutine)
        {
            _routine        = selectedRoutine;
            _routineManager = routineManager;

            InitializeComponent();
        }
Beispiel #2
0
        /// <summary>
        /// William Clark
        /// Created: 2021/03/04
        ///
        /// Updates the current routine in the data store, then udpates the interface to reflect the changes
        /// </summary>
        ///
        /// <remarks>
        /// </remarks>
        private void btnSaveRoutineDescription_Click(object sender, RoutedEventArgs e)
        {
            Routine newRoutine = new Routine(txtRoutineName.Text, txtRoutineDescription.Text, _routine.UserAccountID_Client, _routine.UserAccountID_Admin, _routine.Active, _routine.EntryDate, DateTime.Now, null);

            try
            {
                if (_routineManager.UpdateRoutine(_routine, newRoutine))
                {
                    try
                    {
                        _routine = new RoutineVM(newRoutine, _routineManager.GetRoutineStepsByRoutine(newRoutine));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("The Steps of the routine could not be loaded.");
                    }
                }
                else
                {
                    MessageBox.Show("The Routine could not be updated.");
                }
                PopulatePage();
            }
            catch (Exception)
            {
                MessageBox.Show("The routine could not be updated.");
            }
        }
Beispiel #3
0
        /// <summary>
        /// William Clark
        /// Created: 2021/03/04
        ///
        /// Deactivates/Reactivates Routine in the data store
        /// </summary>
        ///
        /// <remarks>
        /// </remarks>
        private void btnActive_Click(object sender, RoutedEventArgs e)
        {
            switch (btnActive.Content)
            {
            case "Deactivate":
                try
                {
                    Routine newRoutine = new Routine(txtRoutineName.Text, txtRoutineDescription.Text, _routine.UserAccountID_Client, _routine.UserAccountID_Admin, false, _routine.EntryDate, _routine.EditDate, DateTime.Now);
                    _routine = new RoutineVM(newRoutine, _routineManager.GetRoutineStepsByRoutine(newRoutine));
                    PopulatePage();
                }
                catch (Exception)
                {
                    MessageBox.Show("Routine could not be deactivated.");
                }
                break;

            case "Reactivate":
                try
                {
                    Routine newRoutine = new Routine(txtRoutineName.Text, txtRoutineDescription.Text, _routine.UserAccountID_Client, _routine.UserAccountID_Admin, false, _routine.EntryDate, _routine.EditDate, DateTime.Now);
                    _routine = new RoutineVM(newRoutine, _routineManager.GetRoutineStepsByRoutine(newRoutine));
                    PopulatePage();
                }
                catch (Exception)
                {
                    MessageBox.Show("Routine could not be reactivated.");
                }
                break;

            default:
                break;
            }
        }
Beispiel #4
0
        public RoutinesPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new RoutineVM();

            if (viewModel.Routines.Count == 0)
            {
                viewModel.IsBusy = true;
            }
        }
Beispiel #5
0
 /// <summary>
 /// William Clark
 /// Created: 2021/02/24
 ///
 /// Constructs an CompleteRoutine
 /// </summary>
 ///
 /// <remarks>
 /// </remarks>
 ///
 /// <param name="routineManager">The RoutineManager Reference</param>
 /// <param name="routine">The Routine to be completed</param>
 /// <param name="user">The UserAccount which will complete the Routine</param>
 public CompleteRoutine(IRoutineManager routineManager, Routine routine, UserAccount user)
 {
     this._routineManager = routineManager;
     this._user           = user;
     try
     {
         this._routine = new RoutineVM(routine, _routineManager.GetRoutineStepsByRoutine(routine));
     }
     catch (Exception)
     {
         MessageBox.Show("The Routine steps could not be loaded.");
     }
     _currentRoutineStep = 0;
     InitializeComponent();
 }