/// <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="dt">dt</param> /// <param name="orgNo">orgNo</param> /// <param name="DICTVALUE">DICTVALUE</param> /// <returns></returns> public static string getMCount(DataTable dt, string orgNo, string DICTVALUE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 return dt.Rows.Count.ToString(); if (PublicCls.OrgIsShi(orgNo))//市 { if (string.IsNullOrEmpty(DICTVALUE)) return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString(); else return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and ARMYTYPE='" + DICTVALUE + "'").ToString(); } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString(); else return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and ARMYTYPE='" + DICTVALUE + "'").ToString(); } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString(); else return dt.Compute("Sum(ARMYMEMBERCOUNT)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and ARMYTYPE='" + DICTVALUE + "'").ToString(); } else //机构编码可能不正确 return ""; }
/// <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 JsonResult getSHFKCount() { Message ms = null; int count = 0; var curog = SystemCls.getCurUserOrgNo(); var bo = PublicCls.OrgIsShi(curog); //市 var bb = PublicCls.OrgIsXian(curog); //县 var bx = PublicCls.OrgIsZhen(curog); //镇 if (bo) { var list = JC_FIRECls.GetListModel(new JC_FIRE_SW { MANSTATESTR = "11,15" }); count = list.Count(); } else if (bb) { var list = JC_FIRECls.GetListModel(new JC_FIRE_SW { MANSTATESTR = "31,32,33,34" }); count = list.Count(); } else if (bx) { var list = JC_FIRECls.GetListModel(new JC_FIRE_SW { MANSTATESTR = "0,51" }); count = list.Count(); } ms = new Message(true, count.ToString(), ""); return(Json(ms)); }
/// <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> /// 修改 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Mdy(JC_MONITOR_BASICINFO_Model m) {//, XH, PP, GD, JCJL if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "修改失败,所属单位必须为乡镇!", "")); } StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE JC_MONITOR_BASICINFO"); sb.AppendFormat(" set "); sb.AppendFormat("TTBH='{0}'", ClsSql.EncodeSql(m.TTBH)); sb.AppendFormat(",EMNAME='{0}'", ClsSql.EncodeSql(m.EMNAME)); sb.AppendFormat(",BYORGNO='{0}'", ClsSql.EncodeSql(m.BYORGNO)); if (string.IsNullOrEmpty(m.JD) == false) { sb.AppendFormat(",JD='{0}'", ClsSql.EncodeSql(m.JD)); } if (string.IsNullOrEmpty(m.WD) == false) { sb.AppendFormat(",WD='{0}'", ClsSql.EncodeSql(m.WD)); } if (string.IsNullOrEmpty(m.GC) == false) { sb.AppendFormat(",GC='{0}'", ClsSql.EncodeSql(m.GC)); } sb.AppendFormat(",ADDRESS='{0}'", ClsSql.EncodeSql(m.ADDRESS)); sb.AppendFormat(",IP='{0}'", ClsSql.EncodeSql(m.IP)); sb.AppendFormat(",LOGINUSERNAME='******'", ClsSql.EncodeSql(m.LOGINUSERNAME)); sb.AppendFormat(",USERPWD='{0}'", ClsSql.EncodeSql(m.USERPWD)); sb.AppendFormat(",XH='{0}'", ClsSql.EncodeSql(m.XH)); sb.AppendFormat(",PP='{0}'", ClsSql.EncodeSql(m.PP)); if (string.IsNullOrEmpty(m.GD) == false) { sb.AppendFormat(",GD='{0}'", ClsSql.EncodeSql(m.GD)); } if (string.IsNullOrEmpty(m.JCJL) == false) { sb.AppendFormat(",JCJL='{0}'", ClsSql.EncodeSql(m.JCJL)); } sb.AppendFormat(",OBJID='{0}'", ClsSql.EncodeSql(m.OBJID)); sb.AppendFormat(",TEMPLATEDID='{0}'", ClsSql.EncodeSql(m.TEMPLATEDID)); sb.AppendFormat(",PORT='{0}'", ClsSql.EncodeSql(m.PORT)); sb.AppendFormat(",TYPE='{0}'", ClsSql.EncodeSql(m.TYPE)); sb.AppendFormat(" where EMID= '{0}'", ClsSql.EncodeSql(m.EMID)); bool bln = DataBaseClass.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(JC_FIRE_PLAN_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_FIRE_PLAN"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.JC_FIRE_PLANID) == false) { sb.AppendFormat(" AND JC_FIRE_PLANID = '{0}'", ClsSql.EncodeSql(sw.JC_FIRE_PLANID)); } if (string.IsNullOrEmpty(sw.FIRELEVEL) == false) { sb.AppendFormat(" AND FIRELEVEL = '{0}'", ClsSql.EncodeSql(sw.FIRELEVEL)); } if (string.IsNullOrEmpty(sw.PLANTITLE) == false) { sb.AppendFormat(" AND PLANTITLE like '%{0}%'", ClsSql.EncodeSql(sw.PLANTITLE)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { if (PublicCls.OrgIsShi(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsXian(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsZhen(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } else { sb.AppendFormat(" and BYORGNO = '{0}'", sw.BYORGNO); } } string sql = "SELECT JC_FIRE_PLANID, BYORGNO, FIRELEVEL, PLANTITLE, PLANCONTENT, PLANFILENAME" + sb.ToString() + " order by BYORGNO ,FIRELEVEL"; string sqlC = "select count(1) " + sb.ToString(); total = int.Parse(DataBaseClass.ReturnSqlField(sqlC)); sw.curPage = PagerCls.getCurPage(new PagerSW { curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total }); DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a"); return(ds.Tables[0]); }
/// <summary> /// 签收状态(仅限签收由于签收无顺序性 所以不能用最新时间的记录的状态来判断) /// </summary> /// <param name="orgno"></param> /// <param name="state"></param> /// <returns></returns> public static string QSStateNewList(string orgno, List <string> statelist) { string str = ""; bool bo = PublicCls.OrgIsShi(orgno);//是否为市 if (bo) { if (statelist.Contains("1") || statelist.Contains("4")) { str = "已签收"; } else { str = "未签收"; } } else { bool bb = PublicCls.OrgIsXian(orgno);//是否为县 if (bb) { if (statelist.Contains("2") || statelist.Contains("32")) { str = "已签收"; } else { str = "未签收"; } } else { bool bc = PublicCls.OrgIsZhen(orgno);//是否为乡镇 if (bc) { if (statelist.Contains("3")) { str = "已签收"; } else { str = "未签收"; } } } } return(str); }
/// <summary> /// 根据DataTable和OrgNo和队伍类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// /// <param name="DICTVALUE">队伍类型</param> /// <returns>记录个数</returns> public static string getCountXSByOrgNo(DataTable dt, string orgNo, string DICTVALUE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 return dt.Rows.Count.ToString(); if (PublicCls.OrgIsZhen(orgNo) == false) { string result = ""; if (string.IsNullOrEmpty(DICTVALUE)) result=dt.Compute("count(DC_ARMY_ID)", "BYORGNO='" + orgNo + "'").ToString(); else result =dt.Compute("count(DC_ARMY_ID)", "BYORGNO='" + orgNo + "' and ARMYTYPE='" + DICTVALUE + "'").ToString(); return result; } else //机构编码可能不正确 return ""; }
/// <summary> /// 根据DataTable和OrgNo和装备类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <param name="DICTVALUE">装备的各个类型</param> /// /// <param name="TYPE">确定统计那个装备的类型</param> /// <returns>记录个数</returns> public static string getCountXSByOrgNo(DataTable dt, string orgNo, string DICTVALUE, string TYPE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (TYPE == "1")//统计装备类型 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_EQUIP_NEW_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_EQUIP_NEW_ID)", "BYORGNO='" + orgNo + "' and EQUIPTYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "2")//统计使用现状 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_EQUIP_NEW_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_EQUIP_NEW_ID)", "BYORGNO='" + orgNo + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } else { return(""); } }
/// <summary> /// 获取分页数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(JC_INFRAREDCAMERA_BASICINFO_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_INFRAREDCAMERA_BASICINFO a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.INFRAREDCAMERAID) == false) { sb.AppendFormat(" AND INFRAREDCAMERAID = '{0}'", ClsSql.EncodeSql(sw.INFRAREDCAMERAID)); } if (string.IsNullOrEmpty(sw.PHONE) == false) { sb.AppendFormat(" AND PHONE = '{0}'", ClsSql.EncodeSql(sw.PHONE)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { if (PublicCls.OrgIsShi(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsXian(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsZhen(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } else { sb.AppendFormat(" and BYORGNO = '{0}'", sw.BYORGNO); } } string sql = "SELECT INFRAREDCAMERAID,BYORGNO,INFRAREDCAMERANAME,PHONE,JD,WD,GC,ADDRESS" + sb.ToString() + " order by BYORGNO"; string sqlC = "select count(1) " + sb.ToString(); total = int.Parse(DataBaseClass.ReturnSqlField(sqlC)); sw.curPage = PagerCls.getCurPage(new PagerSW { curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total }); DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a"); return(ds.Tables[0]); }
/// <summary> /// 统计队伍人数 /// </summary> /// <param name="dt">dt</param> /// <param name="orgNo">orgNo</param> /// <param name="DICTVALUE">DICTVALUE</param> /// <returns></returns> public static string getMXSCount(DataTable dt, string orgNo, string DICTVALUE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 return dt.Rows.Count.ToString(); if (PublicCls.OrgIsZhen(orgNo)==false) { if (string.IsNullOrEmpty(DICTVALUE)) return dt.Compute("Sum(ARMYMEMBERCOUNT)", "BYORGNO='" + orgNo + "'").ToString(); else return dt.Compute("Sum(ARMYMEMBERCOUNT)", "BYORGNO='" + orgNo + "' and ARMYTYPE='" + DICTVALUE + "'").ToString(); } else //机构编码可能不正确 return ""; }
/// <summary> /// 判断护林员当前是否在线 /// </summary> /// <example> /// 传递参数: /// sw.USERID 护林员ID列表,多用户以逗号分隔 /// sw.SearchTime 查询时间,空默认取当前时间 /// sw.ORGNO 组织机构编码,非空取该组织机构下的所有护林员 /// </example> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static DataTable getOnLineDtByOrgno(T_IPS_REALDATATEMPORARYSW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" SELECT a.BYORGNO,a.HNAME,a.PHONE,a.ONSTATE,a.HID,b.SBTIME,b.ISOUTRAIL"); sb.AppendFormat(" FROM T_IPSFR_USER a left outer join T_IPS_REALDATATEMPORARY b on a.HID=b.USERID"); sb.AppendFormat(" where a.ISENABLE=1");//护林员启用状态 if (string.IsNullOrEmpty(sw.USERID) == false) { sb.AppendFormat(" and a.HID in({0})", sw.USERID); } if (string.IsNullOrEmpty(sw.SearchTime)) { sb.AppendFormat(" and DATEDIFF(mi,SBTIME,'{1}') <= '{0}' ", ConfigCls.inLineTimeInterval().ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } else { sb.AppendFormat(" and DATEDIFF(mi,SBTIME,'{1}') >= '{0}'", ConfigCls.inLineTimeInterval().ToString(), sw.SearchTime); } if (string.IsNullOrEmpty(sw.ORGNO) == false) { if (PublicCls.OrgIsShi(sw.ORGNO)) { sb.AppendFormat(" and a.BYORGNO like'{0}%'", PublicCls.getShiIncOrgNo(sw.ORGNO)); } else if (PublicCls.OrgIsXian(sw.ORGNO)) { sb.AppendFormat(" and a.BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.ORGNO)); } else if (PublicCls.OrgIsZhen(sw.ORGNO)) { sb.AppendFormat(" and a.BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(sw.ORGNO)); } else if (PublicCls.OrgIsCun(sw.ORGNO)) { sb.AppendFormat(" and a.BYORGNO like '{0}'", PublicCls.getCunIncOrgNo(sw.ORGNO)); } } if (string.IsNullOrEmpty(sw.PhoneHname) == false) { sb.AppendFormat(" AND (a.PHONE like '%{0}%' or a.HNAME like '%{0}%')", ClsSql.EncodeSql(sw.PhoneHname)); } return(DataBaseClass.FullDataSet(sb.ToString()).Tables[0]); }
/// <summary> /// 根据DataTable和OrgNo和瞭望台类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <param name="DICTVALUE">结构类型值</param> /// <returns>记录个数</returns> public static string getCountOVERWATCHByOrgNo(DataTable dt, string orgNo, string DICTVALUE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (PublicCls.OrgIsShi(orgNo))//市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 根据DataTable、orgNo和SBDATE判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <param name="SBDATE">上报日期</param> /// <returns>记录个数</returns> public static string getCountByOrgNoSBDATE(DataTable dt, string orgNo, string SBDATE) { if (PublicCls.OrgIsShi(orgNo))//市 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and SBDATE='" + SBDATE + "'").ToString()); } else if (PublicCls.OrgIsXian(orgNo))//县 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and SBDATE='" + SBDATE + "'").ToString()); } else if (PublicCls.OrgIsZhen(orgNo)) { return(dt.Compute("count(HID)", "BYORGNO='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and SBDATE='" + SBDATE + "'").ToString()); } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 正常的 /// </summary> /// <param name="dt"></param> /// <param name="orgNo"></param> /// <param name="LengthError"></param> /// <returns>参见模型</returns> public static string getCountByPatrolLengthError(DataTable dt, string orgNo, float LengthError) { if (PublicCls.OrgIsShi(orgNo))//市 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and PatrolLenError>=" + LengthError.ToString()).ToString()); } else if (PublicCls.OrgIsXian(orgNo))//县 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and PatrolLenError>=" + LengthError.ToString()).ToString()); } else if (PublicCls.OrgIsZhen(orgNo)) { return(dt.Compute("count(HID)", "BYORGNO='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and PatrolLenError>=" + LengthError.ToString()).ToString()); } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 获取数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(JC_MONITOR_BASICINFO_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_MONITOR_BASICINFO a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.EMID) == false) { sb.AppendFormat(" AND EMID = '{0}'", ClsSql.EncodeSql(sw.EMID)); } if (string.IsNullOrEmpty(sw.TTBH) == false) { sb.AppendFormat(" AND TTBH like '%{0}%'", ClsSql.EncodeSql(sw.TTBH)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { if (PublicCls.OrgIsShi(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsXian(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsZhen(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } else { //sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } } string sql = "SELECT EMID, TTBH, EMNAME, BYORGNO, JD, WD, GC, ADDRESS, IP, LOGINUSERNAME, USERPWD, XH, PP, GD, JCJL,OBJID,TEMPLATEDID,PORT,TYPE" + sb.ToString() + " order by BYORGNO"; DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 获取数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(JC_INFRAREDCAMERA_BASICINFO_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_INFRAREDCAMERA_BASICINFO a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.INFRAREDCAMERAID) == false) { sb.AppendFormat(" AND INFRAREDCAMERAID = '{0}'", ClsSql.EncodeSql(sw.INFRAREDCAMERAID)); } if (string.IsNullOrEmpty(sw.PHONE) == false) { sb.AppendFormat(" AND PHONE = '{0}'", ClsSql.EncodeSql(sw.PHONE)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { if (PublicCls.OrgIsShi(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsXian(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.BYORGNO)); } else if (PublicCls.OrgIsZhen(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } else { sb.AppendFormat(" and BYORGNO = '{0}'", sw.BYORGNO); } } string sql = "SELECT INFRAREDCAMERAID,BYORGNO,INFRAREDCAMERANAME,PHONE,JD,WD,GC,ADDRESS" + sb.ToString() + " order by BYORGNO"; DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 获取火情来源数据 /// </summary> /// <returns></returns> public JsonResult GetFireSourceData() { var result = new List <OutData>(); MessageListObject ms = new MessageListObject(false, null); var sw = new JC_FIRE_SW(); var curogr = SystemCls.getCurUserOrgNo(); if (!string.IsNullOrEmpty(curogr)) { var bo = PublicCls.OrgIsShi(curogr); var bb = PublicCls.OrgIsXian(curogr); var bx = PublicCls.OrgIsZhen(curogr); if (!bo) { sw.BYORGNO = curogr; } sw.isCountIndex = "1"; //遍历火情来源 Array ary = Enum.GetValues(typeof(EnumType)); //array是数组的基类, 无法实例化 var list = JC_FIRECls.GetListModel(sw); foreach (int item in ary) { string hotsum = "0"; var fireData = new OutData(); if (item.ToString() != "1")//排除红外相机 { if (list.Any()) { var firelist = list.Where(p => p.FIREFROM == item.ToString() && !string.IsNullOrEmpty(p.FIREFROM) && p.ISOUTFIRE != "1" && p.MANSTATE != "19" && p.MANSTATE != "18"); //筛选热点类型 排除已灭的 && ((p.ISOUTFIRE.Trim() == "1" && p.MANSTATE.Trim() != "4") || p.ISOUTFIRE.Trim() != "1") 已在程序中处理 hotsum = firelist.Count().ToString(); //热点个数 } fireData.name = Enum.GetName(typeof(EnumType), item); fireData.value = hotsum; result.Add(fireData); } } ms = new MessageListObject(true, result); } return(Json(ms)); }
/// <summary> /// 护林员定位 获取护林员最新一条位置信息 /// </summary> /// <param name="sw">参见模型</param> /// <returns>DataTable</returns> public static DataTable getTopOneDT(T_IPS_REALDATATEMPORARYSW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select REALDATAID, USERID, LONGITUDE, LATITUDE, HEIGHT, ELECTRIC, SPEED, DIRECTION, SBTIME, NOTE, "); sb.AppendFormat(" ORGNO, SBDATE, SBTIMEBEGIN, PATROLLENGTH, ISOUTRAIL"); sb.AppendFormat(" from T_IPS_REALDATATEMPORARY t "); sb.AppendFormat(" where 1=1 "); if (string.IsNullOrEmpty(sw.USERID) == false) { sb.AppendFormat(" AND t.USERID in({0})", sw.USERID); } sb.AppendFormat(" AND REALDATAID= (select top 1 REALDATAID from T_IPS_REALDATATEMPORARY where USERID = t.USERID order by SBDATE desc)"); if (!string.IsNullOrEmpty(sw.ORGNO) && PublicCls.OrgIsZhen(sw.ORGNO.Trim())) { sb.AppendFormat(" AND USERID in (select HID from T_IPSFR_USER where BYORGNO ='{0}')", sw.ORGNO.Trim()); } DataSet ds = DataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 三维添加 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Add(TD_POINTMARK_Model m) { if (PublicCls.OrgIsZhen(m.BYORGNO) == false) { return(new Message(false, "添加失败,所属单位必须为乡镇!", "")); } if (TD_POINTMARK.isExists(new TD_POINTMARK_Model { JD = m.JD, WD = m.WD }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into CUNZHUDI(NAME,MAPNAME,BYORGNO,BYORGNOXS,TYPE,VILLAGE,DISPLAY_X,DISPLAY_Y,Shape,KIND,TELEPHONE,ADDRESS) values("); sb.AppendFormat("{0},", ClsSql.saveNullField(m.NAME)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.MAPNAME)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.BYORGNO)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.BYORGNOXS)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.TYPE)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.VILLAGE)); 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.KIND)); sb.AppendFormat("{0},", ClsSql.saveNullField(m.TELEPHONE)); 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, "添加失败,请检查各输入框是否正确!", "")); } } else { return(new Message(false, "已有相同地址的自然村,请重新选择地址", "")); } }
/// <summary> /// 根据DataTable和OrgNo判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <returns>记录个数</returns> public static string getCountByOrgNo(DataTable dt, string orgNo) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (PublicCls.OrgIsShi(orgNo))//市 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else if (PublicCls.OrgIsXian(orgNo))//县 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else if (PublicCls.OrgIsZhen(orgNo)) { return(dt.Compute("count(HID)", "BYORGNO='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 根据DataTable和OrgNo和瞭望台的各个县市类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <param name="DICTVALUE">结构类型值</param> /// <returns>记录个数</returns> public static string getCountXSByOrgNo(DataTable dt, string orgNo, string DICTVALUE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "ORGNOS='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_OVERWATCH_ID)", "ORGNOS='" + orgNo + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 根据DataTable和OrgNo判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">单位编码</param> /// <param name="state">状态</param> /// <returns>记录个数</returns> public static string getCountByOrgNo(DataTable dt, string orgNo, string state) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } string sqlStr = ""; if (string.IsNullOrEmpty(state) == false) { if (state == "0") //未检 { sqlStr = " AND ROUTESTATE=0"; } else { sqlStr = " AND ROUTESTATE=1"; } } if (PublicCls.OrgIsShi(orgNo))//市 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'" + sqlStr + "").ToString()); } else if (PublicCls.OrgIsXian(orgNo))//县 { return(dt.Compute("count(HID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'" + sqlStr + "").ToString()); } else if (PublicCls.OrgIsZhen(orgNo)) { return(dt.Compute("count(HID)", "BYORGNO='" + PublicCls.getZhenIncOrgNo(orgNo) + "'" + sqlStr + "").ToString()); } else //机构编码可能不正确 { return(""); } }
/// <summary> /// 根据DataTable和OrgNo和监测站的各个市县类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">组织机构</param> /// <param name="DICTVALUE">监测站的各个类型</param> /// <param name="TYPE">确定统计那个监测站的类型</param> /// <returns>记录个数</returns> public static string getCountXSByOrgNo(DataTable dt, string orgNo, string DICTVALUE, string TYPE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (TYPE == "1")//统计使用现状类型 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "2")//统计维护管理现状 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "3")//无线电传输方式 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "BYORGNO='" + orgNo + "' and TRANSFERMODETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } else { return(""); } }
/// <summary> /// 根据DataTable和OrgNo和监测站的各个类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">组织机构</param> /// <param name="DICTVALUE">监测站的各个类型</param> /// <param name="TYPE">确定统计那个监测站的类型</param> /// <returns>记录个数</returns> public static string getCountMONITORINGSTATIONByOrgNo(DataTable dt, string orgNo, string DICTVALUE, string TYPE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (TYPE == "1") //统计使用现状类型 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "2") //统计维护管理现状 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "3") //无线电传输方式 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and TRANSFERMODETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and TRANSFERMODETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_MONITORINGSTATION_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and TRANSFERMODETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } else { return(""); } }
/// <summary> /// 根据DataTable和OrgNo和宣传碑牌的各个类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">组织机构码</param> /// <param name="DICTVALUE">类型值</param> /// <param name="TYPE">确定统计那个宣传碑牌的类型</param> /// <returns>记录个数</returns> public static string getCountXSByOrgNo(DataTable dt, string orgNo, string DICTVALUE, string TYPE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (TYPE == "1")//统计使用现状类型 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "2")//统计维护管理现状 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "3")//宣传碑类型 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "' and PROPAGANDASTELETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "4")//结构类型 { if (PublicCls.OrgIsZhen(orgNo) == false) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "BYORGNO='" + orgNo + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } else { return(""); } }
/// <summary> /// 根据DataTable和OrgNo和宣传碑牌的各个类型判断记录个数 /// </summary> /// <param name="dt">DataTable</param> /// <param name="orgNo">组织机构码</param> /// <param name="DICTVALUE">类型值</param> /// <param name="TYPE">确定统计那个宣传碑牌的类型</param> /// <returns>记录个数</returns> public static string getCountPROPAGANDASTELEByOrgNo(DataTable dt, string orgNo, string DICTVALUE, string TYPE) { if (string.IsNullOrEmpty(orgNo))//返回所有记录个数 { return(dt.Rows.Count.ToString()); } if (TYPE == "1") //统计使用现状类型 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "2") //统计维护管理现状 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "3") //宣传碑类型 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and PROPAGANDASTELETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and PROPAGANDASTELETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and PROPAGANDASTELETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } if (TYPE == "4") //结构类型 { if (PublicCls.OrgIsShi(orgNo)) //市 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsXian(orgNo))//县 { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else if (PublicCls.OrgIsZhen(orgNo)) { if (string.IsNullOrEmpty(DICTVALUE)) { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString()); } else { return(dt.Compute("count(DC_UTILITY_PROPAGANDASTELE_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and STRUCTURETYPE='" + DICTVALUE + "'").ToString()); } } else //机构编码可能不正确 { return(""); } } else { return(""); } }
/// <summary> /// ajax 获取各种火情数据 /// </summary> /// <returns></returns> public JsonResult GetFireInfosAjax() { int total = 0; //记录总数 string topOrg = ""; var firetype = Request.Params["firetype"]; //火情类型 string PageSize = Request.Params["PageSize"]; //记录个数 string page = Request.Params["page"]; //页数 if (string.IsNullOrEmpty(firetype)) { return(Json(new Message(false, "没有火情类型", ""))); } var currOrgNo = SystemCls.getCurUserOrgNo(); if (PublicCls.OrgIsXian(currOrgNo))//县 { topOrg = currOrgNo.Substring(0, 6); } else if (PublicCls.OrgIsZhen(currOrgNo))//乡镇 { topOrg = currOrgNo; } var result = JC_FIRECls.getModelPager(new JC_FIRE_SW { curPage = int.Parse(page), pageSize = int.Parse(PageSize), FIREFROM = firetype, TopORGNO = topOrg }, out total); StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table cellpadding=\"0\" cellspacing=\"0\">"); sb.AppendFormat("<thead>"); sb.AppendFormat("<tr>"); sb.AppendFormat("<th>序号</th>"); sb.AppendFormat("<th>区域</th>"); //sb.AppendFormat("<th>经度</th>"); //sb.AppendFormat("<th>纬度</th>"); sb.AppendFormat("<th>接收时间</th>"); //sb.AppendFormat("<th>周围(公里)</th>"); sb.AppendFormat("</tr>"); sb.AppendFormat("</thead>"); sb.AppendFormat("<tbody>"); if (result.Any()) { int i = 0; int rowB = (int.Parse(page) - 1) * int.Parse(PageSize); foreach (var s in result) { if (i % 2 == 0) { // onclick="moveto(@item.JD,@item.WD,'@item.FIRENAME',@item.JCFID);" sb.AppendFormat("<tr style=\"cursor: pointer;\" title='双击行定位' ondblclick=\"moveto(" + s.JD + "," + s.WD + ",'" + s.FIRENAME + "'," + s.JCFID + ")\">"); } else { sb.AppendFormat("<tr style=\"cursor: pointer;\" title='双击行定位' class='row1' ondblclick=\"moveto(" + s.JD + "," + s.WD + ",'" + s.FIRENAME + "'," + s.JCFID + ")\">"); } sb.AppendFormat("<td>{0}</td>", ++rowB); if (s.FIREFROM == "5")//护林员报警 { sb.AppendFormat("<td><font color=\"#FF0000;\">{0}</font></td>", StateSwitch.GetOrgNameByOrgNO(s.BYORGNO)); } else { sb.AppendFormat("<td><font color=\"#FF0000;\">{0}</font></td>", s.ZQWZ); } //sb.AppendFormat("<td>{0}</td>", Convert.ToDouble(s.JD).ToString("f3")); //sb.AppendFormat("<td>{0}</td>", Convert.ToDouble(s.WD).ToString("f3")); sb.AppendFormat("<td>{0}</td>", Convert.ToDateTime(s.RECEIVETIME).ToString("MM-dd HH:mm")); //sb.AppendFormat("<td><select onchange=\"GetHlyInfos(" + s.JD + "," + s.WD + ",'" + s.FIRENAME + "'," + s.JCFID + ")\" id=\"areaselect_{0}\" ><option value=\"0\">请选择</option><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option>/select></td>", s.JCFID); sb.AppendFormat("</tr>"); ++i; } } else { sb.AppendFormat("<tr>"); sb.AppendFormat("<td colspan='5'>未查询出结果</td>"); sb.AppendFormat("</tr>"); } sb.AppendFormat("</tbody>"); sb.AppendFormat("</table>"); string pageInfo = PagerCls.getPagerInfoAjax(new PagerSW { curPage = int.Parse(page), pageSize = int.Parse(PageSize), rowCount = total, hidePageList = true, hidePageSize = true }); return(Json(new MessagePagerAjax(true, sb.ToString(), pageInfo))); }