示例#1
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]);
        }
示例#2
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(JC_FIRE_PLAN_SW sw)
        {
            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
                {
                    sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.BYORGNO));
                }
            }
            if (string.IsNullOrEmpty(sw.searchOrgNo) == false)//根据当前单位编码,反查上级单位预案,主要用于调度指挥
            {
                if (PublicCls.OrgIsShi(sw.searchOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getShiIncOrgNo(sw.searchOrgNo) + "00000");
                }
                else if (PublicCls.OrgIsXian(sw.searchOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO in  ('{0}','{1}')", PublicCls.getXianIncOrgNo(sw.searchOrgNo) + "000", PublicCls.getShiIncOrgNo(sw.searchOrgNo) + "00000");
                }
                else
                {
                    sb.AppendFormat(" and BYORGNO in  ('{0}','{1}','{2}')", PublicCls.getXianIncOrgNo(sw.searchOrgNo) + "000", PublicCls.getShiIncOrgNo(sw.searchOrgNo) + "00000", sw.searchOrgNo);
                }
            }
            string sql = "SELECT JC_FIRE_PLANID, BYORGNO, FIRELEVEL, PLANTITLE, PLANCONTENT, PLANFILENAME"
                         + sb.ToString()
                         + " order by BYORGNO DESC, FIRELEVEL";

            DataSet ds = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }
示例#3
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]);
        }
示例#4
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]);
        }
示例#5
0
        /// <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]);
        }
示例#6
0
 /// <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("");
     }
 }
示例#7
0
 /// <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("");
     }
 }
示例#8
0
        /// <summary>
        /// 获取DataTable
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>返回DataTable</returns>
        public static DataTable getDT(T_IPSFR_ROUTERAIL_PATROL_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" SELECT   a.HID, a.ROUTEDATE, a.LONGITUDE, a.ROADID,a.LATITUDE, a.ROUTESTATE,b.BYORGNO,b.PHONE,b.HNAME");
            sb.AppendFormat(" FROM T_IPSFR_ROUTERAIL_PATROL a  LEFT OUTER JOIN T_IPSFR_USER b ON a.HID = b.HID");
            sb.AppendFormat(" where 1=1");//护林员启用状态
            if (string.IsNullOrEmpty(sw.HID) == false)
            {
                sb.AppendFormat(" and a.HID='{0}'", sw.HID);
            }
            if (string.IsNullOrEmpty(sw.DateBegin) == false)
            {
                sb.AppendFormat(" and ROUTEDATE >= '{0}'", sw.DateBegin);
            }
            if (string.IsNullOrEmpty(sw.DateEnd) == false)
            {
                sb.AppendFormat(" and ROUTEDATE <= '{0}'", sw.DateEnd);
            }
            if (string.IsNullOrEmpty(sw.orgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.orgNo))
                {
                    sb.AppendFormat(" and b.BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.orgNo));
                }
                else if (PublicCls.OrgIsXian(sw.orgNo))
                {
                    sb.AppendFormat(" and b.BYORGNO like '{0}%'", PublicCls.getXianIncOrgNo(sw.orgNo));
                }
                else
                {
                    sb.AppendFormat(" and b.BYORGNO='{0}'", PublicCls.getZhenIncOrgNo(sw.orgNo));
                }
            }
            if (string.IsNullOrEmpty(sw.PhoneHname) == false)
            {
                sb.AppendFormat(" AND (b.PHONE  like '%{0}%' or b.HNAME like '%{0}%')", ClsSql.EncodeSql(sw.PhoneHname));
            }

            sb.AppendFormat(" order by a.HID,a.ROUTEDATE DESC,a.ROUTESTATE desc");
            return(DataBaseClass.FullDataSet(sb.ToString()).Tables[0]);
        }
示例#9
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]);
        }
示例#10
0
        /// <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]);
        }
示例#11
0
        /// <summary>
        /// 获取DataTable
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>DataTable</returns>
        public static DataTable getDT(OutRaiLCount_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" SELECT   a.HID,a.LONGITUDE,a.LATITUDE,a.SBTIME,b.HNAME,b.PHONE,b.BYORGNO");
            sb.AppendFormat(" FROM T_IPSFR_ROUTERAIL_RAIL a  LEFT OUTER JOIN T_IPSFR_USER b ON a.HID = b.HID");
            sb.AppendFormat(" where 1=1");//护林员启用状态
            if (string.IsNullOrEmpty(sw.DateBegin) == false)
            {
                sb.AppendFormat(" and a.SBTIME >= '{0} 00:00:00'", sw.DateBegin);
            }
            if (string.IsNullOrEmpty(sw.DateEnd) == false)
            {
                sb.AppendFormat(" and a.SBTIME <= '{0} 23:59:59'", sw.DateEnd);
            }

            if (string.IsNullOrEmpty(sw.orgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.orgNo))
                {
                    sb.AppendFormat(" and left(b.BYORGNO,4)='{0}'", PublicCls.getShiIncOrgNo(sw.orgNo));
                }
                else if (PublicCls.OrgIsXian(sw.orgNo))
                {
                    sb.AppendFormat(" and left(b.BYORGNO,6)='{0}'", PublicCls.getXianIncOrgNo(sw.orgNo));
                }
                else
                {
                    sb.AppendFormat(" and b.BYORGNO='{0}'", PublicCls.getZhenIncOrgNo(sw.orgNo));
                }
            }
            if (string.IsNullOrEmpty(sw.PhoneHname) == false)
            {
                sb.AppendFormat(" AND (b.PHONE  like '%{0}%' or b.HNAME like '%{0}%')", ClsSql.EncodeSql(sw.PhoneHname));
            }

            //sb.AppendFormat(" order by a.HID,a.SBTIME desc");
            return(DataBaseClass.FullDataSet(sb.ToString()).Tables[0]);
        }
示例#12
0
 /// <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("");
     }
 }
示例#13
0
 /// <summary>
 /// 获取上报与护林员、单位组合数量统计
 /// </summary>
 /// <param name="dt">DataTable</param>
 /// <param name="ORGNO">单位编码</param>
 /// <param name="SYSTYPEVALUE">上报类型ID</param>
 /// <returns>采集数量</returns>
 public static string getCountByOrgHUse(DataTable dt, string ORGNO, string SYSTYPEVALUE)
 {
     if (PublicCls.OrgIsShi(ORGNO))//市
     {
         if (string.IsNullOrEmpty(SYSTYPEVALUE))
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,4)='" + PublicCls.getShiIncOrgNo(ORGNO) + "'").ToString());
         }
         else
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,4)='" + PublicCls.getShiIncOrgNo(ORGNO) + "' and SYSTYPEVALUE='" + SYSTYPEVALUE + "'").ToString());
         }
     }
     else if (PublicCls.OrgIsXian(ORGNO))//县
     {
         if (string.IsNullOrEmpty(SYSTYPEVALUE))
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,6)='" + PublicCls.getXianIncOrgNo(ORGNO) + "'").ToString());
         }
         else
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,6)='" + PublicCls.getXianIncOrgNo(ORGNO) + "' and SYSTYPEVALUE='" + SYSTYPEVALUE + "'").ToString());
         }
     }
     else
     {
         if (string.IsNullOrEmpty(SYSTYPEVALUE))
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(ORGNO) + "'").ToString());
         }
         else
         {
             return(dt.Compute("count(HID)", "substring(ORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(ORGNO) + "' and SYSTYPEVALUE='" + SYSTYPEVALUE + "'").ToString());
         }
     }
     //return str;
 }
示例#14
0
        /// <summary>
        /// 护林员与数据上传中间表组合查询
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static DataTable getHRAndRealDataDT(T_IPS_REALDATATEMPORARYSW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" SELECT   a.BYORGNO,a.HNAME,a.HID,a.PHONE,b.USERID, b.SBDATE,(b.PATROLLENGTH-a.PATROLLENGTH/1000) as PatrolLenError,a.PATROLLENGTH/1000,b.PATROLLENGTH as RealPATROLLENGTH");
            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 and b.USERID is not null");//护林员启用状态
            if (string.IsNullOrEmpty(sw.DateBegin) == false)
            {
                sb.AppendFormat(" and SBDATE >= '{0}'", sw.DateBegin);
            }
            if (string.IsNullOrEmpty(sw.DateEnd) == false)
            {
                sb.AppendFormat(" and SBDATE <= '{0}'", sw.DateEnd);
            }
            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
                {
                    sb.AppendFormat(" and a.BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(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]);
        }
示例#15
0
        /// <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("");
            }
        }
示例#16
0
        /// <summary>
        /// 获取周末人员值班信息
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getWeekDT(DUTY_USER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT    ");
            sb.AppendFormat(" DUID, DUTYDATE, BYORGNO, DUTYUSERTYPE, DUTYUSERID, ISATTENDED,ATTENDEDTIME");
            sb.AppendFormat(" FROM      DUTY_USER");
            sb.AppendFormat(" WHERE   1=1");
            sb.AppendFormat(" AND DUTYDATE in(SELECT DISTINCT DUTYDATE FROM  DUTY_USER where datepart(weekday,DUTYDATE)=1 or datepart(weekday,DUTYDATE)=7)");
            if (string.IsNullOrEmpty(sw.DTBegin) == false)
            {
                sb.AppendFormat(" AND DUTYDATE>='{0}'", sw.DTBegin);
            }
            if (string.IsNullOrEmpty(sw.DTEnd) == false)
            {
                sb.AppendFormat(" AND DUTYDATE<='{0}'", sw.DTEnd);
            }
            if (string.IsNullOrEmpty(sw.curOrgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.curOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.curOrgNo));
                }
                else if (PublicCls.OrgIsXian(sw.curOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO like  '{0}%'", PublicCls.getXianIncOrgNo(sw.curOrgNo));
                }
                else
                {
                    sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.curOrgNo));
                }
            }

            sb.AppendFormat(" order by DUTYDATE");
            return(DataBaseClass.FullDataSet(sb.ToString()).Tables[0]);
        }
示例#17
0
        /// <summary>
        /// 获取周末人员值班信息
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getWeekDT(OD_USER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT    ");
            sb.AppendFormat(" OD_TYPEID,ODUID, ONDUTYDATE, BYORGNO, ONDUTYUSERTYPE, ONDUTYUSERID, ISATTENDED,ATTENDEDTIME");
            sb.AppendFormat(" FROM      OD_USER");
            sb.AppendFormat(" WHERE   1=1");
            sb.AppendFormat(" AND ONDUTYDATE in(SELECT     ONDUTYDATE FROM      OD_DATE where WEEK in('星期六','星期日'))");
            if (string.IsNullOrEmpty(sw.DTBegin) == false)
            {
                sb.AppendFormat(" AND ONDUTYDATE>='{0}'", sw.DTBegin);
            }
            if (string.IsNullOrEmpty(sw.DTEnd) == false)
            {
                sb.AppendFormat(" AND ONDUTYDATE<='{0}'", sw.DTEnd);
            }
            if (string.IsNullOrEmpty(sw.curOrgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.curOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO like '{0}%'", PublicCls.getShiIncOrgNo(sw.curOrgNo));
                }
                else if (PublicCls.OrgIsXian(sw.curOrgNo))
                {
                    sb.AppendFormat(" and BYORGNO like  '{0}%'", PublicCls.getXianIncOrgNo(sw.curOrgNo));
                }
                else
                {
                    sb.AppendFormat(" and BYORGNO = '{0}'", PublicCls.getZhenIncOrgNo(sw.curOrgNo));
                }
            }

            sb.AppendFormat(" order by ONDUTYDATE");
            return(DataBaseClass.FullDataSet(sb.ToString()).Tables[0]);
        }
示例#18
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("");
            }
        }
示例#19
0
        /// <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]);
        }
示例#20
0
 /// <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 getCountFIRECHANNELByOrgNo(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_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_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_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and FIRECHANNELLEVELTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and FIRECHANNELLEVELTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and FIRECHANNELLEVELTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "4")                   //统计防火通道使用性质
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and FIRECHANNELUSERTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and FIRECHANNELUSERTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_UTILITY_FIRECHANNEL_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and FIRECHANNELUSERTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     else
     {
         return("");
     }
 }
示例#21
0
 /// <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 getCountEquipByOrgNo(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_EQUIP_NEW_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and EQUIPTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and EQUIPTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and EQUIPTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "2")                   //统计使用现状
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_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_EQUIP_NEW_ID)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_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_EQUIP_NEW_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("count(DC_EQUIP_NEW_ID)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     else
     {
         return("");
     }
 }
示例#22
0
 /// <summary>
 /// 统计面积
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="orgNo"></param>
 /// <param name="DICTVALUE"></param>
 /// <param name="TYPE"></param>
 /// <returns></returns>
 public static string getAREACount(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("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and RESOURCETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and RESOURCETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and RESOURCETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "2")                   //统计林龄类别
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and AGETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and AGETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and AGETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "3")                   //统计起源类型
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and ORIGINTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and ORIGINTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and ORIGINTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "4")                   //统计可燃类型
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and BURNTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and BURNTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and BURNTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     if (TYPE == "5")                   //统计林木类型
     {
         if (PublicCls.OrgIsShi(orgNo)) //市
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and TREETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and TREETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(AREA)", "substring(ORGNOS,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and TREETYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     else
     {
         return("");
     }
 }
示例#23
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]);
        }
示例#24
0
 /// <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("");
     }
 }
示例#25
0
 /// <summary>
 /// 统计长度
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="orgNo"></param>
 /// <param name="DICTVALUE"></param>
 /// <param name="TYPE"></param>
 /// <returns></returns>
 public static string getLENGTHCount(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("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and USESTATE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "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("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and MANAGERSTATE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "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("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,4)='" + PublicCls.getShiIncOrgNo(orgNo) + "' and ISOLATIONTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsXian(orgNo))//县
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,6)='" + PublicCls.getXianIncOrgNo(orgNo) + "' and ISOLATIONTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else if (PublicCls.OrgIsZhen(orgNo))
         {
             if (string.IsNullOrEmpty(DICTVALUE))
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "'").ToString());
             }
             else
             {
                 return(dt.Compute("Sum(LENGTH)", "substring(BYORGNO,1,9)='" + PublicCls.getZhenIncOrgNo(orgNo) + "' and ISOLATIONTYPE='" + DICTVALUE + "'").ToString());
             }
         }
         else //机构编码可能不正确
         {
             return("");
         }
     }
     else
     {
         return("");
     }
 }
示例#26
0
 /// <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("");
     }
 }
示例#27
0
        /// <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 "";
            
        }
示例#28
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <returns>参见模型</returns>

        public static DataTable getDT(T_IPS_ALARM_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT ALARMID, LONGITUDE, LATITUDE, HEIGHT, PHONE, ADDRESS, ALARMTIME, ALARMCONTENT, MANSTATE,MANRESULT, MANTIME, MANUSERID");
            sb.AppendFormat(" FROM T_IPS_ALARM");
            sb.AppendFormat(" WHERE   1=1");
            //判断是否是多少,如果是多少,用in,如果只是一个,用=  主要考虑到速度
            if (string.IsNullOrEmpty(sw.ALARMID) == false)
            {
                if (sw.ALARMID.Split(',').Length > 1)
                {
                    sb.AppendFormat(" AND ALARMID in({0})", ClsSql.EncodeSql(sw.ALARMID));
                }
                else
                {
                    sb.AppendFormat(" AND ALARMID ='{0}'", ClsSql.EncodeSql(sw.ALARMID));
                }
            }


            //if (string.IsNullOrEmpty(sw.PHONE) == false)
            //{
            //    if (sw.PHONE.Length == 11)//精确查询
            //        sb.AppendFormat(" AND PHONE= '{0}'", ClsSql.EncodeSql(sw.PHONE));
            //    else//模糊查询
            //        sb.AppendFormat(" AND PHONE like '%{0}%'", ClsSql.EncodeSql(sw.PHONE));
            //}
            if (string.IsNullOrEmpty(sw.MANSTATE) == false)
            {
                sb.AppendFormat(" AND MANSTATE ='{0}'", ClsSql.EncodeSql(sw.MANSTATE));
            }

            if (string.IsNullOrEmpty(sw.orgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.orgNo))
                {
                    sb.AppendFormat(" and PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where left(BYORGNO,4)='{0}')", PublicCls.getShiIncOrgNo(sw.orgNo));
                }
                else if (PublicCls.OrgIsXian(sw.orgNo))
                {
                    sb.AppendFormat(" and PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where left(BYORGNO,6)='{0}')", PublicCls.getXianIncOrgNo(sw.orgNo));
                }
                else
                {
                    sb.AppendFormat(" and PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where BYORGNO='{0}')", PublicCls.getZhenIncOrgNo(sw.orgNo));
                }
                //if (sw.orgNo.Substring(4, 5) == "00000")//获取所有县的
                //    sb.AppendFormat(" AND PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where SUBSTRING(BYORGNO,1,4)) = '{0}'", ClsSql.EncodeSql(sw.orgNo.Substring(0, 4)));
                //else if (sw.orgNo.Substring(6, 3) == "000")//获取所有市的
                //    sb.AppendFormat(" AND PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where SUBSTRING(BYORGNO,1,6)) = '{0}'", ClsSql.EncodeSql(sw.orgNo.Substring(0, 6)));
                //else
                //    sb.AppendFormat(" AND PHONE in (SELECT    PHONE FROM      T_IPSFR_USER where BYORGNO = '{0}')", ClsSql.EncodeSql(sw.orgNo));
            }
            if (!string.IsNullOrEmpty(sw.DateBegin))
            {
                sb.AppendFormat(" AND ALARMTIME>='{0} 00:00:00'", sw.DateBegin);
            }
            if (!string.IsNullOrEmpty(sw.DateEnd))
            {
                sb.AppendFormat(" AND ALARMTIME<='{0} 23:59:59'", sw.DateEnd);
            }

            sb.AppendFormat(" ORDER BY ALARMTIME DESC ");

            DataSet ds = DataBaseClass.FullDataSet(sb.ToString());

            return(ds.Tables[0]);
        }
示例#29
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>DataTable</returns>

        public static DataTable getDT(T_IPSRPT_REPORT_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT REPORTID, HID, SYSTYPEVALUE, ADDRESS, REPORTTIME, COLLECTNAME, MANSTATE, MANRESULT,MANTIME, MANUSERID");
            sb.AppendFormat(" FROM T_IPSRPT_REPORTDATA ");
            sb.AppendFormat(" WHERE   1=1");
            //判断是否是多少,如果是多少,用in,如果只是一个,用=  主要考虑到速度
            if (string.IsNullOrEmpty(sw.REPORTID) == false)
            {
                if (sw.REPORTID.Split(',').Length > 1)
                {
                    sb.AppendFormat(" AND REPORTID in({0})", ClsSql.EncodeSql(sw.REPORTID));
                }
                else
                {
                    sb.AppendFormat(" AND REPORTID ='{0}'", ClsSql.EncodeSql(sw.REPORTID));
                }
            }
            if (string.IsNullOrEmpty(sw.SYSTYPEVALUE) == false)
            {
                sb.AppendFormat(" AND SYSTYPEVALUE ='{0}'", ClsSql.EncodeSql(sw.SYSTYPEVALUE));
            }

            if (string.IsNullOrEmpty(sw.MANSTATE) == false)
            {
                sb.AppendFormat(" AND MANSTATE ='{0}'", ClsSql.EncodeSql(sw.MANSTATE));
            }
            //根据护林员ID查询
            if (string.IsNullOrEmpty(sw.HID) == false)
            {
                sb.AppendFormat(" AND HID ='{0}'", ClsSql.EncodeSql(sw.HID));
            }

            if (string.IsNullOrEmpty(sw.orgNo) == false)
            {
                if (PublicCls.OrgIsShi(sw.orgNo))
                {
                    sb.AppendFormat(" and HID in (SELECT    HID FROM      T_IPSFR_USER where BYORGNO like '{0}%')", PublicCls.getShiIncOrgNo(sw.orgNo));
                }
                else if (PublicCls.OrgIsXian(sw.orgNo))
                {
                    sb.AppendFormat(" and HID in (SELECT    HID FROM      T_IPSFR_USER where BYORGNO like '{0}%')", PublicCls.getXianIncOrgNo(sw.orgNo));
                }
                else if (PublicCls.OrgIsZhen(sw.orgNo))
                {
                    sb.AppendFormat(" and HID in (SELECT    HID FROM      T_IPSFR_USER where BYORGNO='{0}')", PublicCls.getZhenIncOrgNo(sw.orgNo));
                }
                else
                {
                    //sb.AppendFormat(" and HID in (SELECT    HID FROM      T_IPSFR_USER where BYORGNO='{0}')", PublicCls.getZhenIncOrgNo(sw.orgNo));
                }
            }
            if (!string.IsNullOrEmpty(sw.DateBegin))
            {
                sb.AppendFormat(" AND REPORTTIME>='{0} 00:00:00'", sw.DateBegin);
            }
            if (!string.IsNullOrEmpty(sw.DateEnd))
            {
                sb.AppendFormat(" AND REPORTTIME<='{0} 23:59:59'", sw.DateEnd);
            }

            sb.AppendFormat(" ORDER BY REPORTTIME DESC ");

            DataSet ds = DataBaseClass.FullDataSet(sb.ToString());

            return(ds.Tables[0]);
        }