public ActionResult DeleteConfirmed(int id)
        {
            Technologie technologie = db.Technologies.Find(id);

            db.Technologies.Remove(technologie);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Language,Framework,Type")] Technologie technologie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(technologie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(technologie));
 }
        public ActionResult Create([Bind(Include = "ID,Language,Framework,Type")] Technologie technologie)
        {
            if (ModelState.IsValid)
            {
                db.Technologies.Add(technologie);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(technologie));
        }
        // GET: Technologies/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Technologie technologie = db.Technologies.Find(id);

            if (technologie == null)
            {
                return(HttpNotFound());
            }
            return(View(technologie));
        }
Example #5
0
        private Mandat AssemblerMandat(List <XmlDocNode> mandatNodes)
        {
            ProjetGraphRepository      projetGraphRepository      = new ProjetGraphRepository();
            FonctionGraphRepository    fonctionGraphRepository    = new FonctionGraphRepository();
            TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository();

            Mandat      mandat      = new Mandat();
            Projet      projet      = new Projet();
            Technologie technologie = null;

            int    parseInt = 0, mois, annee;
            string concatenatedString, envergureText, environnement, tech;

            string[] periode, debut, fin, splitedString, technologies;

            List <XmlDocParagraph> infoParagraphs = new List <XmlDocParagraph>(), infoParagraphsSecondColumn = new List <XmlDocParagraph>();

            XmlDocTable infoTable = (XmlDocTable)mandatNodes.First(x => x is XmlDocTable);

            infoParagraphs.AddRange(infoTable.GetParagraphsFromColumn(1));
            infoParagraphsSecondColumn.AddRange(infoTable.GetParagraphsFromColumn(2));

            for (int i = 0; i < infoParagraphs.Count; i++)
            {
                concatenatedString = string.Empty;

                if (infoParagraphs[i].GetParagraphText().Contains("Projet"))
                {
                    projet.Nom = infoParagraphsSecondColumn[i].GetParagraphText();
                }

                if (infoParagraphs[i].GetParagraphText().Contains("Mandat"))
                {
                    mandat.Numero = infoParagraphsSecondColumn[i].GetParagraphText();
                }

                if (infoParagraphs[i].GetParagraphText().Contains("Envergure"))
                {
                    envergureText = infoParagraphsSecondColumn[i].GetParagraphText().Trim();
                    if (envergureText.Any(x => char.IsDigit(x)))
                    {
                        projet.Envergure = int.Parse(string.Join("", envergureText.Where(x => char.IsDigit(x)).ToArray()));
                    }
                }


                if (infoParagraphs[i].GetParagraphText().Contains("Fonction"))
                {
                    Fonction fonction;
                    fonction = fonctionGraphRepository.CreateIfNotExists(new Dictionary <string, object> {
                        { "Description", infoParagraphsSecondColumn[i].GetParagraphText() }
                    });

                    mandat.Fonction = fonction;
                }

                if (infoParagraphs[i].GetParagraphText().Contains("Période"))
                {
                    periode = infoParagraphsSecondColumn[i].GetParagraphText().Split("à");
                    if (periode.Length > 1)
                    {
                        debut = periode[0].Trim().Split(" ").Where(x => !string.IsNullOrEmpty(x)).ToArray();
                        if (debut.Length > 1)
                        {
                            mois             = DicMois[RemoveAcentuation(debut[0].Trim().ToUpper())];
                            annee            = int.Parse(debut[1].Trim());
                            mandat.DateDebut = DateTime.Parse($"{annee}-{mois}-01");
                        }

                        if (periode[1].Contains("ce jour"))
                        {
                            mandat.DateFin = DateTime.MinValue;
                        }
                        else
                        {
                            fin = periode[1].Trim().Split(" ").Where(x => !string.IsNullOrEmpty(x)).ToArray();
                            if (fin.Length > 1)
                            {
                                mois           = DicMois[RemoveAcentuation(fin[0].Trim().ToUpper())];
                                annee          = int.Parse(fin[1].Sanitize());
                                mandat.DateFin = DateTime.Parse($"{annee}-{mois}-01");
                            }
                        }
                    }
                }

                if (infoParagraphs[i].GetParagraphText().Contains("Efforts"))
                {
                    splitedString = infoParagraphsSecondColumn[i].GetParagraphText().Split(" ");
                    parseInt      = 0;

                    if (int.TryParse(splitedString[0], out parseInt))
                    {
                        mandat.Efforts = parseInt;
                    }
                }


                if (infoParagraphs[i].GetParagraphText().Contains("Référence"))
                {
                    projet.NomReference = infoParagraphsSecondColumn[i].GetParagraphText();
                }
            }


            infoParagraphsSecondColumn.Clear();
            infoParagraphsSecondColumn = null;

            infoParagraphs.Clear();
            infoParagraphs = mandatNodes.SkipWhile(x => x is XmlDocTable).Cast <XmlDocParagraph>().ToList();

            var sections = new List <CVSection>();
            SectionsExtractor CvSectionsExtractor = new SectionsExtractor();

            List <XmlNode>   Nodes       = (List <XmlNode>)infoParagraphs.Select(x => x.OriginalNode).ToList();
            List <IXmlToken> matchTokens = new List <IXmlToken>();

            matchTokens.Add(MandatTextToken.CreateTextToken());

            try
            {
                sections = CvSectionsExtractor.GetCVSections(Nodes, matchTokens, "DESCRIPTION");

                aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "DESCRIPTION");
                AssemblerDescription(aSection, projet);
            }
            catch (Exception ex)
            {
                WriteToErrorLog(ex);
            }

            try
            {
                aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "ENVIRONNEMENT TECHNOLOGIQUE");
                AssemblerEnvironnementTecnologic(aSection, projet);
            }
            catch (Exception ex)
            {
                WriteToErrorMessageLog("Mandat" + projet.Description);
                WriteToErrorLog(ex);
            }

            try
            {
                aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "LES TÂCHES SUIVANTES");
                AssemblerTache(aSection, mandat);
            }
            catch (Exception ex)
            {
                WriteToErrorMessageLog("Mandat:  " + projet.Nom);
                WriteToErrorLog(ex);
            }

            mandat.Titre  = projet.Nom;
            mandat.Projet = projet;

            projet.DateDebut = mandat.DateDebut;
            projet.DateFin   = mandat.DateFin;

            return(mandat);
        }
Example #6
0
 public static SelectListItem ToSelectListItem(this Technologie client)
 {
     return(new SelectListItem {
         Value = client.Id.ToString(), Text = client.Nom
     });
 }