Esempio n. 1
0
        public ActionResult AddBookingNote(RichTextContentViewModel model, int id)
        {
            var success = true;

            try
            {
                if (!string.IsNullOrWhiteSpace(model.Text))
                {
                    bookingService.AddNote(id, model.Text);
                }
            }
            catch (Exception ex)
            {
                success = false;
                loggingService.LogException(ex);
            }

            SetFeedbackMessage(success,
                               "Booking note successfully added.",
                               "There has been an error whilst adding the booking note.");

            TempData["SetFocus"] = "pnlNotes";

            return(RedirectToAction("Edit", new { id = id }));
        }
Esempio n. 2
0
        public ActionResult RichTextContent()
        {
            var ds = Sitecore.Context.Database.GetItem(RenderingContext.CurrentOrNull.Rendering.DataSource);

            if (ds == null || ds.TemplateID.ToString() != Constants.Templates.RichTextContent.TemplateId)
            {
                return(View());
            }

            var viewModel = new RichTextContentViewModel()
            {
                TextContent = ds[Constants.Templates.RichTextContent.TextContent]
            };

            return(View(viewModel));
        }
Esempio n. 3
0
        public ActionResult ShowBookingPreviewEmailModal(int Id)
        {
            var booking = bookingService.GetBooking(Id);
            var body    = renderingService.RenderHtml(booking,
                                                      renderingService.GetTemplatePath(TemplateType.BOOKING_PREVIEW_EMAIL));

            var model = new RichTextContentViewModel()
            {
                Text = body
            };

            ViewBag.Id         = Id;
            ViewBag.NextAction = "SendBookingPreviewEmail";

            return(PartialView("_MessageModal", model));
        }
Esempio n. 4
0
        public ActionResult SendBookingPreviewEmail(RichTextContentViewModel model, int id)
        {
            var success = true;

            try
            {
                var booking = bookingService.GetBooking(id);

                messagingService.QueueEmail(booking.CustomerID.Value,
                                            new MailAddress(booking.Customer.Email, booking.Customer.DisplayName),
                                            null,
                                            null,
                                            ApplicationSettings.BookingPreviewEmailSubject,
                                            model.Text,
                                            null,
                                            (new BookingsEmailAccount()).FromAddress);

                booking.BookingStatus = BookingStatus.WaitingForCustomerAcceptance;
                if (booking.BookingStatusChanged)
                {
                    booking.CurrentBookingStatus = new BookingStatusHistory()
                    {
                        BookingID     = booking.ID,
                        Reason        = "Booking preview sent to customer",
                        Notes         = "",
                        BookingStatus = booking.BookingStatus,
                        CreatedBy     = ServiceContext.User.ID,
                        CreatedDate   = DateTime.Now
                    };

                    bookingService.SaveBooking(booking);
                }
            }
            catch (Exception ex)
            {
                success = false;
                loggingService.LogException(ex);
            }

            SetFeedbackMessage(success,
                               "The booking preview email is being sent to the customer.",
                               "There has been an error whilst sending the booking preview email to the customer.");

            return(RedirectToSamePage());
        }
        public ActionResult SendCustomerInvoices(RichTextContentViewModel model, int id)
        {
            var success = true;

            try
            {
                jobService.ExecuteBackgroundJob <SendCustomerStatementsJob>(this.ServiceContext, new Dictionary <string, object>
                {
                    { "Batch Id", id },
                    { "Message", model.Text ?? "" }
                });
            }
            catch (Exception ex)
            {
                success = false;
                loggingService.LogException(ex);
            }

            SetFeedbackMessage(success,
                               "The invoices are being sent. Please <a href =\"javascript: location.reload();\">refresh</a> the page in a few minutes.",
                               "There has been an error whilst sending the invoices.");
            return(RedirectToAction("Batches"));
        }