Example #1
0
        /// <summary>
        /// 判断是否存在
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static bool isExists(TD_CAMP_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select 1 from YINGFANG where 1=1");
            if (string.IsNullOrEmpty(m.OBJECTID) == false)
            {
                sb.AppendFormat(" and OBJECTID='{0}'", ClsSql.EncodeSql(m.OBJECTID));
            }
            return(SDEDataBaseClass.JudgeRecordExists(sb.ToString()));
        }
Example #2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="m"></param>
 /// <returns></returns>
 public static Message Mdy(TD_CAMP_Model m)
 {
     if (TD_CAMP.isExists(new TD_CAMP_Model {
         OBJECTID = m.OBJECTID
     }) == false)
     {
         StringBuilder sb = new StringBuilder();
         sb.AppendFormat("insert into YINGFANG(OBJECTID,NAME,DISPLAY_X,DISPLAY_Y,Shape,category) values(");
         sb.AppendFormat("{0},", ClsSql.saveNullField(m.OBJECTID));
         sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME));
         sb.AppendFormat("{0},", ClsSql.saveNullField(m.JD));
         sb.AppendFormat("{0},", ClsSql.saveNullField(m.WD));
         sb.AppendFormat("{0},", m.Shape);
         sb.AppendFormat("{0})", ClsSql.saveNullField(m.TYPE));
         bool bln = SDEDataBaseClass.ExeSql(sb.ToString());
         if (bln == true)
         {
             return(new Message(true, "添加成功!", ""));
         }
         else
         {
             return(new Message(false, "添加失败,请检查各输入框是否正确!", ""));
         }
     }
     else
     {
         StringBuilder sb = new StringBuilder();
         sb.AppendFormat("UPDATE YINGFANG");
         sb.AppendFormat(" set ");
         sb.AppendFormat("NAME={0}", ClsSql.saveNullField(m.NAME));
         sb.AppendFormat(",DISPLAY_X={0}", ClsSql.saveNullField(m.JD));
         sb.AppendFormat(",DISPLAY_Y={0}", ClsSql.saveNullField(m.WD));
         sb.AppendFormat(",category={0}", ClsSql.saveNullField(m.TYPE));
         sb.AppendFormat(",Shape={0}", m.Shape);
         sb.AppendFormat(" where OBJECTID= {0}", ClsSql.saveNullField(m.OBJECTID));
         bool bln = SDEDataBaseClass.ExeSql(sb.ToString());
         if (bln == true)
         {
             return(new Message(true, "修改成功!", ""));
         }
         else
         {
             return(new Message(false, "修改失败,请检查各输入框是否正确!", ""));
         }
     }
 }
Example #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message Del(TD_CAMP_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("delete YINGFANG");
            sb.AppendFormat(" where OBJECTID= '{0}'", ClsSql.EncodeSql(m.OBJECTID));
            bool bln = SDEDataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败,请检查各输入框是否正确!", ""));
            }
        }
Example #4
0
        /// <summary>
        /// 三维-车辆
        /// </summary>

        public static Message Manager(TD_CAMP_Model m)
        {
            if (m.opMethod == "Add")
            {
                Message msgUser = BaseDT.SDE.TD_CAMP.Add(m);
                return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
            }
            if (m.opMethod == "Mdy")
            {
                Message msgUser = BaseDT.SDE.TD_CAMP.Mdy(m);
                return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
            }

            if (m.opMethod == "Del")
            {
                Message msgUser = BaseDT.SDE.TD_CAMP.Del(m);
                return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
            }
            return(new Message(false, "无效操作", ""));
        }
Example #5
0
        /// <summary>
        /// 三维营房
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message Add(TD_CAMP_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("insert into YINGFANG(OBJECTID,NAME,DISPLAY_X,DISPLAY_Y,Shape,category) values(");
            sb.AppendFormat("{0},", ClsSql.saveNullField(m.OBJECTID));
            sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME));
            sb.AppendFormat("{0},", ClsSql.saveNullField(m.JD));
            sb.AppendFormat("{0},", ClsSql.saveNullField(m.WD));
            sb.AppendFormat("{0},", m.Shape);
            sb.AppendFormat("{0})", ClsSql.saveNullField(m.TYPE));
            bool bln = SDEDataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "添加成功!", ""));
            }
            else
            {
                return(new Message(false, "添加失败,请检查各输入框是否正确!", ""));
            }
        }
Example #6
0
        /// <summary>
        /// 护林员上传
        /// </summary>
        /// <param name="filePath">文件路径</param>
        public static void CAMPUpload(string filePath)
        {
            HSSFWorkbook hssfworkbook;

            try
            {
                using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    hssfworkbook = new HSSFWorkbook(file);
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0);
            int rowCount = sheet.LastRowNum;

            for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
            {
                IRow     row = sheet.GetRow(i);
                string[] arr = new string[12];
                for (int k = 0; k < arr.Length; k++)
                {
                    if (k != 6)
                    {
                        arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容
                    }
                    else
                    {
                        arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd");
                    }
                }
                DC_UTILITY_CAMP_Model m = new DC_UTILITY_CAMP_Model();
                //单位	结构类型 名称 编号 建筑面积 楼层 建设日期 附属设施 价值 经度 纬度
                if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[2]))
                {
                    continue;
                }
                m.ORGNOS    = BaseDT.T_SYS_ORG.getCodeByName(arr[0]);
                m.NAME      = arr[2];
                m.NUMBER    = arr[3];
                m.AREA      = arr[4];
                m.FLOOR     = arr[5];
                m.BUILDDATE = arr[6];
                if (m.BUILDDATE == "9999-12-31")
                {
                    m.BUILDDATE = "1900-01-01";
                }
                m.SUBFACILITIES = arr[7];
                m.WORTH         = arr[8];
                string jd = arr[9];
                string wd = arr[10];
                if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false)
                {
                    double[] brr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1");
                    m.JD = brr[1].ToString();
                    m.WD = brr[0].ToString();
                }
                if (arr[1].Trim() == "钢构")//装备类型
                {
                    m.STRUCTURETYPE = "1";
                }
                else if (arr[1].Trim() == "砖混")
                {
                    m.STRUCTURETYPE = "2";
                }
                else if (arr[1].Trim() == "钢混")
                {
                    m.STRUCTURETYPE = "3";
                }
                else
                {
                    m.STRUCTURETYPE = "1";
                }
                var ms = BaseDT.DC_UTILITY_CAMP.Add(m);
                if (string.IsNullOrEmpty(jd) == false && string.IsNullOrEmpty(wd) == false)
                {
                    TD_CAMP_Model m1 = new TD_CAMP_Model();
                    m1.OBJECTID = ms.Url;
                    m1.NAME     = m.NAME;
                    m1.TYPE     = m.STRUCTURETYPE;
                    m1.JD       = jd;
                    m1.WD       = wd;
                    m1.Shape    = "geometry::STGeomFromText('POINT(" + m1.JD + " " + m1.WD + ")',4326)";
                    BaseDT.SDE.TD_CAMP.Add(m1);
                }
                string a  = row.GetCell(0).ToString();
                string a1 = row.GetCell(1).ToString();
                string a2 = row.GetCell(2).ToString();
            }
        }