Ejemplo n.º 1
0
        public async Task <IActionResult> MembresCote(SendCotesReportViewModel sendCotesReportViewModel)
        {
            if (ModelState.IsValid)
            {
                // Créer et envoyer rapport PDF:
                RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
                // Chercher l'admin courriel
                var userManager = _serviceProvider.GetRequiredService <UserManager <ApplicationUser> >();
                var userName    = await userManager.FindByNameAsync(User.Identity.Name);

                // envoyer rapport
                rapportsClass.rapport4(userName.Email, sendCotesReportViewModel);

                return(RedirectToAction(nameof(MembresCote)));
            }

            ViewBag.Months = new SelectList(Enumerable.Range(1, 12).Select(x =>
                                                                           new SelectListItem()
            {
                Text  = CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedMonthNames[x - 1] + " (" + x + ")",
                Value = x.ToString()
            }), "Value", "Text");

            ViewBag.Years = new SelectList(Enumerable.Range(DateTime.Today.Year - 5, 6).Select(x =>
                                                                                               new SelectListItem()
            {
                Text  = x.ToString(),
                Value = x.ToString()
            }), "Value", "Text");
            return(View(sendCotesReportViewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> rap5Mt()
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);

            // envoyer rapport
            rapportsClass.rapport5(DateTime.Now.Year, "*****@*****.**");
            TempData["message"] = "Rapport est envoyé";
            return(RedirectToAction("Index", "Admin"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> rap3Mt()
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);

            // envoyer rapport
            //rapportsClass.rapport3();
            TempData["message"] = "Rapport est envoyé";
            return(RedirectToAction("Index", "Admin"));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> rapSettings(RapViewModel rap)
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
            int           an            = DateTime.Now.Year;
            DateTime      s             = DateTime.Now.AddMinutes(1);
            string        emilAdmin     = "*****@*****.**";

            if (rap.rap1 == true)
            {
                RecurringJob.AddOrUpdate("rap1Job", () => this.rapport1(), "0 0 1 1-12 *");
            }
            else
            {
            }

            if (rap.rap2 == true)
            {
                RecurringJob.AddOrUpdate("rap2Job", () => this.rapport2(), "0 0 1 1-12 *");
            }
            else
            {
            }

            if (rap.rap3 == true)
            {
                RecurringJob.AddOrUpdate("rap3Job", () => this.rapport3(), "0 0 1 1-12 *");
            }
            else
            {
            }

            if (rap.rap4 == true)
            {
                RecurringJob.AddOrUpdate("rap4Job", () => this.rapport4(), "0 0 1 1-12 *");
            }
            else
            {
            }

            if (rap.rap5 == true)
            {
                RecurringJob.AddOrUpdate("rap5Job", () => this.rapport5(), "59 23 31 12 *");
            }
            else
            {
                RecurringJob.RemoveIfExists("rap5Job");
            }
            TempData["message"] = "votre configuration est sauvegardée";
            return(RedirectToAction("Index", "Admin"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Ventes(SendVentesReportViewModel sendVentesReportViewModel)
        {
            if (ModelState.IsValid)
            {
                // Créer et envoyer rapport PDF:
                RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
                // Chercher l'admin courriel
                var userManager = _serviceProvider.GetRequiredService <UserManager <ApplicationUser> >();
                var userName    = await userManager.FindByNameAsync(User.Identity.Name);

                // envoyer rapport
                rapportsClass.rapport5(sendVentesReportViewModel.Year,
                                       userName.Email);

                return(RedirectToAction(nameof(Ventes)));
            }

            ViewBag.Years = new List <int> {
                2018
            };
            return(View(sendVentesReportViewModel));
        }
Ejemplo n.º 6
0
        public void rapport5()
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);

            rapportsClass.rapport5(2018, "*****@*****.**");
        }
Ejemplo n.º 7
0
 public void rapport4()
 {
     RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
     // rapportsClass.rapport4("*****@*****.**", SendCotesReportViewModel sendCotesReportViewModel);
 }
Ejemplo n.º 8
0
 public void rapport3()
 {
     RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
     // rapportsClass.rapport3();
 }