Пример #1
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>true存在 false不存在</returns>
        public static bool isExists(DC_UTILITY_ISOLATIONSTRIP_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select 1 from DC_UTILITY_ISOLATIONSTRIP where 1=1");
            if (string.IsNullOrEmpty(sw.DC_UTILITY_ISOLATIONSTRIP_ID) == false)
            {
                sb.AppendFormat(" where DC_UTILITY_ISOLATIONSTRIP_ID= '{0}'", ClsSql.EncodeSql(sw.DC_UTILITY_ISOLATIONSTRIP_ID));
            }
            return(DataBaseClass.JudgeRecordExists(sb.ToString()));
        }
Пример #2
0
        /// <summary>
        /// 统计当前用户下防火通道的记录数量
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getNum(DC_UTILITY_ISOLATIONSTRIP_SW sw)
        {
            string        total = "";
            StringBuilder sb    = new StringBuilder();

            sb.AppendFormat("    from   DC_UTILITY_ISOLATIONSTRIP a ");
            sb.AppendFormat("where 1 = 1 ");
            if (sw.BYORGNO.Substring(4, 11) == "00000000000")  //获取所有市的
            {
                sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4)));
            }
            else if (sw.BYORGNO.Substring(6, 9) == "000000000" && sw.BYORGNO.Substring(4, 11) != "00000000000") //获取所有县的
            {
                sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6)));
            }
            else
            {
                sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9)));
            }
            string sqlC = "select count(1) " + sb.ToString();

            total = (DataBaseClass.ReturnSqlField(sqlC)).ToString();
            return(total);
        }
Пример #3
0
        /// <summary>
        /// 根据查询条件获取某一条用户信息记录,用于修改、删除、用户登录验证
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static DC_UTILITY_ISOLATIONSTRIP_Model getModel(DC_UTILITY_ISOLATIONSTRIP_SW sw)
        {
            var       result = new List <DC_UTILITY_ISOLATIONSTRIP_Model>();
            DataTable dt     = BaseDT.DC_UTILITY_ISOLATIONSTRIP.getDT(sw);//列表
            DataTable dtORG  = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位
            DataTable dt35 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "35"
            });                                                                              //防火隔离带类型
            DataTable dt36 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "36"
            });                                                                              //使用现状
            DataTable dt37 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "37"
            });                                                                              //维护类型
            DataTable dt52 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "52"
            });                                                                              //树种
            DataTable dt53 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "53"
            });                                                                              //规划生物隔离带位置
            DC_UTILITY_ISOLATIONSTRIP_Model m = new DC_UTILITY_ISOLATIONSTRIP_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.DC_UTILITY_ISOLATIONSTRIP_ID = dt.Rows[i]["DC_UTILITY_ISOLATIONSTRIP_ID"].ToString();
                m.ISOLATIONTYPE     = dt.Rows[i]["ISOLATIONTYPE"].ToString();
                m.ISOLATIONTYPEName = BaseDT.T_SYS_DICT.getName(dt35, m.ISOLATIONTYPE);
                m.NUMBER            = dt.Rows[i]["NUMBER"].ToString();
                m.NAME      = dt.Rows[i]["NAME"].ToString();
                m.BYORGNO   = dt.Rows[i]["BYORGNO"].ToString();
                m.BUILDDATE = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["BUILDDATE"].ToString());
                m.ENTRYTIME = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["ENTRYTIME"].ToString());
                //m.ENTRYTIME = ClsSwitch.SwitTM(dt.Rows[i]["ENTRYTIME"].ToString());
                m.USESTATE         = dt.Rows[i]["USESTATE"].ToString();
                m.USESTATEName     = BaseDT.T_SYS_DICT.getName(dt36, m.USESTATE);
                m.MANAGERSTATE     = dt.Rows[i]["MANAGERSTATE"].ToString();
                m.MANAGERSTATEName = BaseDT.T_SYS_DICT.getName(dt37, m.MANAGERSTATE);
                m.WIDTH            = dt.Rows[i]["WIDTH"].ToString();
                m.LENGTH           = dt.Rows[i]["LENGTH"].ToString();
                m.JDBEGIN          = dt.Rows[i]["JDBEGIN"].ToString();
                m.WDBEGIN          = dt.Rows[i]["WDBEGIN"].ToString();
                m.JDEND            = dt.Rows[i]["JDEND"].ToString();
                m.WDEND            = dt.Rows[i]["WDEND"].ToString();
                m.JWDLIST          = dt.Rows[i]["JWDLIST"].ToString();
                m.PLANAREA         = dt.Rows[i]["PLANAREA"].ToString();
                m.REALAREA         = dt.Rows[i]["REALAREA"].ToString();
                m.WORTH            = dt.Rows[i]["WORTH"].ToString();
                m.KINDTYPE         = dt.Rows[i]["KINDTYPE"].ToString();
                m.TREETYPE         = dt.Rows[i]["TREETYPE"].ToString();
                m.TREETYPEName     = BaseDT.T_SYS_DICT.getName(dt52, m.TREETYPE);
                m.Position         = dt.Rows[i]["POSITION"].ToString();
                m.PositionName     = BaseDT.T_SYS_DICT.getName(dt53, m.Position);
                m.Price            = dt.Rows[i]["PRICE"].ToString();
                m.AlleywayWideth   = dt.Rows[i]["ALLEYWAYWIDETH"].ToString();
                m.ORGName          = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                m.BUILDDATEBEGIN   = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["BUILDDATEBEGIN"].ToString());
                m.BUILDDATEEND     = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["BUILDDATEEND"].ToString());
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            dt35.Clear();
            dt35.Dispose();
            dt36.Clear();
            dt36.Dispose();
            dt37.Clear();
            dt37.Dispose();
            return(m);
        }
Пример #4
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public static DataTable getDT(DC_UTILITY_ISOLATIONSTRIP_SW sw, out int total)
        {
            StringBuilder sb = new StringBuilder();


            sb.AppendFormat(" FROM      DC_UTILITY_ISOLATIONSTRIP");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.DC_UTILITY_ISOLATIONSTRIP_ID) == false)
            {
                sb.AppendFormat(" AND DC_UTILITY_ISOLATIONSTRIP_ID = '{0}'", ClsSql.EncodeSql(sw.DC_UTILITY_ISOLATIONSTRIP_ID));
            }
            if (string.IsNullOrEmpty(sw.NUMBER) == false)
            {
                sb.AppendFormat(" AND NUMBER like '%{0}%'", ClsSql.EncodeSql(sw.NUMBER));
            }
            if (string.IsNullOrEmpty(sw.NAME) == false)
            {
                sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME));
            }
            if (string.IsNullOrEmpty(sw.ISOLATIONTYPE) == false)
            {
                sb.AppendFormat(" AND ISOLATIONTYPE = '{0}'", ClsSql.EncodeSql(sw.ISOLATIONTYPE));
            }
            if (string.IsNullOrEmpty(sw.USESTATE) == false)
            {
                sb.AppendFormat(" AND USESTATE = '{0}'", ClsSql.EncodeSql(sw.USESTATE));
            }
            if (string.IsNullOrEmpty(sw.MANAGERSTATE) == false)
            {
                sb.AppendFormat(" AND MANAGERSTATE = '{0}'", ClsSql.EncodeSql(sw.MANAGERSTATE));
            }

            if (!string.IsNullOrEmpty(sw.BYORGNO))
            {
                if (sw.BYORGNO.Substring(4, 11) == "00000000000")//获取所有市的
                {
                    sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4)));
                }
                else if (sw.BYORGNO.Substring(4, 11) == "xxxxxxxxxxx")//单独市
                {
                    sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,15) = '{0}')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4) + "00000000000"));
                }
                else if (sw.BYORGNO.Substring(6, 9) == "xxxxxxxxx")//获取所有县的
                {
                    sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6)));
                }
                else if (sw.BYORGNO.Substring(9, 6) == "000000")//获取说有乡镇的
                {
                    sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}'or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9)));
                }
                else if (sw.BYORGNO.Substring(12, 3) == "000")//获取说有村的
                {
                    sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,12) = '{0}'or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 12)));
                }
                else
                {
                    sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO));
                }
            }
            string sql = "SELECT DC_UTILITY_ISOLATIONSTRIP_ID, ISOLATIONTYPE, NUMBER, NAME, BYORGNO, BUILDDATE, USESTATE,MANAGERSTATE, WIDTH, LENGTH, JDBEGIN, WDBEGIN, JDEND, WDEND,JWDLIST,PLANAREA,REALAREA,WORTH,KINDTYPE,POSITION,PRICE,ALLEYWAYWIDETH,TREETYPE,ENTRYTIME,BUILDDATEBEGIN,BUILDDATEEND"
                         + sb.ToString()
                         + " order by BYORGNO,DC_UTILITY_ISOLATIONSTRIP_ID desc";
            string sqlC = "select count(1) " + sb.ToString();

            total      = int.Parse(DataBaseClass.ReturnSqlField(sqlC));
            sw.curPage = PagerCls.getCurPage(new PagerSW {
                curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total
            });
            DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a");

            return(ds.Tables[0]);
        }
Пример #5
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(DC_UTILITY_ISOLATIONSTRIP_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" FROM      DC_UTILITY_ISOLATIONSTRIP");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.DC_UTILITY_ISOLATIONSTRIP_ID) == false)
            {
                sb.AppendFormat(" AND DC_UTILITY_ISOLATIONSTRIP_ID = '{0}'", ClsSql.EncodeSql(sw.DC_UTILITY_ISOLATIONSTRIP_ID));
            }
            if (string.IsNullOrEmpty(sw.NUMBER) == false)
            {
                sb.AppendFormat(" AND NUMBER like '%{0}%'", ClsSql.EncodeSql(sw.NUMBER));
            }
            if (string.IsNullOrEmpty(sw.NAME) == false)
            {
                sb.AppendFormat(" AND NAME like '%{0}%'", ClsSql.EncodeSql(sw.NAME));
            }
            if (string.IsNullOrEmpty(sw.ISOLATIONTYPE) == false)
            {
                sb.AppendFormat(" AND ISOLATIONTYPE = '{0}'", ClsSql.EncodeSql(sw.ISOLATIONTYPE));
            }
            if (string.IsNullOrEmpty(sw.USESTATE) == false)
            {
                sb.AppendFormat(" AND USESTATE = '{0}'", ClsSql.EncodeSql(sw.USESTATE));
            }
            if (string.IsNullOrEmpty(sw.MANAGERSTATE) == false)
            {
                sb.AppendFormat(" AND MANAGERSTATE = '{0}'", ClsSql.EncodeSql(sw.MANAGERSTATE));
            }

            if (!string.IsNullOrEmpty(sw.BYORGNO))
            {
                if (sw.ORGNOSXZ != "1")
                {
                    if (sw.BYORGNO.Substring(4, 11) == "00000000000")//获取所有市的
                    {
                        sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,4) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 4)));
                    }
                    else if (sw.BYORGNO.Substring(6, 9) == "000000000")//获取所有县的
                    {
                        sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,6) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 6)));
                    }
                    else if (sw.BYORGNO.Substring(9, 6) == "000000")//获取说有乡镇的
                    {
                        sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,9) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 9)));
                    }
                    else if (sw.BYORGNO.Substring(12, 3) == "000")//获取说有村的
                    {
                        sb.AppendFormat(" AND (SUBSTRING(BYORGNO,1,12) = '{0}' or BYORGNO is null or BYORGNO='')", ClsSql.EncodeSql(sw.BYORGNO.Substring(0, 12)));
                    }
                    else
                    {
                        sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO));
                    }
                }
                else
                {
                    sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO));
                }
            }
            string sql = "SELECT DC_UTILITY_ISOLATIONSTRIP_ID, ISOLATIONTYPE, NUMBER, NAME, BYORGNO, BUILDDATE, USESTATE,MANAGERSTATE, WIDTH, LENGTH, JDBEGIN, WDBEGIN, JDEND, WDEND,JWDLIST,PLANAREA,REALAREA,WORTH,KINDTYPE,POSITION,PRICE,ALLEYWAYWIDETH,TREETYPE,ENTRYTIME,BUILDDATEBEGIN,BUILDDATEEND"
                         + sb.ToString()
                         + " order by DC_UTILITY_ISOLATIONSTRIP_ID desc";

            DataSet ds = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }