Example #1
0
        internal static void SendTaxiQuoteEmail(TaxiQuoteModel model)
        {
            try
            {
                MailDefinition mail = new MailDefinition();

                mail.From = WebSettings.EmailUsername;
                mail.Subject = WebSettings.TaxiQuoteEmailSubject;
                mail.BodyFileName = WebSettings.TaxiQuoteEmailTemplate;
                mail.IsBodyHtml = true;

                //ListDictionary replacements = ResetLinkToDictionary(order);
                Dictionary<string, string> replacements = new Dictionary<string, string>();
                EmailSender sender = new EmailSender();

                replacements = sender.TaxiQuoteToDictionary(model);

                MailMessage message = mail.CreateMailMessage(WebSettings.AdminEmail, replacements, new System.Web.UI.Control());

                EmailHandler handler = new EmailHandler(message);
                Thread thread = new Thread(new ThreadStart(handler.SendEmail));
                thread.Start();
                // LoggerService.Info(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], "Enquiry email sent to " + WebSettings.AdminEmail);

            }
            catch (Exception)
            {
                // LoggerService.Error(e.Message, "Stack Trace: " + e.StackTrace, "");
                throw;
            }
        }
Example #2
0
        public ActionResult Detail(int id)
        {
            try
            {
                TourDetailModel model = TourRepository.GetTourAndTourDays(id);
                model.TourCharges = TourRepository.GetTourCharges(id);

                TaxiQuoteModel quote = new TaxiQuoteModel();
                //quote.PickupDateTime = DateTime.Now;
                ViewBag.Vehicles = CommonRepository.GetVehiclesSelectList();
                ViewBag.FromPlaces = CommonRepository.GetFromPlacesSelectList();
                ViewBag.ToPlaces = CommonRepository.GetToPlacesSelectList();

                return View(model);
            }
            catch (Exception)
            {

                throw;
            }
        }
Example #3
0
        public ActionResult TaxiQuote(TaxiQuoteModel model)
        {
            GetSelectListData();

            if (ModelState.IsValid)
            {
                try
                {
                    EmailSender.SendTaxiQuoteEmail(model);
                    ViewBag.MessageType = MessageType.Success;
                    ViewBag.Message = "Thank you for your enquiry, our representatives will contact you soon";

                    return View();
                    //return Json(new { StatusCode = 200 }, JsonRequestBehavior.AllowGet);

                }
                catch (Exception)
                {
                    throw;
                }
            }

            return View(model);
        }
Example #4
0
        private Dictionary<string, string> TaxiQuoteToDictionary(TaxiQuoteModel model)
        {
            try
            {
                Dictionary<string, string> replacments = new Dictionary<string, string>();
                replacments.Add("#NAME#", ValueToString(model.Name));
                replacments.Add("#EMAIL#", ValueToString(model.Email));
                replacments.Add("#TELEPHONE#", ValueToString(model.Mobile));
                replacments.Add("#MOBILE#", ValueToString(model.Mobile));
                replacments.Add("#PICKUPDATETIME#", ValueToString(model.PickupDateTime));
                replacments.Add("#FROM#", ValueToString(model.FromId));
                replacments.Add("#TO#", ValueToString(model.ToId));
                replacments.Add("#NOOFPERSONS#", ValueToString(model.NoOfPersons));
                replacments.Add("#VEHICLE#", ValueToString(model.VehicleId));
                replacments.Add("#MESSAGE#", ValueToString(model.Message));
                return replacments;
            }
            catch (Exception)
            {

                throw;
            }
        }