private void InformCustomer(ErpService.ShippingInfo info, Customer customer)
        {
            string mailTemplate = Repository.GetMailTemplate("ORDER");
            string mailBody     =
                String.Format(mailTemplate,
                              customer.Name,
                              info.EstimatedShippingDate);

            if (SmtpService.SendMail(customer.EmailAddress, "Order status", mailBody) == false)
            {
                throw new SmptException("Failed to send mail");
            }
        }
Exemple #2
0
        private Result <bool> HandleInformCustomer(ErpService.ShippingInfo info, Customer customer)
        {
            var result = Result <bool> .FromBool(() =>
            {
                string mailTemplate = Repository.GetMailTemplate("ORDER");
                string mailBody     =
                    String.Format(mailTemplate,
                                  customer.Name,
                                  info.EstimatedShippingDate);

                return(SmtpService.SendMail(customer.EmailAddress, "Order status", mailBody));
            });

            return(result);
        }
        public IHttpActionResult ConfirmUser(int userId)
        {
            AppUser user = db.AppUsers.Get(userId);

            if (user == null)
            {
                return(NotFound());
            }

            user.IsUserConfirmed = true;
            db.AppUsers.Update(user);
            db.Complete();

            SmtpService    smtpService = new SmtpService();
            string         mailBody    = "User " + user.FullName + " Id:" + user.Id + " is confirmed.";
            RAIdentityUser RAUser      = db.Users.GetByAppUserId(user.Id);

            smtpService.SendMail("User confirmation", mailBody, RAUser.Email);
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #4
0
        public void ApproveService(Service service)
        {
            var s = Context.Services.FirstOrDefault(q => q.Id == service.Id);

            if (s != null && !s.Approved)
            {
                s.Approved             = true;
                Context.Entry(s).State = EntityState.Modified;
                Context.SaveChanges();
                var manager = Context.Users.FirstOrDefault(m => m.AppUserId == service.ManagerId);
                if (manager == null)
                {
                    return;
                }
                var subject = "Odobren servis";
                var body    =
                    "Postovani,\nOvim putem zelimo da vas obavestimo da je Vas servis odobren i dostupan korisnicima da ga koriste.\nSrecan rad,\nRent-a-car tim.";
                var smtp = new SmtpService();
                smtp.SendMail(subject, body, manager.Email);
            }
        }
        public IHttpActionResult ConfirmService(int serviceId)
        {
            Service service = db.Services.Get(serviceId);

            if (service == null)
            {
                return(NotFound());
            }

            service.IsConfirmed = true;
            db.Services.Update(service);
            db.Complete();

            SmtpService    smtpService = new SmtpService();
            string         mailBody    = "Service " + service.Name + " Id:" + service.Id + " is confirmed.";
            AppUser        manager     = db.AppUsers.Get(service.ServiceManagerId);
            RAIdentityUser RAUser      = db.Users.GetByAppUserId(manager.Id);

            smtpService.SendMail("Service confirmation", mailBody, RAUser.Email);
            return(StatusCode(HttpStatusCode.NoContent));
        }
        private Result <bool> SendMailChangeVerification(string email, Customer customer)
        {
            string body = $"Dear {customer.Name}, your email address has been changed to {customer.EmailAddress}.";

            return(Result <bool> .FromBool(SmtpService.SendMail(email, "Your email address has changed", body)));
        }