Пример #1
0
        /// <summary>
        /// 获取所有周边景点
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="keywords"></param>
        /// <param name="recommend"></param>
        /// <returns></returns>
        public List <POIDto> GetScenics(int wid, string keywords, bool recommend = false)
        {
            BLL.wx_travel_marker bll = new BLL.wx_travel_marker();

            string strWhere = string.Format("wid={0}", wid);

            if (!string.IsNullOrEmpty(keywords))
            {
                strWhere += string.Format("  And Name Like '%{0}%'", keywords);
            }

            if (recommend)
            {
                strWhere += " And Recommend=1";
            }

            var markers = bll.GetModelList(strWhere);

            if (markers.Any())
            {
                return(markers.Select(m => new POIDto
                {
                    Id = m.Id,
                    Name = m.Name,
                    Introduction = m.Remark,
                    Logo = GetScenicLogo(m.ScenicId),
                    Lat = m.Lat,
                    Lng = m.Lng,
                    Url = m.Url,
                    PoiType = "scenic"
                }).ToList());
            }

            return(null);
        }
Пример #2
0
        public void GetMarkers(int wid)
        {
            try
            {
                //后台登陆的通过session获取wid
                Model.wx_userweixin model = Session["nowweixin"] as Model.wx_userweixin;
                if (model != null)
                {
                    wid = model.id;
                }
                BLL.wx_travel_marker bll = new BLL.wx_travel_marker();
                var markers = bll.GetModelList(string.Format("wid={0}", wid));

                if (!markers.Any())
                {
                    Context.Response.Write(AjaxResult.Error("该微信帐号下未配置景点信息").ToCamelString());
                    return;
                }

                Context.Response.Write(AjaxResult.Success(markers).ToCamelString());
            }
            catch
            {
                Context.Response.Write(AjaxResult.Error("获取景点信息失败").ToCamelString());
            }
        }
Пример #3
0
        /// <summary>
        /// 获取景点实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public MapDTO GetMapInfo(int id)
        {
            MapDTO result = null;

            var marker = new BLL.wx_travel_marker().GetModel(id);

            result = Mapper.Map <Model.wx_travel_marker, MapDTO>(marker);

            return(result);
        }
Пример #4
0
        public void DeleteMarker(int id)
        {
            try
            {
                //后台登陆的通过session获取wid
                Model.wx_userweixin model = Session["nowweixin"] as Model.wx_userweixin;
                if (model == null)
                {
                    throw new Exception("用户为空!");
                }
                BLL.wx_travel_marker bll = new BLL.wx_travel_marker();
                bll.Delete(id);


                Context.Response.Write(AjaxResult.Success(true).ToCamelString());
            }
            catch
            {
                Context.Response.Write(AjaxResult.Error("删除景点信息失败").ToCamelString());
            }
        }