Ejemplo n.º 1
0
        static public int GetAuditNote(Audit audit)
        {
            int             auditnote = 0;
            List <Resultat> results   = ServiceResultat.getAuditResults(audit);

            foreach (var result in results)
            {
                auditnote += (int)result.Note;
            }
            return(auditnote);
        }
Ejemplo n.º 2
0
        static public void addPDCAToAudit(Audit audit)
        {
            var resultats = ServiceResultat.getAuditresults(audit);

            foreach (var item in resultats)
            {
                if (item.Note == 0)
                {
                    addPDCA(new PDCA {
                        resultat = item
                    });
                }
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        static public void UpdateResultats(ResultsViewModel resultvm)
        {
            using (ResultatRepository resultatrepo = new ResultatRepository())
            {
                //geeting the audit and setting it to unchanged so it wont be readded to the database that will be hell oh no no
                resultatrepo.context.Entry(resultvm.audit).State = EntityState.Unchanged;

                //geeting the themes and the points and setting it to unchanged so it wont be readded to the database that will be hell oh no no
                resultvm.themes = ServiceTheme.GetAllThemes(resultvm.audit);
                foreach (var item in resultvm.themes)
                {
                    resultatrepo.context.Entry(item).State = EntityState.Unchanged;
                }



                List <int> ResultPoints = new List <int>();
                foreach (var item in resultvm.audit.resultats)
                {
                    ResultPoints.Add(item.point.PointID);
                }
                List <Point> PointTemp1 = new List <Point>();

                //foreach (var item in ServicePoint.GetAllPoints())
                //{

                //}

                foreach (var theme in resultvm.themes)
                {
                    PointTemp1.Clear();
                    foreach (var item1 in theme.points)
                    {
                        PointTemp1.Add(item1);
                    }
                    //for (int i = 0; i < PointTemp1.Count; i++)
                    //{
                    //    if (!ResultPoints.Contains(point.PointID))
                    //    {
                    //        theme.points.Remove(point);
                    //    }
                    //}
                    foreach (var point in PointTemp1)
                    {
                        if (!ResultPoints.Contains(point.PointID))
                        {
                            theme.points.Remove(point);
                        }
                    }
                }



                //getting the results from the database and updating them
                Resultat tempresultat = null;
                int      compteur     = -1;
                foreach (var item in resultvm.themes)
                {
                    foreach (var inneritem in item.points)
                    {
                        compteur++;
                        tempresultat             = ServiceResultat.getresultatbyCriteria(resultvm.audit, item, inneritem);
                        tempresultat.audit       = resultvm.audit;
                        tempresultat.theme       = item;
                        tempresultat.point       = inneritem;
                        tempresultat.Note        = resultvm.resultats[compteur].Note;
                        tempresultat.req_comment = resultvm.resultats[compteur].req_comment;

                        resultatrepo.Update(tempresultat);
                    }
                }
                resultatrepo.Save();
            }
        }