Exemplo n.º 1
0
        static async Task notifySubmissiontoParticipants(Audit audit)
        {
            ApplicationUser auditeuruser = ServiceUser.getUserAuditeur(audit.auditeur.AuditeurId);
            await ServiceEmail.sendEmailAsync(auditeuruser.Email, "Soumission d'audit", "la soumission de l'audit de la zone " + audit.zone.NomZone + " est terminée");


            String htmlresultbody = @"";

            htmlresultbody += @"<h2>Dernier Resultats de la Zone " + audit.zone.NomZone + "</h2>";
            List <Theme> themes = ServiceTheme.GetAllThemeswithoutdetaching(audit);
            int          compt  = -1;

            htmlresultbody += @"<table style=""width: 100%; margin: 0; float: none; text-align:left;"" class=""table"">";
            foreach (Theme item in themes)
            {
                htmlresultbody += @"<tr> <th></th> </tr> <tr> <th></th> <th>" + item.info + @"</th><th></th> <th></th> </tr> <tr> <th></th> </tr>";

                foreach (Point insideitem in item.points)
                {
                    compt++;
                    htmlresultbody += @"<tr> <th style=""width: 5%"">" + insideitem.NumPoint + @"</th> <th style=""width: 63%"">" + insideitem.NomPoint + @"</th> <th style=""width: 7%"">" + audit.resultats[compt].Note + @"</th> <th style=""width: 25%"">" + audit.resultats[compt].req_comment + @"</th> </tr>";
                }
            }
            htmlresultbody += @"</table>";//piloteuser.Email
            ApplicationUser piloteuser = ServiceUser.getUserPilote(audit.zone.PiloteZoneObli.PiloteId);
            await ServiceEmail.sendHTMLEmailAsync(piloteuser.Email, "Résultats de l'audit de votre Zone " + audit.zone.NomZone, htmlresultbody);

            if (audit.zone.PiloteZoneOpti != null)
            {
                ApplicationUser piloteuseropt = ServiceUser.getUserAuditeur(audit.zone.PiloteZoneOpti.PiloteId);
                // await ServiceEmail.sendHTMLEmailAsync(piloteuseropt.Email, "Résultats de l'audit de votre Zone " + audit.zone.NomZone, htmlresultbody);
            }
        }
Exemplo n.º 2
0
        static public int GetAudit5StarsLevel(Audit audit)
        {
            List <Theme>    themes            = ServiceTheme.GetAllThemeswithoutdetaching();
            List <Resultat> derniersresultats = ServiceResultat.getAuditresults(audit);
            int             niv = 0;

            foreach (var theme in themes)
            {
                niv++;
                if (!levelPassed(niv, theme.Passinggrade, derniersresultats, themes))
                {
                    return(niv - 1);
                }
            }
            return(5);
        }