/// <summary> /// 获取分页列表 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(DC_PHOTO_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM DC_PHOTO"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.PHOTO_ID) == false) { sb.AppendFormat(" AND PHOTO_ID = '{0}'", ClsSql.EncodeSql(sw.PHOTO_ID)); } if (string.IsNullOrEmpty(sw.PHOTOTYPE) == false) { sb.AppendFormat(" AND PHOTOTYPE = '{0}'", ClsSql.EncodeSql(sw.PHOTOTYPE)); } if (string.IsNullOrEmpty(sw.PRID) == false) { sb.AppendFormat(" AND PRID = '{0}'", ClsSql.EncodeSql(sw.PRID)); } string sql = "SELECT PHOTO_ID, PHOTOTITLE, PHOTOFILENAME, PHOTOEXPLAIN, PHOTOTIME, PHOTOTYPE, PRID" + sb.ToString() + " order by PHOTO_ID desc"; 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> /// <returns>参见模型</returns> public static DataTable getDT(T_SYS_BIOLOGICALTYPE_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYS_BIOLOGICALTYPE "); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.BIOLOCODE) == false) { sb.AppendFormat(" AND BIOLOCODE = '{0}'", ClsSql.EncodeSql(sw.BIOLOCODE)); } if (string.IsNullOrEmpty(sw.BIOLONAME) == false) { sb.AppendFormat(" AND BIOLONAME like '%{0}%'", ClsSql.EncodeSql(sw.BIOLONAME)); } if (string.IsNullOrEmpty(sw.BIOLOENNAME) == false) { sb.AppendFormat(" AND BIOLOENNAME like '%{0}%'", ClsSql.EncodeSql(sw.BIOLOENNAME)); } string sql = "SELECT BIOLOCODE, BIOLONAME, BIOLOENNAME, ORDERBY " + sb.ToString() + " order by ORDERBY"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(PEST_MONITORINGSTATION_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM PEST_MONITORINGSTATION WHERE 1=1"); if (string.IsNullOrEmpty(sw.PEST_MONITORINGSTATIONID) == false) { sb.AppendFormat(" AND PEST_MONITORINGSTATIONID = '{0}'", ClsSql.EncodeSql(sw.PEST_MONITORINGSTATIONID)); } if (string.IsNullOrEmpty(sw.NUMBER) == false) { sb.AppendFormat(" AND NUMBER like '%{0}%'", ClsSql.EncodeSql(sw.NUMBER)); } if (string.IsNullOrEmpty(sw.NAME) == false) { sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME)); } if (string.IsNullOrEmpty(sw.USESTATE) == false) { sb.AppendFormat(" AND USESTATE = '{0}'", ClsSql.EncodeSql(sw.USESTATE)); } if (string.IsNullOrEmpty(sw.MANAGERSTATE) == false) { sb.AppendFormat(" AND MANAGERSTATE = '{0}'", ClsSql.EncodeSql(sw.MANAGERSTATE)); } if (string.IsNullOrEmpty(sw.TRANSFERMODETYPE) == false) { sb.AppendFormat(" AND TRANSFERMODETYPE = '{0}'", ClsSql.EncodeSql(sw.TRANSFERMODETYPE)); } if (!string.IsNullOrEmpty(sw.BYORGNO)) { if (sw.BYORGNO.Substring(4, 11) == "00000000000")//获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4))); } else if (sw.BYORGNO.Substring(4, 11) == "xxxxxxxxxxx")//单独市 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4) + "00000000000")); } else if (sw.BYORGNO.Substring(6, 9) == "xxxxxxxxx")//获取所有县的 { 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 PEST_MONITORINGSTATIONID, NUMBER, NAME, ADDRESS, MODEL, BYORGNO, TRANSFERMODETYPE, MONICONTENT, BUILDDATE, USESTATE, MANAGERSTATE, MARK, JD, WD, WORTH " + sb.ToString() + " ORDER BY BYORGNO, BUILDDATE DESC "; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(PEST_CONSULREPLY_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM PEST_CONSULREPLY WHERE 1=1"); if (string.IsNullOrEmpty(sw.PEST_CONSULREPLYID) == false) { sb.AppendFormat(" AND PEST_CONSULTATIONID = '{0}'", ClsSql.EncodeSql(sw.PEST_CONSULTATIONID)); } if (string.IsNullOrEmpty(sw.PEST_CONSULTATIONID) == false) { sb.AppendFormat(" AND PEST_CONSULTATIONID = '{0}'", ClsSql.EncodeSql(sw.PEST_CONSULTATIONID)); } if (string.IsNullOrEmpty(sw.REPLYUID) == false) { sb.AppendFormat(" AND REPLYUID = '{0}'", ClsSql.EncodeSql(sw.REPLYUID)); } if (string.IsNullOrEmpty(sw.REPLYTIME) == false) { sb.AppendFormat(" AND REPLYTIME = '{0}'", ClsSql.EncodeSql(DateTime.Parse(sw.REPLYTIME).ToString())); sb.AppendFormat(" AND REPLYTIME = '{0}'", ClsSql.EncodeSql(DateTime.Parse(sw.REPLYTIME).AddDays(1).AddSeconds(-1).ToString())); } string sql = "SELECT PEST_CONSULREPLYID, PEST_CONSULTATIONID, REPLYUID, REPLYTIME, REPLYCONTENT" + sb.ToString() + " ORDER BY REPLYTIME "; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(WILD_ANIMALDISTRIBUTE_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM WILD_ANIMALDISTRIBUTE"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.WILD_ANIMALDISTRIBUTEID) == false) { sb.AppendFormat(" AND WILD_ANIMALDISTRIBUTEID = '{0}'", ClsSql.EncodeSql(sw.WILD_ANIMALDISTRIBUTEID)); } if (string.IsNullOrEmpty(sw.BIOLOGICALTYPECODE) == false) { sb.AppendFormat(" AND BIOLOGICALTYPECODE = '{0}'", ClsSql.EncodeSql(sw.BIOLOGICALTYPECODE)); } if (string.IsNullOrEmpty(sw.POPULATIONTYPE) == false) { sb.AppendFormat(" AND POPULATIONTYPE = '{0}'", ClsSql.EncodeSql(sw.POPULATIONTYPE)); } string sql = "SELECT WILD_ANIMALDISTRIBUTEID, BIOLOGICALTYPECODE, POPULATIONTYPE, JD, WD, JWDLIST, ANIMALCOUNT, MARK" + sb.ToString() + " order by WILD_ANIMALDISTRIBUTEID desc"; 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="sw"></param> /// <param name="total">总共</param> /// <returns></returns> public static DataTable getDT(E_GROUP_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM E_GROUP"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.EGROUPID) == false) { sb.AppendFormat(" AND EGROUPID = '{0}'", ClsSql.EncodeSql(sw.EGROUPID)); } if (string.IsNullOrEmpty(sw.EGROUPUSERID) == false) { sb.AppendFormat(" AND EGROUPUSERID = '{0}'", ClsSql.EncodeSql(sw.EGROUPUSERID)); } if (string.IsNullOrEmpty(sw.EGROUPNAME) == false) { sb.AppendFormat(" AND EGROUPNAME = '{0}'", ClsSql.EncodeSql(sw.EGROUPNAME)); } if (string.IsNullOrEmpty(sw.EGROUPTYPE) == false) { sb.AppendFormat(" AND EGROUPTYPE = '{0}'", ClsSql.EncodeSql(sw.EGROUPTYPE)); } string sql = "SELECT EGROUPID, EGROUPUSERID, EGROUPNAME, EGROUPMEMBERLIST, EGROUPTYPE,EGROUPPHONELIST" + sb.ToString() + " order by EGROUPID"; 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"); //DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 获取记录 /// </summary> /// <param name="sw"></param> /// <param name="total">总共</param> /// <returns></returns> public static DataTable getDT(EM_Message_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM EM_MESSAGE"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.EM_MESSAGEID) == false) { sb.AppendFormat(" AND EM_MESSAGEID = '{0}'", ClsSql.EncodeSql(sw.EM_MESSAGEID)); } if (string.IsNullOrEmpty(sw.MessageContent) == false) { sb.AppendFormat(" AND TMPCONTENT = '{0}'", ClsSql.EncodeSql(sw.MessageContent)); } string sql = "SELECT EM_MESSAGEID, TMPCONTENT, ORDERBY" + sb.ToString() + " order by EM_MESSAGEID,ORDERBY"; 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"); //DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 获取数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(JC_PERALARM_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_PERALARM a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.PERALARMID) == false) { sb.AppendFormat(" AND PERALARMID = '{0}'", ClsSql.EncodeSql(sw.PERALARMID)); } if (string.IsNullOrEmpty(sw.PERALARMPHONE) == false) { sb.AppendFormat(" AND PERALARMPHONE like '%{0}%'", ClsSql.EncodeSql(sw.PERALARMPHONE)); } if (string.IsNullOrEmpty(sw.PERALARMNAME) == false) { sb.AppendFormat(" AND PERALARMNAME like '%{0}%'", ClsSql.EncodeSql(sw.PERALARMNAME)); } if (!string.IsNullOrEmpty(sw.DateBegin)) { sb.AppendFormat(" AND PERALARMTIME>='{0} 00:00:00'", sw.DateBegin); } if (!string.IsNullOrEmpty(sw.DateEnd)) { sb.AppendFormat(" AND PERALARMTIME<='{0} 23:59:59'", sw.DateEnd); } if (string.IsNullOrEmpty(sw.MANSTATE) == false) { sb.AppendFormat(" AND MANSTATE = '{0}'", ClsSql.EncodeSql(sw.MANSTATE)); } 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 { sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.BYORGNO)); } } string sql = "SELECT PERALARMID,BYORGNO, FIRENAME,PERALARMPHONE, PERALARMNAME, PERALARMTIME, PERALARMADDRESS, PERALARMCONTENT, MANSTATE, MANRESULT, MANTIME, MANUSERID,JD, WD, PEARLARMPRE, PEARLARMISSUED" + sb.ToString() + " order by PERALARMTIME DESC"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(T_SYS_ORG_LINK_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYS_ORG_LINK"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ORGLINK_ID) == false) { sb.AppendFormat(" AND ORGLINK_ID = '{0}'", ClsSql.EncodeSql(sw.ORGLINK_ID)); } if (string.IsNullOrEmpty(sw.ORGNO) == false) { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.ORGNO)); } if (string.IsNullOrEmpty(sw.ORGLINKTYPE) == false) { sb.AppendFormat(" AND ORGLINKTYPE = '{0}'", ClsSql.EncodeSql(sw.ORGLINKTYPE)); } if (string.IsNullOrEmpty(sw.keys) == false) { sb.AppendFormat(" AND (NAME like '%{0}%' or USERJOB like '%{0}%' or PHONE like '%{0}%' or Tell like '%{0}%')", ClsSql.EncodeSql(sw.keys)); } 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 { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } } string sql = "SELECT ORGLINK_ID, BYORGNO, ORGLINKTYPE, UNITNAME,NAME, USERJOB, PHONE, Tell, ORDERBY" + sb.ToString() + " order by BYORGNO,ORGLINKTYPE,ORDERBY"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(DC_UTILITY_OVERWATCH_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM DC_UTILITY_OVERWATCH"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.DC_UTILITY_OVERWATCH_ID) == false) { sb.AppendFormat(" AND DC_UTILITY_OVERWATCH_ID = '{0}'", ClsSql.EncodeSql(sw.DC_UTILITY_OVERWATCH_ID)); } if (string.IsNullOrEmpty(sw.NUMBER) == false) { sb.AppendFormat(" AND NUMBER like '%{0}%'", ClsSql.EncodeSql(sw.NUMBER)); } if (string.IsNullOrEmpty(sw.NAME) == false) { sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME)); } if (string.IsNullOrEmpty(sw.STRUCTURETYPE) == false) { sb.AppendFormat(" AND STRUCTURETYPE = '{0}'", ClsSql.EncodeSql(sw.STRUCTURETYPE)); } if (!string.IsNullOrEmpty(sw.ORGNOS)) { if (sw.ORGNOS.Substring(4, 11) == "00000000000")//获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(ORGNOS,1,4) = '{0}')", ClsSql.EncodeSql(sw.ORGNOS.Substring(0, 4))); } else if (sw.ORGNOS.Substring(4, 11) == "xxxxxxxxxxx")//单独市 { sb.AppendFormat(" AND (SUBSTRING(ORGNOS,1,15) = '{0}')", ClsSql.EncodeSql(sw.ORGNOS.Substring(0, 4) + "00000000000")); } else if (sw.ORGNOS.Substring(6, 9) == "xxxxxxxxx")//获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(ORGNOS,1,6) = '{0}' )", ClsSql.EncodeSql(sw.ORGNOS.Substring(0, 6))); } else { sb.AppendFormat(" AND ORGNOS = '{0}'", ClsSql.EncodeSql(sw.ORGNOS)); } } string sql = "SELECT DC_UTILITY_OVERWATCH_ID, NUMBER, NAME, ORGNOS, AREA, BUILDDATE, FLOOR, STRUCTURETYPE, SUBFACILITIES, MARK, JD, WD,WORTH,BUILDDATEBEGIN,BUILDDATEEND" + sb.ToString() + " order by ORGNOS,DC_UTILITY_OVERWATCH_ID desc"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(JC_UAV_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_UAV"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.UAVID) == false) { sb.AppendFormat(" AND UAVID = '{0}'", ClsSql.EncodeSql(sw.UAVID)); } if (string.IsNullOrEmpty(sw.UAVNAME) == false) { sb.AppendFormat(" AND UAVNAME like '%{0}%'", ClsSql.EncodeSql(sw.UAVNAME)); } if (string.IsNullOrEmpty(sw.UAVEQUIPNAME) == false) { sb.AppendFormat(" AND UAVEQUIPNAME like '%{0}%'", ClsSql.EncodeSql(sw.UAVEQUIPNAME)); } 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 BYORGNO = '{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 BYORGNO = '{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 UAVID,BYORGNO, UAVNAME, UAVEQUIPNAME,ORDERBY" + sb.ToString() + " order by ORDERBY desc"; 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="sw">查询模型</param> /// <param name="total">总记录数</param> /// <returns></returns> public static DataTable getDT(PEST_REPORT_DIEPINESURVEY_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM PEST_REPORT_DIEPINESURVEY WHERE 1=1"); #region 查询条件 if (!string.IsNullOrEmpty(sw.BYORGNO)) { if (sw.BYORGNO.Substring(4, 11) == "00000000000") //获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4))); } else if (sw.BYORGNO.Substring(6, 9) == "000000000" && sw.BYORGNO.Substring(4, 11) != "00000000000") //获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6))); } else if (sw.BYORGNO.Substring(9, 6) == "000000" && sw.BYORGNO.Substring(6, 9) != "000000000") //获取所有乡镇的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9))); } else if (sw.BYORGNO.Substring(9, 6) != "000000") //获取所有村的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,12) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 12))); } else { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } } if (!string.IsNullOrEmpty(sw.FINDER)) { sb.AppendFormat(" AND FINDER LIKE '%{0}%'", ClsSql.EncodeSql(sw.FINDER)); } if (!string.IsNullOrEmpty(sw.STARTDATE)) { sb.AppendFormat(" AND FINDDATE >= '{0}'", DateTime.Parse(sw.STARTDATE).ToString("yyyy-MM-dd HH:mm:ss")); } if (!string.IsNullOrEmpty(sw.ENDDATE)) { sb.AppendFormat(" AND FINDDATE <= '{0}'", DateTime.Parse(sw.ENDDATE).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss")); } #endregion string sql = "SELECT * " + sb.ToString() + " ORDER BY FINDDATE DESC,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, "PEST_REPORT_DIEPINESURVEY"); return(ds.Tables[0]); }
/// <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="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> /// 获取分页列表 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(ART_DOCUMENT_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM ART_DOCUMENT"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ARTTYPEID) == false) { sb.AppendFormat(" AND ARTTYPEID = '{0}'", ClsSql.EncodeSql(sw.ARTTYPEID)); } if (string.IsNullOrEmpty(sw.ARTCHECKSTATUS) == false) { sb.AppendFormat(" AND ARTCHECKSTATUS = '{0}'", ClsSql.EncodeSql(sw.ARTCHECKSTATUS)); } if (string.IsNullOrEmpty(sw.ARTTITLE) == false) { sb.AppendFormat(" AND ARTTITLE like '%{0}%'", ClsSql.EncodeSql(sw.ARTTITLE)); } if (string.IsNullOrEmpty(sw.ARTTAG) == false) { sb.AppendFormat(" AND ARTTAG like '%{0}%'", ClsSql.EncodeSql(sw.ARTTAG)); } if (string.IsNullOrEmpty(sw.TIMEBegin) == false) { sb.AppendFormat(" AND ARTTIME >= '{0}'", ClsSql.EncodeSql(sw.TIMEBegin)); } if (string.IsNullOrEmpty(sw.TIMEEnd) == false) { sb.AppendFormat(" AND ARTTIME <= '{0}'", ClsSql.EncodeSql(sw.TIMEEnd)); } if (string.IsNullOrEmpty(sw.ARTBigTYPEID) == false) { sb.AppendFormat(" AND ARTTYPEID like '{0}%'", ClsSql.EncodeSql(sw.ARTBigTYPEID)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } string sql = "SELECT ARTID, ARTTYPEID, ARTTITLE, ARTTAG, ARTTIME, ARTCHECKSTATUS, ARTADDUSERID,ARTCHECKTIME, ARTCHECKUSERID,PLANFILENAME,BYORGNO" + sb.ToString() + " order by ARTTIME DESC"; 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> /// <returns>参见模型</returns> public static DataTable getDT(T_SYS_ADDREDDBOOK_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYS_ADDREDDBOOK a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ADID) == false) { sb.AppendFormat(" AND ADID = '{0}'", ClsSql.EncodeSql(sw.ADID)); } if (string.IsNullOrEmpty(sw.ATID) == false) { sb.AppendFormat(" AND ATID = '{0}'", ClsSql.EncodeSql(sw.ATID)); } //if (string.IsNullOrEmpty(sw.ORGNO) == false) // sb.AppendFormat(" AND ORGNO = '{0}'", ClsSql.EncodeSql(sw.ORGNO)); if (string.IsNullOrEmpty(sw.PHONE) == false) { sb.AppendFormat(" AND PHONE like '%{0}%'", ClsSql.EncodeSql(sw.PHONE)); } if (string.IsNullOrEmpty(sw.ADNAME) == false) { sb.AppendFormat(" AND ADNAME like '%{0}%'", ClsSql.EncodeSql(sw.ADNAME)); } //if (string.IsNullOrEmpty(sw.TopORGNO) == false) //{ // if (PublicCls.OrgIsShi(sw.TopORGNO)) // { // sb.AppendFormat(" and ORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.TopORGNO)); // } // else if (PublicCls.OrgIsXian(sw.TopORGNO)) // { // sb.AppendFormat(" and ORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.TopORGNO)); // } // else // { // sb.AppendFormat(" and ORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.TopORGNO)); // } //} string sql = "SELECT ADID,ATID, ORGNO, ADNAME, USERJOB, PHONE, Tell, ORDERBY " + sb.ToString() + " order by ORDERBY"; 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> /// <returns>参见模型</returns> public static DataTable getDT(T_SYS_LOG_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYS_LOG"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.LOGID) == false) { sb.AppendFormat(" AND LOGID = '{0}'", ClsSql.EncodeSql(sw.LOGID)); } if (string.IsNullOrEmpty(sw.LOGTYPE) == false) { sb.AppendFormat(" AND LOGTYPE = '{0}'", ClsSql.EncodeSql(sw.LOGTYPE)); } if (string.IsNullOrEmpty(sw.OPERATION) == false) { sb.AppendFormat(" AND OPERATION like '%{0}%'", ClsSql.EncodeSql(sw.OPERATION)); } if (string.IsNullOrEmpty(sw.LOGINUSERID) == false) { sb.AppendFormat(" AND LOGINUSERID IN({0})", ClsSql.EncodeSql(sw.LOGINUSERID)); } if (string.IsNullOrEmpty(sw.TIMEBegin) == false) { sb.AppendFormat(" AND OPERATETIME >= '{0}'", ClsSql.EncodeSql(sw.TIMEBegin)); } if (string.IsNullOrEmpty(sw.TIMEEnd) == false) { sb.AppendFormat(" AND OPERATETIME <= '{0}'", ClsSql.EncodeSql(sw.TIMEEnd)); } if (string.IsNullOrEmpty(sw.SYSFLAG) == false) { sb.AppendFormat(" AND SYSFLAG = '{0}'", ClsSql.EncodeSql(sw.SYSFLAG)); } string sql = "SELECT LOGID, LOGTYPE, OPERATION, OPERATIONCONTENT, LOGINUSERID, USERIP, OPERATETIME,SYSFLAG" + sb.ToString() + " order by OPERATETIME DESC"; 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> /// <returns>参见模型</returns> public static DataTable getDT2(T_SYSSEC_IPSUSER_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYSSEC_IPSUSER a right outer join T_SYSSEC_USER b on a.userid=b.userid WHERE 1=1"); //针对护林员用户,系统用户表中需要有对应的记录 sb.AppendFormat(" AND b.USERID is not null"); //根据登录用户名查询 if (string.IsNullOrEmpty(sw.LOGINUSERNAME) == false) { sb.AppendFormat(" AND b.LOGINUSERNAME like '%{0}%'", sw.LOGINUSERNAME); } //根据用户名查询 if (string.IsNullOrEmpty(sw.USERNAME) == false) { sb.AppendFormat(" AND b.USERNAME like '%{0}%'", sw.USERNAME); } //根据组织机构查询 if (!string.IsNullOrEmpty(sw.ORGNO)) { sb.AppendFormat(" AND b.ORGNO = '{0}'", ClsSql.EncodeSql(sw.ORGNO)); } //根据是否开通OA if (!string.IsNullOrEmpty(sw.IsOpenOA)) { if (sw.IsOpenOA == "1") { sb.AppendFormat(" AND b.IsOpenOA = '{0}'", ClsSql.EncodeSql(sw.IsOpenOA)); } else { sb.AppendFormat(" AND (b.IsOpenOA = '{0}' or b.IsOpenOA is NULL )", ClsSql.EncodeSql(sw.IsOpenOA)); } } string sql = "SELECT a.GID,a.SEX, a.PHONE, a.USERJOB" + ",b.USERID,b.ORGNO, b.LOGINUSERNAME, b.USERNAME, b.USERPWD, b.REGISTERTIME, b.LOGINNUM, b.LOGINIP, b.LASTTIME, b.NOTE,b.DEPARTMENT,b.IsOpenOA" + sb.ToString() + " order by b.ORGNO"; 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="sw">参见模型</param> /// <param name="total">总记录数</param> /// <returns>参见模型</returns> public static DataTable getDT(PEST_LOCALTREESPECIES_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM PEST_LOCALTREESPECIES WHERE 1=1"); if (string.IsNullOrEmpty(sw.BYORGNO) == false) { if (sw.BYORGNO.Substring(4, 11) == "00000000000") //获取所有市的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4))); } else if (sw.BYORGNO.Substring(6, 9) == "000000000" && sw.BYORGNO.Substring(4, 11) != "00000000000") //获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6))); } else if (sw.BYORGNO.Substring(9, 6) == "000000" && sw.BYORGNO.Substring(6, 9) != "000000000") //获取所有乡镇的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9))); } else if (sw.BYORGNO.Substring(9, 6) != "000000") //获取所有村的 { sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,12) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 12))); } else { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } } if (!string.IsNullOrEmpty(sw.TSPCODE)) { sb.AppendFormat(" AND TSPCODE = '{0}'", ClsSql.EncodeSql(sw.TSPCODE)); } if (!string.IsNullOrEmpty(sw.TSPAREA)) { sb.AppendFormat(" AND TSPAREA = '{0}'", ClsSql.EncodeSql(sw.TSPAREA)); } string sql = " SELECT PEST_LOCALTREESPECIESID, BYORGNO, TSPCODE, TSPAREA " + 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> /// <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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(TASK_INFO_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM TASK_INFO"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.TASKSTAUTS) == false) { sb.AppendFormat(" AND TASKSTAUTS = '{0}'", ClsSql.EncodeSql(sw.TASKSTAUTS)); } if (string.IsNullOrEmpty(sw.TASKTITLE) == false) { sb.AppendFormat(" AND TASKTITLE like '%{0}%'", ClsSql.EncodeSql(sw.TASKTITLE)); } 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 TASK_INFOID,BYORGNO, TASKTITLE, TASKTYPE, TASKLEVEL, TASKSTAUTS, TASKSTARTTIME, TASKBEGINTIME, TASKENDTIME,TASKCONTENT" + sb.ToString() + " order by TASK_INFOID desc"; 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="sw">参见模型</param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(FIRERECORD_FIREINFO_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM FIRERECORD_FIREINFO WHERE 1=1"); if (!string.IsNullOrEmpty(sw.FIREADDRESSTOWNS)) { if (sw.FIREADDRESSTOWNS.Substring(4, 11) == "00000000000")//获取所有市 { sb.AppendFormat(" AND (SUBSTRING(FIREADDRESSTOWNS,1,4) = '{0}')", ClsSql.EncodeSql(sw.FIREADDRESSTOWNS.Substring(0, 4))); } else if (sw.FIREADDRESSTOWNS.Substring(4, 11) == "xxxxxxxxxxx")//单独市 { sb.AppendFormat(" AND (SUBSTRING(FIREADDRESSTOWNS,1,15) = '{0}')", ClsSql.EncodeSql(sw.FIREADDRESSTOWNS.Substring(0, 4) + "00000000000")); } else if (sw.FIREADDRESSTOWNS.Substring(6, 9) == "xxxxxxxxx")//获取所有县的 { sb.AppendFormat(" AND (SUBSTRING(FIREADDRESSTOWNS,1,6) = '{0}')", ClsSql.EncodeSql(sw.FIREADDRESSTOWNS.Substring(0, 6))); } else { sb.AppendFormat(" AND FIREADDRESSTOWNS = '{0}'", ClsSql.EncodeSql(sw.FIREADDRESSTOWNS)); } } if (!string.IsNullOrEmpty(sw.FIRETIME)) { sb.AppendFormat(" AND FIRETIME>='{0}'", sw.FIRETIME); } if (!string.IsNullOrEmpty(sw.FIREENDTIME)) { sb.AppendFormat(" AND FIREENDTIME<='{0}'", sw.FIREENDTIME); } string sql = "SELECT * " + sb.ToString() + " ORDER BY FRFIID "; 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> /// <returns>参见模型</returns> public static DataTable getDT(JC_INFRAREDCAMERA_PHOTO_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM tb_rcvtmp AS a LEFT OUTER JOIN tb_rcvmmsfiles AS b ON a.mmsfilesid = b.mmsfilesid"); sb.AppendFormat(" WHERE (b.filetype = 'IMG')"); if (string.IsNullOrEmpty(sw.smid) == false) { sb.AppendFormat(" AND smid = '{0}'", ClsSql.EncodeSql(sw.smid)); } if (string.IsNullOrEmpty(sw.tpa) == false) { sb.AppendFormat(" AND tpa like '%{0}%'", ClsSql.EncodeSql(sw.tpa)); } if (!string.IsNullOrEmpty(sw.DateBegin)) { sb.AppendFormat(" AND recvdatetime>='{0} 00:00:00'", sw.DateBegin); } if (!string.IsNullOrEmpty(sw.DateEnd)) { sb.AppendFormat(" AND recvdatetime<='{0} 23:59:59'", sw.DateEnd); } if (string.IsNullOrEmpty(sw.MANSTATE) == false) { sb.AppendFormat(" AND MANSTATE = '{0}'", ClsSql.EncodeSql(sw.MANSTATE)); } string sql = "SELECT a.smid, a.tpa, a.recvdatetime, a.mmsfilesid, a.MANSTATE, a.MANRESULT, a.MANTIME, a.MANUSERID, b.filetype, b.filename" + sb.ToString() + " order by recvdatetime DESC"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(PEST_REMOTEDIAGN_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM PEST_REMOTEDIAGN WHERE 1=1"); if (string.IsNullOrEmpty(sw.PEST_REMOTEDIAGNID) == false) { sb.AppendFormat(" AND PEST_REMOTEDIAGNID = '{0}'", ClsSql.EncodeSql(sw.PEST_REMOTEDIAGNID)); } if (string.IsNullOrEmpty(sw.DIAGNTITLE) == false) { sb.AppendFormat(" AND DIAGNTITLE like '%{0}%'", ClsSql.EncodeSql(sw.DIAGNTITLE)); } if (string.IsNullOrEmpty(sw.DIAGNSTARTTIME) == false) { sb.AppendFormat(" AND DIAGNTIME >= '{0}'", ClsSql.EncodeSql(DateTime.Parse(sw.DIAGNSTARTTIME).ToString())); } if (string.IsNullOrEmpty(sw.DIAGNENDTIME) == false) { sb.AppendFormat(" AND DIAGNTIME <= '{0}'", ClsSql.EncodeSql(DateTime.Parse(sw.DIAGNENDTIME).AddDays(1).AddSeconds(-1).ToString())); } if (string.IsNullOrEmpty(sw.DIAGNSTATUS) == false) { sb.AppendFormat(" AND DIAGNSTATUS = '{0}'", ClsSql.EncodeSql(sw.DIAGNSTATUS)); } if (string.IsNullOrEmpty(sw.DIAGNSPONSERUID) == false) { sb.AppendFormat(" AND DIAGNSPONSERUID = '{0}'", ClsSql.EncodeSql(sw.DIAGNSPONSERUID)); } string sql = "SELECT PEST_REMOTEDIAGNID, DIAGNTITLE, DIAGNCONTENT, DIAGNTIME, DIAGNEXPERTS, DIAGNSTATUS, DIAGNRESULT, DIAGNSPONSERUID, DIAGNSPONSERTIME" + sb.ToString() + " ORDER BY DIAGNTIME DESC "; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(E_RECEIVE_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.Append("FROM E_RECEIVE b left join E_SUBJECT a on b.BYEMAILID=a.EMAILID"); sb.AppendFormat(" WHERE 1=1 "); if (string.IsNullOrEmpty(sw.ERID) == false) { sb.AppendFormat(" AND b.ERID = '{0}'", ClsSql.EncodeSql(sw.ERID)); } if (string.IsNullOrEmpty(sw.BYEMAILID) == false) { sb.AppendFormat(" AND b.BYEMAILID ='{0}'", ClsSql.EncodeSql(sw.BYEMAILID)); } if (string.IsNullOrEmpty(sw.RECEIVETYPE) == false) { sb.AppendFormat(" AND b.RECEIVETYPE = '{0}'", ClsSql.EncodeSql(sw.RECEIVETYPE)); } if (string.IsNullOrEmpty(sw.RECEIVEUSERID) == false)//接收人序号 用于收件箱 { sb.AppendFormat(" AND b.RECEIVEUSERID ='{0}'", ClsSql.EncodeSql(sw.RECEIVEUSERID)); } if (sw.EMAILRECEIVESTATUS != null && sw.EMAILRECEIVESTATUS.Trim() != "")//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1 { sb.AppendFormat(" AND b.EMAILRECEIVESTATUS in({0})", ClsSql.EncodeSql(sw.EMAILRECEIVESTATUS)); } if (!string.IsNullOrEmpty(sw.EMAILTITLE))//主题 { sb.AppendFormat(" AND a.EMAILTITLE like '%{0}%'", ClsSql.EncodeSql(sw.EMAILTITLE)); } string sql = "select a.*,b.*" + sb.ToString() + " order by b.EMAILSENDTIME DESC"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(DC_ARMY_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM DC_ARMY"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.DC_ARMY_ID) == false) sb.AppendFormat(" AND DC_ARMY_ID = '{0}'", ClsSql.EncodeSql(sw.DC_ARMY_ID)); if (string.IsNullOrEmpty(sw.ARMYTYPE) == false) sb.AppendFormat(" AND ARMYTYPE = '{0}'", ClsSql.EncodeSql(sw.ARMYTYPE)); if (string.IsNullOrEmpty(sw.NUMBER) == false) sb.AppendFormat(" AND NUMBER like '%{0}%'", ClsSql.EncodeSql(sw.NUMBER)); 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, 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(4, 11) == "xxxxxxxxxxx")//单独市 sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,15) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4) + "00000000000")); else if (sw.BYORGNO.Substring(6, 9) == "xxxxxxxxx")//获取所有县的 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 DC_ARMY_ID, ARMYTYPE, NUMBER, NAME, BYORGNO, ARMYMEMBERCOUNT, ARMYLEADER, CONTACTS,ARMYCHARACTER, ARMYEQUIP, MARK, JD, WD" + sb.ToString() + " order by BYORGNO,ARMYTYPE,NUMBER,DC_ARMY_ID desc"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(E_SUBJECT_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM E_SUBJECT a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.EMAILID) == false) { sb.AppendFormat(" AND EMAILID = '{0}'", ClsSql.EncodeSql(sw.EMAILID)); } if (string.IsNullOrEmpty(sw.EMAILTITLE) == false) { sb.AppendFormat(" AND EMAILTITLE like '%{0}%'", ClsSql.EncodeSql(sw.EMAILTITLE)); } if (string.IsNullOrEmpty(sw.EMAILSENDUSERID) == false) { sb.AppendFormat(" AND EMAILSENDUSERID ='{0}'", ClsSql.EncodeSql(sw.EMAILSENDUSERID)); } if (string.IsNullOrEmpty(sw.EMAILSTATUS) == false)//状态 { sb.AppendFormat(" AND EMAILSTATUS = '{0}'", ClsSql.EncodeSql(sw.EMAILSTATUS)); } //if (string.IsNullOrEmpty(sw.RECEIVEUSERID))//接收人序号不为空,获取收件箱 //{ //} string sql = "SELECT EMAILID, EMAILTITLE, EMAILSTATUS, EMAILSENDUSERID, EMAILTIME, EMAILCONTENT, EMAILRECUSERLIST, EMAILCOPYUSERLIST, EMAILSECRETUSERLIST" + sb.ToString() + " order by EMAILTIME DESC"; 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="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(SDE_GONGYILIN_Model sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" from GONGYILIN "); sb.AppendFormat("where 1=1"); if (!string.IsNullOrEmpty(sw.COUNTY)) { sb.AppendFormat(" AND 县 LIKE '%{0}%'", ClsSql.EncodeSql(sw.COUNTY)); } if (!string.IsNullOrEmpty(sw.COUNTRY)) { sb.AppendFormat(" AND 乡 LIKE '%{0}%'", ClsSql.EncodeSql(sw.COUNTRY)); } if (!string.IsNullOrEmpty(sw.VILLAGE)) { sb.AppendFormat(" AND 村 LIKE '%{0}%'", ClsSql.EncodeSql(sw.VILLAGE)); } if (!string.IsNullOrEmpty(sw.LINBAN)) { sb.AppendFormat(" AND 林班 = '{0}'", ClsSql.EncodeSql(sw.LINBAN)); } if (!string.IsNullOrEmpty(sw.XIAOBAN)) { sb.AppendFormat(" AND 小班 = '{0}'", ClsSql.EncodeSql(sw.XIAOBAN)); } string sql = ("select *, shape.STCentroid().STX AS STX ,shape.STCentroid().STY AS STY ") + sb.ToString() + (" order by 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> /// 获取分页列表 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(DC_ARMY_MEMBER_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM DC_ARMY_MEMBER"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.DC_ARMY_MEMBER_ID) == false) { sb.AppendFormat(" AND DC_ARMY_MEMBER_ID = '{0}'", ClsSql.EncodeSql(sw.DC_ARMY_MEMBER_ID)); } if (string.IsNullOrEmpty(sw.DC_ARMY_ID) == false) { sb.AppendFormat(" AND DC_ARMY_ID = '{0}'", ClsSql.EncodeSql(sw.DC_ARMY_ID)); } if (string.IsNullOrEmpty(sw.MEMBERNAME) == false) { sb.AppendFormat(" AND MEMBERNAME like '%{0}%'", ClsSql.EncodeSql(sw.MEMBERNAME)); } if (string.IsNullOrEmpty(sw.SEX) == false) { sb.AppendFormat(" AND SEX = '{0}'", ClsSql.EncodeSql(sw.SEX)); } string sql = "SELECT DC_ARMY_MEMBER_ID, DC_ARMY_ID, MEMBERNAME, SEX, CONTACTS, BIRTH" + sb.ToString() + " order by MEMBERNAME"; 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> /// <returns>参见模型</returns> public static DataTable getDT(T_SYS_NOTICE_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_SYS_NOTICE a left outer join T_SYSSEC_USER b on a.INFOUSERID=b.USERID"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.INFOID) == false) { sb.AppendFormat(" AND a.INFOID = '{0}'", ClsSql.EncodeSql(sw.INFOID)); } if (string.IsNullOrEmpty(sw.INFOTITLE) == false) { sb.AppendFormat(" AND a.INFOTITLE like '%{0}%'", ClsSql.EncodeSql(sw.INFOTITLE)); } if (string.IsNullOrEmpty(sw.INFOTYPE) == false) { sb.AppendFormat(" AND a.INFOTYPE = '{0}'", ClsSql.EncodeSql(sw.INFOTYPE)); } if (string.IsNullOrEmpty(sw.SYSFLAG) == false) { sb.AppendFormat(" AND a.SYSFLAG = '{0}'", ClsSql.EncodeSql(sw.SYSFLAG)); } string sql = "SELECT a.INFOID, a.INFOTITLE, a.INFOCONTENT, a.INFOURL, a.FBTIME, a.LABLE, a.NUM, a.INFOTYPE, a.INFOUSERID, a.SYSFLAG,b.LOGINUSERNAME" + sb.ToString() + " order by a.FBTIME DESC"; 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]); }