Esempio n. 1
0
        public bool SendEmail(Request request)
        {
            bool         sent      = false;
            const string mailTitle = "EMPLOYMENT REQUEST";

            try
            {
                Email email = new Email();
                email.Addressee  = request.ToPerson.ContactAddress;
                email.MailBody   = request.RequestMessage.Text;
                email.MailDate   = request.Date;
                email.MailTitle  = mailTitle;
                email.MailTo     = request.ToPerson.Email;
                email.NameFrom   = "Nmutaka Team, Nitware Solutions";
                email.Salutation = "Dear " + request.ToPerson.Name;
                email.Subject    = mailTitle;

                sent = _emailEngine.Send(email);
            }
            catch (Exception)
            {
                //suppress the error (some email address might be incorrectly entered);
            }

            return(sent);
        }
Esempio n. 2
0
        public ActionResult Delete(int id)
        {
            try
            {
                var customerHasOrders = _ordersRepository.Get(id).Count > 0;

                if (customerHasOrders)
                {
                    return(Content("Unable to delete customer due to existing invoices."));
                }

                _customerRepository.Delete(id);

                var statusMessage = string.Format("Customer Deleted : {0}", id);

                _notificationProvider.Send("*****@*****.**", "Customer Deleted", statusMessage);

                _logger.Info(statusMessage);

                return(Content(statusMessage));
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Error Deleting Customer Id: {0}", id);

                return(Content("Unable to delete customer"));
            }
        }
        public void ProcessOrders()
        {
            //summ up all the items in the order, save things to database

            //send an email to customer
            notifier.Send("*****@*****.**", "Your order is ready");
        }
Esempio n. 4
0
        public ActionResult Index()
        {
            //string name = _iTest.SayHello("Sourav");
            //return View(model: name);
            Course c = new Course();

            c = _iCourse.Get(1);
            _iLog.Info("Log from Index");
            _iNotification.Send("*****@*****.**", "Test", "Body message");

            return(View(c));
        }
Esempio n. 5
0
        public void SendSMS(string message, string recipientPhoneNo)
        {
            try
            {
                Sms sms = new Sms();
                sms.RecepientPhoneNo = recipientPhoneNo;
                sms.Message          = message;

                NexmoResponse response = _smsEngine.Send(sms);
            }
            catch (Exception)
            {
                //suppress the error (some email address might be incorrectly entered);
            }
        }
Esempio n. 6
0
        public void SendOrderSummary(string toEmailAddress, DateTime startDate, DateTime endDate)
        {
            //Discussion point: the point at which this moves to the repository
            var orders =
                _orderRepository.Get(o => o.OrderDate >= startDate && o.OrderDate < endDate)
                .OrderBy(c => c.OrderDate)
                .Select(o => new { Code = o.OrderCode, Status = o.OrderStatus, Date = o.OrderDate }).ToList();

            var messageSubject = string.Format("Order Summary {0} - {1}", startDate, endDate);

            var messageBody = new System.Text.StringBuilder();

            orders.ForEach(c => messageBody.AppendLine(string.Format("{0} - {1} ({2})", c.Date, c.Code, c.Status)));

            _notificationProvider.Send(toEmailAddress, messageSubject, messageBody.ToString());
        }
 public string SendNotification(string target, string content)
 {
     return(_provider.Send(target, content)); //strategy
 }