public ActionResult GetBizTime(int id) { BizInfo bi = BizInfoRepository.GetBizInfoById(id); DateTime dt = SearchFilter.ConvertLocalToMyTime(bi.BizHour.BizTimeZoneName); return(Json(new { result = dt.ToLongTimeString() })); }
public ActionResult FilterUpdate(string schedule, string time, string cuisine, string min, string dist, string rating, string freeDelivery, string breakfast, string lunchSpecial, string coupons, string freeItems, BrowseHistory bh) { string timeout = "timein"; if (bh.FilterSet == null) { timeout = "timeout"; return(Json(new { timeexp = timeout })); } List <BizInfo> openset = new List <BizInfo>(); List <BizInfo> closeset = new List <BizInfo>(); List <BizInfo> hiddenset = new List <BizInfo>(); int[] filterOn = { }; int[] filterOff = { }; int[] filterOpen = { }; string[] localOn = { }; string[] localOff = { }; string[] localOpen = { }; List <int> ltOn = new List <int>(); List <int> ltOpen = new List <int>(); List <int> ltOff = new List <int>(); List <string> ltLocalOn = new List <string>(); List <string> ltLocalOpen = new List <string>(); List <string> ltLocalOff = new List <string>(); int closeCount = 0; YelpReviewModel yrm = new YelpReviewModel(); foreach (var p in bh.FilterSet) { string tm = SearchFilter.ConvertLocalToMyTime(p.BizHour.BizTimeZoneName).ToString(); yrm = YelpBizDetails.GetYelpBiz(p); bool yrating = string.IsNullOrEmpty(rating)?true: int.Parse(rating) <= 0 ? true : yrm.Biz == null?p.AverageRating >= decimal.Parse(rating):yrm.Biz.rating >= double.Parse(rating); if (SearchFilter.ItemFilter(p, schedule, time, cuisine, min, dist, yrating, freeDelivery, breakfast, lunchSpecial, coupons, freeItems, bh)) { ltOn.Add(p.BizInfoId); ltLocalOn.Add(tm); if (p.IsOpenNow) { openset.Add(p); ltOpen.Add(p.BizInfoId); ltLocalOpen.Add(tm); } else { closeset.Add(p); closeCount++; } } else { hiddenset.Add(p); ltOff.Add(p.BizInfoId); ltLocalOff.Add(tm); } } bh.FilterOpenSet = openset; bh.FilterCloseSet = closeset; bh.FilterHiddenSet = hiddenset; filterOn = ltOn.ToArray(); filterOpen = ltOpen.ToArray(); filterOff = ltOff.ToArray(); localOn = ltLocalOn.ToArray(); localOff = ltLocalOff.ToArray(); localOpen = ltLocalOpen.ToArray(); return(Json(new { timeexp = timeout, featherOn = filterOn, featherOnCount = filterOn.Count().ToString(), featherCloseCount = closeCount, featherOpen = filterOpen, featherOpenCount = filterOpen.Count().ToString(), featherOff = filterOff, featherOffCount = filterOff.Count().ToString(), localOn = localOn, localOff = localOff, localOpen = localOpen })); // return Json(new { sch = schedule, dlvtime = time, mini = min, distc = dist, rate = rating, re1 = freeDelivery, re2 = breakfast, re3 = lunchSpecial, re4 = coupons, re5 = freeItems }); }