public ActionResult DiscountResult(DeliveryCheckModel dcm, BrowseHistory bh) { ViewBag.success = string.Empty; string[] s = base.GetAddressCityState(dcm.Address); string approxtime = string.Empty; string mysAddress = dcm.Address + " " + dcm.ZipCode; ViewBag.ValidateAddress = "Oops, feel like something wrong with you input. Please check it and try again."; if (!(string.IsNullOrEmpty(dcm.Address) || string.IsNullOrEmpty(dcm.ZipCode) || dcm.ZipCode.Length != 5 || string.IsNullOrEmpty(s[0]) || string.IsNullOrEmpty(s[1]) || string.IsNullOrEmpty(s[2]))) { decimal st = SearchFilter.GetDistance(mysAddress, "1291 Parkside Dr.,Walnut Creek, CA 94596", out approxtime); string xx = approxtime; if (st >= 0.0m) { ViewBag.success = "ok"; ViewBag.ValidateAddress = ""; bh.Address = s[0]; bh.City = s[1]; bh.State = s[2]; bh.Zip = dcm.ZipCode; bh.AddressCityState = dcm.Address; string goList = Url.Action("DiscountList", "Restaurants", new { vCity = s[1], vZip = dcm.ZipCode }); ViewBag.goList = goList; } } return(PartialView(dcm)); }
public ActionResult CheckDeliveryOKResult(DeliveryCheckModel dcm) { BizInfo bi = BizInfoRepository.GetBizInfoById(dcm.BizInfoId); string approxtime = string.Empty; string mysAddress = dcm.Address + ", " + dcm.ZipCode; ViewBag.ValidateAddress = "Oops, feel like something wrong with you input. Please check it and try again."; if (string.IsNullOrEmpty(dcm.Address) || string.IsNullOrEmpty(dcm.ZipCode) || dcm.ZipCode.Length != 5) { ViewBag.ValidateAddress = "Oops, feel like something wrong with you input. Please check it and try again."; } else { decimal st = SearchFilter.GetDistance(mysAddress, bi.BizAddressString, out approxtime); string xx = approxtime; if (st < 0.0m) { ViewBag.ValidateAddress = "Oops, feel like something wrong with you input. Please check it and try again."; } else if (st > bi.DeliveryRadius && bi.Delivery) { ViewBag.ValidateAddress = "Sorry, your address is beyond the area this restaurant deliveries to. Try other restaurants or you may need change your location to try again."; } else { ViewBag.ValidateAddress = "Yes, " + dcm.BizName + " delivers to your area : " + mysAddress + "."; } } return(PartialView(dcm)); }
public ActionResult Discount(BrowseHistory bh) { DeliveryCheckModel dcm = new DeliveryCheckModel(); dcm.Address = string.IsNullOrEmpty(bh.AddressCityState) ? "" : bh.AddressCityState; dcm.ZipCode = string.IsNullOrEmpty(bh.Zip) ? "" : bh.Zip; return(PartialView(dcm)); }
public ActionResult CheckDeliveryOK(int id, string bizname, BrowseHistory bh) { DeliveryCheckModel dcm = new DeliveryCheckModel(); ViewBag.bizid = id.ToString(); ViewBag.bizname = string.IsNullOrEmpty(bizname) ? "" : bizname; dcm.Address = string.IsNullOrEmpty(bh.AddressCityState) ? "" : bh.AddressCityState; dcm.ZipCode = string.IsNullOrEmpty(bh.Zip) ? "" : bh.Zip; dcm.BizInfoId = id; dcm.BizName = bizname; return(PartialView(dcm)); }