示例#1
0
        public void saveShdz(HttpContext context)
        {
            try
            {
                Interfaces.Service.FenceService dbserv = new Interfaces.Service.FenceService();
                string json = context.Request.Params["json"];
                string cxh  = context.Request.Params["cxh"];
                yw_wldw_gnkh_shdzEntity model = JsonConvert.DeserializeObject <yw_wldw_gnkh_shdzEntity>(json);

                if (string.IsNullOrEmpty(model.shdz))
                {
                    throw new Exception("收货地址不能为空");
                }

                if (string.IsNullOrEmpty(cxh))
                {
                    dbserv.addShdz(model);
                }
                else
                {
                    dbserv.updateBaseShdz(model);
                }
                res.result = true;
            }
            catch (Exception ex)
            {
                res.result = true;
                res.msg    = ex.Message;
            }
        }
示例#2
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);
            }
        }
示例#3
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;
        }
示例#4
0
 public void updateShdz(yw_wldw_gnkh_shdzEntity model)
 {
     using (conn = ConnectionFactory.CreateConnection())
     {
         if (conn.State == ConnectionState.Closed)
         {
             conn.Open();
         }
         string sql = " update yw_wldw_gnkh_shdz set jd=@jd,wd=@wd,fw=@fw,type=@type,points=@points where yw_khbm=@yw_khbm  and cxh=@cxh ";
         conn.Execute(sql, model);
     }
 }
示例#5
0
 /// <summary>
 /// 修改基本信息
 /// </summary>
 /// <param name="model"></param>
 public void updateBaseShdz(yw_wldw_gnkh_shdzEntity model)
 {
     using (conn = ConnectionFactory.CreateConnection())
     {
         if (conn.State == ConnectionState.Closed)
         {
             conn.Open();
         }
         string sql = " update yw_wldw_gnkh_shdz set shdz=@shdz,dz_sf=@dz_sf,dz_dq=@dz_dq,dz_lm=@dz_lm,sfgx=@sfgx,scmc=@scmc where yw_khbm=@yw_khbm  and cxh=@cxh ";
         conn.Execute(sql, model);
     }
 }
示例#6
0
 public void addShdz(yw_wldw_gnkh_shdzEntity model)
 {
     using (conn = ConnectionFactory.CreateConnection())
     {
         if (conn.State == ConnectionState.Closed)
         {
             conn.Open();
         }
         model.cxh  = getNewCxh(model.yw_khbm).ToString();
         model.lrrq = DateTime.Now;
         string sql = " insert into yw_wldw_gnkh_shdz  (yw_khbm,cxh,shdz,dz_sf,dz_dq,dz_lm,sfgx,scmc)values(@yw_khbm,@cxh,@shdz,@dz_sf,@dz_dq,@dz_lm,@sfgx,@scmc) ";
         conn.Execute(sql, model);
     }
 }