Exemplo n.º 1
0
        /// <summary>
        /// Obtient les plages horaires de travail.
        /// </summary>
        /// <param name="_cbo_workTimetable">ComboBox</param>
        internal static void MergeWorkTimetable(ComboBox _cbo_workTimetable)
        {
            List <TimeSpan> workTimetable = InterimDatabase.GetWorkTimetable();
            bool            isCorrecyWorkTimetableList = (workTimetable != null);

            // Vérifie le contenu de la liste.
            if (isCorrecyWorkTimetableList)
            {
                List <string> mergeWorkTimetableList = new List <string>();

                for (int index = 0; index < workTimetable.Count; index += 2)
                {
                    mergeWorkTimetableList.Add(workTimetable[index].ToString().Substring(0, 5) + Home_Val.Default.BetweenTime + workTimetable[index + 1].ToString().Substring(0, 5));
                }

                // Assigne les horaires de travail et sélectionne la première.
                _cbo_workTimetable.ItemsSource  = mergeWorkTimetableList;
                _cbo_workTimetable.SelectedItem = mergeWorkTimetableList[0];
            }
            else
            {
                // Affichage d'un message d'erreur.
                MessageBox.Show(Home_Val.Default.WorkTimetableListNull, Home_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }