Esempio n. 1
0
        public ActionResult CreateProject([Bind(Include = "id_projet,nom,description")] projet projet)
        {
            HomePageViewModel model = new HomePageViewModel();

            if (ModelState.IsValid)
            {
                page homePage = new page
                {
                    titre  = "HomePage",
                    numero = 0
                };

                projet.pages.Add(homePage);
                db.projets.Add(projet);

                db.SaveChanges();

                model                   = createDefaultHomeViewModel();
                model.validation        = true;
                model.validationMessage = "Projet crée avec succès";

                return(View("Index", model));
            }

            model          = createDefaultHomeViewModel();
            model.projet   = projet;
            model.creation = true;

            return(View("Index", model));
        }
Esempio n. 2
0
        public ActionResult DeleteProjectConfirmed(int?id)
        {
            HomePageViewModel model = new HomePageViewModel();

            if (id != null)
            {
                projet projet = db.projets.Find(id);

                projet.pages.ToList().ForEach(x => x.sections.ToList().ForEach(y => y.sous_section.ToList().ForEach(z => db.sous_section.Remove(z))));
                projet.pages.ToList().ForEach(x => x.sections.ToList().ForEach(y => db.sections.Remove(y)));
                projet.pages.ToList().ForEach(x => db.pages.Remove(x));
                db.projets.Remove(projet);

                db.SaveChanges();

                model                   = createDefaultHomeViewModel();
                model.validation        = true;
                model.validationMessage = "Projet supprimé avec succès";
            }
            else
            {
                model                   = createDefaultHomeViewModel();
                model.validation        = false;
                model.validationMessage = "Echec de la suppression du projet";
            }


            return(View("Index", model));
        }
Esempio n. 3
0
        public ActionResult Avancement(int id)
        {
            // int pourcentageRestante;

            //   NewOrder ord = spno.GetById(id);
            projet ord = sc.GetById(id);

            List <activity> ordd1 = ac.GetMany(x => x.projet_id == id).ToList();

            foreach (var a in ordd1)
            {
                //   a.product = spp.GetById(a.Productid);
            }
            ViewBag.total           = ordd1.Sum(x => + x.NombreHeuresEstimer);
            ord.NombreHeuresEstimer = ordd1.Sum(x => + x.NombreHeuresEstimer);
            ViewBag.ordd            = ordd1;


            // nb tr

            ViewBag.total2             = ordd1.Sum(x => + x.NombreHeuresTravailler);
            ord.NombreHeuresTravailler = ordd1.Sum(x => + x.NombreHeuresTravailler);
            ViewBag.ordd = ordd1;

            // nb retard

            /* ViewBag.total3 = ordd1.Sum(y=>ordd1.Sum(x => +x.NombreHeuresTravailler) - ordd1.Sum(x => +x.NombreHeuresTravailler));
             * ord.NombreHeuresEnRetard = ordd1.Sum(y => ordd1.Sum(x => +x.NombreHeuresTravailler) - ordd1.Sum(x => +x.NombreHeuresTravailler));
             * ViewBag.ordd = ordd1;
             */



            if ((ViewBag.total2 - ViewBag.total) > 0)
            {
                ord.NombreHeuresEnRetard = ViewBag.total2 - ViewBag.total;
            }
            else
            {
                ord.NombreHeuresEnRetard = 0;
            }

            ViewBag.ordd = ordd1;

            // ord.NombreHeuresEnRetard = ViewBag.total2 - ViewBag.total;

            //  ord.NombreHeuresEstimer = sc.Update(ord.NombreHeuresEstimer= ViewBag.total);
            // pourcentage projets



            //  pourcentageRestante = ord.NombreHeuresEstimer - (ord.NombreHeuresTravailler);

            // affectation


            ViewBag.nbAct = ordd1.Count;
            return(View(ord));
        }
Esempio n. 4
0
        // GET: Project/Delete/5
        public ActionResult Delete(int id)
        {
            projet c = sc.GetById(id);

            sc.Delete(c);
            sc.Commit();
            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
 public ActionResult ModifierProjet(projet projet)
 {
     if (!ModelState.IsValid)
     {
         return(View(projet));
     }
     dalCProj.ModifierProjet(projet.id_projet, projet.libelle, projet.description, projet.type_du_projet, projet.montant_attendu, projet.date_debut, projet.date_butoir);
     return(RedirectToAction("Index"));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "id_projet,nom,description")] projet projet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(projet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(projet));
 }
Esempio n. 7
0
        public ActionResult Create(projet p)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:8080");
            client.PostAsJsonAsync <projet>("Piadvy-web/api/new", p).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
            context.projets.Add(p);
            Console.WriteLine(p);
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            projet projet = db.projets.Find(id);

            projet.pages.ToList().ForEach(x => x.sections.ToList().ForEach(y => y.sous_section.ToList().ForEach(z => db.sous_section.Remove(z))));
            projet.pages.ToList().ForEach(x => x.sections.ToList().ForEach(y => db.sections.Remove(y)));
            projet.pages.ToList().ForEach(x => db.pages.Remove(x));
            db.projets.Remove(projet);

            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 9
0
        // GET: projets/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            projet projet = db.projets.Find(id);

            if (projet == null)
            {
                return(HttpNotFound());
            }
            return(View(projet));
        }
Esempio n. 10
0
 //Get: ModifierProjet
 public ActionResult ModifierProjet(int?id_projet)
 {
     if (id_projet.HasValue)
     {
         projet projet = dalCProj.ObtenirTousLesProjets().FirstOrDefault(p => p.id_projet == id_projet.Value);
         if (projet == null)
         {
             return(View("Error"));
         }
         return(View(projet));
     }
     else
     {
         return(HttpNotFound());
     }
 }
Esempio n. 11
0
        public ActionResult Create(projetm collection)
        {
            projet c = new projet();


            c.id          = collection.id;
            c.nom         = collection.nom;
            c.description = collection.description;
            c.mailClient  = collection.mailClient;



            sc.Add(c);
            sc.Commit();
            //   return View();
            return(RedirectToAction("Index"));
        }
Esempio n. 12
0
        public ActionResult EditProject(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            projet projet = db.projets.Find(id);

            if (projet == null)
            {
                return(HttpNotFound());
            }

            HomePageViewModel model = createDefaultHomeViewModel();

            model.projetToEdit = projet;

            return(View("Index", model));
        }
Esempio n. 13
0
        public ActionResult EditProjectConfirmed([Bind(Include = "id_projet,nom,description")] projet projetToEdit)
        {
            HomePageViewModel model = new HomePageViewModel();

            if (ModelState.IsValid)
            {
                db.Entry(projetToEdit).State = EntityState.Modified;
                db.SaveChanges();

                model                   = createDefaultHomeViewModel();
                model.validation        = true;
                model.validationMessage = "Projet édité avec succès";

                return(View("Index", model));
            }

            model = createDefaultHomeViewModel();
            model.projetToEdit = projetToEdit;

            return(View("Index", model));
        }
Esempio n. 14
0
        public ActionResult Edit(int id, projetm ord)
        {
            List <activity> ordd1 = ac.GetMany(x => x.projet_id == id).ToList();

            ViewBag.total = ordd1.Sum(x => + x.NombreHeuresEstimer);
            //ord.NombreHeuresEstimer = ordd1.Sum(x => +x.NombreHeuresEstimer);
            // ViewBag.ordd = ordd1;
            ViewBag.total2 = ordd1.Sum(x => + x.NombreHeuresTravailler);

            try
            {
                projet order = sc.GetById(id);
                order.nom                    = ord.nom;
                order.description            = ord.description;
                order.mailClient             = ord.mailClient;
                order.NombreHeuresEstimer    = ViewBag.total;
                order.NombreHeuresTravailler = ViewBag.total2;


                if ((ViewBag.total2 - ViewBag.total) > 0)
                {
                    order.NombreHeuresEnRetard = ViewBag.total2 - ViewBag.total;
                }
                else
                {
                    order.NombreHeuresEnRetard = 0;
                }
                sc.Update(order);
                sc.Commit();


                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 15
0
        public ActionResult CreationProjet(projet projet)
        {
            get_type_projets();
            if (dalCProj.ProjetExiste(projet.libelle))
            {
                ModelState.AddModelError("libelle", "Ce projet existe déjà ! Veuillez modifier le titre de votre projet");
                return(View(projet));
            }
            if (projet.type_du_projet == null)
            {
                ModelState.AddModelError("type_du_projet", "Séléctionnez un type valable");
                return(View(projet));
            }
            //   return View(projet);
            if (!ModelState.IsValid)
            {
                return(View(projet));
            }

            int projid = dalCProj.CreerProjet(projet.libelle, projet.description, projet.type_du_projet,
                                              projet.montant_attendu, (DateTime)projet.date_debut, (DateTime)projet.date_butoir, HttpContext.User.Identity.Name);

            return(RedirectToAction("Index", "Media", new { id = projid }));
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            Console.WriteLine("Start parsing....");

            string filename = @"..\..\..\Files\Monsieur et Madame TROCHARD Gilles et Antoinette - Nouvelle étude.xml";

            System.IO.StreamReader str   = new System.IO.StreamReader(filename);
            XmlRootAttribute       xRoot = new XmlRootAttribute();

            xRoot.ElementName = "projet";

            System.Xml.Serialization.XmlSerializer xSerializer = new System.Xml.Serialization.XmlSerializer(typeof(projet), xRoot);
            projet res = (projet)xSerializer.Deserialize(str);

            //foreach (ResultSetResult r in res)
            //{
            //    Console.WriteLine(r.Title);
            //    Console.WriteLine(r.Summary);
            //    Console.WriteLine();
            //}
            //str.Close();

            Console.ReadLine();
        }
        // GET: Media
        public ActionResult Index(int?id, string err)
        {
            if (id.HasValue)
            {
                // recuperation infos sur projer
                projet monprojet = dalCProj.get_Projet(id.Value);
                if (monprojet == null)
                {
                    return(View("Erreur"));
                }

                ViewBag.monprojet = monprojet;

                // Recuperation infos sur Medias principal
                ViewBag.monmedia = dalCProj.GetId_Media(id.Value);

                // recuperation des autres images projets
                ViewBag.image2 = dalCProj.GetId_Media_all(id.Value, "image_2");
                ViewBag.image3 = dalCProj.GetId_Media_all(id.Value, "image_3");
                ViewBag.image4 = dalCProj.GetId_Media_all(id.Value, "image_4");

                // message d'erreur
                string libsel   = "principale";
                string msgLibel = "";
                string msgfile  = "";
                if (err != null)
                {
                    if (err == "err1")
                    {
                        msgLibel = "Séléctionnez un libelle valide";
                        libsel   = null;
                    }
                    else if (err.Substring(0, 4) == "errl")
                    {
                        string zonerr = err.Substring(4);

                        msgLibel = "Il y a déjà une image pour le libellé " + zonerr;
                        libsel   = zonerr;
                    }
                    else if (err == "errf")
                    {
                        msgfile = "Pas de fichier selectionné pour le téléchargement";
                    }
                    else if (err == "errfl")
                    {
                        msgfile = "fichier selectionné trop volumineux";
                    }
                }
                ViewBag.errlibel = msgLibel;
                ViewBag.errfile  = msgfile;

                SelectList maListe = new SelectList(
                    new List <SelectListItem>
                {
                    new SelectListItem {
                        Text = "Principale", Value = "Principale"
                    },
                    new SelectListItem {
                        Text = "Image 2", Value = "Image_2"
                    },
                    new SelectListItem {
                        Text = "Image 3", Value = "Image_3"
                    },
                    new SelectListItem {
                        Text = "Image 4", Value = "Image_4"
                    },
                }, "Value", "Text");

                ViewBag.LibImage = maListe;

                // ViewBag.monId = (int)id;

                medium monMedia = new medium()
                {
                    id_media   = -1,
                    id_projet  = id.Value,
                    lien       = null,
                    media      = null,
                    type_media = "JPEG",
                    lib_image  = libsel
                };

                return(View(monMedia));
            }
            else
            {
                return(View("Erreur"));
            }
        }