Exemple #1
0
        public void DernierePrestationTest()
        {
            Dossier monDoss      = InitialiseDossier();
            String  maLastPresta = new Prestation("Libelle P5", new DateTime(2015, 9, 10, 6, 0, 0), new Intervenant("Tournier", "helene")).ToString();

            Assert.AreEqual(maLastPresta, monDoss.DernierePrestation().ToString(), "oui");
        }
        public async Task UpdatePrestation(Prestation prestationToBeUpdate, Prestation newPrestation)
        {
            try
            {
                prestationToBeUpdate.Description = newPrestation.Description;
                prestationToBeUpdate.Duration    = newPrestation.Duration;
                prestationToBeUpdate.Price       = newPrestation.Price;
                prestationToBeUpdate.Title       = newPrestation.Title;
                var spec = new IsPrestationCategoryExistSpecification(newPrestation.PrestationCategoryId.ToString());

                bool isCategoryExist = await _unitOfWork.Prestations.IsPrestationCategoryExistAsync(spec);

                if (!isCategoryExist)
                {
                    throw new CategoryDoesNotExistException();
                }

                prestationToBeUpdate.PrestationCategory = newPrestation.PrestationCategory;

                await _unitOfWork.CommitAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void CompareToTestV3()
        {
            Prestation unePrestation      = new Prestation("CC", new DateTime(2015, 9, 11, 12, 0, 0), new Intervenant("Durand", "Annie"));
            Prestation uneAutrePrestation = new Prestation("CD", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Sainz", "Olivier"));

            Assert.AreEqual(-1, uneAutrePrestation.CompareTo(unePrestation), "Le chiffre attendu est -1");
        }
        public void CompareToTestV3()
        {
            Prestation unePresta      = new Prestation("oulou", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("oulou", "oula"));
            Prestation uneautrePresta = new Prestation("oulou", new DateTime(2015, 9, 9, 12, 0, 0), new Intervenant("oulou", "oula"));

            Assert.AreEqual(1, unePresta.CompareTo(uneautrePresta), "Erreur : valeur attendue 1.");
        }
        public void CompareATestInf()
        {
            Prestation unePrestation  = new Prestation("xx", new DateTime(2015, 9, 02, 12, 0, 0), new Intervenant("Dupond", "Jean"));
            Prestation deuxPrestation = new Prestation("xx", new DateTime(2008, 9, 02, 12, 0, 0), new Intervenant("Dupond", "Jean"));

            Assert.AreEqual(1, unePrestation.CompareA(deuxPrestation), "Doit retourner 0");
        }
Exemple #6
0
        public void CompareToTest()
        {
            Prestation unePrestation  = new Prestation("XX", new DateTime(2015, 9, 10, 15, 0, 0), new Intervenant("Dupont", "Jean"));
            Prestation unePrestation2 = new Prestation("XX", new DateTime(2015, 9, 10, 17, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(0, unePrestation.CompareTo(unePrestation2), "Les dates doivent être égales");
        }
Exemple #7
0
        public void DernierePrestationTest()
        {
            Dossier    unDossier      = InitialiseDossier();
            Prestation DernierePresta = new Prestation("Libelle P5", new DateTime(2015, 9, 10, 6, 0, 0), new Intervenant("Tournier", "Hélène"));

            Assert.AreEqual(DernierePresta.ToString(), unDossier.DernierePrestation().ToString(), "Ce n'est pas la derniere prestation enregistrée dans le dossier");
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,IdFacture,Nom,Montant,Description")] Prestation prestation)
        {
            if (id != prestation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prestation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrestationExists(prestation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdFacture"] = new SelectList(_context.Factures, "Id", "Id", prestation.IdFacture);
            return(View(prestation));
        }
        public void CompareToTest()
        {
            Prestation maPresta  = new Prestation("OuiAdrienCBien", new DateTime(2015, 9, 6, 12, 0, 0), new Intervenant("Adry1", "Dairmhan"));
            Prestation maPresta2 = new Prestation("OuiAdrienCMal", new DateTime(2015, 9, 6, 12, 0, 0), new Intervenant("kantain", "Duvallundi"));

            Assert.AreEqual(0, maPresta2.CompareTo(maPresta), "Si égale : Le résultat doit être égale à 0 ");
        }
Exemple #10
0
        public async Task <IActionResult> PutPrestation(int id, Prestation prestation)
        {
            if (id != prestation.PrestationID)
            {
                return(BadRequest());
            }

            _context.Entry(prestation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PrestationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #11
0
        /// <summary>
        /// construit, à partir d'un noeud XML un objet de la classe Dossier.
        /// Avec, ses prestations et les intervenants des prestations
        /// </summary>
        /// <param name="unDossierXML">Elément XML du dossier à créer</param>
        /// <returns>Un objet de la classe Dossier</returns>
        public static Dossier XmlToDossier(XmlElement unDossierXML)
        {
            string nom    = unDossierXML.ChildNodes[0].InnerText;
            string prenom = unDossierXML.ChildNodes[1].InnerText;

            DateTime dateNaissance = TraitementXML.XmlToDateTime((XmlElement)unDossierXML.ChildNodes[2]);

            if (unDossierXML.GetElementsByTagName("dossierprestations").Count == 0)
            {
                // pas de prestations
                return(new Dossier(nom, prenom, dateNaissance));
            }
            else
            {
                // au moins une prestation
                XmlNodeList       lesPrestations          = (unDossierXML.GetElementsByTagName("dossierprestations")[0]).ChildNodes;
                List <Prestation> lesPrestationsDuDossier = new List <Prestation>();
                foreach (XmlElement unePrestationXml in lesPrestations)
                {
                    Prestation unePrestation = XmlToPrestation(unePrestationXml);
                    lesPrestationsDuDossier.Add(unePrestation);
                }
                return(new Dossier(nom, prenom, dateNaissance, lesPrestationsDuDossier));
            }
        }
        public void CompareToTestEstInferieur()
        {
            Prestation unePrestation      = new Prestation("XX", new DateTime(2015, 9, 4, 12, 0, 0), new Intervenant("Dupont", "Jean"));
            Prestation uneAutrePrestation = new Prestation("XX", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(-1, unePrestation.compareTo(uneAutrePrestation));
        }
        public void CompareToSuperieur()
        {
            Prestation unePrestation      = new Prestation("XX", new DateTime(2015, 9, 13, 12, 0, 0), new Intervenant("Dupont", "Jean"));
            Prestation uneAutrePrestation = new Prestation("XX", new DateTime(2015, 9, 12, 12, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(1, unePrestation.CompareTo(uneAutrePrestation));
        }
        public IHttpActionResult PutPrestation(int id, Prestation prestation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != prestation.Id)
            {
                return(BadRequest());
            }

            db.Entry(prestation).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PrestationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult RecapDemande(int id)
        {
            using (IDal dal = new Dal())
            {
                string name = HttpContext.User.Identity.Name;
                if (HttpContext.User.Identity.IsAuthenticated & !name.Contains("utilisateur"))
                {
                    ViewBag.Auth = true;
                }
                else
                {
                    ViewBag.Auth = false;
                }

                Prestation presta = dal.ObtientPrestation(id);
                if (name.Count() > 11)
                {
                    if (!name.Substring(11, name.Count() - 11).Equals(presta.Id.ToString()))
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }

                return(View(presta));
            }
        }
Exemple #16
0
        public void compareToTest2()
        {
            Prestation unePrestation      = new Prestation("XX", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Dupont", "Jean"));
            Prestation uneAutrePrestation = new Prestation("XX", new DateTime(2015, 11, 10, 12, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(1, unePrestation.compareTo(uneAutrePrestation), "La somme doit être égal à 1");
        }
Exemple #17
0
        public void DernierePrestationTest()
        {
            Dossier    unDossier     = InitialiseDossier();
            Prestation unePrestation = new Prestation("Libelle P3", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(unePrestation.ToString(), unDossier.DernierePrestation().ToString(), "Erreur !!!!");
        }
Exemple #18
0
        public async Task <ActionResult <Prestation> > PostPrestation(Prestation prestation)
        {
            _context.Prestations.Add(prestation);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPrestation", new { id = prestation.PrestationID }, prestation));
        }
Exemple #19
0
        public void CompareToTestV3()
        {
            Prestation unePrestation  = new Prestation("XX", new DateTime(2015, 9, 10, 15, 0, 0), new Intervenant("Dupont", "Jean"));
            Prestation unePrestation2 = new Prestation("XX", new DateTime(2016, 9, 10, 17, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(-1, unePrestation.CompareTo(unePrestation2), "La date de la 1ere presta doit être antérieure à la date de la 2eme presta");
        }
Exemple #20
0
        /// <summary>
        /// construit, à partir d'un noeud XML un objet de la classe Dossier.
        /// Avec, ses prestations et les intervenants des prestations
        /// </summary>
        /// <param name="unDossierXML">Elément XML du dossier à créer</param>
        /// <returns>Un objet de la classe Dossier</returns>
        public static Dossier XmlToDossier(XmlElement unDossierXML)
        {
            string   nom           = unDossierXML.ChildNodes[0].InnerText;
            string   prenom        = unDossierXML.ChildNodes[1].InnerText;
            DateTime dateNaissance = TraitementXML.XmlToDateTime((XmlElement)unDossierXML.ChildNodes[2]);

            if (unDossierXML.GetElementsByTagName("dossierprestations").Count == 0)
            {
                // pas de prestation
                return(new Dossier(nom, prenom, dateNaissance));
            }
            else
            {
                // au moins une prestation
                XmlNodeList       lesPrestations          = (unDossierXML.GetElementsByTagName("dossierprestations")[0]).ChildNodes;
                List <Prestation> lesPrestationsDuDossier = new List <Prestation>();
                foreach (XmlElement unePrestation in lesPrestations)
                {
                    int        idPrestation     = Convert.ToInt32(unePrestation.GetAttribute("idprestation"));
                    XmlElement unePrestationXML = CherchePrestation(idPrestation);
                    Prestation prestation       = XmlToPrestation(unePrestationXML);
                    lesPrestationsDuDossier.Add(prestation);
                }
                return(new Dossier(nom, prenom, dateNaissance, lesPrestationsDuDossier));
            }
        }
Exemple #21
0
        public static void Persist(Prestation prestation, int poleId, Dictionary <string, bool> territoires)
        {
            prestation.Pole = DAO.Find <Pole>(poleId);
            DAO.Persist(prestation);
            IEnumerable <Territoire> territoireSet = IsJoinedDictionary.ToDbSet <Territoire>(territoires);

            territoireSet.Each(t => PrestationTerritoireDAO.Join(prestation, t));
        }
        public void SommePourRienTest()
        {
            int        a        = 3;
            int        b        = 5;
            Prestation maPresta = new Prestation("XX", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Paul", "Jean"));

            Assert.AreEqual(8, maPresta.SommePourRien(a, b), "la somme doit être égale à 8.");
        }
        public void SommePourRienTest()
        {
            int        a             = 3;
            int        b             = 5;
            Prestation unePrestation = new Prestation("XX", new DateTime(2015, 9, 10, 12, 0, 0), new Intervenant("Dupont", "Jean"));

            Assert.AreEqual(9, unePrestation.SommePourRien(a, b), "La somme doit être égale à 8");
        }
 private void ListBoxPrestation_MouseDoubleClick(object sender, RoutedEventArgs e)
 {
     if (listBox_prestation.SelectedItem != null)
     {
         Prestation selectedPrestation = (Prestation)listBox_prestation.SelectedItem;
         dataGrid_Element.Items.Add(selectedPrestation);
         PrixTotal += selectedPrestation.PrixTTC;
     }
 }
        // GET: Prestations/Create
        public IActionResult Create(Guid idFacture)
        {
            var prestation = new Prestation()
            {
                IdFacture = idFacture
            };

            return(View(prestation));
        }
Exemple #26
0
 public string MailDemandePresta(int id)
 {
     try
     {
         Prestation presta  = ObtientPrestation(id);
         string     message = "Bonjour " + presta.Prenom + " " + presta.Nom + "<br/>" +
                              "Voici vos coordonnées : <br/>" +
                              "Téléphone : " + presta.Telephone + "<br/>" +
                              "Email : " + presta.Email + "<br/><br/>" +
                              "Vous êtes ";
         if (presta.Type != "Particulier")
         {
             message += "l'" + presta.Type + " " + presta.NomStructure + "<br/>";
         }
         else
         {
             message += "un " + presta.Type + "<br/>";
         }
         message += presta.Pays + ", ";
         if (presta.Pays == "France")
         {
             message += presta.CodePostal + "<br/><br/>";
         }
         else if (presta.Pays == "EtatsUnis")
         {
             message += presta.Etat + ", " + presta.VilleEU + "<br/><br/>";
         }
         else
         {
             message += presta.VilleAutre + "<br/><br/>";
         }
         message += "Vous demandez : <br/>";
         if (presta.ChoixPrestation == "representation")
         {
             message += presta.Occurence + " représentations de " + presta.TempsPresta + "minutes.<br/>" +
                        "Avec initiation : " + presta.Initiation + "<br/>" +
                        "Budget : " + presta.Budget + "€<br/><br/>";
         }
         else if (presta.ChoixPrestation == "stage")
         {
             message += "un stage de " + presta.DureeStage + " pour le " + presta.Date.ToShortDateString() + "<br/>" +
                        "Niveau : " + presta.Niveau + "<br/><br/>";
         }
         else
         {
             message += "des informations sur les cours <br/><br/>";
         }
         message += "Informations complémentaire : \n" + presta.InfoComplementaire + "<br/><br/><br/>" +
                    "Merci de votre demande, Origin's Krew";
         return(message);
     }catch (Exception e)
     {
         Utils.Logger.Log("ERROR", "Erreur génération texte du mail : " + e);
         return("ERROR");
     }
 }
        public Prestation Update(Prestation prestation, string code, DateTime date, int duration, string description)
        {
            prestation.CodeChantierId = code;
            prestation.Date           = date;
            prestation.Duration       = duration;
            prestation.Description    = description;

            _db.SaveChanges();
            return(prestation);
        }
Exemple #28
0
        public static Prestation_Territoire Join(Prestation prestation, Territoire territoire)
        {
            var join = new Prestation_Territoire()
            {
                Prestation = prestation, Territoire = territoire
            };

            DAO.Persist(join);
            return(join);
        }
Exemple #29
0
 public PrestationWithColor(Prestation prestation)
 {
     this.Id      = prestation.Id;
     this.IdManif = prestation.IdManif;
     this.NbTotal = prestation.NbTotal;
     //this.NbInscrits = prestation.NbInscrits;
     this.NbRemaining = prestation.NbRemaining;
     this.Title       = prestation.Title;
     this.NbPresents  = prestation.NbPresents;
 }
        public IHttpActionResult GetPrestation(int id)
        {
            Prestation prestation = db.Prestations.Find(id);

            if (prestation == null)
            {
                return(NotFound());
            }

            return(Ok(prestation));
        }