protected void ValidateButton_OnClick(object sender, EventArgs e) { var bookingId = int.Parse(BookingIdHidden.Value); var response = _bookingRepository.ValidatePinCode(bookingId, string.Empty, true); var javaScriptSerializer = new JavaScriptSerializer(); var responseData = javaScriptSerializer.Deserialize <Response>(response); string script = string.Empty; if (responseData.IsSuccess) { var bookings = _bookingRepository.GetById(bookingId); var products = _bookingRepository.ProductList.First(p => p.ProductId == bookings.ProductId); var hotels = _bookingRepository.HotelList.First(h => h.HotelId == products.HotelId); var customerInfo = _bookingRepository.CustomerInfoList.First(ci => ci.CustomerId == bookings.CustomerId); var schedules = new Schedules { BookingId = bookingId, Name = "EmailSurvey", ScheduleSendType = (int)Enums.ScheduleSendType.IsEmailSurvey, Status = (int)Enums.ScheduleType.NotRun, SendAt = DateTime.UtcNow.AddMinutes(AppConfiguration.SendEmailSurveyAfterMinutes) }; _bookingRepository.AddSchedule(schedules); // Insert Schedule Send Add On Notification var schedulesAddOn = new Schedules { ScheduleSendType = (int)Enums.ScheduleSendType.IsAddOnNotificationAfterRedemption, Name = "Send Add-On Notification Redemption", Status = (int)Enums.ScheduleType.NotRun, BookingId = bookingId, SendAt = DateTime.UtcNow.AddMinutes(AppConfiguration.SendEmailSurveyAfterMinutes) }; _bookingRepository.AddSchedule(schedulesAddOn); script = string.Format(@"_learnq.push(['track', 'Booking Status Changed', {{ '$email': '{0}', 'email': '{0}', 'customer_id': '{1}', 'item_type': '{2}', 'item_name': '{3}', 'item_hotel_name': '{4}', 'item_id': '{5}', 'item_location': '{6}', 'item_photo': '{7}', 'booking_id': '{8}', 'booking_code': '{9}', 'booking_url': '{10}', 'booking_status': '{11}' }}]);", customerInfo.EmailAddress, customerInfo.CustomerId, Helper.GetStringPassByProductType(products.ProductType), products.ProductName, hotels.HotelName, products.ProductId, string.Format("{0}, {1}", hotels.Neighborhood, hotels.City), string.Format("{0}", new Uri(new Uri(AppConfiguration.CdnImageUrlDefault), products.ImageUrl).AbsoluteUri), bookings.BookingId, bookings.BookingIdString, AppConfiguration.DayaxeClientUrl + "/" + bookings.BookingId + Constant.ViewDayPassPage, ((Enums.BookingStatus)bookings.PassStatus).ToString() ); ScriptManager.RegisterClientScriptBlock(ValidateUpdatePanel, typeof(string), "HideRedeemEvent", "$(function(){$('#redeemModal').on('hidden.bs.modal', function (e) {window.location.reload();});});", true); ValidateMessage.Text = "Success! This ticket is valid! You may issue this customer an access card"; ValidateMessage.CssClass = "success-message"; ValidateButton.Attributes["data-dismiss"] = "modal"; ValidateButton.Text = "DONE"; } else { ValidateMessage.Text = responseData.Message; ValidateMessage.CssClass = "error-message"; } ScriptManager.RegisterClientScriptBlock(ValidateUpdatePanel, typeof(string), "ValidateBookings", string.Format("$(function(){{ {0} $('.modal-backdrop').remove(); $('#redeemModal').modal('show');}});", script), true); }