Beispiel #1
0
        public static void SendConfirmationEmail(TicketExportItem ticketExportItem, Project project)
        {
            TicketItemConfirmationViewModel ticketExportConfirmationViewModel = new TicketItemConfirmationViewModel()
            {
                ProjectName = project.TicketSetting.ProjectViewNameCZ,
                Email       = ticketExportItem.Email,
                IsExport    = true,
                DateStart   = project.TicketSetting.StartsCZ,
                Location    = project.TicketSetting.LocationCZ,
                Note        = project.TicketSetting.NoteCZ
            };

            List <TicketPDFGenerator.TicketToGenerateWrapper> ticketsToGenerate = new List <TicketPDFGenerator.TicketToGenerateWrapper>();

            TicketPDFGenerator.TicketToGenerateWrapper ticketWrapper = new TicketPDFGenerator.TicketToGenerateWrapper();

            ticketWrapper.CategoryName = ticketExportItem.TicketExport.Name;
            ticketWrapper.Location     = project.TicketSetting.LocationEN;
            ticketWrapper.StartDate    = project.TicketSetting.StartsEN;
            ticketWrapper.ProjectName  = project.TicketSetting.ProjectViewNameEN;
            ticketWrapper.Note         = project.TicketSetting.NoteCZ;

            ticketWrapper.VisitorEmail = ticketExportItem.Email;
            ticketWrapper.VisitorName  = ticketExportItem.Name;
            ticketWrapper.Code         = ticketExportItem.Code;
            ticketWrapper.QRCode       = ticketExportItem.QRCode;

            ticketsToGenerate.Add(ticketWrapper);


            IUserMailer userMailer = new UserMailer();
            var         email      = userMailer.SendTicketOrderConfirmation(ticketExportConfirmationViewModel, ticketsToGenerate, project.TicketSetting);

            email.Send();
        }
Beispiel #2
0
        public static void SendConfirmationEmail(TicketOrder ticketOrder, Project project, ApplicationDbContext context)
        {
            TicketItemConfirmationViewModel ticketOrderFinalViewModel = new TicketItemConfirmationViewModel()
            {
                ProjectName    = ticketOrder.IsEnglish ? project.TicketSetting.ProjectViewNameEN : project.TicketSetting.ProjectViewNameCZ,
                Email          = ticketOrder.Email,
                VariableSymbol = ticketOrder.VariableSymbol,
                IsExport       = false
            };

            if (ticketOrder.IsEnglish)
            {
                ticketOrderFinalViewModel.DateStart = project.TicketSetting.StartsEN;
                ticketOrderFinalViewModel.Location  = project.TicketSetting.LocationEN;
                ticketOrderFinalViewModel.Note      = project.TicketSetting.NoteEN;
            }
            else
            {
                ticketOrderFinalViewModel.DateStart = project.TicketSetting.StartsCZ;
                ticketOrderFinalViewModel.Location  = project.TicketSetting.LocationCZ;
                ticketOrderFinalViewModel.Note      = project.TicketSetting.NoteCZ;
            }

            List <TicketPDFGenerator.TicketToGenerateWrapper> ticketsToGenerate = new List <TicketPDFGenerator.TicketToGenerateWrapper>();

            foreach (TicketCategoryOrder ticketCategoryOrder in ticketOrder.TicketCategoryOrders)
            {
                context.Entry(ticketCategoryOrder).Collection(tco => tco.TicketItems).Load();
                foreach (TicketItem ticketItem in ticketCategoryOrder.TicketItems)
                {
                    TicketPDFGenerator.TicketToGenerateWrapper ticketWrapper = new TicketPDFGenerator.TicketToGenerateWrapper();

                    if (ticketOrder.IsEnglish)
                    {
                        ticketWrapper.CategoryName = ticketCategoryOrder.TicketCategory.HeaderEN;
                        ticketWrapper.Location     = project.TicketSetting.LocationEN;
                        ticketWrapper.StartDate    = project.TicketSetting.StartsEN;
                        ticketWrapper.ProjectName  = project.TicketSetting.ProjectViewNameEN;
                        ticketWrapper.Note         = project.TicketSetting.NoteEN;
                    }
                    else
                    {
                        ticketWrapper.CategoryName = ticketCategoryOrder.TicketCategory.HeaderCZ;
                        ticketWrapper.Location     = project.TicketSetting.LocationCZ;
                        ticketWrapper.StartDate    = project.TicketSetting.StartsCZ;
                        ticketWrapper.ProjectName  = project.TicketSetting.ProjectViewNameCZ;
                        ticketWrapper.Note         = project.TicketSetting.NoteCZ;
                    }

                    ticketWrapper.VisitorEmail = string.IsNullOrEmpty(ticketItem.Email) ? ticketOrder.Email : ticketItem.Email;
                    ticketWrapper.VisitorName  = ticketItem.Name;
                    ticketWrapper.Code         = ticketItem.Code;
                    ticketWrapper.QRCode       = ticketItem.QRCode;

                    ticketsToGenerate.Add(ticketWrapper);
                }
            }

            IUserMailer userMailer = new UserMailer();
            var         email      = userMailer.SendTicketOrderConfirmation(ticketOrderFinalViewModel, ticketsToGenerate, project.TicketSetting);

            email.Send();
        }