示例#1
0
        protected override string OnExecute()
        {
            SpRequestMsg pSpRequestMsg  = new SpRequestMsg();
            DataTable    dtDetail       = null;
            string       pRequestguid   = string.Empty;
            HttpContext  context        = this.SpContext as HttpContext;
            string       dateStart      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string       InspectionGuid = string.Empty;
            string       sqlSelectguid  = "select max(cid) from p_gas_inspection";
            DataTable    dtGetguid      = new DataTable();

            dtGetguid = ApplicationManager.DefaultConnection.QueryData(sqlSelectguid).Tables[0];
            if (dtGetguid.Rows[0][0].ToString() == "")
            {
                InspectionGuid = "1";
            }
            if (dtGetguid.Rows[0][0].ToString() != "")
            {
                int maxguid = Convert.ToInt32(dtGetguid.Rows[0][0]) + 1;
                InspectionGuid = Convert.ToString(maxguid);
            }
            string           xjjd = context.Request["xjjd"] ?? ""; //经度
            string           xjwd = context.Request["xjwd"] ?? ""; //纬度
            string           xjdz = context.Request["xjdz"] ?? ""; //巡检地址
            string           xjyh = context.Request["xjyh"] ?? ""; //巡检用户cid
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();

            try
            {
                dtDetail = service.QueryInspectionData(InspectionGuid, dateStart, xjjd, xjwd, xjdz, xjyh);

                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "巡检开始成功";
                pSpRequestMsg.data    = pRequestguid;
                pRequestguid          = ValueHelper.DataTable2Json(dtDetail);
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "巡检获取异常,详情" + ex.Message;
                pSpRequestMsg.data    = "";
                Log.Error("巡检详情获取异常:" + ex.Message.ToString());
                return(pSpRequestMsg.ToNormalJson());
            }
            return(dtDetail.ToJsonStore(true, dtDetail.Rows.Count));
        }
示例#2
0
        protected override string OnExecute()
        {
            SpRequestMsg pSpRequestMsg  = new SpRequestMsg();
            string       pRequestguid   = string.Empty;
            string       pRequestzpwjmc = string.Empty;
            var          dic            = RequestData.FromJson <Dictionary <string, string> >();

            pRequestguid   = dic.ContainsKey("guid") ? dic["guid"] : "";//序号
            pRequestzpwjmc = dic.ContainsKey("image") ? dic["image"] : "";
            if (string.IsNullOrEmpty(pRequestguid))
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "返回guid为空!";
                pSpRequestMsg.data    = "";
                return(pSpRequestMsg.ToNormalJson());
            }
            if (string.IsNullOrEmpty(pRequestzpwjmc))
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "传入图片为空!";
                pSpRequestMsg.data    = "";
                return(pSpRequestMsg.ToNormalJson());
            }
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();

            try
            {
                string    NameImg  = ValueHelper.ToImage(pRequestzpwjmc);
                DataTable dtDetail = service.QueryInsertImage(pRequestguid, NameImg);
                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "插入图片成功";
                pSpRequestMsg.data    = dtDetail.ToJson();
                pRequestguid          = ValueHelper.DataTable2Json(dtDetail);
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "插入信息获取异常,详情" + ex.Message;
                pSpRequestMsg.data    = "";
                Log.Error("插入信息详情获取异常:" + ex.Message.ToString());
            }

            return(pSpRequestMsg.ToNormalJson());
            // return pRequestguid;
        }
示例#3
0
        protected override string OnExecute()
        {
            SpRequestMsg pSpRequestMsg = new SpRequestMsg();
            string       JsonData      = string.Empty;
            string       tableName     = "p_terminal";                                             //设备表
            string       fields        = "cid,jxh,sbbm,jkfl,sbmc,jd,wd,jdmc,lxdh,ssdw,dwdz,dwlxr"; //返回字段
            HttpContext  context       = this.SpContext as HttpContext;
            string       cid           = context.Request["cid"] ?? "";

            if (string.IsNullOrEmpty(cid))
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "设备唯一标识不能为空!";
                pSpRequestMsg.data    = "";
                return(pSpRequestMsg.ToNormalJson());
            }
            string strWhere = string.Format("cid={0}", cid);

            ValueHelper.TerminalCid = cid;
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();
            DataTable        dtDetail          = null;

            try
            {
                dtDetail = service.QueryData(fields, tableName, strWhere, cid);
                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "设备详情获取成功";
                pSpRequestMsg.data    = JsonData;
                JsonData = ValueHelper.DataTable2Json(dtDetail);
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "设备详情获取异常,详情" + ex.Message;
                // pSpRequestMsg.data = "";
                Log.Error("设备详情获取异常:" + ex.Message.ToString());
                return(pSpRequestMsg.ToNormalJson());
            }
            // return JsonData;//返回json字符串数据
            //return pSpRequestMsg.ToNormalJson();
            return(dtDetail.ToJsonStore(true, dtDetail.Rows.Count));
        }
示例#4
0
        protected override string OnExecute()
        {
            SpRequestMsg     pSpRequestMsg     = new SpRequestMsg();
            SpRequestMsgData pSpRequestMsgdata = new SpRequestMsgData();
            DataTable        dtDetail          = null;
            string           JsonData          = string.Empty;
            string           tableName         = "p_user";   //用户信息
            string           fields            = "xm,dh,wx"; //返回字段
            HttpContext      context           = this.SpContext as HttpContext;
            string           cid = context.Request["usercid"] ?? "";

            // string cid = ValueHelper.pwdcid;
            if (string.IsNullOrEmpty(cid))
            {
                pSpRequestMsgdata.success  = false;
                pSpRequestMsgdata.message  = "唯一标识不能为空!";
                pSpRequestMsgdata.Jsondata = "";
                return(JsonData);
            }
            string           strWhere          = string.Format("cid={0}", cid);
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();

            try
            {
                dtDetail = service.QueryUserData(fields, tableName, strWhere, cid);
                pSpRequestMsgdata.success = true;
                pSpRequestMsgdata.message = "用户详情获取成功";
                JsonData = ValueHelper.DataTable2Json(dtDetail);
                pSpRequestMsgdata.Jsondata = JsonData;
            }
            catch (Exception ex)
            {
                pSpRequestMsgdata.success  = false;
                pSpRequestMsgdata.message  = "用户详情获取异常,详情" + ex.Message;
                pSpRequestMsgdata.Jsondata = "";
                Log.Error("用户详情获取异常:" + ex.Message.ToString());
                return(pSpRequestMsg.ToNormalJson());
            }

            // return JsonData;
            return(dtDetail.ToJsonStore(true, dtDetail.Rows.Count));
        }
示例#5
0
        protected override string OnExecute()
        {
            DataTable    dtDetail      = null;
            SpRequestMsg pSpRequestMsg = new SpRequestMsg();
            string       pRequestguid  = string.Empty;
            HttpContext  context       = this.SpContext as HttpContext;
            string       Inspectguid   = context.Request["xjguid"] ?? "";
            string       xjjd          = context.Request["xjjd"] ?? "";
            string       xjwd          = context.Request["xjwd"] ?? "";
            string       xjdz          = context.Request["xjdz"] ?? "";
            string       xjyh          = context.Request["xjyh"] ?? "";//巡检用户cid
            string       dateStop      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            if (string.IsNullOrEmpty(Inspectguid))
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "返回guid为空!";
                pSpRequestMsg.data    = "";
                return(pSpRequestMsg.ToNormalJson());
            }
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();

            try
            {
                dtDetail = service.QueryInsertExitDate(Inspectguid, dateStop, xjjd, xjwd, xjdz, xjyh);
                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "巡检结束成功";
                pSpRequestMsg.data    = dtDetail.ToJson();
                pRequestguid          = ValueHelper.DataTable2Json(dtDetail);
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "巡检获取异常,详情" + ex.Message;
                pSpRequestMsg.data    = "";
                Log.Error("巡检详情获取异常:" + ex.Message.ToString());
                return(pSpRequestMsg.ToNormalJson());
            }
            return(dtDetail.ToJsonStore(true, dtDetail.Rows.Count));
        }
        protected override string OnExecute()
        {
            //获取传入参数
            HttpContext context = this.SpContext as HttpContext;

            context.Response.ContentType = "text/html";
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic = RequestData.FromJson <Dictionary <string, string> >();

            DataTable    dtDetail      = null;
            SpRequestMsg pSpRequestMsg = new SpRequestMsg();
            string       pRequestguid  = string.Empty;
            string       yhcid         = string.Empty;

            pRequestguid = dic["guid"] ?? "";                                           //
            string    pRequestxjnrjjl = dic["xjnrjjl"] ?? "";                           //获取结论上报内容
            string    datesbsj        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");   //上报时间
            string    sqlSelectguid   = "select max(cid) from p_gas_inspection_hidden"; //查询出隐患表的最大cid值
            DataTable dtGetguid       = new DataTable();

            dtGetguid = ApplicationManager.DefaultConnection.QueryData(sqlSelectguid).Tables[0];
            if (dtGetguid.Rows[0][0].ToString() == "")
            {
                yhcid = "1";
            }
            if (dtGetguid.Rows[0][0].ToString() != "")
            {
                int maxguid = Convert.ToInt32(dtGetguid.Rows[0][0]) + 1;
                yhcid = Convert.ToString(maxguid);
            }
            if (string.IsNullOrEmpty(pRequestguid))
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "返回guid为空!";
                pSpRequestMsg.data    = "";
                return(pSpRequestMsg.ToNormalJson());
            }
            SpPagingResponse pSpPagingResponse = new SpPagingResponse();
            IUtilService     service           = SpServiceFactory.CreateUtilService();

            try
            {
                SavePicAction savepic      = new SavePicAction();
                List <string> listImgeName = new List <string>();
                listImgeName = savepic.SaveUploadFileList(context, "GasPhoto");
                string NameImgs = "";
                Log.Info("listImgeName:" + listImgeName.Count);
                for (int i = 0; i < listImgeName.Count; i++)
                {
                    if (listImgeName[i].ToString() == "")
                    {
                    }
                    else
                    {
                        NameImgs += listImgeName[i].ToString() + ";";
                    }
                }
                dtDetail = service.QueryInsertImageList(pRequestguid, NameImgs, pRequestxjnrjjl, datesbsj, yhcid);
                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "上报信息成功";
                pSpRequestMsg.data    = dtDetail.ToJson();
                pRequestguid          = ValueHelper.DataTable2Json(dtDetail);
                //Log.Info("结果:上报信息成功");
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "插入信息获取异常,详情" + ex.Message;
                pSpRequestMsg.data    = "";
                Log.Error("插入信息详情获取异常:" + ex.Message.ToString());
                return(pSpRequestMsg.ToNormalJson());
            }
            return(dtDetail.ToJsonStore(true, dtDetail.Rows.Count));
        }