Ejemplo n.º 1
0
        // GET: Auditeur
        public ActionResult Index()
        {
            List <Delegation> demandes = ServiceDelegation.getDemandesDelegation(ServiceUser.getAuditeurUser(User.Identity.Name));
            List <Delegation> offres   = ServiceDelegation.getoffresDelegation(ServiceUser.getAuditeurUser(User.Identity.Name));


            List <Auditeur> auditeurs = ServiceAuditeur.GetAllAuditeurs();// GetAllAuditeursexceptloggedin(User.Identity.Name);

            List <SelectListItem> auditeursselectlist = new List <SelectListItem>();

            foreach (var item in auditeurs.Where(a => a.AuditeurId != ServiceUser.getAuditeurUser(User.Identity.Name)).ToList())
            {
                auditeursselectlist.Add(new SelectListItem {
                    Value = item.AuditeurId.ToString(), Text = item.Nom + " " + item.Prenom
                });
            }

            List <Audit> thisweekaudits        = ServiceAudit.Getmyauditsthisweek(User.Identity.Name);
            List <Audit> lastweekmissingaudits = ServiceAudit.Getmymissedauditslastweek(User.Identity.Name);

            InterfaceAuditeurViewModel vm = new InterfaceAuditeurViewModel {
                audits = thisweekaudits, auditsderniersemaine = lastweekmissingaudits, auditeursselectlist = auditeursselectlist, offres = offres, demandes = demandes
            };

            return(View(vm));
        }
Ejemplo n.º 2
0
        // GET: Auditeur
        public ActionResult Resultats(int id)
        {
            Audit currentaudit = ServiceAudit.getAudit(id);

            ResultsViewModel resultats = new ResultsViewModel();

            resultats.audit  = currentaudit;
            resultats.themes = ServiceTheme.GetAllThemeswithoutdetaching(currentaudit);

            if (!currentaudit.isInProgress)
            {
                resultats.resultats = new List <Resultat>();
                foreach (var item in resultats.themes)
                {
                    foreach (var inneritem in item.points)
                    {
                        resultats.resultats.Add(new Resultat {
                            theme = item, point = inneritem, audit = currentaudit, Note = 0
                        });
                    }
                }
            }
            else
            {
                resultats.resultats = ServiceResultat.getAuditresults(currentaudit);
            }
            return(View(resultats));
        }
Ejemplo n.º 3
0
        public ActionResult DrawChart(int zoneid)
        {
            List <Audit> temp = ServiceAudit.getalllatestAuditsforZone(zoneid);

            List <String> lastauditdates      = new List <String>(temp.Count);
            List <String> lastlevels          = new List <String>(temp.Count);
            DateTime      workaroungtogetdate = new DateTime();

            foreach (var item in temp)
            {
                lastlevels.Insert(0, item.FiveStarsLevel.ToString());
                workaroungtogetdate = (DateTime)item.DateOfCompletion;
                lastauditdates.Insert(0, workaroungtogetdate.ToString("dd/MM/yyyy"));
            }
            var   myTheme = @"
<Chart BackColor=""#CECECE"" BackGradientStyle=""TopBottom"" BackSecondaryColor=""White"" BorderColor=""26, 59, 105"" BorderlineDashStyle=""Solid"" BorderWidth=""2"" Palette=""BrightPastel"">
   <Series>
      <series _Template_=""All"" BorderColor=""180, 26, 59, 105"" BorderWidth=""5"" CustomProperties=""LabelStyle=Outside"" IsValueShownAsLabel=""False"" />
   </Series>
   <ChartAreas>
      <ChartArea Name=""Default"" _Template_=""All"" BackColor=""64, 165, 191, 228"" BackGradientStyle=""TopBottom"" BackSecondaryColor=""White"" BorderColor=""64, 64, 64, 64"" BorderDashStyle=""Solid"" ShadowColor=""Transparent"">
         <AxisY>
            <LabelStyle Format=""{#} ★"" />
         </AxisY>
      </ChartArea>
   </ChartAreas>
   <Legends>
      <Legend _Template_=""All"" BackColor=""Transparent"" Font=""Trebuchet MS, 8.25pt, style=Bold"" IsTextAutoFit=""False"" />
   </Legends>
   <BorderSkin SkinStyle=""None"" />
</Chart>";
            Chart chart;

            if (lastlevels.Count == 1)
            {
                chart = new Chart(width: 800, height: 200, theme: myTheme)
                        .AddTitle("la courbe de tendance depuis le 1er audit 5 stars ")
                        .AddSeries(
                    chartType: "Bar",
                    //x  & yValues must be of the same type to sync properly
                    xValue: lastauditdates,
                    yValues: lastlevels)
                        .SetYAxis(max: 5);
            }
            else
            {
                chart = new Chart(width: 800, height: 200, theme: myTheme)
                        .AddTitle("la courbe de tendance depuis le 1er audit 5 stars ")
                        .AddSeries(
                    chartType: "Line",
                    //x  & yValues must be of the same type to sync properly
                    xValue: lastauditdates,
                    yValues: lastlevels)
                        .SetYAxis(max: 5);
            }



            return(File(chart.GetBytes("png"), "image/png"));
        }
Ejemplo n.º 4
0
        public ActionResult PDCAZone(int?idAudit, int?idResultat)
        {
            ResultsViewModel resultats = new ResultsViewModel();

            resultats.auditid   = idAudit.Value;
            resultats.audit     = ServiceAudit.getAudit(idAudit.Value);
            resultats.resultats = ServiceResultat.getAuditresults(resultats.audit);
            resultats.themes    = ServiceTheme.GetAllThemeswithoutdetaching(resultats.audit);
            ViewBag.idResultat  = idResultat;
            return(View(resultats));
        }
Ejemplo n.º 5
0
        // GET: Delegation
        public ActionResult demanderdelegation([Bind] DelagationViewModel vm)
        {
            Delegation delegation = new Delegation();

            delegation.Delegate       = ServiceAuditeur.GetAuditeur(vm.audit);
            delegation.Concernedaudit = ServiceAudit.getAuditdetached(vm.AuditId);
            delegation.Delegator      = ServiceAuditeur.GetAuditeur(ServiceUser.getAuditeurUser(User.Identity.Name));
            delegation.semaine        = ServiceSemaine.getCurrentSemaine();
            ServiceDelegation.addDelegation(delegation);
            return(RedirectToAction("Index", "Auditeur"));
        }
Ejemplo n.º 6
0
        public ActionResult DernierResultats(int id)
        {
            ResultsViewModel resultats = new ResultsViewModel();

            Audit currentaudit = ServiceAudit.getlatestAuditforZone(id);

            resultats.audit = currentaudit;

            resultats.themes = ServiceTheme.GetAllThemeswithoutdetaching(currentaudit);

            resultats.resultats = ServiceResultat.getAuditresults(currentaudit);

            return(View(resultats));
        }
Ejemplo n.º 7
0
        static List <ZoneWithLevel> descStars(List <Zone> zones)
        {
            Audit audit;
            List <ZoneWithLevel> ZWL = new List <ZoneWithLevel>();

            foreach (var item in zones)
            {
                audit = ServiceAudit.getlatestAuditforZone(item.ZoneId);
                if (audit != null)
                {
                    ZWL.Add(new ZoneWithLevel {
                        zone = item, level = audit.FiveStarsLevel
                    });
                }
            }
            return(ZWL.OrderByDescending(z => z.level).ToList());
        }
Ejemplo n.º 8
0
        public ActionResult DrawChart()
        {
            List <Audit> temp       = ServiceAudit.Getthisweekaudits();
            int          Pending    = temp.Where(a => !a.isInProgress && !a.isCompleted).ToList().Count;
            int          InProgress = temp.Where(a => a.isInProgress && !a.isCompleted).ToList().Count;
            int          Completed  = temp.Where(a => !a.isInProgress && a.isCompleted).ToList().Count;


            var myTheme = @"
<Chart PaletteCustomColors=""255, 50,50;255,102, 0;0, 255, 0"" BackColor=""#CECECE"" BackGradientStyle=""TopBottom"" BackSecondaryColor=""White"" BorderColor=""26, 59, 105"" BorderlineDashStyle=""Solid"" BorderWidth=""2"" Palette=""None"">
   <Series>
      <series _Template_=""All"" BorderColor=""180, 26, 59, 105"" CustomProperties=""LabelStyle=Outside"" IsValueShownAsLabel=""False"" Label=""#VALY #VALX""  />
   </Series>
   <ChartAreas>
      <ChartArea Name=""Default"" _Template_=""All"" BackColor=""64, 165, 191, 228"" BackGradientStyle=""TopBottom"" BackSecondaryColor=""White"" BorderColor=""64, 64, 64, 64"" BorderDashStyle=""Solid"" ShadowColor=""Transparent"" >
         <AxisX>
            <LabelStyle Format=""{#VALY}"" />
         </AxisX>
         <Area3DStyle
                Enable3D=""True""
                Inclination=""20""
                LightStyle=""Realistic""
                Perspective=""20""
                IsRightAngleAxes=""True""
                IsClustered=""False"" />
      </ChartArea>
   </ChartAreas>
   <Legends>
      <Legend _Template_=""All"" BackColor=""Transparent"" Font=""Trebuchet MS, 8.25pt, style=Bold"" IsTextAutoFit=""False"" />
   </Legends>
   <BorderSkin SkinStyle=""None"" />
</Chart>";

            var chart = new Chart(width: 800, height: 400, theme: myTheme)
                        .AddSeries(
                chartType: "Pie",
                xValue: new[] { "En attente", "En cours", "Terminé" },
                yValues: new[] { Pending, InProgress, Completed })
                        //.AddLegend()
                        .AddTitle("Aperçu sur l'état des audits de cette semaine");

            return(File(chart.GetBytes("png"), "image/png"));
        }
Ejemplo n.º 9
0
        static List <ZoneWithProgress> ascProgress(List <Zone> zones)
        {
            Audit latestaudit;
            Audit beforelatestaudit;
            List <ZoneWithProgress> ZWP = new List <ZoneWithProgress>();

            foreach (var item in zones)
            {
                latestaudit       = ServiceAudit.getlatestAuditforZone(item.ZoneId);
                beforelatestaudit = ServiceAudit.getbeforelatestAuditforZone(item.ZoneId);
                if (beforelatestaudit != null)
                {
                    ZWP.Add(new ZoneWithProgress {
                        zone = item, progress = latestaudit.Note - beforelatestaudit.Note
                    });
                }
            }
            return(ZWP.OrderBy(z => z.progress).ToList());
        }
Ejemplo n.º 10
0
        static List <ZoneWithNote> descNotes(List <Zone> zones)
        {
            Audit audit;
            int   pointcount        = ServicePoint.GetAllPoints().Count;
            List <ZoneWithNote> ZWN = new List <ZoneWithNote>();

            foreach (var item in zones)
            {
                audit = ServiceAudit.getlatestAuditforZone(item.ZoneId);

                if (audit != null)
                {
                    ZWN.Add(new ZoneWithNote {
                        zone = item, note = audit.Note, pointcount = pointcount
                    });
                }
            }
            return(ZWN.OrderByDescending(z => z.note).ToList());
        }
Ejemplo n.º 11
0
 // GET: Pilote
 public ActionResult demandercertification(int?id)
 {
     ServiceAudit.demanderCertification((int)id);
     return(RedirectToAction("Index", "PDCAs"));
 }
Ejemplo n.º 12
0
        // GET: Affectations
        public ActionResult Index()
        {
            List <Audit> temp = ServiceAudit.Getthisweekaudits();

            return(View(temp));
        }
Ejemplo n.º 13
0
        // GET: Auditeur
        public async Task <ActionResult> Soumettre(int id)
        {
            await ServiceAudit.updatecompletedAudit(id);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 14
0
        public void Assign()
        {
            Semaine semaineactuelle = ServiceSemaine.getLastSemaine();

            if (!semaineactuelle.isCurrent)
            {
                semaineactuelle.isCurrent = true;
                ServiceSemaine.updateSemaine(semaineactuelle);
            }
            else
            {
                //Getting this week ready this is abdallah
                semaineactuelle           = new Semaine();
                semaineactuelle.isCurrent = true;
                semaineactuelle.Datedebut = DateTime.Now;
                semaineactuelle.Datefin   = semaineactuelle.Datedebut.AddDays(6);
                ServiceSemaine.addSemaine(semaineactuelle);
            }

            List <Semaine> Allsemaines = ServiceSemaine.getAllsem();

            Allsemaines = Allsemaines.Where(s => s.SemaineId != semaineactuelle.SemaineId).ToList();
            foreach (var item in Allsemaines)
            {
                item.isCurrent = false;
                ServiceSemaine.updateSemaine(item);
            }
            //I'm going to get the number of "zones" and "auditeurs"
            //and make sure that I don't choose the same person twice
            //if there is an other zone to audit and there are auditeurs
            //that were not yet assigned to any zone
            //GG dude


            //modified by abdallah
            //PS!!!: if i forget to mention it directly always go through the services
            //see the Services folders and u will instantly get it
            //and encapsulate the repository inside a Using
            //so that the repository gets disposed of
            //thats very critical dude to get rid of the DbContext object
            //thats a nasty object man its messes every thing when it gets tangled with its own kind dude
            //They are Jhon Snows they are LONE WOLVES :p

            List <Zone> zones    = ServiceZone.GetAllZones();
            int         numZones = zones.Count;

            //same here

            List <Auditeur> auditeurs    = ServiceAuditeur.GetAllAuditeurs();
            int             numAuditeurs = auditeurs.Count;

            List <int> auditeursPris = new List <int>(numAuditeurs);

            for (int i = 0; i < numAuditeurs; i++)
            {
                auditeursPris.Add(0);
            }

            Random rand = new Random();
            int    r;
            int    numAssignments = 0;


            for (int i = 0; i < numZones; i++)
            {
                if (numAssignments == numAuditeurs)
                {
                    auditeursPris.Clear();
                    for (int j = 0; j < numAuditeurs; j++)
                    {
                        auditeursPris.Add(0);
                    }
                    numAssignments = 0;
                }
                r = rand.Next(0, numAuditeurs);
                while (auditeursPris[r] != 0 && numAssignments < numAuditeurs)
                {
                    r = rand.Next(0, numAuditeurs);
                }
                numAssignments++;
                auditeursPris[r] = 1;

                //Adding Audits. this is abdallah
                Audit audittemp = new Audit();
                audittemp.TypeAudit    = "Regulier";
                audittemp.semaine      = semaineactuelle;
                audittemp.auditeur     = auditeurs[r];
                audittemp.zone         = zones[i];
                audittemp.AuditDay     = semaineactuelle.Datedebut.AddDays(rand.Next(2, 6));
                audittemp.isInProgress = false;
                audittemp.isCompleted  = false;
                ServiceAudit.addAudit(audittemp);

                Console.WriteLine("l'auditeur " + auditeurs[r].Nom + " est affecté à la zone" + zones[i].NomZone);

                //Sending mail to Auditeur
                //ServiceEmail.sendEmail(auditeurs[r].Mail, "Information sur un prochain Audit", " La zone " + zones[i].NomZone + " sera auditée le jour J par l’auditeur " + auditeurs[r].Nom + " " + auditeurs[r].Prenom + ", merci de vous fixer l’heure de l’audit ");

                //sending mail To Audité aka pilote zone its not provided
                //ServiceEmail.sendEmail("no access to company emails", "Information sur un Audit cette semaine", " La zone " + zones[i].NomZone + " sera auditée le jour J par l’auditeur " + auditeurs[r].Nom + " " + auditeurs[r].Prenom + ", merci de vous fixer l’heure de l’audit ");
            }
        }