示例#1
0
        public void updateElectronicFence(HttpContext context)
        {
            try
            {
                string json = context.Request.Params["json"];
                writeLog(json);
                authorityCheck(context);
                ElectronicFence         param = JsonConvert.DeserializeObject <ElectronicFence>(json);
                string[]                id    = param.uniqueId.Split('_');
                yw_wldw_gnkh_shdzEntity m     = new yw_wldw_gnkh_shdzEntity();
                m.yw_khbm = id[0];
                m.cxh     = id[1];
                if (param.style == "circle")
                {
                    m.type = 0;
                    m.fw   = param.radius;
                    m.jd   = param.lng;
                    m.wd   = param.lat;
                }
                else
                {
                    m.type   = 1;
                    m.points = param.points;
                }

                new Interfaces.Service.FenceService().updateShdz(m);
                res.result = true;
            }
            catch (Exception ex)
            {
                res.msg    = ex.Message;
                res.result = false;
                writeLog("updateElectronicFence出现异常:" + ex.Message);
            }
        }
示例#2
0
        public void getCreatFenceUrl(HttpContext context)
        {
            string createFenceBaseUrl = baseUrl + "/showFenceInfoPage.do";
            string logid = context.Request.Params["logid"];
            string token = HttpUtility.UrlEncode(DESEncrypt(userid));
            yw_wldw_gnkh_shdzEntity m1 = JsonConvert.DeserializeObject <yw_wldw_gnkh_shdzEntity>(context.Request.Params["json"]);

            ElectronicFence m = new ElectronicFence();

            m.uniqueId = m1.yw_khbm + "_" + m1.cxh;
            m.userId   = userid;
            m.lat      = m1.wd;
            m.lng      = m1.jd;
            m.radius   = m1.fw;
            m.address  = m1.shdz;
            m.style    = m1.type == 1 ? "polygon" : "circle";
            if (!string.IsNullOrEmpty(m1.points))
            {
                m.points = m1.points.Replace("\"", "\'");
            }

            var json = JsonConvert.SerializeObject(m, setting);

            string param = "?userId=" + userid + "&token=" + token + "&tools=1&json=" + HttpUtility.UrlEncode(json);

            res.data = createFenceBaseUrl + param;
        }