/// <summary> /// 三维添加 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Add(TD_MOUNTAIN_Model m) { if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "添加失败,请选择所属乡镇!", "")); } if (TD_MOUNTAIN.isPExists(new TD_MOUNTAIN_Model { JD = m.JD, WD = m.WD }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into MOUNTAIN(NAME,BYORGNO,BYORGNOXS,DISPLAY_X,DISPLAY_Y,Shape,VILLAGE,TYPE) values("); sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.BYORGNO)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.BYORGNOXS)); 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.VILLAGE)); 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 { return(new Message(false, "已有相同地址的山,请重新选择地址", "")); } }
/// <summary> /// 更新三维库危害等级 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message UpdateAceHarmClass(PEST_HARMCLASS_Model m) { List <string> sqllist = new List <string>(); var arrBYORGNO = m.BYORGNO.Split(','); var arrHARMCLASS = m.HARMCLASS.Split(','); var arrDCDATE = m.DCDATE.Split(','); for (int i = 0; i < arrBYORGNO.Length - 1; i++) { if (ClsSql.EncodeSql(arrHARMCLASS[i]) != "") { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" UPDATE PESTHARMCLASS SET "); sb.AppendFormat(" HARMCLASS='{0}'", ClsSql.EncodeSql(arrHARMCLASS[i])); sb.AppendFormat(",DCDATE={0}", ClsSql.saveNullField(arrDCDATE[i])); sb.AppendFormat(" WHERE BYORGNO='{0}'", ClsSql.EncodeSql(arrBYORGNO[i])); sqllist.Add(sb.ToString()); } } var j = SDEDataBaseClass.ExecuteSqlTran(sqllist); if (j >= 0) { return(new Message(true, "保存成功!", "")); } else { return(new Message(false, "保存失败,事物回滚!", "")); } }
/// <summary> /// 三维-修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(TD_POINTMARK_Model m) { if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "添加失败,所属单位必须为乡镇!", "")); } StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE CUNZHUDI"); sb.AppendFormat(" set "); sb.AppendFormat("NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",MAPNAME={0}", ClsSql.saveNullField(m.MAPNAME)); sb.AppendFormat(",BYORGNO={0}", ClsSql.saveNullField(m.BYORGNO)); sb.AppendFormat(",BYORGNOXS={0}", ClsSql.saveNullField(m.BYORGNOXS)); sb.AppendFormat(",TYPE={0}", ClsSql.saveNullField(m.TYPE)); sb.AppendFormat(",VILLAGE={0}", ClsSql.saveNullField(m.VILLAGE)); sb.AppendFormat(",DISPLAY_X={0}", ClsSql.saveNullField(m.JD)); sb.AppendFormat(",DISPLAY_Y={0}", ClsSql.saveNullField(m.WD)); sb.AppendFormat(",KIND={0}", ClsSql.saveNullField(m.KIND)); sb.AppendFormat(",TELEPHONE={0}", ClsSql.saveNullField(m.TELEPHONE)); sb.AppendFormat(",ADDRESS={0}", ClsSql.saveNullField(m.ADDRESS)); 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, "修改失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 空间库火险等级更新 根据QH_CODE更新 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message UpdateAceHuoXianDengJiByQHCODE(YJ_DANGERCLASS_Model m) { List <string> sqllist = new List <string>(); var arrBYORGNO = m.BYORGNO.Split(','); var arrDANGERCLASS = m.DANGERCLASS.Split(','); Message ms = null; StringBuilder sb1 = new StringBuilder(); for (int i = 0; i < arrBYORGNO.Length - 1; i++) { if (ClsSql.EncodeSql(arrDANGERCLASS[i]) != "") { string QHCODE = arrBYORGNO[i] + "000"; sb1.AppendFormat(" Update HUOXIANDENGJI set DValue={0}", ClsSql.EncodeSql(arrDANGERCLASS[i])); sb1.AppendFormat(" Where QH_CODE='{0}'", ClsSql.EncodeSql(QHCODE)); sqllist.Add(sb1.ToString()); sb1.Remove(0, sb1.Length); } } var j = SDEDataBaseClass.ExecuteSqlTran(sqllist); if (j >= 0) { ms = new Message(true, "保存成功!", ""); } else { ms = new Message(false, "保存失败,事物回滚!", ""); } return(ms); }
/// <summary> /// 添加三维库 /// </summary> /// <param name="m">参见模型</param> /// <param name="emid">参见模型</param> /// <returns>参见模型</returns> public static Message AddSHIPINGJIANKONG(JC_MONITOR_BASICINFO_Model m, string emid) { if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "添加失败,所属单位必须为乡镇!", "")); } StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into SHIPINGJIANKONG(OBJECTID,BYORGNO,NAME,JD,WD,Shape,ADDRESS) values("); sb.AppendFormat("{0},", ClsSql.saveNullField(emid)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.BYORGNO)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.EMNAME)); 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.ADDRESS)); bool bln = SDEDataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "添加成功!", "")); } else { return(new Message(false, "添加失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 三维-修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(TD_MOUNTAIN_Model m) { if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "修改失败,请选择所属乡镇!", "")); } StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE MOUNTAIN"); sb.AppendFormat(" set "); sb.AppendFormat("NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",BYORGNO={0}", ClsSql.saveNullField(m.BYORGNO)); sb.AppendFormat(",BYORGNOXS={0}", ClsSql.saveNullField(m.BYORGNOXS)); sb.AppendFormat(",DISPLAY_X={0}", ClsSql.saveNullField(m.JD)); sb.AppendFormat(",DISPLAY_Y={0}", ClsSql.saveNullField(m.WD)); sb.AppendFormat(",VILLAGE={0}", ClsSql.saveNullField(m.VILLAGE)); sb.AppendFormat(",TYPE={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, "修改失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 获取火情档案年份数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getHQDADT() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT distinct(YEAR) from HUOQINGDANGAN order by YEAR desc"); DataSet ds = SDEDataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 统计当前用户下自定义数据的数量 /// </summary> /// <param name="orgno"></param> /// <returns></returns> public static string getNum(string orgno) { string total = ""; string total1 = ""; string total2 = ""; StringBuilder sb = new StringBuilder(); sb.AppendFormat(" from MOUNTAIN a "); sb.AppendFormat("where 1 = 1 "); if (orgno.Substring(4, 11) == "00000000000")//获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' )", ClsSql.EncodeSql(orgno.Substring(0, 4))); } else if (orgno.Substring(6, 9) == "000000000")//获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' )", ClsSql.EncodeSql(orgno.Substring(0, 6))); } else { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(orgno.Substring(0, 9))); } string sqlC = "select count(1) " + sb.ToString(); total = SDEDataBaseClass.ReturnSqlField(sqlC); StringBuilder sb1 = new StringBuilder(); sb1.AppendFormat(" from CUNZHUDI a "); sb1.AppendFormat("where 1 = 1 "); if (orgno.Substring(4, 11) == "00000000000")//获取所有市的 { sb1.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' )", ClsSql.EncodeSql(orgno.Substring(0, 4))); } else if (orgno.Substring(6, 9) == "000000000")//获取所有县的 { sb1.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' )", ClsSql.EncodeSql(orgno.Substring(0, 6))); } else { sb1.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(orgno.Substring(0, 9))); } string sql = "select count(1) " + sb1.ToString(); total1 = SDEDataBaseClass.ReturnSqlField(sql); if (total == "") { total = "0"; } if (total1 == "") { total1 = "0"; } total2 = (int.Parse(total) + int.Parse(total1)).ToString(); return(total2); }
/// <summary> /// 判断面记录是否存在 /// </summary> /// <param name="m"></param> /// <returns></returns> public static bool isExistsArea(WILD_ANIMALDISTRIBUTEArea_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from ANIMALAREA where 1=1"); if (string.IsNullOrEmpty(m.OBJECTID) == false) { sb.AppendFormat(" and OBJECTID='{0}'", ClsSql.EncodeSql(m.OBJECTID)); } return(SDEDataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <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())); }
/// <summary> /// 判断是否存在 /// </summary> /// <param name="m"></param> /// <returns></returns> public static bool isExists(YHSWJCD_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from YHSWJCD where 1=1"); if (string.IsNullOrEmpty(m.OBJECTID) == false) { sb.AppendFormat(" and OBJECTID={0}", ClsSql.saveNullField(m.OBJECTID)); } return(SDEDataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <summary> /// 获取记录 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static DataTable getDT(TD_MOUNTAIN_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM MOUNTAIN"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.OBJECTID) == false) { sb.AppendFormat(" AND OBJECTID = '{0}'", ClsSql.EncodeSql(sw.OBJECTID)); } if (string.IsNullOrEmpty(sw.ORGNO) == false) { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.ORGNO)); } if (string.IsNullOrEmpty(sw.NAME) == false) { sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME)); } if (string.IsNullOrEmpty(sw.type) == false) { sb.AppendFormat(" AND TYPE = '{0}'", ClsSql.EncodeSql(sw.type)); } if (!string.IsNullOrEmpty(sw.BYORGNO)) { if (sw.BYORGNO.Substring(4, 11) == "00000000000")//获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4))); } else if (sw.BYORGNO.Substring(6, 9) == "000000000")//获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6))); } else if (sw.BYORGNO.Substring(9, 6) == "000000")//获取说有乡镇的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9))); } else if (sw.BYORGNO.Substring(12, 3) == "000")//获取说有村的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,12) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 12))); } else { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } } string sql = "SELECT OBJECTID,NAME,BYORGNO,BYORGNOXS,DISPLAY_X,DISPLAY_Y,Shape,VILLAGE,TYPE" + sb.ToString() + " order by BYORGNO,OBJECTID"; DataSet ds = SDEDataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 是否存在 /// </summary> /// <param name="m"></param> /// <returns></returns> public static bool isExists(TD_POINTMARK_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from CUNZHUDI where 1=1"); if (string.IsNullOrEmpty(m.JD) == false && string.IsNullOrEmpty(m.WD) == false) { sb.AppendFormat(" and DISPLAY_X='{0}'", ClsSql.EncodeSql(m.JD)); } sb.AppendFormat(" and DISPLAY_Y='{0}'", ClsSql.EncodeSql(m.WD)); return(SDEDataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <summary> /// 修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(YHSWJCD_Model m) { if (isExists(new YHSWJCD_Model { OBJECTID = m.OBJECTID }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("INSERT INTO YHSWJCD(OBJECTID, NAME, ADDRESS, DISPLAY_X, DISPLAY_Y, Shape) Values("); sb.AppendFormat("{0},", ClsSql.saveNullField(m.OBJECTID)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.ADDRESS)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.JD)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.WD)); sb.AppendFormat("{0})", m.Shape); 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 YHSWJCD SET "); sb.AppendFormat(" NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",ADDRESS={0}", ClsSql.saveNullField(m.ADDRESS)); sb.AppendFormat(",DISPLAY_X={0}", ClsSql.saveNullField(m.JD)); sb.AppendFormat(",DISPLAY_Y={0}", ClsSql.saveNullField(m.WD)); if (!string.IsNullOrEmpty(m.Shape)) { sb.AppendFormat(",Shape={0}", m.Shape); } else { sb.AppendFormat(",Shape=null"); } 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, "修改失败!", "")); } } }
/// <summary> /// 获取分页列表 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(TD_POINTMARK_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM CUNZHUDI"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.OBJECTID) == false) { sb.AppendFormat(" AND OBJECTID = '{0}'", ClsSql.EncodeSql(sw.OBJECTID)); } if (string.IsNullOrEmpty(sw.ORGNO) == false) { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.ORGNO)); } if (string.IsNullOrEmpty(sw.NAME) == false) { sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME)); } if (!string.IsNullOrEmpty(sw.BYORGNO)) { if (sw.BYORGNO.Substring(4, 5) == "00000")//获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4))); } else if (sw.BYORGNO.Substring(4, 5) == "xxxxx")//单独市 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4) + "00000")); } else if (sw.BYORGNO.Substring(6, 3) == "xxx")//获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' )", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6))); } else { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } } string sql = "SELECT OBJECTID,NAME,MAPNAME,BYORGNO,BYORGNOXS,TYPE,VILLAGE,DISPLAY_X,DISPLAY_Y,Shape,KIND,TELEPHONE,ADDRESS" + sb.ToString() + " order by BYORGNO,OBJECTID desc"; string sqlC = "select count(1) " + sb.ToString(); total = int.Parse(SDEDataBaseClass.ReturnSqlField(sqlC)); sw.curPage = PagerCls.getCurPage(new PagerSW { curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total }); DataSet ds = SDEDataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a"); return(ds.Tables[0]); }
/// <summary> /// 获取最大ID /// </summary> /// <returns></returns> public static int GetMaxOBJECTID() { string sql = "Select max(OBJECTID) from BINGCHONGHAI"; string value = SDEDataBaseClass.ReturnSqlField(sql); if (value != "") { return(int.Parse(value)); } else { return(0); } }
/// <summary> /// 点的修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(WILD_BotanyPoint_Model m) { if (TD_WILD_BOTANYDISTRIBUTE.isExists(new WILD_BotanyPoint_Model { OBJECTID = m.OBJECTID }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into BOTANYPOINT(OBJECTID,NAME,JD,WD,Shape,TYPE,BYORGNO) 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)); sb.AppendFormat("{0})", ClsSql.saveNullField(m.BYORGNO)); 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 BOTANYPOINT"); sb.AppendFormat(" set "); sb.AppendFormat("NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",JD={0}", ClsSql.saveNullField(m.JD)); sb.AppendFormat(",WD={0}", ClsSql.saveNullField(m.WD)); sb.AppendFormat(",TYPE={0}", ClsSql.saveNullField(m.TYPE)); sb.AppendFormat(",Shape={0}", m.Shape); sb.AppendFormat(",BYORGNO={0}", ClsSql.saveNullField(m.BYORGNO)); 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, "修改失败,请检查各输入框是否正确!", "")); } } }
/// <summary> /// 修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(Firedepartment_Model m) { if (Firedepartment.isExists(new Firedepartment_Model { OBJECTID = m.OBJECTID }) == false) //如果开始添加空的的经纬度之后再修改则插入空间库是添加 { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into XIAOFANGDUIWU(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 XIAOFANGDUIWU"); 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, "修改失败,请检查各输入框是否正确!", "")); } } }
/// <summary> /// 删除 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message DelSHIPINGJIANKONG(JC_MONITOR_BASICINFO_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete SHIPINGJIANKONG"); sb.AppendFormat(" where OBJECTID= '{0}'", ClsSql.EncodeSql(m.EMID)); bool bln = SDEDataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "删除成功!", "")); } else { return(new Message(false, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 删除 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message DelHONGWAIXIANGJI(JC_INFRAREDCAMERA_BASICINFO_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete HONGWAIXIANGJI"); sb.AppendFormat(" where OBJECTID= '{0}'", ClsSql.EncodeSql(m.INFRAREDCAMERAID)); bool bln = SDEDataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "删除成功!", "")); } else { return(new Message(false, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 删除 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Del(YHSWJCD_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete YHSWJCD"); 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, "删除失败!", "")); } }
/// <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, "修改失败,请检查各输入框是否正确!", "")); } } }
/// <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, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 面的删除 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message DelA(WILD_ANIMALDISTRIBUTEArea_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete ANIMALAREA"); 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, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 面的修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message MdyA(WILD_ANIMALDISTRIBUTEArea_Model m) { if (TD_WILD_ANIMALDISTRIBUTE.isExistsArea(new WILD_ANIMALDISTRIBUTEArea_Model { OBJECTID = m.OBJECTID }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into ANIMALAREA(OBJECTID,NAME,Shape,JD,WD,TYPE) values("); sb.AppendFormat("{0},", ClsSql.saveNullField(m.OBJECTID)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME)); sb.AppendFormat("{0},", m.Shape); sb.AppendFormat("{0},", ClsSql.saveNullField(m.JD)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.WD)); 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 ANIMALAREA"); sb.AppendFormat(" set "); sb.AppendFormat("NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",TYPE={0}", ClsSql.saveNullField(m.TYPE)); sb.AppendFormat(",Shape={0}", m.Shape); sb.AppendFormat(",JD={0}", ClsSql.EncodeSql(m.JD)); sb.AppendFormat(",WD={0}", ClsSql.EncodeSql(m.WD)); 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, "修改失败,请检查各输入框是否正确!", "")); } } }
/// <summary> /// 修改 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Mdy(BINGCHONGHAI_Model m) { if (isExists(new BINGCHONGHAI_Model { OBJECTID = m.OBJECTID }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" INSERT INTO BINGCHONGHAI(OBJECTID,NAME,CATEGORY,DISPLAY_X,DISPLAY_Y,Shape) values("); sb.AppendFormat("{0},", ClsSql.saveNullField(m.OBJECTID.ToString())); sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.CATEGORY)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.DISPLAY_X)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.DISPLAY_Y)); sb.AppendFormat("{0})", m.Shape); 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 BINGCHONGHAI SET "); sb.AppendFormat(" NAME={0}", ClsSql.saveNullField(m.NAME)); sb.AppendFormat(",CATEGORY={0}", ClsSql.saveNullField(m.CATEGORY)); sb.AppendFormat(",DISPLAY_X={0}", ClsSql.saveNullField(m.DISPLAY_X)); sb.AppendFormat(",DISPLAY_Y={0}", ClsSql.saveNullField(m.DISPLAY_Y)); sb.AppendFormat(",Shape={0}", m.Shape); sb.AppendFormat(" where OBJECTID= {0}", ClsSql.saveNullField(m.OBJECTID.ToString())); bool bln = SDEDataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "修改成功!", "")); } else { return(new Message(false, "修改失败!", "")); } } }
/// <summary> /// 获取公益林数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static DataTable getDT(SDE_GONGYILIN_Model model) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT *,shape.STCentroid().STX AS STX ,shape.STCentroid().STY AS STY FROM GONGYILIN Where 1=1 "); if (!string.IsNullOrEmpty(model.OBJECTID)) { sb.AppendFormat(" AND OBJECTID = {0}", ClsSql.EncodeSql(model.OBJECTID)); } if (!string.IsNullOrEmpty(model.SqlStr)) { sb.AppendFormat(" AND {0} ", model.SqlStr); } DataSet ds = SDEDataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 三维删除 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Del(TD_DUTYROUTE_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" ZERENLUXIAN"); sb.AppendFormat(" WHERE OBJECTID = '{0}'", ClsSql.EncodeSql(m.OBJECTID)); string sql = "DELETE" + sb.ToString(); bool bln = SDEDataBaseClass.ExeSql(sql); if (bln == true) { return(new Message(true, "删除成功!", "")); } else { return(new Message(false, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 增加点 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message AddPoints(T_COLLECTPOINTS_SW m) { StringBuilder sb = new StringBuilder(); ////([OBJECTID],[TYPEID],[NAME],[SHAPE]) sb.AppendFormat(" Insert INTO T_COLLECTPOINTS (OBJECTID,TYPEID,NAME,SHAPE)"); sb.AppendFormat(" values({0},{1},'{2}','{3}') ", m.OBJECTID, m.TypeId, m.NAME, m.Shape); bool bln = SDEDataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "空间数据点处理成功!", "")); } else { return(new Message(false, "空间数据点处理失败!", "")); } }
/// <summary> /// 删除 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Del(FIRERECORD_FIREINFO_Model m) { List <string> sqllist = new List <string>(); //删除FIRERECORD_FIREINFO表中的数据 StringBuilder sb1 = new StringBuilder(); sb1.AppendFormat("delete from FIRERECORD_FIREINFO "); sb1.AppendFormat(" where JCFID = '{0}'", ClsSql.EncodeSql(m.JCFID)); sqllist.Add(sb1.ToString()); //删除JC_FIRE表中的数据 StringBuilder sb2 = new StringBuilder(); sb2.AppendFormat("delete from JC_FIRE "); sb2.AppendFormat(" where JCFID ='{0}'", ClsSql.EncodeSql(m.JCFID)); sqllist.Add(sb2.ToString()); //删除JC_FIRE_PROP表中的数据 StringBuilder sb3 = new StringBuilder(); sb3.AppendFormat("delete from JC_FIRE_PROP "); sb3.AppendFormat(" where JCFID = '{0}'", ClsSql.EncodeSql(m.JCFID)); sqllist.Add(sb3.ToString()); //删除空间库HUOQINGDANGAN的数据 StringBuilder sc = new StringBuilder(); sc.AppendFormat("delete from HUOQINGDANGAN "); sc.AppendFormat(" where OBJECTID = '{0}", ClsSql.EncodeSql(m.JCFID)); var y = DataBaseClass.ExecuteSqlTran(sqllist); if (y > 0) { SDEDataBaseClass.ExeSql(sc.ToString()); return(new Message(true, "删除成功!", m.returnUrl)); } else { return(new Message(false, "删除失败,事物回滚机制!", "")); } }