Example #1
0
        //belirnen filmi mail olarak yollama
        public IResult MailSend(string email, int movieId)
        {
            try
            {
                var movie = GetMovieFromApiById(movieId);

                var genresData = JsonConvert.SerializeObject(movie.Data.genres, Formatting.None);
                var productionCompaniesData = JsonConvert.SerializeObject(movie.Data.production_companies, Formatting.None);
                var productionCountriesData = JsonConvert.SerializeObject(movie.Data.production_countries, Formatting.None);


                List <string> mailTo  = new List <string>();
                List <string> mailCC  = new List <string>();
                List <string> mailBCC = new List <string>();


                mailTo.Add(email);
                string subject = "Movie Advice";
                string body    = "<b>Adult:</b> " + movie.Data.adult + "<br></br>" + "<b>Backdrop Path</b>: " + movie.Data.backdrop_path + "<br></br>" + "<b>Budget:</b> " + movie.Data.budget + "<br></br>" + "<b>Genres:</b> " + genresData + "<br></br>" + "<b>Id:</b> " + movie.Data.id + "<br></br>" + "<b>Imdb Id:</b> " + movie.Data.imdb_id + "<br></br>" + "<b>Original Language:</b> " + movie.Data.original_language + "<br></br>" + "<b>Original Title:</b> " + movie.Data.original_title + "<br></br>" + "<b>Overview:</b> " + movie.Data.overview + "<br></br>" + "<b>Popularity:</b> " + movie.Data.popularity + "<br></br>" + "<b>Production Companies:</b> " + productionCompaniesData + "<br></br>" + "<b>Production Countries:</b> " + productionCountriesData + "<br></br>" + "<b>Release Date:</b> " + movie.Data.release_date + "<br></br>" + "<b>Status:</b> " + movie.Data.status + "<br></br>" + "<b>Title:</b> " + movie.Data.title + "<br></br>" + "<b>Vote Average:</b> " + movie.Data.vote_average + "<br></br>" + "<b>Vote Count:</b> " + movie.Data.vote_average;
                MailExtensions.MailSend(mailTo, mailCC, mailBCC, subject, body);

                return(new SuccessResult(Messages.MailSuccessful));
            }
            catch (Exception ex)
            {
                return(new ErrorResult(ex.Message));
            }
        }
Example #2
0
        public async Task <IHttpActionResult> EmailAll(EmailAllBindingModel model)
        {
            var course = await MailExtensions.GetCourseIncludes(Repo)
                         .FirstOrDefaultAsync(cp => cp.Id == model.CourseId);

            //Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(course.Department.Institution.LocaleCode);

            if (course == null)
            {
                return(NotFound());
            }
            if (course.LastDay().StartFacultyUtc < DateTime.UtcNow)
            {
                return(Ok("The course finish must be after now"));
            }

            var result = await CreateParticipantEmails.SendCourseEmail(course /*, User */, UserManager);

            DateTime now = DateTime.UtcNow;

            foreach (var cp in result.SuccessRecipients)
            {
                cp.EmailedUtc = now;
            }
            await Repo.SaveChangesAsync();

            return(Ok(new
            {
                SuccessRecipients = result.SuccessRecipients.Select(sr => sr.ParticipantId),
                FailRecipients = result.FailRecipients.Select(sr => sr.ParticipantId)
            }));
        }
Example #3
0
        public void TestCourseInvite()
        {
            Course course;

            using (var context = new MedSimDbContext())
            {
                var courseQueryable = MailExtensions.GetCourseIncludes(context);
                course = courseQueryable.AsNoTracking().First(c => c.CourseParticipants.Any(cp => cp.IsFaculty) && c.CourseParticipants.Any(cp => !cp.IsFaculty));
            }

            WriteMail(new CourseInvite {
                CourseParticipant = course.CourseParticipants.First()
            });
        }
Example #4
0
        public void Enviar(string nomeArquivo = null, RelatorioFormato?formato = null)
        {
            var arquivo    = this.GetNomeArquivo(nomeArquivo);
            var formatoExp = this.GetFormato(formato);
            var conteudo   = this.GetConteudoExportacao(formatoExp);

            File.WriteAllLines(arquivo, conteudo);

            var emailParaMail = string.Join(";", Emails.ToList().ConvertAll(e => e.Email));
            var assuntoMail   = Titulo;
            var conteudoMail  = "Exportacao de relatorio";
            var anexosMail    = new[] { arquivo };

            MailExtensions.Enviar(
                emailPara: emailParaMail,
                assunto: assuntoMail,
                conteudo: conteudoMail,
                anexos: anexosMail);
        }
Example #5
0
 public void OnReport()
 {
     MailExtensions.ReportComment(comment);
 }