using SteamWare; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Data { public class utils { /// /// Effettua invio notifica (email e quando disponibile tramite notifica browser) /// /// /// /// /// /// 1 = email | 2 = webPush | 3 = email + webPush /// public static bool inviaEmail(string mittente, string destinatario, string oggetto, string corpo, int tipoNotifica) { bool answ = false; // se in modalità debug --> email solo a destinatario _debugEmail #if DEBUG string newEmail = memLayer.ML.CRS("_debugEmail"); //loggo sostituzione... logger.lg.scriviLog(string.Format("Applicazione in DEBUG: sostituzione email destinatario {0} --> {1} prima dell'invio", destinatario, newEmail), tipoLog.INFO); destinatario = memLayer.ML.CRS("_debugEmail"); #endif // se richeisto webPush... if (tipoNotifica == 2 || tipoNotifica == 3) { sendPushNotification(); answ = true; } if (tipoNotifica == 1 || tipoNotifica == 3) { gestEmail.geAuth.mandaEmail(mittente, destinatario, oggetto, corpo); answ = true; } return answ; } /// /// Gestione invio push notifications /// private static void sendPushNotification() { // da fare... sottoscrizione canale?!? } /// /// Ripulisce le note per display /// /// /// public static string parseNote(object original) { string answ = original.ToString(); // fix a capo.. answ = answ.Replace("\n", @"
"); // fix linee... answ = answ.Replace("---", @"
"); // fix bold... answ = answ.Replace("[[", @"").Replace("]]", @""); return answ; } } }