Ejemplo n.º 1
0
        private CartViewModel GetTickets()
        {
            TicketDto[] tickets;

            tickets = _cartManageService.GeTickets(GetCart());

            var cartModel = new CartViewModel
            {
                Tickets = MapperManager.Map <List <TicketViewModel> >(tickets),
            };

            return(cartModel);
        }
Ejemplo n.º 2
0
        public void Send(Cart cart, string email)
        {
            var client    = new SmtpClient();
            var emailPath = client.PickupDirectoryLocation;

            if (emailPath != null && emailPath.Contains("AppPath"))
            {
                emailPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + emailPath.Replace("AppPath", string.Empty);

                if (!Directory.Exists(emailPath))
                {
                    Directory.CreateDirectory(emailPath);
                }

                client.PickupDirectoryLocation = emailPath;
            }

            var     text    = new StringBuilder();
            var     id      = 1;
            decimal total   = 0;
            var     tickets = _cartManageService.GeTickets(cart);

            foreach (var item in tickets)
            {
                text.AppendLine($"{id++} | {LanguageUI.Date}: {item.EventTime} | {LanguageUI.Name}: {item.EventName} | {LanguageUI.Row}: {item.Row} | {LanguageUI.Seat}: {item.Num} | {LanguageUI.Cost}: {item.Cost}");
                total += item.Cost;
            }

            text.AppendLine($"/n{LanguageUI.Total} - {total}");

            var emailInfo = ConfigurationManager.AppSettings["info"];

            var message = new MailMessage(emailInfo, email)
            {
                Subject = LanguageUI.Tickets,
                Body    = text.ToString()
            };

            client.Send(message);
        }