コード例 #1
0
        /// <summary>
        /// Action lors du clic sur l'étiquette "viewWorkReport" et de sa remontée.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbl_viewWorkReport_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            List <string>[] workTimetableInformations       = InterimDatabase.GetTemporaryWorkReport(Profile.TemporaryID);
            bool            isCorrectWorkReportInformations = (workTimetableInformations != null);

            // Vérifie le contenu du tableau.
            if (isCorrectWorkReportInformations)
            {
                string employmentagencyID          = InterimDatabase.GetEmploymentAgencyID(Profile.TemporaryID);
                bool   isCorrectEmploymentAgencyID = (!string.IsNullOrEmpty(employmentagencyID));

                // Vérifie le contenu de la chaîne de caractères.
                if (isCorrectEmploymentAgencyID)
                {
                    workTimetableInformations[5] = WorkReportInformations(employmentagencyID);

                    // Vérifie l'existence du chemin d'accès au dossier.
                    if (!Directory.Exists(workTimetableInformations[5][15]))
                    {
                        System.IO.Directory.CreateDirectory(workTimetableInformations[5][15]);
                    }

                    // Vérifie l'existence du chemin d'accès au fichier.
                    if (!File.Exists(workTimetableInformations[5][16]))
                    {
                        workTimetableInformations[5].Add(Profile.CreateWorkReport(workTimetableInformations));

                        // Vérifie le contenu de la liste et l'enregistrement du rapport de travail.
                        if (Profile.IsNullList(workTimetableInformations[5]) || (!Profile.SaveWorkReport(workTimetableInformations[5])))
                        {
                            // Affiche un message d'erreur.
                            MessageBox.Show(Profile_Val.Default.NullWorkReport, Profile_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }

                    // Essaye d'ouvrir le rapport de travail.
                    Profile.TryOpenFile(workTimetableInformations[5][16]);
                }
                else
                {
                    // Affiche un message d'erreur.
                    MessageBox.Show(Profile_Val.Default.NullEmploymentAgencyID, Profile_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                // Affiche un message d'erreur.
                MessageBox.Show(Profile_Val.Default.NullWorkReportInformations, Profile_Val.Default.InformationTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }