コード例 #1
0
ファイル: lbsedit.aspx.cs プロジェクト: LinRB1573/Weixin
 private void ShowInfo(int id)
 {
     Model.wx_lbs_shopInfo lbsModel = lbsBll.GetModel(id);
     txtshopName.Text  = lbsModel.shopName;
     txtTelphone.Text  = lbsModel.telphone;
     txtBrief.Text     = lbsModel.brief;
     txtImgUrl.Text    = lbsModel.shopLogo;
     txtAddr.Text      = lbsModel.detailAddr;
     txtLatXPoint.Text = lbsModel.xPoint.Value.ToString();
     txtLngYPoint.Text = lbsModel.yPoint.Value.ToString();
     txtwUrl.Text      = lbsModel.wUrl;
     ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript'> $(\"#baiduframe\").attr(\"src\", \"MapSelectPoint.aspx?yjindu=" + lbsModel.yPoint.Value.ToString() + "&xweidu=" + lbsModel.xPoint.Value.ToString() + "\");</script>");
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shopid"></param>
        /// <param name="x">客户传过来的纬度x</param>
        /// <param name="y">客户传过来的经度y</param>
        protected void BindData(int wid, int shopid, float x, float y)
        {
            // 页面上部链接
            BLL.wx_lbs_shopInfo   shopBll = new BLL.wx_lbs_shopInfo();
            Model.wx_lbs_shopInfo shop    = shopBll.GetModel(shopid);
            string openid = MyCommFun.RequestOpenid();

            if (shop == null)
            {
                return;
            }

            string aInfo = " <a data-role=\"button\" data-ajax=\"false\" rel=\"external\" href=\"index.aspx?x=" + x + "&y=" + y + "&wid=" + wid + "&openid=" + openid + "\">更多..." + br();

            aInfo        += "</a>" + br();
            aInfo        += "<a data-role=\"button\" href=\"tel:" + shop.telphone + "\">拨打电话</a>";
            litAInfo.Text = aInfo;


            //页面Js

            string jsInfo = " <script type=\"text/javascript\">" + br();

            jsInfo += "  var map = new BMap.Map(\"allmap\"); " + br();
            jsInfo += "  var point = new BMap.Point(" + shop.yPoint + ", " + shop.xPoint + "); " + br();
            jsInfo += " map.centerAndZoom(point, 15);                 " + br();
            jsInfo += " map.enableScrollWheelZoom();                         " + br();
            jsInfo += "  map.addControl(new BMap.NavigationControl()); " + br();

            jsInfo += "  var marker = new BMap.Marker(point);  " + br();
            jsInfo += " map.addOverlay(marker);            " + br();
            jsInfo += "   marker.setAnimation(BMAP_ANIMATION_BOUNCE);" + br();

            jsInfo += "  var p1 = new BMap.Point(" + y + ", " + x + ");" + br();
            jsInfo += "  var p2 = new BMap.Point(" + shop.yPoint + ", " + shop.xPoint + "); " + br();

            jsInfo += "  var driving = new BMap.DrivingRoute(map, { renderOptions: { map: map, autoViewport: true } });" + br();
            jsInfo += "  driving.search(p1, p2);" + br();

            jsInfo += "  $('#allmap').height($(window).height() - 60);" + br();
            jsInfo += "  document.title = '" + shop.city + "';" + br();

            jsInfo += "</script>";

            litJavaScript.Text = jsInfo;
        }
コード例 #3
0
        public IResponseMessageBase GetResponseMessage(RequestMessageLocation requestMessage)
        {
            #region 注释掉的
            //var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageNews>(requestMessage);

            //var markersList = new List<Markers>();
            //markersList.Add(new Markers()
            //{
            //    X = requestMessage.Location_X,
            //    Y = requestMessage.Location_Y,
            //    Color = "red",
            //    Label = "S",
            //    Size = MarkerSize.Default,
            //});
            //var mapSize = "480x600";
            //var mapUrl = GoogleMapHelper.GetGoogleStaticMap(19 /*requestMessage.Scale*//*微信和GoogleMap的Scale不一致,这里建议使用固定值*/,
            //                                                markersList, mapSize);
            //responseMessage.Articles.Add(new Article()
            //{
            //    Description = string.Format("您刚才发送了地理位置信息。Location_X:{0},Location_Y:{1},Scale:{2},标签:{3}",
            //                  requestMessage.Location_X, requestMessage.Location_Y,
            //                  requestMessage.Scale, requestMessage.Label),
            //    PicUrl = mapUrl,
            //    Title = "定位地点周边地图",
            //    Url = mapUrl
            //});
            //responseMessage.Articles.Add(new Article()
            //{
            //    Title = "微信公众平台SDK 官网链接",
            //    Description = "Senparc.Weixin.MK SDK地址",
            //    PicUrl = "http://weixin.senparc.com/images/logo1.jpg",
            //    Url = "http://www.yubom.net"
            //});

            //return responseMessage;

            #endregion

            WeiXCommFun wxcomm = new WeiXCommFun();

            string yuming = MyCommFun.getWebSite();
            int    apiid  = 38;// wxcomm.getApiid()该了

            //1 查询店面,如果查询到店面,则返回图文列表信息,如果未查询到,则返回纯文本“找不到你查询的内容”
            BLL.wx_lbs_setting   setBll  = new BLL.wx_lbs_setting();
            Model.wx_lbs_setting setting = setBll.GetSettingByWid(apiid);


            BLL.wx_lbs_shopInfo sBll = new BLL.wx_lbs_shopInfo();
            //SELECT * FROM wx_lbs_shopInfo WHERE dbo.[ufn_GetMapDistance](121.4624,31.220933,yPoint, xPoint) < 5
            IList <Model.wx_lbs_shopInfo> shopList = sBll.GetDetailList(apiid, "dbo.[ufn_GetMapDistance](" + requestMessage.Location_Y + "," + requestMessage.Location_X + ",yPoint, xPoint) < " + setting.searchRadius);

            if (shopList == null || shopList.Count <= 0)
            {  //未查询到
                var responseTextMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageText>(requestMessage);

                responseTextMessage.Content = "找不到你查询的内容";
                return(responseTextMessage);
            }
            else
            {  //查询到了数据
                var responseMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageNews>(requestMessage);
                ////第一条信息
                //responseMessage.Articles.Add(new Article()
                //{
                //    Description = string.Format("您刚才发送了地理位置信息。Location_X:{0},Location_Y:{1},Scale:{2},标签:{3}",
                //                  requestMessage.Location_X, requestMessage.Location_Y,
                //                  requestMessage.Scale, requestMessage.Label),
                //    PicUrl = yuming + "/lbsInfo/images/ditu.jpg",
                //    Title = "周边门店信息",
                //    Url = yuming + "/weixin/lbs/index.aspx?x=" + requestMessage.Location_X + "&y=" + requestMessage.Location_Y + "&wid=" + apiid + "&openid=" + requestMessage.FromUserName
                //});

                //中间n条信息 ,图文消息个数,限制为10条以内,所以中间控制最多8条信息
                for (int i = 0; i < shopList.Count; i++)
                {
                    if (i == 8)
                    {
                        break;
                    }
                    Model.wx_lbs_shopInfo shop = shopList[i];
                    string pUrl = "";
                    if (shop.shopLogo == null || shop.shopLogo.Trim() == "")
                    {
                        // pUrl = yuming + "/lbsinfo/images/logo.jpg";
                    }
                    else
                    {
                        pUrl = yuming + shop.shopLogo;
                    }
                    responseMessage.Articles.Add(new Article()
                    {
                        Title       = shop.shopName + "\n 地址:" + shop.detailAddr + "\n电话:" + shop.telphone,
                        Description = shop.shopName + "分店信息",
                        PicUrl      = pUrl,
                        Url         = yuming + "/weixin/lbs/detailAddr.aspx?shopid=" + shop.id + "&x=" + requestMessage.Location_X + "&y=" + requestMessage.Location_Y + "&wid=" + apiid + "&openid=" + requestMessage.FromUserName
                    });
                }

                //最后一条信息
                responseMessage.Articles.Add(new Article()
                {
                    Title = "更多门店>>",
                    Url   = yuming + "/weixin/lbs/index.aspx?x=" + requestMessage.Location_X + "&y=" + requestMessage.Location_Y + "&wid=" + apiid + "&openid=" + requestMessage.FromUserName
                });

                return(responseMessage);
            }
        }
コード例 #4
0
        private bool DoAdd()
        {

            #region 判断
            string strErr = "";
            if (this.txtshopName.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!";
            }
            if (this.txtLatXPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }

            if (this.txtLngYPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }
            if (this.txtTelphone.Text.Trim().Length == 0)
            {
                strErr += "电话不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");

                return false;
            }
    #endregion


            string shopName = this.txtshopName.Text;
            string telphone = this.txtTelphone.Text;
            string brief = this.txtBrief.Text;
            string shopLogo = this.txtImgUrl.Text;
            string detailAddr = this.txtAddr.Text;
            decimal xPoint = (decimal)MyCommFun.Str2Float(this.txtLatXPoint.Text);
            decimal yPoint = (decimal)MyCommFun.Str2Float(this.txtLngYPoint.Text);
            string wUrl = this.txtwUrl.Text;
            int seq = MyCommFun.Str2Int(txtSortId.Text);


            Model.wx_userweixin weixin = GetWeiXinCode();
            Model.wx_lbs_shopInfo model = new  Model.wx_lbs_shopInfo();
            model.wid = weixin.id;
            model.shopName = shopName;
            model.telphone = telphone;
            model.brief = brief;
            model.shopContent = "";
            model.shopLogo = shopLogo;

            model.detailAddr = detailAddr;
            model.xPoint = xPoint;
            model.yPoint = yPoint;
            model.wUrl = wUrl;
            model.seq = seq;
            model.createDate = DateTime.Now;
            int mid = lbsBll.Add(model);
            this.id = mid;
            if (mid > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加lbs数据信息成功,主键为:" + model.id ); //记录日志
                return true;
            }
            return false;
        }
コード例 #5
0
ファイル: lbsedit.aspx.cs プロジェクト: LinRB1573/Weixin
        private bool DoAdd()
        {
            #region 判断
            string strErr = "";
            if (this.txtshopName.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!";
            }
            if (this.txtLatXPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }

            if (this.txtLngYPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }
            if (this.txtTelphone.Text.Trim().Length == 0)
            {
                strErr += "电话不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");

                return(false);
            }
            #endregion


            string  shopName   = this.txtshopName.Text;
            string  telphone   = this.txtTelphone.Text;
            string  brief      = this.txtBrief.Text;
            string  shopLogo   = this.txtImgUrl.Text;
            string  detailAddr = this.txtAddr.Text;
            decimal xPoint     = (decimal)MyCommFun.Str2Float(this.txtLatXPoint.Text);
            decimal yPoint     = (decimal)MyCommFun.Str2Float(this.txtLngYPoint.Text);
            string  wUrl       = this.txtwUrl.Text;
            int     seq        = MyCommFun.Str2Int(txtSortId.Text);


            Model.wx_userweixin   weixin = GetWeiXinCode();
            Model.wx_lbs_shopInfo model  = new  Model.wx_lbs_shopInfo();
            model.wid         = weixin.id;
            model.shopName    = shopName;
            model.telphone    = telphone;
            model.brief       = brief;
            model.shopContent = "";
            model.shopLogo    = shopLogo;

            model.detailAddr = detailAddr;
            model.xPoint     = xPoint;
            model.yPoint     = yPoint;
            model.wUrl       = wUrl;
            model.seq        = seq;
            model.createDate = DateTime.Now;
            int mid = lbsBll.Add(model);
            this.id = mid;
            if (mid > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加lbs数据信息成功,主键为:" + model.id);  //记录日志
                return(true);
            }
            return(false);
        }
コード例 #6
0
ファイル: lbsedit.aspx.cs プロジェクト: LinRB1573/Weixin
        private bool DoEdit(int _id)
        {
            #region 判断
            string strErr = "";
            if (this.txtshopName.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!";
            }
            if (this.txtLatXPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }

            if (this.txtLngYPoint.Text.Trim().Length == 0)
            {
                strErr += "经纬度不能为空!";
            }
            if (this.txtTelphone.Text.Trim().Length == 0)
            {
                strErr += "电话不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");

                return(false);
            }
            #endregion

            string  shopName   = this.txtshopName.Text;
            string  telphone   = this.txtTelphone.Text;
            string  brief      = this.txtBrief.Text;
            string  shopLogo   = this.txtImgUrl.Text;
            string  detailAddr = this.txtAddr.Text;
            decimal xPoint     = (decimal)MyCommFun.Str2Float(this.txtLatXPoint.Text);
            decimal yPoint     = (decimal)MyCommFun.Str2Float(this.txtLngYPoint.Text);
            string  wUrl       = this.txtwUrl.Text;
            int     seq        = MyCommFun.Str2Int(txtSortId.Text);

            Model.wx_lbs_shopInfo model = lbsBll.GetModel(_id);
            model.shopName    = shopName;
            model.telphone    = telphone;
            model.brief       = brief;
            model.shopContent = "";
            model.shopLogo    = shopLogo;

            model.detailAddr = detailAddr;
            model.xPoint     = xPoint;
            model.yPoint     = yPoint;
            model.wUrl       = wUrl;
            model.seq        = seq;
            bool ret = lbsBll.Update(model);

            if (ret)
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改lbs数据信息,主键为:" + model.id); //记录日志

                return(true);
            }
            return(false);
        }