/// <summary> /// Obtient les informations pour les emails d'annulation à envoyer. /// </summary> /// <param name="_avaibilityID">ID de la diponibilité</param> /// <returns>List : Réussite -> Informations de l'email. Echec -> Valeur null</returns> private static List <string> AbortEmailInformations(string _avaibilityID) { string avaibilityID = _avaibilityID; string temporaryID = InterimDatabase.GetAvaibilityTemporaryID(avaibilityID); bool isCorrectTemporaryID = (!string.IsNullOrEmpty(temporaryID)); // Vérifie le contenu de l'ID de l'intérimaire. if (isCorrectTemporaryID) { string temporaryTitle = InterimDatabase.GetTemporaryTitle(temporaryID); string temporaryName = InterimDatabase.GetTemporaryName(temporaryID); string temporaryEmailAdress = InterimDatabase.GetTemporaryEmailAdress(temporaryID); string date = InterimDatabase.GetTemporaryDate(avaibilityID); bool isCorrectTemporaryTitle = (!string.IsNullOrEmpty(temporaryTitle)); bool isCorrectTemporaryName = (!string.IsNullOrEmpty(temporaryName)); bool isCorrectEmailAdress = (!string.IsNullOrEmpty(temporaryEmailAdress)); bool isCorrectDate = (!string.IsNullOrEmpty(date)); // Vérifie le contenu des informations de l'intérimaire. if (isCorrectTemporaryTitle && isCorrectTemporaryName && isCorrectEmailAdress && isCorrectDate) { string dayName = DayName(date); string dayNumber = DayNumber(date); string month = MonthName(date); string workTimetableStart = InterimDatabase.GetTemporaryWorkTimetableStart(avaibilityID); string workTimetableEnd = InterimDatabase.GetTemporaryWorkTimetableEnd(avaibilityID); string serviceName = InterimDatabase.GetTemporaryService(avaibilityID); string sendDate = InterimDatabase.GetTemporarySendDate(avaibilityID); bool isCorrectWorkTimetableStart = (!string.IsNullOrEmpty(workTimetableStart)); bool isCorrectWorkTimetableEnd = (!string.IsNullOrEmpty(workTimetableEnd)); bool isCorrectServiceName = (!string.IsNullOrEmpty(serviceName)); bool isCorrectSendDate = (!string.IsNullOrEmpty(sendDate)); // Vérifie le contenu des informations de la mission. if (isCorrectWorkTimetableStart && isCorrectWorkTimetableEnd && isCorrectServiceName && isCorrectSendDate) { List <string> emailInformations = new List <string>(); emailInformations.Add(avaibilityID); emailInformations.Add(temporaryEmailAdress); emailInformations.Add(temporaryTitle); emailInformations.Add(temporaryName); emailInformations.Add(dayName); emailInformations.Add(dayNumber); emailInformations.Add(month); emailInformations.Add(workTimetableStart); emailInformations.Add(workTimetableEnd); emailInformations.Add(serviceName); emailInformations.Add(sendDate); return(emailInformations); } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullAvaibilityInformations, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullInformations, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullTemporaryID, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }
/// <summary> /// Obtient les informations pour l'email à envoyer. /// </summary> /// <param name="_avaibilityIDAndMessage">ID de la disponibilité et message à afficher</param> /// <returns>List : Réussite -> Informations de l'email. Echec -> Valeur null</returns> private static List <string> EmailInformations(List <string> _avaibilityIDAndMessage) { List <string> avaibilityIDAndMessage = _avaibilityIDAndMessage; string temporaryID = InterimDatabase.GetAvaibilityTemporaryID(avaibilityIDAndMessage[0]); bool isCorrectTemporaryID = (!string.IsNullOrEmpty(temporaryID)); // Vérifie le contenu de l'ID de l'intérimaire. if (isCorrectTemporaryID) { string temporaryTitle = InterimDatabase.GetTemporaryTitle(temporaryID); string temporaryName = InterimDatabase.GetTemporaryName(temporaryID); bool isCorrectTemporaryTitle = (!string.IsNullOrEmpty(temporaryTitle)); bool isCorrectTemporaryName = (!string.IsNullOrEmpty(temporaryName)); // Vérifie le contenu des informations de l'intérimaire. if (isCorrectTemporaryTitle && isCorrectTemporaryName) { string messageBox = avaibilityIDAndMessage[1] + temporaryTitle + " " + temporaryName + SentOffer_Val.Default.Ask; // Message de confirmation. DialogResult dialogResult = MessageBox.Show(messageBox, avaibilityIDAndMessage[2], MessageBoxButtons.YesNo, MessageBoxIcon.Question); // Vérifie la réponse au message de confirmation. if (dialogResult == DialogResult.Yes) { string temporaryEmailAdress = InterimDatabase.GetTemporaryEmailAdress(temporaryID); string date = InterimDatabase.GetTemporaryDate(avaibilityIDAndMessage[0]); bool isCorrectEmailAdress = (!string.IsNullOrEmpty(temporaryEmailAdress)); bool isCorrectDate = (!string.IsNullOrEmpty(date)); // Vérifie le contenu de l'adresse email. if (isCorrectEmailAdress && isCorrectDate) { string dayName = DayName(date); string dayNumber = DayNumber(date); string month = MonthName(date); string workTimetableStart = InterimDatabase.GetTemporaryWorkTimetableStart(avaibilityIDAndMessage[0]); string workTimetableEnd = InterimDatabase.GetTemporaryWorkTimetableEnd(avaibilityIDAndMessage[0]); string serviceName = InterimDatabase.GetTemporaryService(avaibilityIDAndMessage[0]); string sendDate = InterimDatabase.GetTemporarySendDate(avaibilityIDAndMessage[0]); bool isCorrectWorkTimetableStart = (!string.IsNullOrEmpty(workTimetableStart)); bool isCorrectWorkTimetableEnd = (!string.IsNullOrEmpty(workTimetableEnd)); bool isCorrectServiceName = (!string.IsNullOrEmpty(serviceName)); bool isCorrectSendDate = (!string.IsNullOrEmpty(sendDate)); // Vérifie le contenu des informations de la mission. if (isCorrectWorkTimetableStart && isCorrectWorkTimetableEnd && isCorrectServiceName && isCorrectSendDate) { List <string> emailInformations = new List <string>(); emailInformations.Add(avaibilityIDAndMessage[0]); emailInformations.Add(temporaryEmailAdress); emailInformations.Add(temporaryTitle); emailInformations.Add(temporaryName); emailInformations.Add(dayName); emailInformations.Add(dayNumber); emailInformations.Add(month); emailInformations.Add(workTimetableStart); emailInformations.Add(workTimetableEnd); emailInformations.Add(serviceName); emailInformations.Add(sendDate); return(emailInformations); } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullAvaibilityInformations, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullEmailAdressOrDate, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } return(null); } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullInformations, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } else { // Affiche un message d'erreur. MessageBox.Show(SentOffer_Val.Default.NullTemporaryID, SentOffer_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }