//[OutputCache(Duration = 1000)]
        public ActionResult Index(ShoppingCart cart)
        {
            RestaurantJoinModel rjm = new RestaurantJoinModel();
            List <CuisineType>  lct = CuisineTypeRepository.GetAllCuisineTypes(true);

            rjm.CuisineAssistances = new List <SelectListItem>();
            foreach (var c in lct)
            {
                rjm.CuisineAssistances.Add(new SelectListItem {
                    Text = c.Title, Value = c.Title
                });
            }
            ViewBag.servicephone = ServicePhone;
            ViewBag.bagitems     = GetCartItems(cart);
            return(View(rjm));
        }
        public ActionResult InfoSubmit(RestaurantJoinModel model)
        {
            bool sendSuccess = false;

            if (ModelState.IsValid)
            {
                //ViewBag.qqq = EmailManager.BuildPartnerInfoHtmlBody(model);
                EmailManager  em = new EmailManager();
                EmailContents ec = new EmailContents(model.Name, Globals.Settings.ContactForm.MailTo, model.Email,
                                                     "Restaurant Application", EmailManager.BuildPartnerInfoHtmlBody(model));

                em.FaxBody = EmailManager.BuildPartnerInfoHtmlBody(model);
                em.SendFax(WebConfigurationManager.AppSettings["OnlineFaxNumber"].ToString());
                em.Send(ec); // send to foodready.net
                if (em.IsSent == false)
                {
                    sendSuccess = false;
                    TempData["SentIMEALMsg"] = "Your message has not been sent out for some reasons.";
                }
                else
                {
                    sendSuccess = true;
                    TempData["SentIMEALMsg"] = "Your message has  been sent out successfully.";
                }
                ec = new EmailContents("Foodready.net", model.Email, Globals.Settings.ContactForm.MailTo, "Restaurant Application", EmailManager.BuildImealHtmlBody());
                em.Send(ec); // send to Partner
                if (em.IsSent == false)
                {
                    sendSuccess = false;
                    TempData["SentPartnerMsg"] = "Your message has not been sent out for some reasons.";
                }
                else
                {
                    sendSuccess = true;
                    TempData["SentPartnerMsg"] = "Your message has  been sent out successfully.";
                }
            }
            ViewBag.SendingSuccess = sendSuccess;
            return(PartialView(model));
        }
Example #3
0
        public static string BuildPartnerInfoHtmlBody(RestaurantJoinModel model)
        {
            string pagepath = "~/Content/HTMLPages/BackToIMEAL.htm";
            string msgbody  = string.Empty;

            using (StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath(pagepath)))
            {
                msgbody = sr.ReadToEnd();
            }
            msgbody = msgbody.Replace("+name+", model.Name);
            msgbody = msgbody.Replace("+address+", model.Address + ", " + model.City + ", " + model.State + " " + model.ZipCode);
            msgbody = msgbody.Replace("+phone+", model.Phone);
            msgbody = msgbody.Replace("+mobile+", model.Mobile);
            msgbody = msgbody.Replace("+Fax+", model.Fax);
            msgbody = msgbody.Replace("+email+", model.Email);
            msgbody = msgbody.Replace("+delivery+", model.Delivery);
            msgbody = msgbody.Replace("+radius+", model.Radius.ToString("N2") + " miles");
            msgbody = msgbody.Replace("+deliveryMinimum+", "$" + model.OrderMinimum.ToString("N2"));
            msgbody = msgbody.Replace("+TaxRate+", model.TaxPercentage.ToString("N2") + "%");
            msgbody = msgbody.Replace("+Cuisine+", model.CuisineType);
            msgbody = msgbody.Replace("+message+", model.Message);
            msgbody = msgbody.Replace("+time+", DateTime.Now.ToString());
            return(msgbody);
        }