/// <summary> /// 返回各县护林员个数 /// </summary> /// <param name="sw">参见模型</param> /// <returns></returns> public static DataTable getDTByOrgSum(T_IPSFR_USER_SW sw) { StringBuilder sb = new StringBuilder(); if (PublicCls.OrgIsShi(sw.BYORGNO)) { sb.AppendFormat(" select count(substring(BYORGNO,1,6)+'000000000') as C,substring(BYORGNO,1,6)+'000000000' as BYORGNO"); sb.AppendFormat(" FROM T_IPSFR_USER"); sb.AppendFormat(" where ISENABLE = '1'"); sb.AppendFormat(" group by substring(BYORGNO,1,6)+'000000000'"); } else if (PublicCls.OrgIsXian(sw.BYORGNO)) { sb.AppendFormat(" select count(BYORGNO) as C, BYORGNO"); sb.AppendFormat(" FROM T_IPSFR_USER"); sb.AppendFormat(" where ISENABLE = '1'"); sb.AppendFormat(" and substring(BYORGNO,1,6)+'000000000'='{0}'", sw.BYORGNO); sb.AppendFormat(" group by BYORGNO"); } else { sb.AppendFormat(" select hid,hname"); sb.AppendFormat(" FROM T_IPSFR_USER"); sb.AppendFormat(" where ISENABLE = '1'"); sb.AppendFormat(" and BYORGNO='{0}'", sw.BYORGNO); } DataSet ds = DataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 护林员统计 /// </summary> /// <returns>参见HUReport_HUCount_Model</returns> public static IEnumerable <HUReport_HUCount_Model> getHUCountModel(T_IPSFR_USER_SW sw) { var result = new List <HUReport_HUCount_Model>(); T_SYS_ORGSW swOrg = new T_SYS_ORGSW(); swOrg.SYSFLAG = ConfigCls.getSystemFlag(); swOrg.TopORGNO = sw.TopORGNO; if (PublicCls.OrgIsShi(sw.TopORGNO)) { swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县 } if (PublicCls.OrgIsXian(sw.TopORGNO)) { swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇 } DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg); //DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag() }); DataTable dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW { ISENABLE = "1" }); DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有 if (1 == 1) { HUReport_HUCount_Model m = new HUReport_HUCount_Model(); m.ORGName = BaseDT.T_SYS_ORG.getName(sw.TopORGNO) + "合计"; m.ORGNo = ""; m.HUCount = getHUCountBySex(dtHU, sw.TopORGNO, ""); m.Sex0Count = getHUCountBySex(dtHU, sw.TopORGNO, "1"); m.Sex1Count = getHUCountBySex(dtHU, sw.TopORGNO, "0"); m.Onstate0Count = getHUCountByOnstate(dtHU, sw.TopORGNO, "1"); m.Onstate1Count = getHUCountByOnstate(dtHU, sw.TopORGNO, "2"); result.Add(m); } for (int i = 0; i < drOrg.Length; i++) { HUReport_HUCount_Model m = new HUReport_HUCount_Model(); string orgName = drOrg[i]["ORGNAME"].ToString(); m.ORGName = orgName; m.ORGNo = drOrg[i]["ORGNO"].ToString(); m.HUCount = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), ""); m.Sex0Count = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), "1"); m.Sex1Count = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), "0"); m.Onstate0Count = getHUCountByOnstate(dtHU, drOrg[i]["ORGNO"].ToString(), "1"); m.Onstate1Count = getHUCountByOnstate(dtHU, drOrg[i]["ORGNO"].ToString(), "2"); result.Add(m); } dtHU.Clear(); dtHU.Dispose(); dtOrg.Clear(); dtOrg.Dispose(); return(result); }
/// <summary> /// 判断护林员线路、围栏是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在</returns> public static bool isRouteRailExists(T_IPSFR_USER_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from T_IPSFR_USER where 1=1"); if (string.IsNullOrEmpty(sw.HID) == false) { sb.AppendFormat(" and HID='{0}'", ClsSql.EncodeSql(sw.HID)); } return(DataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <summary> /// 返回各县护林员个数 用于统计优化 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static DataTable getDTShi(T_IPSFR_USER_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" select count(substring(BYORGNO,1,6)+'000000000') as C,substring(BYORGNO,1,6)+'000000000' as BYORGNO"); sb.AppendFormat(" FROM T_IPSFR_USER"); sb.AppendFormat(" where ISENABLE = '1'"); sb.AppendFormat(" group by substring(BYORGNO,1,6)+'000000000'"); DataSet ds = DataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 返回查询表格 /// </summary> /// <returns></returns> public ActionResult getHUCountJson() { T_IPSFR_USER_SW sw = new T_IPSFR_USER_SW(); sw.TopORGNO = Request.Params["TopORGNO"]; var list = HUReportCls.getHUCountModel(sw); StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table id=\"tb\" cellpadding=\"0\" cellspacing=\"0\">"); sb.AppendFormat("<thead>"); sb.AppendFormat(" <tr>"); sb.AppendFormat(" <th rowspan=\"2\">单位</th>"); sb.AppendFormat(" <th rowspan=\"2\">总数</th>"); sb.AppendFormat(" <th colspan=\"2\">性别</th>"); sb.AppendFormat(" <th colspan=\"2\">固/兼职</th>"); sb.AppendFormat(" </tr>"); sb.AppendFormat(" <tr>"); 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>"); int i = 0; foreach (var item in list) { i++; if (i % 2 == 0) { sb.AppendFormat(" <tr>"); } else { sb.AppendFormat(" <tr class='row1'>"); } sb.AppendFormat("<td class=\"left\">{0}</td>", item.ORGName); sb.AppendFormat("<td class=\"center\">{0}</td>", item.HUCount); sb.AppendFormat("<td class=\"center\">{0}</td>", item.Sex1Count); sb.AppendFormat("<td class=\"center\">{0}</td>", item.Sex0Count); sb.AppendFormat("<td class=\"center\">{0}</td>", item.Onstate0Count); sb.AppendFormat("<td class=\"center\">{0}</td>", item.Onstate1Count); sb.AppendFormat("</tr>"); } sb.AppendFormat("</tbody>"); sb.AppendFormat("</table>"); return(Content(JsonConvert.SerializeObject(new Message(true, sb.ToString(), "")), "text/html;charset=UTF-8")); }
public JsonResult GetIPSUserAjax(string userid) { T_IPSFR_USER_SW info = new T_IPSFR_USER_SW(); Message msg = new Message(false, "", ""); info.HID = userid; var model = T_IPSFR_USERCls.getModel(info);//获取护林员详细信息 if (model != null) { string enablestr = model.ISENABLE == "1" ? "启用" : "禁用"; string imageurl = "../Images/photo.png"; StringBuilder sb = new StringBuilder(); sb.AppendFormat(" <br />"); sb.AppendFormat("<div class=\"divTable\" style=\"margin:10px 5px;\">"); sb.AppendFormat("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" style=\"width:100%;height:200px\">"); sb.AppendFormat("<tr align=\"center\" height=\"30\">"); sb.AppendFormat("<td>姓名:</td><td>{0}</td>", model.HNAME); sb.AppendFormat("<td>性别:</td><td>{0}</td>", model.SEXNAME); sb.AppendFormat("<td colspan=\"2\" rowspan=\"3\"><div id=\"photodiv\" onclick=\"imgshow('photodiv')\"><img id=\"photoimg\" src=\"{0}\" title=\"{1}\"照片 style=\"width:150px;height:100px\"></div></td>", imageurl, model.HNAME); sb.AppendFormat("</tr>"); sb.AppendFormat("<tr align=\"center\" height=\"30\">"); sb.AppendFormat("<td>电话号码:</td><td>{0}</td>", model.PHONE); sb.AppendFormat("<td>出生日期:</td><td>{0}</td>", model.BIRTH); sb.AppendFormat("</tr>"); sb.AppendFormat("<tr align=\"center\" height=\"30\">"); sb.AppendFormat("<td>设备号:</td><td>{0}</td>", model.SN); sb.AppendFormat("<td>固/兼职:</td><td>{0}</td>", model.ONSTATENAME); sb.AppendFormat("</tr>"); sb.AppendFormat("<tr align=\"center\" height=\"30\">"); sb.AppendFormat("<td>是否启用:</td><td>{0}</td>", model.ISENABLENAME); sb.AppendFormat("<td>所属机构:</td><td colspan=\"3\">{0}</td>", model.ORGNAME); sb.AppendFormat("</tr>"); sb.AppendFormat("</table>"); sb.AppendFormat("</div>"); msg = new Message(true, sb.ToString(), ""); } return(Json(msg)); }
/// <summary> /// 获取护林员离线 在线 出围 /// </summary> /// <returns></returns> public JsonResult showHLYLineInOrOut() { Message ms = null; string str = Request.Params["obj"]; string curUserOrg = SystemCls.getCurUserOrgNo(); //获取当前登录用户的机构编码 var dataResult = new List <T_IPSFR_USER_Model>(); //护林员结果 if (string.IsNullOrEmpty(str)) { ms = new Message(false, "护林员离在出线参数传参错误", ""); return(Json(ms)); } string hidstr = string.Empty; var sw = new T_IPSFR_USER_SW(); if (str == "0")//护林员在线 { hidstr = T_IPSFR_USERCls.GetHids(curUserOrg, "0"); } else if (str == "1")//护林员离线 { hidstr = T_IPSFR_USERCls.GetHids(curUserOrg, "1"); } else if (str == "2")//护林员出围 { hidstr = T_IPSFR_USERCls.GetHids(curUserOrg, "2"); } sw.HID = hidstr; if (!string.IsNullOrEmpty(hidstr)) { dataResult = T_IPSFR_USERCls.getListModel(sw).ToList(); } StringBuilder sb = new StringBuilder(); int i = 0; sb.AppendFormat("<div class=\"divTable\">"); 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("</tr>"); sb.AppendFormat("</thead>"); sb.AppendFormat("<tbody role=\"alert\" aria-live=\"polite\" aria-relevant=\"all\">"); if (dataResult.Any()) { foreach (var person in dataResult) { if (i % 2 == 0) { sb.AppendFormat("<tr>"); } else { sb.AppendFormat("<tr class='row1'>"); } sb.AppendFormat("<td class=\"center\">{0}</td>", ++i); sb.AppendFormat("<td class=\"center\">{0}</td>", person.ORGNAME); sb.AppendFormat("<td class=\"center\">{0}</td>", person.HNAME); sb.AppendFormat("<td class=\"center\">{0}</td>", person.PHONE); sb.AppendFormat("</tr>"); } } else { sb.AppendFormat("<td colspan=\"4\"><em>暂无信息</em></td>"); } sb.AppendFormat("</tbody>"); sb.AppendFormat("</table>"); sb.AppendFormat("</div>"); ms = new Message(true, sb.ToString(), ""); return(Json(ms)); }
/// <summary> /// 导出 /// </summary> /// <returns></returns> public FileResult HUCountExportExcel() { var vMenu = T_SYS_MENUCls.getModel(new T_SYS_MENU_SW { MENUCODE = "004001", SYSFLAG = ConfigCls.getSystemFlag() }); //vMenu.MENUNAME 页面/菜单名称 NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); //添加一个sheet NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1"); sheet1.IsPrintGridlines = true; //打印时显示网格线 sheet1.DisplayGridlines = true; //查看时显示网格线 sheet1.SetColumnWidth(0, 50 * 256); sheet1.SetColumnWidth(1, 10 * 256); sheet1.SetColumnWidth(2, 10 * 256); sheet1.SetColumnWidth(3, 10 * 256); sheet1.SetColumnWidth(4, 10 * 256); sheet1.SetColumnWidth(5, 10 * 256); IRow row = sheet1.CreateRow(0); row.CreateCell(0).SetCellValue(vMenu.MENUNAME); row.GetCell(0).CellStyle = getCellStyleTitle(book); row = sheet1.CreateRow(1); row.CreateCell(0).SetCellValue("单位"); row.CreateCell(1).SetCellValue("总数"); row.CreateCell(2).SetCellValue("性别"); row.CreateCell(4).SetCellValue("固/兼职"); row.GetCell(0).CellStyle = getCellStyleHead(book); row.GetCell(1).CellStyle = getCellStyleHead(book); row.GetCell(2).CellStyle = getCellStyleHead(book); row.GetCell(4).CellStyle = getCellStyleHead(book); row = sheet1.CreateRow(2); row.CreateCell(2).SetCellValue("男"); row.CreateCell(3).SetCellValue("女"); row.CreateCell(4).SetCellValue("固职"); row.CreateCell(5).SetCellValue("兼职"); row.GetCell(2).CellStyle = getCellStyleHead(book); row.GetCell(3).CellStyle = getCellStyleHead(book); row.GetCell(4).CellStyle = getCellStyleHead(book); row.GetCell(5).CellStyle = getCellStyleHead(book); sheet1.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(0, 0, 0, 5)); sheet1.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 1, 2, 3)); sheet1.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 1, 4, 5)); sheet1.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 2, 0, 0)); sheet1.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 2, 1, 1)); T_IPSFR_USER_SW sw = new T_IPSFR_USER_SW(); sw.TopORGNO = Request.Params["TopORGNO"]; var list = HUReportCls.getHUCountModel(sw); int rowI = 0; foreach (var item in list) { row = sheet1.CreateRow(rowI + 3); row.CreateCell(0).SetCellValue(item.ORGName); row.CreateCell(1).SetCellValue(item.HUCount); row.CreateCell(2).SetCellValue(item.Sex0Count); row.CreateCell(3).SetCellValue(item.Sex1Count); row.CreateCell(4).SetCellValue(item.Onstate0Count); row.CreateCell(5).SetCellValue(item.Onstate1Count); for (int i = 0; i < 6; i++) { if (i == 0) { row.GetCell(0).CellStyle = getCellStyleLeft(book); } else { row.GetCell(i).CellStyle = getCellStyleCenter(book); } } rowI++; } // 写入到客户端 System.IO.MemoryStream ms = new System.IO.MemoryStream(); book.Write(ms); ms.Seek(0, SeekOrigin.Begin); string fileName = vMenu.MENUNAME + DateTime.Now.ToString("yyyy-MM-dd") + ".xls"; return(File(ms, "application/vnd.ms-excel", fileName)); }
/// <summary> /// 获取数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(T_IPSFR_USER_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT a.HID, a.HNAME, a.SN, a.PHONE, a.SEX, a.BIRTH, a.ONSTATE, a.BYORGNO,a.MOBILEPARAMLIST, a.ISENABLE,a.PATROLLENGTH, b.ORGNAME"); sb.AppendFormat(" FROM T_IPSFR_USER AS a LEFT OUTER JOIN T_SYS_ORG AS b ON a.BYORGNO = b.ORGNO"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.HID) == false) { if (sw.HID.Split(',').Length > 1) { sb.AppendFormat(" AND a.HID in({0})", ClsSql.EncodeSql(sw.HID)); } else { sb.AppendFormat(" AND a.HID ='{0}'", ClsSql.EncodeSql(sw.HID)); } } if (string.IsNullOrEmpty(sw.HNAME) == false) { sb.AppendFormat(" AND a.HNAME like '%{0}%'", ClsSql.EncodeSql(sw.HNAME)); } if (string.IsNullOrEmpty(sw.SN) == false) { sb.AppendFormat(" AND a.SN like '%{0}%'", ClsSql.EncodeSql(sw.SN)); } if (string.IsNullOrEmpty(sw.PHONE) == false) { if (sw.PHONE.Length == 11)//精确查询 { sb.AppendFormat(" AND a.PHONE= '{0}'", ClsSql.EncodeSql(sw.PHONE)); } else //模糊查询 { sb.AppendFormat(" AND a.PHONE like '%{0}%'", ClsSql.EncodeSql(sw.PHONE)); } } if (string.IsNullOrEmpty(sw.PHONELIST) == false) { if (sw.PHONELIST.Split(',').Length > 1) { sb.AppendFormat(" AND PHONE in({0})", ClsSql.SwitchStrToSqlIn(sw.PHONELIST)); } else { sb.AppendFormat(" AND PHONE ='{0}'", ClsSql.EncodeSql(sw.PHONELIST)); } } if (string.IsNullOrEmpty(sw.PATROLLENGTH) == false) { sb.AppendFormat(" AND a.PATROLLENGTH = '{0}'", ClsSql.EncodeSql(sw.PATROLLENGTH)); } if (string.IsNullOrEmpty(sw.SEX) == false) { sb.AppendFormat(" AND a.SEX = '{0}'", ClsSql.EncodeSql(sw.SEX)); } if (string.IsNullOrEmpty(sw.ONSTATE) == false) { sb.AppendFormat(" AND a.ONSTATE = '{0}'", ClsSql.EncodeSql(sw.ONSTATE)); } if (string.IsNullOrEmpty(sw.ISENABLE) == false)//默认取有效用户 { sb.AppendFormat(" AND a.ISENABLE = '{0}'", ClsSql.EncodeSql(sw.ISENABLE)); } if (string.IsNullOrEmpty(sw.PhoneHname) == false) { sb.AppendFormat(" AND (a.PHONE like '%{0}%' or a.HNAME like '%{0}%')", ClsSql.EncodeSql(sw.PhoneHname)); } 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 if (PublicCls.OrgIsCun(sw.BYORGNO)) { sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getCunIncOrgNo(sw.BYORGNO)); } } if (string.IsNullOrEmpty(sw.Orgs) == false) { string[] arr = sw.Orgs.Split(','); string tmpOrg = ""; for (int i = 0; i < arr.Length; i++) { if (arr[i].Length == 15) { if (tmpOrg != "") { tmpOrg += ","; } tmpOrg += arr[i]; } } if (tmpOrg != "") { string[] arr1 = tmpOrg.Split(',');//循环每个单位 sb.AppendFormat(" and ("); for (int i = 0; i < arr1.Length; i++) { if (i > 0) { sb.AppendFormat(" or"); } if (PublicCls.OrgIsShi(arr1[i])) { sb.AppendFormat(" BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(arr1[i])); } else if (PublicCls.OrgIsXian(arr1[i])) { sb.AppendFormat(" BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(arr1[i])); } else if (PublicCls.OrgIsZhen(arr1[i])) { sb.AppendFormat(" BYORGNO like '{0}%'", PublicCls.getZhenIncOrgNo(arr1[i])); } else if (PublicCls.OrgIsCun(arr1[i])) { sb.AppendFormat(" BYORGNO like '{0}%'", PublicCls.getCunIncOrgNo(arr1[i])); } } sb.AppendFormat(" )"); } } sb.AppendFormat(" ORDER BY a.BYORGNO,a.HNAME "); DataSet ds = DataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 获取数据 /// </summary> /// <returns>参见模型</returns> public static DataTable getDT(T_IPSFR_USER_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM T_IPSFR_USER a"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ISENABLE) == false) { sb.AppendFormat(" AND ISENABLE = '{0}'", ClsSql.EncodeSql(sw.ISENABLE)); } if (string.IsNullOrEmpty(sw.HID) == false) { sb.AppendFormat(" AND HID = '{0}'", ClsSql.EncodeSql(sw.HID)); } if (string.IsNullOrEmpty(sw.HNAME) == false) { sb.AppendFormat(" AND HNAME like '%{0}%'", ClsSql.EncodeSql(sw.HNAME)); } if (string.IsNullOrEmpty(sw.SN) == false) { sb.AppendFormat(" AND SN like '%{0}%'", ClsSql.EncodeSql(sw.SN)); } if (string.IsNullOrEmpty(sw.PHONE) == false) { sb.AppendFormat(" AND PHONE '%{0}%'", ClsSql.EncodeSql(sw.PHONE)); } if (string.IsNullOrEmpty(sw.SEX) == false) { sb.AppendFormat(" AND SEX = '{0}'", ClsSql.EncodeSql(sw.SEX)); } if (string.IsNullOrEmpty(sw.ONSTATE) == false) { sb.AppendFormat(" AND ONSTATE = '{0}'", ClsSql.EncodeSql(sw.ONSTATE)); } if (string.IsNullOrEmpty(sw.MOBILEPARAMLIST) == false) { sb.AppendFormat(" AND MOBILEPARAMLIST = '{0}'", ClsSql.EncodeSql(sw.MOBILEPARAMLIST)); } 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); } } if (string.IsNullOrEmpty(sw.PhoneHname) == false) { sb.AppendFormat(" AND (a.PHONE like '%{0}%' or a.HNAME like '%{0}%')", ClsSql.EncodeSql(sw.PhoneHname)); } string sql = "SELECT HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO,ISENABLE,PATROLLENGTH,MOBILEPARAMLIST" + sb.ToString() + " order by BYORGNO,HNAME"; 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]); }