示例#1
0
        // GET: PDCAs
        public ActionResult Index()
        {
            List <PDCA>     temp = ServicePDCA.GetPDCAByPilote(User.Identity.Name);
            ApplicationUser user = ServiceUser.getUserWD(User.Identity.Name);
            Zone            zone = ServiceZone.GetZoneBypliote(user.pilote);
            //checking if pilote already asked for a certifcation
            Semaine      semaine            = ServiceSemaine.getLastSemaineWD();
            bool         certificationasked = false;
            List <Audit> auditscertif       = semaine.audits.Where(a => a.TypeAudit.Equals("Certification")).ToList <Audit>();

            foreach (var item in auditscertif)
            {
                if (item.zone.PiloteZoneObli.PiloteId == user.pilote.PiloteId)
                {
                    certificationasked = true;
                }
                if (item.zone.PiloteZoneOpti != null)
                {
                    if (item.zone.PiloteZoneOpti.PiloteId == user.pilote.PiloteId)
                    {
                        certificationasked = true;
                    }
                }
            }
            PilotepdcaViewModel PPVM = new PilotepdcaViewModel {
                pdcas = temp, zone = zone, pilote = user.pilote, certificationasked = certificationasked
            };

            return(View(PPVM));
        }
示例#2
0
        public ActionResult Create([Bind] ZoneAddViewModel zonevm)
        {
            Zone zone = getZoneObject(zonevm);

            if (ModelState.IsValid)
            {
                Zone zonetemp = ServiceZone.GetZoneByName(zone.NomZone);

                if (zonetemp != null)
                {
                    ModelState.AddModelError("NomZone", "Cette Zone nommé " + zone.NomZone + " est deja inscrit dans la Base");
                    return(View(zone));
                }


                try
                {
                    ServiceZone.addzone(zone);
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                        }
                    }
                }
                //when successfull it delivers a full list of zones
                return(RedirectToAction("Index"));
            }

            return(View(zone));
        }
示例#3
0
        protected override string Action(JSONObject payload)
        {
            if (payload == null)
            {
                return(ToastNativeMessage.CreateErrorMessage(this.GetUri(),
                                                             this.GetTransactionId(),
                                                             false,
                                                             ToastNativeCommonErrorCode.InvalidParameter.Code,
                                                             this.GetUri() + " action not found").ToJsonString());
            }

            string projectKey  = payload["projectKey"].Value;
            string serviceZone = payload["serviceZone"].Value;

            if (string.IsNullOrEmpty(projectKey))
            {
                return(ToastNativeMessage.CreateErrorMessage(this.GetUri(),
                                                             this.GetTransactionId(),
                                                             false,
                                                             ToastNativeCommonErrorCode.InvalidParameter.Code,
                                                             "Project key does not exist").ToJsonString());
            }

            ServiceZone zone = (ServiceZone)System.Enum.Parse(typeof(ServiceZone), serviceZone, true);

            ToastInstanceLoggerSdk.Instance.NativeInstanceLogger.Initialize(zone);

            return(ToastNativeMessage.CreateSuccessMessage(this.GetUri(),
                                                           this.GetTransactionId()).ToJsonString());
        }
示例#4
0
        public ActionResult Zone(int id)
        {
            ZoneViewModel zn = new ZoneViewModel();

            zn.zone   = ServiceZone.GetZone(id);
            zn.niveau = ServiceZone.GetZone5StarsLevel(zn.zone);
            zn.Note   = ServiceZone.GetZoneNote(zn.zone);
            return(View(zn));
        }
示例#5
0
        // GET: Zones/Edit/5
        public ActionResult Edit(int id)
        {
            Zone zone = ServiceZone.GetZone(id);

            if (zone == null)
            {
                return(HttpNotFound());
            }
            return(View(zone));
        }
示例#6
0
        // GET: Suivi
        public ActionResult Index()
        {
            SuiviViewModel sv = new SuiviViewModel();

            sv.zones  = ServiceZone.GetAllZones();
            sv.appart = new List <string> {
                "UF", "ATR", "STB1", "STB2", "ENEL", "Process", "Maintenance", "Magazin"
            };
            return(View(sv));
        }
示例#7
0
        public ActionResult Zone(int?id)
        {
            if (id != null)
            {
                List <PDCA> temp = ServicePDCA.GetPDCAByZone(id.Value);

                ViewBag.NomZone = ServiceZone.GetZone(id.Value) != null?ServiceZone.GetZone(id.Value).NomZone : "Cette zone n'existe pas";

                return(View(temp));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
示例#8
0
        public ActionResult post(CommentViewModel commentvm)
        {
            commentvm.comment.user = ServiceUser.getUser(User.Identity.Name);


            commentvm.comment.zone = ServiceZone.GetZonedetached(commentvm.ZoneId);



            if (ModelState.IsValid)
            {
                ServiceComment.addComment(commentvm.comment);

                return(Redirect("/Suivi/Zone/" + commentvm.ZoneId));
            }

            return(View(commentvm.comment));
        }
示例#9
0
        public static void createReport()
        {
            List <Zone> zones = ServiceZone.GetAllZones();


            // descending order of zones  by level
            List <ZoneWithLevel> ZonesdescLevel = descStars(zones);
            string reportemailbody = "";

            if (ZonesdescLevel.Count != 0)
            {
                reportemailbody = builddescStars(reportemailbody, ZonesdescLevel);
                // descending order of zones  by Note
                List <ZoneWithNote> ZonesdescNote = descNotes(zones);
                reportemailbody = builddescNotes(reportemailbody, ZonesdescNote);
            }
            // ascending order of zones  by Progress
            List <ZoneWithProgress> ZonesascProgress = ascProgress(zones);

            if (ZonesascProgress.Count != 0)
            {
                reportemailbody = buildascProgress(reportemailbody, ZonesascProgress);
            }

            //gettin zones non auditées
            List <Audit> auditsnonaccompli = getzonesnonauditées();

            reportemailbody = buildnonauditées(reportemailbody, auditsnonaccompli);
            if (ZonesdescLevel.Count != 0)
            {
                //getting audieurs to calculate how much they gave points
                List <Auditeur> auditeurs = ServiceAuditeur.GetAllAuditeursWD();
                reportemailbody = buildauditeurpoints(reportemailbody, auditeurs);
            }

            ServiceEmail.sendHTMLEmail("*****@*****.**", "Report Five Stars", reportemailbody);
        }
        public static void Initialize(ServiceZone serviceZone)
        {
            ServiceZone = serviceZone;

            if (ServiceZone == ServiceZone.ALPHA)
            {
                CollectorUrl = GetCollectorURL(LogUrlConstants.COLLECTOR_ALPHA_URL);
            }
            else if (ServiceZone == ServiceZone.BETA)
            {
                CollectorUrl = GetCollectorURL(LogUrlConstants.COLLECTOR_BETA_URL);
            }
            else if (ServiceZone == ServiceZone.REAL)
            {
                CollectorUrl = GetCollectorURL(LogUrlConstants.COLLECTOR_REAL_URL);
            }
            else
            {
                ToastLog.Error("20003 : ServiceZone is missing!! (LoggerServiceZone is a strange value!!)");
                return;
            }

            LogTransfer.Instance.StartSender();
        }
 public void Initialize(ServiceZone serviceZone)
 {
     ToastInstanceLoggerCommonLogic.Initialize(serviceZone);
 }
示例#12
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 ");
            }
        }