Exemplo n.º 1
0
        public ActionResult Near(long id, string filterSource)
        {
            var           element = ServiceContext.ElementService.GetByIdExtended(id);
            ElementFilter filter  = SerializationHelper.DeSerializeJSON <ElementFilter>(filterSource);

            filter.LatitudeBase  = element.Latitude.ToString().Replace(",", ".");
            filter.LongitudeBase = element.Longitude.ToString().Replace(",", ".");
            filter.Radius        = "1";//Próximo a 1 km do ponto selecionado
            return(RedirectToAction("List", new { filterSource = SerializationHelper.SerializeJSON <ElementFilter>(filter) }));
        }
Exemplo n.º 2
0
        public ActionResult List(string filterSource, int page = 1)
        {
            Session["LastFilter"] = filterSource;
            page--;
            int           recordCount = 0;
            ElementFilter filter      = SerializationHelper.DeSerializeJSON <ElementFilter>(filterSource);
            var           result      = ServiceContext.ElementService.List(out recordCount, filter, null, SiteContext.MaximumRows * page, SiteContext.MaximumRows);// Context.ElementService.List(out recordCount, filter, null, 1 * page, 1);

            ViewBag.FilterSource = filterSource;
            ViewBag.RecordCount  = recordCount;
            return(View(result));
        }
Exemplo n.º 3
0
        public ActionResult Similar(long id, string filterSource)
        {
            int           recordCount = 0;
            var           element     = ServiceContext.ElementService.GetByIdExtended(id);
            ElementFilter filter      = SerializationHelper.DeSerializeJSON <ElementFilter>(filterSource);

            filter.LatitudeBase  = element.Latitude.ToString().Replace(",", ".");
            filter.LongitudeBase = element.Longitude.ToString().Replace(",", ".");
            filter.Radius        = "1";//Próximo a 1 km do ponto selecionado
            filter.IDCustomer    = (Session["IDCustomer"] == null) ? "0" : Session["IDCustomer"].ToString();
            var result = ServiceContext.ElementService.List(out recordCount, filter, null, 0, 10);

            //Ignorando o selecionado
            if (result != null && result.Count > 0)
            {
                result = result.Where(p => p.IDElement != id).ToList();
            }
            return(View(result));
        }
Exemplo n.º 4
0
        public JsonResult MapItem(string filterSource)
        {
            Session["LastFilter"] = filterSource;
            int           recordCount = 0;
            ElementFilter filter      = SerializationHelper.DeSerializeJSON <ElementFilter>(filterSource);
            var           result      = from r in ServiceContext.ElementService.List(out recordCount, filter, null, 0, SiteContext.MaximumRows)
                                        select new
            {
                IDElement = r.IDElement.Value,
                Title     = String.Format("{0}-{1}", r.IDElement.Value, r.Name),
                Latitude  = r.Latitude,
                Longitude = r.Longitude,
                Icon      = String.Format("{0}{1}", SpongeSolutions.ServicoDireto.Admin.SiteContext.LayoutPath, r.IconPath)
            };

            ViewBag.FilterSource = filterSource;
            ViewBag.RecordCount  = recordCount;
            return(Json(Response <dynamic> .WrapResponse(result, SpongeSolutions.Core.RestFul.Enums.ResponseStatus.OK), JsonRequestBehavior.AllowGet));
        }