Ejemplo n.º 1
0
        public override Lettre Insert(Lettre toInsert)
        {
            Dictionary <string, object> Parameters = MapToDico(toInsert);

            base.Insert(Parameters);
            return(toInsert);
        }
Ejemplo n.º 2
0
        private Dictionary <string, object> MapToDico(Lettre toInsert)
        {
            Dictionary <string, object> p = new Dictionary <string, object>();

            p["IdMembre"]    = toInsert.IdMembre;
            p["IdEvenement"] = toInsert.IdEvenement;
            p["Contenu"]     = toInsert.Contenu;
            return(p);
        }
Ejemplo n.º 3
0
 private void MajLettreActuelle(Lettre nouvelleLettre)
 {
     if (lettreActuelle != null)
     {
         blanchirMot(lettreActuelle);
     }
     surlignerMot(nouvelleLettre);
     lettreActuelle     = nouvelleLettre;
     transform.position = lettreActuelle.Go.transform.position + Vector3.back;
 }
Ejemplo n.º 4
0
 public static void genererTlettre(ref Lettre[] Tlettre, ref string[] Tvaleur)
 {
     Tlettre = new Lettre[Tvaleur.Length];
     for (int i = 0; i < Tvaleur.Length; i++)
     {
         Tlettre[i]        = new Lettre();
         Tlettre[i].Numero = i;
         Tlettre[i].Valeur = Tvaleur[i];
     }
 }
Ejemplo n.º 5
0
 private void blanchirMot(Lettre lettre)
 {
     if (lettre.MotHorizontal != null)
     {
         foreach (Lettre l in lettre.MotHorizontal.ListeLettres)
         {
             l.GoRenderer.color = Color.white;
         }
     }
     if (lettre.MotVertical != null)
     {
         foreach (Lettre l in lettre.MotVertical.ListeLettres)
         {
             l.GoRenderer.color = Color.white;
         }
     }
 }
Ejemplo n.º 6
0
 private void surlignerMot(Lettre lettre)
 {
     if (horizontalMode)
     {
         if (lettre.MotHorizontal != null)
         {
             foreach (Lettre l in lettre.MotHorizontal.ListeLettres)
             {
                 l.GoRenderer.color = Color.cyan;
             }
         }
     }
     else
     {
         if (lettre.MotVertical != null)
         {
             foreach (Lettre l in lettre.MotVertical.ListeLettres)
             {
                 l.GoRenderer.color = Color.cyan;
             }
         }
     }
 }
Ejemplo n.º 7
0
    /// <summary>
    /// Lit le plan des cases et crée une grille
    /// </summary>
    /// <param name="gridAsString"></param>
    private void LireGridFile(string gridAsString)
    {
        List <string> eachLine = new List <string>();

        eachLine.AddRange(gridAsString.Split((new string[] { "\r\n", "\n" }), System.StringSplitOptions.None));
        nbLignes     = eachLine.Count;
        nbColonnes   = eachLine[0].Length;
        listeLettres = new Lettre[nbLignes, nbColonnes];
        for (int y = 0; y < nbLignes; y++)
        {
            for (int x = 0; x < nbColonnes; x++)
            {
                if (eachLine[y].Substring(x, 1).CompareTo("1") == 0)
                {
                    listeLettres [x, y] = new Lettre(".", x, y);
                }
                else
                {
                    listeLettres [x, y] = new Lettre(null, x, y);
                }
            }
        }
    }
Ejemplo n.º 8
0
        static void NbreCaract() // Menu 4
        {
            string Phrase;
            string Lettre;
            int    Compt = 0;

            Phrase = GetString("Entrez une phrase :");

            Lettre = GetString("Quelle lettre voulez-vous compter :");


            for (int i = 0; i < Phrase.Length; i++)
            {
                if (Lettre.IndexOf(Phrase.Substring(i, 1)) != -1)
                {
                    Compt++;
                }
            }
            Console.WriteLine("Dans {0}, il y a {1} fois {2}", Phrase, Compt, Lettre);

            //Console.WriteLine();
            //Console.WriteLine("Menu 4");
        }
Ejemplo n.º 9
0
        public override bool Update(Lettre toUpdate)
        {
            Dictionary <string, object> Parameters = MapToDico(toUpdate);

            return(base.Update(Parameters));
        }
Ejemplo n.º 10
0
 public override string ToString()
 {
     return(Lettre.ToString() + ", du noeud n°" + Origine.Numero + " vers le n°" + Destination.Numero);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Ajoute une lettre au mot courant
 /// </summary>
 /// <param name="l"></param>
 public void AjouterLettre(Lettre l)
 {
     listeLettres.Add(l);
     taille = listeLettres.Count;
 }
Ejemplo n.º 12
0
        public ActionResult ExtraireLettreAction(string numLot, string debutDate, string finDate, string agent)
        {
            using (WakilRecouvContext WakilContext = new WakilRecouvContext())
            {
                using (UnitOfWork UOW = new UnitOfWork(WakilContext))
                {
                    FormulaireService  FormulaireService  = new FormulaireService(UOW);
                    AffectationService AffectationService = new AffectationService(UOW);
                    LotService         LotService         = new LotService(UOW);
                    LettreService      lettreService      = new LettreService(UOW);
                    EmployeService     EmployeService     = new EmployeService(UOW);

                    ViewData["list"]  = new SelectList(NumLotListForDropDown(LotService), "Value", "Text");
                    ViewBag.AgentList = new SelectList(AgentListForDropDown(EmployeService), "Value", "Text");

                    string   lettreDir = GetFolderNameForLettre();
                    DateTime startDate = DateTime.Parse(debutDate);
                    DateTime endDate   = DateTime.Parse(finDate);

                    if (!Directory.Exists(lettreDir))
                    {
                        Directory.CreateDirectory(lettreDir);
                    }

                    string lettreDirList = Directory.GetDirectories(lettreDir).Length + 1 + "_" + ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds() + "";

                    string dirLettre = "";

                    if (!Directory.Exists(lettreDir + "/" + lettreDirList))
                    {
                        Directory.CreateDirectory(lettreDir + "/" + lettreDirList);
                        dirLettre = lettreDir + "/" + lettreDirList;
                    }

                    List <LettreContent> lettreJoinedList = new List <LettreContent>();

                    if (numLot == "0")
                    {
                        lettreJoinedList = (from f in FormulaireService.GetAll()
                                            join a in AffectationService.GetAll() on f.AffectationId equals a.AffectationId
                                            join l in LotService.GetAll() on a.LotId equals l.LotId
                                            where (f.TraiteLe.Date >= startDate.Date && f.TraiteLe.Date <= endDate.Date) && (f.EtatClient == Note.FAUX_NUM || f.EtatClient == Note.NRP || f.EtatClient == Note.INJOIGNABLE) && lettreIsTrue(FormulaireService, a.AffectationId)
                                            select new LettreContent
                        {
                            NumLot = l.NumLot,
                            Adresse = l.Adresse,
                            NomClient = l.NomClient,
                            Agence = l.DescIndustry,
                            Compte = l.Compte
                        }).ToList();

                        if (int.Parse(agent) != 0)
                        {
                            lettreJoinedList = (from f in FormulaireService.GetAll()
                                                join a in AffectationService.GetAll() on f.AffectationId equals a.AffectationId
                                                join l in LotService.GetAll() on a.LotId equals l.LotId
                                                where (f.TraiteLe.Date >= startDate.Date && f.TraiteLe.Date <= endDate.Date) && (f.EtatClient == Note.FAUX_NUM || f.EtatClient == Note.NRP || f.EtatClient == Note.INJOIGNABLE) && lettreIsTrue(FormulaireService, a.AffectationId) && a.EmployeId == int.Parse(agent)
                                                select new LettreContent
                            {
                                NumLot = l.NumLot,
                                Adresse = l.Adresse,
                                NomClient = l.NomClient,
                                Agence = l.DescIndustry,
                                Compte = l.Compte
                            }).ToList();
                        }
                        else
                        {
                            lettreJoinedList = (from f in FormulaireService.GetAll()
                                                join a in AffectationService.GetAll() on f.AffectationId equals a.AffectationId
                                                join l in LotService.GetAll() on a.LotId equals l.LotId
                                                where (f.TraiteLe.Date >= startDate.Date && f.TraiteLe.Date <= endDate.Date) && (f.EtatClient == Note.FAUX_NUM || f.EtatClient == Note.NRP || f.EtatClient == Note.INJOIGNABLE) && lettreIsTrue(FormulaireService, a.AffectationId)
                                                select new LettreContent
                            {
                                NumLot = l.NumLot,
                                Adresse = l.Adresse,
                                NomClient = l.NomClient,
                                Agence = l.DescIndustry,
                                Compte = l.Compte
                            }).ToList();
                        }
                    }
                    else
                    {
                        if (int.Parse(agent) != 0)
                        {
                            lettreJoinedList = (from f in FormulaireService.GetAll()
                                                join a in AffectationService.GetAll() on f.AffectationId equals a.AffectationId
                                                join l in LotService.GetAll() on a.LotId equals l.LotId
                                                where (f.TraiteLe.Date >= startDate.Date && f.TraiteLe.Date <= endDate.Date) && (f.EtatClient == Note.FAUX_NUM || f.EtatClient == Note.NRP || f.EtatClient == Note.INJOIGNABLE) && lettreIsTrue(FormulaireService, a.AffectationId) && (l.NumLot.Equals(numLot)) && a.EmployeId == int.Parse(agent)
                                                select new LettreContent
                            {
                                NumLot = l.NumLot,
                                Adresse = l.Adresse,
                                NomClient = l.NomClient,
                                Agence = l.DescIndustry,
                                Compte = l.Compte,
                                IdAgent = a.EmployeId + ""
                            }).ToList();
                        }
                        else
                        {
                            lettreJoinedList = (from f in FormulaireService.GetAll()
                                                join a in AffectationService.GetAll() on f.AffectationId equals a.AffectationId
                                                join l in LotService.GetAll() on a.LotId equals l.LotId
                                                where (f.TraiteLe.Date >= startDate.Date && f.TraiteLe.Date <= endDate.Date) && (f.EtatClient == Note.FAUX_NUM || f.EtatClient == Note.NRP || f.EtatClient == Note.INJOIGNABLE) && lettreIsTrue(FormulaireService, a.AffectationId) && (l.NumLot.Equals(numLot))
                                                select new LettreContent
                            {
                                NumLot = l.NumLot,
                                Adresse = l.Adresse,
                                NomClient = l.NomClient,
                                Agence = l.DescIndustry,
                                Compte = l.Compte,
                                IdAgent = a.EmployeId + ""
                            }).ToList();
                        }
                    }



                    int x = 0;
                    ViewBag.total = lettreJoinedList.Count();
                    foreach (LettreContent lc in lettreJoinedList)
                    {
                        string path = dirLettre + "/" + x + "_" + "lettre" + "_" + lc.Compte + ".docx";

                        if (Directory.Exists(dirLettre))
                        {
                            GenerateWordForLettre(path, lc);
                        }
                        ViewData["currClient"] = x;
                        x++;
                    }

                    string zipPath = zipFolderResult(dirLettre);

                    string adressExcelPath = Server.MapPath("~/Uploads/Lettre/0_Result/") + DateTime.Now.ToString("dd.MM.yyyy") + "_" + Path.GetFileName(dirLettre) + ".xlsx";

                    GenerateExcelForLettre(GenerateDatatableFromJoinedListForLettre(lettreJoinedList), adressExcelPath);
                    Lettre lettre = new Lettre
                    {
                        DateDeb              = startDate.Date,
                        DateFin              = endDate.Date,
                        DateExtrait          = DateTime.Now,
                        LettrePathName       = zipPath,
                        LettreAdressPathName = Path.GetFileName(adressExcelPath)
                    };

                    lettreService.Add(lettre);
                    lettreService.Commit();

                    return(RedirectToAction("Renseigner", new { page = 1 }));
                }
            }
        }