Esempio n. 1
0
        public ActionResult SendConfirmationEmail(int orderid, string lastname)
        {
            // orderid and lastname as a basic form of auth

            // Also might be called by scheduler (ie. Azure scheduler), pinging endpoint and using some kind of queue / db

            // This could also be used (but problems when hosted on Azure Websites)
            // if (Request.IsLocal)

            var order = db.Orders.Include("OrderItems").Include("OrderItems.Album").SingleOrDefault(o => o.OrderId == orderid && o.LastName == lastname);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To          = order.Email;
            email.Cost        = order.TotalPrice;
            email.OrderNumber = order.OrderId;
            email.FullAddress = string.Format("{0} {1}, {2}, {3}", order.FirstName, order.LastName, order.Address, order.CodeAndCity);
            email.OrderItems  = order.OrderItems;
            email.CoverPath   = AppConfig.PhotosFolderRelative;
            //email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 2
0
        public void Execute(Order order)
        {
            _handleMakePayment.Handle(new MakePayment(order.Payment));

            var orderConfirmationEmail = new OrderConfirmationEmail("*****@*****.**", order.Email);

            _handleSendEmail.Handle(new SendEmail(orderConfirmationEmail));
        }
Esempio n. 3
0
        public void SendOrderConfirmationEmail(Order order)
        {
            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To      = order.Email;
            email.Cost    = order.SummaryPrice;
            email.Address = string.Format("{0}  {1} {2}, {3}, {4}", order.Country, order.City, order.CityCode, order.Street, order.ApartmentNumber);
            email.Send();
        }
 // Methods to set important data send via email
 public void OrderConfirmaitonMessage(Order order)
 {
     OrderConfirmationEmail email = new OrderConfirmationEmail();
     email.To = order.EMail;
     email.From = "";
     email.Value = order.OrderValue;
     email.OrderNumber = order.OrderId;
     email.ItemPositions = order.ItemPosition;
     email.Send();
 }
Esempio n. 5
0
 public void SendOrderConfirmationEmail(Order order)
 {
     HostingEnvironment.QueueBackgroundWorkItem(ct =>
     {
         OrderConfirmationEmail email = new OrderConfirmationEmail();
         email.To      = order.Email;
         email.Cost    = order.SummaryPrice;
         email.Address = string.Format("{0}  {1} {2}, {3}, {4}", order.Country, order.City, order.CityCode, order.Street, order.ApartmentNumber);
         email.Send();
     });
 }
        public void save_transaction_and_send_confirmation_when_payment_by_check(string paymentMethod, string orderId, decimal amount)
        {
            var email = new OrderConfirmationEmail(orderId, _customerId, paymentMethod);

            _emailGateway.NewEmailFor(orderId, _customerId, paymentMethod).Returns(email);
            var transaction = new PaymentTransaction(orderId, amount, paymentMethod);

            _paymentService.Pay(amount, _customerId, orderId, paymentMethod);

            _transactionRepo.ReceivedWithAnyArgs().Save(transaction);
            _emailGateway.Received().Send(email);
        }
        public void SendOrderConfirmationEmail(Models.Order order)
        {
            // Strongly typed - without background
            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To          = order.Email;
            email.Cost        = order.TotalPrice;
            email.OrderNumber = order.OrderId;
            //email.OrderItems = order.OrderItems;
            email.ResultsOfOrderGRList = order.ResultsOfOrderGRList;
            email.CoverPath            = AppConfig.PhotosFolderRelative;
            email.Send();
        }
Esempio n. 8
0
        public void SendMailOfOrderConfirmation(Order order)
        {
            OrderConfirmationEmail email = new OrderConfirmationEmail()
            {
                To           = order.Email,
                From         = "*****@*****.**",
                OrderValue   = order.Value,
                OrderNumber  = order.OrderID,
                OrderDetails = order.OrderDetails
            };

            email.Send();
        }
Esempio n. 9
0
        public void SendOrderConfirmationEmail(Models.Order order)
        {
            // Strongly typed - without background
            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To          = order.Email;
            email.Cost        = order.TotalPrice;
            email.OrderNumber = order.OrderId;
            email.FullAddress = string.Format("{0} {1}, {2}, {3}", order.FirstName, order.LastName, order.Address, order.CodeAndCity);
            email.OrderItems  = order.OrderItems;
            email.CoverPath   = AppConfig.PhotosFolderRelative;
            email.Send();
        }
Esempio n. 10
0
        public void SendOrderConfirmationEmail(Order newOrder)
        {
            var order = db.Orders.Include("OrderItems").Include("OrderItems.Course").SingleOrDefault(o => o.OrderId == newOrder.OrderId && o.LastName == newOrder.LastName);

            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To          = order.Email;
            email.From        = "*****@*****.**";
            email.Value       = order.OrderValue;
            email.OrderNumber = order.OrderId;
            email.OrderItems  = order.OrderItems;
            email.ImagePath   = AppConfig.ImageFolder;
            email.Send();
        }
Esempio n. 11
0
        public void SendOrderConfirmationEmail(Models.Order order)
        {
            HostingEnvironment.QueueBackgroundWorkItem(ct =>
            {
                OrderConfirmationEmail email = new OrderConfirmationEmail();
                email.To                   = order.Email;
                email.Cost                 = order.TotalPrice;
                email.OrderNumber          = order.OrderId;
                email.ResultsOfOrderGRList = order.ResultsOfOrderGRList;
                email.OrderItems           = order.OrderItems;
                email.CoverPath            = AppConfig.PhotosFolderRelative;

                email.Send();
            });
        }
Esempio n. 12
0
        public ActionResult SendOrderConfirmationEmail(int orderID, string surname)
        {
            var order = db.Orders.Include("OrderItems").SingleOrDefault(a => a.OrderID == orderID && a.Surname == surname);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To      = order.Email;
            email.Cost    = order.SummaryPrice;
            email.Address = string.Format("{0}  {1} {2}, {3}, {4}", order.Country, order.City, order.CityCode, order.Street, order.ApartmentNumber);
            email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 13
0
        public ActionResult OrderConfirmationEmail(int orderId, string lastName)
        {
            var order = db.Orders.Include("OrderItems").Include("OrderItems.Course").SingleOrDefault(o => o.OrderId == orderId && o.LastName == lastName);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To          = order.Email;
            email.From        = "*****@*****.**";
            email.Value       = order.OrderValue;
            email.OrderNumber = order.OrderId;
            email.OrderItems  = order.OrderItems;
            email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 14
0
        public ActionResult ConfirmOrderEmail(int orderId, string lastName)
        {
            var order = db.Orders.Include("OrderPosition").Include("OrderPosition.Course").SingleOrDefault(o => o.OrderId == orderId && o.LastName == lastName);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var email = new OrderConfirmationEmail();

            email.To            = order.Email;
            email.From          = "*****@*****.**";
            email.Value         = order.OrderValue;
            email.OrderNumber   = order.OrderId;
            email.OrderPosition = order.OrderPosition;

            email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 15
0
        public ActionResult OrderConfirmaitonMessage(int orderId, string surname)
        {
            var order = db.Orders.Include("ItemPosition").Include("ItemPosition.Item")
                        .SingleOrDefault(o => o.OrderId == orderId && o.Surname == surname);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            OrderConfirmationEmail email = new OrderConfirmationEmail();

            email.To            = order.EMail;
            email.From          = "";
            email.Value         = order.OrderValue;
            email.OrderNumber   = order.OrderId;
            email.ItemPositions = order.ItemPosition;
            email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 16
0
        public ActionResult SendMailOfOrderConfirmation(int orderID, string lastName)
        {
            var order = _db.Orders.Include(o => o.OrderDetails).Include(o => o.OrderDetails.Select(od => od.Model)).SingleOrDefault(o => o.OrderID == orderID && o.LastName == lastName);

            if (order == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }


            OrderConfirmationEmail email = new OrderConfirmationEmail()
            {
                To           = order.Email,
                From         = "*****@*****.**",
                OrderValue   = order.Value,
                OrderNumber  = order.OrderID,
                OrderDetails = order.OrderDetails
            };

            email.Send();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 17
0
        public async Task <ActionResult> Pay(Order orderDetails)
        {
            if (ModelState.IsValid)
            {
                // pobieramy iduzytkownika aktualnie zalogowanego
                var userId = User.Identity.GetUserId();

                // utworzenie biektu zamowienia na podstawie tego co mamy w koszyku
                var newOrder = cartMenager.CreateOrder(orderDetails, userId);

                // szczegóły użytkownika - aktualizacja danych
                var user = await UserManager.FindByIdAsync(userId);

                TryUpdateModel(user.UserData);
                await UserManager.UpdateAsync(user);

                // opróżnimy nasz koszyk zakupów
                cartMenager.EmptyCart();


                var order = db.Orders.Include("PositionsOrder").Include("PositionsOrder.Audiobook")
                            .SingleOrDefault(o => o.OrderId == newOrder.OrderId);
                OrderConfirmationEmail email = new OrderConfirmationEmail();
                email.To             = order.Email;
                email.From           = "*****@*****.**";
                email.OrderValue     = order.OrderValue;
                email.OrderId        = order.OrderId;
                email.PositionsOrder = order.PositionsOrder;
                email.Send();

                return(RedirectToAction("OrderConfirmation"));
            }
            else
            {
                return(View(orderDetails));
            }
        }
        public async Task <ActionResult> Checkout(Order orderdetails)
        {
            if (ModelState.IsValid)
            {
                // logger.Info("Checking out");

                // Get user
                var userId = User.Identity.GetUserId();

                // Save Order
                ShoppingCartManager shoppingCartManager = new ShoppingCartManager(this.sessionManager, this.db);
                //pobierze dane zamowienia i id usera i powiaze je ze soba
                var newOrder = shoppingCartManager.CreateOrder(orderdetails, userId);

                // Update profile information
                var user = await UserManager.FindByIdAsync(userId);

                TryUpdateModel(user.UserData);
                await UserManager.UpdateAsync(user);

                // Empty cart
                shoppingCartManager.EmptyCart();

                // Send mail confirmation
                // Refetch - need also products details
                //var order = db.Orders.Include("OrderItems").SingleOrDefault(o => o.OrderId == newOrder.OrderId);

                //zwroci wypelnione wlasciwowsci nawigacyjne
                //dot. produktu i zamowienia
                var order = db.Orders.Include("OrderItems").Include("OrderItems.Product").SingleOrDefault(o => o.OrderId == newOrder.OrderId);


                //imailservice mailservice = new hangfirepostalmailservice();
                //mailservice.sendorderconfirmationemail(order);

                // this.mailservice.sendorderconfirmationemail(order);

                string url = Url.Action("SendConfirmationEmail", "Manage", new { orderid = newOrder.OrderId, lastname = newOrder.LastName }, Request.Url.Scheme);

                //// hangfire - nice one (if asp.net app will be still running)
                //BackgroundJob.Enqueue(() => Helpers.CallUrl(url));



                //// Strongly typed - without background
                //ze strony postal
                OrderConfirmationEmail email = new OrderConfirmationEmail();
                email.To          = order.Email;
                email.Cost        = order.TotalPrice;
                email.OrderNumber = order.OrderId;
                email.FullAddress = string.Format("{0} {1}, {2}, {3}", order.FirstName, order.LastName, order.Address, order.CodeAndCity);
                email.OrderItems  = order.OrderItems;
                email.CoverPath   = AppConfig.PhotosFolderRelative;
                email.Send();

                return(RedirectToAction("OrderConfirmation"));
                //return new PartialViewAsPdf("_Checkout", order);
            }
            else
            {
                return(View(orderdetails));
            }
        }