public async Task EmailsService_SendEmail_Test()
        {
            var emailService = new EmailsService(
                Options.Create(new EmailConfiguration
            {
                DefaultSender = "*****@*****.**"
            }));

            await Assert.ThrowsAsync <ArgumentNullException>
                (async() => await emailService.SendEmail(null, CancellationToken.None));
        }
示例#2
0
        public ActionResult Enviaremail(EmailModel model)
        {
            using (var usuariosService = FService.Instance.GetService(typeof(UsuariosModel), ContextService))
            {
                var emailConfiguration = usuariosService.get(ContextService.Id.ToString()) as UsuariosModel;

                //emailConfiguration.Usuariomail = "*****@*****.**";
                //emailConfiguration.Passwordmail = "Fr56QdKLv3f";
                //emailConfiguration.Nombre = "Marfil Team";
                //emailConfiguration.Email = "*****@*****.**";
                //emailConfiguration.Smtp = "smtp.totware.com";
                //emailConfiguration.Puerto = 587;

                if (emailConfiguration.IsValidEmailConfiguration)
                {
                    var emailService = new EmailsService(ContextService);
                    var errorEnvio   = string.Empty;
                    emailService.EnviarEmail(string.Format("{0};{1}", model.Destinatario, model.DestinatarioCc)
                                             , model.DestinatarioBcc
                                             , emailConfiguration.Nombre
                                             , emailConfiguration.Email       //Remitente
                                             , emailConfiguration.Usuariomail //
                                             , emailConfiguration.Passwordmail
                                             , emailConfiguration.Smtp
                                             , emailConfiguration.Puerto.Value
                                             , model.Asunto
                                             , string.Format("{0} {1}", model.Contenido, emailConfiguration.Firma)
                                             , true
                                             , null
                                             , LeerUrls(model.Ficheros)
                                             , emailConfiguration.Ssl
                                             , emailConfiguration.Copiaremitente
                                             , ref errorEnvio
                                             , model.Id
                                             , model.Tipo);

                    HttpContext.Response.StatusCode = string.IsNullOrEmpty(errorEnvio) ? (int)HttpStatusCode.OK : (int)HttpStatusCode.BadRequest;
                    return(Json(errorEnvio));
                }
                HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json("Configuracion de email incorrecta"));
            }
        }
示例#3
0
        // GET: api/Supercuentas/5


        // GET: api/Supercuentas/5
        public HttpResponseMessage Get()
        {
            var emailService = new EmailsService(ContextService);
            var nvc          = HttpUtility.ParseQueryString(Request.RequestUri.Query);
            var email        = nvc["email"];
            var usuario      = nvc["usuario"];
            var password     = nvc["password"];
            var smtp         = nvc["smtp"];
            var puerto       = Funciones.Qint(nvc["puerto"]) ?? 0;
            var ssl          = Funciones.Qbool(nvc["ssl"]);
            var nombre       = nvc["nombre"];
            var asunto       = General.AsuntoEmailTest;
            var cuerpo       = string.Format(General.CuerpoEmailTest, DateTime.Now.ToString(CultureInfo.InvariantCulture));
            var mierror      = "";

            emailService.EnviarEmail(email, "", nombre, email, usuario, password, smtp, puerto, asunto, cuerpo, true, null, null, ssl, null, ref mierror, 0, 0);

            var response = string.IsNullOrEmpty(mierror) ?  Request.CreateResponse(HttpStatusCode.OK): Request.CreateResponse(HttpStatusCode.InternalServerError);

            response.Content = new StringContent(mierror, Encoding.UTF8,
                                                 "application/json");
            return(response);
        }
示例#4
0
        public static void Main(string[] args)
        {
            using (HealthDbContext db = new HealthDbContext())
            {
                //db.Database.EnsureDeleted();
                //db.Database.EnsureCreated();

                db.Database.Migrate();

                //Seed seed = new Seed();
                //seed.SeedDataBase(db);

                IBloodsService           bloodsService                = new BloodsService(db);
                IAddressesService        addressesService             = new AddressesService(db);
                IPhonesService           phonesService                = new PhonesService(db);
                IEmailsService           emailsService                = new EmailsService(db);
                IRelativesService        relativesService             = new RelativesService(db, addressesService, phonesService, emailsService);
                IDoctorsService          doctorsService               = new DoctorsService(db, addressesService, phonesService, emailsService);
                IPersonsService          personsService               = new PersonsService(db, addressesService, phonesService, emailsService, relativesService);
                IVaccinesService         vaccinesService              = new VaccinesService(db);
                IAllergiesService        allergiesService             = new AllergiesService(db);
                IChronicDiseasesService  chronicDiseasesService       = new ChronicDiseasesService(db);
                IPersonDiseasesService   personVaccinesService        = new PersonVaccinesService(db, vaccinesService);
                IPersonDiseasesService   personAlleriesService        = new PersonAllergiesService(db, allergiesService);
                IPersonDiseasesService   personChronicDiseasesService = new PersonChronicDiseasesService(db, chronicDiseasesService);
                IMedicinesService        medicinesService             = new MedicinesService(db);
                IPrescriptionsService    prescriptionsService         = new PrescriptionsService(db, medicinesService);
                IReferralsService        referralsService             = new ReferralsService(db);
                ITreatmentsService       treatmentsService            = new TreatmentsService(db);
                IExaminationsService     examinationsService          = new ExaminationsService(db);
                IHospitalizationsService hospitalizationsService      = new HospitalizationsService(db, examinationsService, treatmentsService);



                #region
                //examinationsService.Add(new ExaminationInputModel()
                //{
                //    Date = "21.09.2019",
                //    Diagnosis = "very sick man",
                //    DoctorId = "bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    PersonId = "9c591451-96e6-4dff-a225-32f092c7b56d",

                //});


                //prescriptionsService.Add("565d1e5a-68df-45ab-8fea-e9d914fc891f");

                //prescriptionsService.AddMedicine("7db87d46-6d71-4355-a482-95e2bf726465",
                //    new MedicineInputModel()
                //    {
                //        Name = "Mesalazin Unipharm",
                //        DaylyDoze = "250mg"
                //    });

                //examinationsService.AddPrescription("565d1e5a-68df-45ab-8fea-e9d914fc891f", "7db87d46-6d71-4355-a482-95e2bf726465");

                //string referralId = referralsService.Add(new ReferralInputModel()
                //                                    {
                //                                        ExaminationId = "565d1e5a-68df-45ab-8fea-e9d914fc891f",
                //                                        Specialty = "Cardiologist"
                //                                    });

                //examinationsService.AddReferral("565d1e5a-68df-45ab-8fea-e9d914fc891f", referralId);

                //hospitalizationsService.AddExamination("22a65132-1949-4e13-bbbc-35201429d0fb", "565d1e5a-68df-45ab-8fea-e9d914fc891f");
                //hospitalizationsService.AddTreatment("22a65132-1949-4e13-bbbc-35201429d0fb", "44f6112f-542a-4eaf-a0b9-5685441f3937");


                //hospitalizationsService.Add(new HospitalizationInputModel()
                //{
                //    EnterDate = "20.08.2019",
                //    DischargeDate = "25.08.2019",
                //    HospitalId = 1,
                //    PersonId = "9c591451-96e6-4dff-a225-32f092c7b56d"
                //});

                //hospitalizationsService.Add(new HospitalizationInputModel()
                //{
                //    EnterDate = "20.09.2019",
                //    HospitalId = 1,
                //    PersonId = "9c591451-96e6-4dff-a225-32f092c7b56d"
                //});


                //treatmentsService.Add(new TreatmentInputModel()
                //{
                //    Description = "knee surgery...",
                //    Date = "21.09.2019",
                //    DoctorId = "bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    HospitalizationId = "22a65132-1949-4e13-bbbc-35201429d0fb"
                //});

                //doctorsService.Add(new DoctorInputModel()
                //{
                //    FirstName = "Boiko",
                //    LastName = "Penkov",
                //    HospitalId = 1,
                //    Specialty = "Cardiologist",
                //    Address = new AddressInputModel()
                //    {
                //        Town = "Sofia",
                //        Street = "ul. Alen Mak 1"
                //    },
                //    Phone = new PhoneInputModel()
                //    {
                //        PhoneNumber = "0888989898"
                //    },
                //    Email = new EmailAddressInputModel()
                //    {
                //        Email = "*****@*****.**"
                //    },
                //});



                //personChronicDiseasesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Parkinson disease",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //personChronicDiseasesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Parkinson disease new",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //personAlleriesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Wheat[26]",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //personAlleriesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Wheat[26] (1)",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //personVaccinesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Strontium chloride",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //personVaccinesService.AddPersonDiseaseInfo("bedfa8a0-46d7-4369-8f85-fe3b1be57095",
                //    "9c591451-96e6-4dff-a225-32f092c7b56d", new PersonDiseaseInfoInputModel()
                //    {
                //        Name = "Strontium chloride new",
                //        DiagnosedOn = "13.10.1973"
                //    });

                //PersonInputModel personInputModel = new PersonInputModel()
                //{
                //    FirstName = "Kamen",
                //    MiddleName = "Dimitrov",
                //    LastName = "Pankov",
                //    PersonalNumber = "7310136488",
                //    BloodId = bloodsService.GetBloodId(BloodType.A, RhD.Negative),
                //    HasHealthInsurance = true,
                //    Address = new AddressInputModel()
                //    {
                //        Town = "Sofia",
                //        Street = "Lerin 45"
                //    }
                //};

                //personsService.Add(personInputModel);

                //Person person = personsService.GetPerson("9c591451-96e6-4dff-a225-32f092c7b56d");

                //personsService.AddPhone("9c591451-96e6-4dff-a225-32f092c7b56d", new PhoneInputModel()
                //{
                //    PhoneNumber = "0888086820"
                //});

                //personsService.AddEmail("9c591451-96e6-4dff-a225-32f092c7b56d", new EmailAddressInputModel()
                //{
                //    Email = "*****@*****.**"
                //});

                //personsService.AddRelative("9c591451-96e6-4dff-a225-32f092c7b56d",
                //    new RelativeInputModel()
                //    {
                //        FirstName = "Desi",
                //        MiddleName = "Svetlozarova",
                //        LastName = "Velkovska",
                //        Address = new AddressInputModel()
                //        {
                //            Town = "Sofia",
                //            Street = "ul. Dobrudjanski krai 1"
                //        },
                //        Phone = new PhoneInputModel()
                //        {
                //            PhoneNumber = "0888127876"
                //        },
                //        Email = new EmailAddressInputModel()
                //        {
                //            Email = "*****@*****.**"
                //        },
                //        RelativeType = "spouse"
                //    });


                #endregion
            }
        }
示例#5
0
 public EmailsController()
 {
     EmailsService = new EmailsService(UnitOfWork);
 }
示例#6
0
 public AuthController(IConfiguration configuration, UserManager <User> userManager, EmailsService emailsService)
 {
     this.configuration = configuration;
     this.userManager   = userManager;
     this.emailsService = emailsService;
 }
示例#7
0
 public EmailController(EmailsService emailsService)
 {
     _emailsService = emailsService;
 }
示例#8
0
 public EmailsController(IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     EmailService = new EmailsService(UnitOfWork);
 }