Ejemplo n.º 1
0
        public void RecieveMail(EmailViewmodel model)
        {
            MakeApplicationViewModel mo = new MakeApplicationViewModel();

            try
            {
                var m = new MailMessage
                {
                    Subject    = "New Applicant",
                    Body       = model.Message,
                    IsBodyHtml = true,
                    From       = new MailAddress(mo.Phone, "Applicant")
                };
                m.To.Add(model.To);

                var smtp = new SmtpClient
                {
                    Host        = "pod51014.outlook.com",
                    Credentials = new NetworkCredential("*****@*****.**", "Dut921208"),
                    EnableSsl   = true,
                    Port        = 587
                };

                smtp.Send(m);
            }
            catch
            {
                //send sms instead
            }
        }
Ejemplo n.º 2
0
 public ActionResult Apply(MakeApplicationViewModel model)
 {
     if (ModelState.IsValid)
     {
         _logic.MakeApplication(model);
         ContactMethod.SendSms(model.Phone, "Application to attend JG Zuma High was received. You will receive feedback within 15 days.");
         return(RedirectToAction("ApplicationSuccess"));
     }
     ViewBag.Gender = new SelectList(gnd.GetGenders(), dataValueField: "GenderTitle", dataTextField: "GenderTitle", selectedValue: gnd.GenderTitle);
     return(View(model));
 }
Ejemplo n.º 3
0
        public void MakeApplication(MakeApplicationViewModel viewmodel)
        {
            using (UnitOfWork.IUnitOfWork uow = new UnitOfWork.UnitOfWork())
            {
                byte[] reportcopy = new byte[viewmodel.ReportCopy.InputStream.Length];
                viewmodel.ReportCopy.InputStream.Read(reportcopy, 0, reportcopy.Length);

                var newaplication = new Application
                {
                    IDNumber       = viewmodel.IdNumber,
                    Name           = viewmodel.FirstName,
                    Surname        = viewmodel.Surname,
                    DateOfBirth    = viewmodel.DateOfBirth,
                    Gender         = viewmodel.Gender,
                    Status         = "Awaiting", Address = viewmodel.Address,
                    Phone          = viewmodel.Phone,
                    ReportCopyType = viewmodel.ReportCopy.ContentType,
                    ReportCopy     = reportcopy,
                };
                uow.Repository <Application>().Insert(newaplication);
                uow.Save();
            }
        }