public DataTable Get统计( string strWhere )
        {
            int nYNow = DateTime.Now.Year;
            int nY80 = nYNow - 80;
            int nY90 = nYNow - 90;
            int nY100 = nYNow - 100;

            string str80 = String.Format("{0}-01-01", nY80);
            string str90 = String.Format( "{0}-01-01", nY90 );
            string str100 = String.Format( "{0}-01-01", nY100 );

            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( @"select 街道, 
                                            SUM( CASE WHEN 出生日期 >= '{0}' and 出生日期 < '{1}' THEN 1 ELSE 0 END) as 年龄段80,
                                            SUM( CASE WHEN 出生日期 >= '{1}' and 出生日期 < '{2}' THEN 1 ELSE 0 END) as 年龄段90,
                                            SUM( CASE WHEN 出生日期 >= '{2}' THEN 1 ELSE 0 END) as 年龄段100
                                                                          
                                            from {3} {4}  group by 街道 ",
                                            str80, str90, str100,
                                            DB.Tab.老龄办.发放老龄津贴.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt( Tab.USER.TAB );
            Sql.Close();
            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            DataTable dt = Sql.GetBlankDt(Tab.TEST_LOG.TAB);
            Sql.Close();
            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt( DB.Tab.优抚科.优抚对象.伤残人员.基本信息.TAB );
            Sql.Close();
            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL ( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt(DB.Tab.福利中心.老人入住管理_监护人.TAB);
            dt.Rows.Clear();
            Sql.Close();
            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt( DB.Tab.优抚科.优抚对象.在乡复员军人.生活费来源.TAB );
            dt.Rows.Clear();
            Sql.Close();
            return dt;
        }
        public void Delete_Table( )
        {
            SQL Sql = new SQL ( DBParam.Sql.Connect );

            string strSql = String.Format ( "delete from {0} " , DB.Tab.福利中心.老人费用登记管理.TAB );
            Sql.Exec ( strSql );

            Sql.Close ();
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt( DB.Tab.事务科.低收入居民.TAB );
            dt.Rows.Clear();
            Sql.Close();
            return dt;
        }
        public void Delete_Table( )
        {
            SQL Sql = new SQL ( DBParam.Sql.Connect );

            string strSql = String.Format ( "delete from {0} " , DB.Tab.基层科.社区服务信息管理_社区公益服务.TAB );
            Sql.Exec ( strSql );

            Sql.Close ();
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt( DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员员子女役人员.基本信息.TAB );
            dt.Rows.Clear();
            Sql.Close();
            return dt;
        }
        public DataTable GetBlank()
        {
            SQL Sql = new SQL ( DBParam.Sql.Connect );

            DataTable dt = Sql.GetBlankDt(DB.Tab.基层科.社区服务信息管理_社区公益服务.TAB);
            dt.Rows.Clear();
            Sql.Close();
            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage( int nPageNo, string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql2005( DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员员子女役人员.基本信息.TAB, nPageNo, CONST.PageSize, DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员员子女役人员.基本信息.ID, strWhere, false );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();
            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage( int nPageNo, string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql2005( DB.Tab.事务科.低收入居民.TAB, nPageNo, CONST.PageSize, DB.Tab.事务科.低收入居民.ID, strWhere, false );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();
            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage(int nPageNo, string strWhere)
        {
            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql(Tab.TEST_LOG.TAB, nPageNo, FrontFlag.Test.DEF.PageSize, Tab.TEST_LOG.ID, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();
            return dt;
        }
        public int GetPageMax( string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            int nRecCount = 0;

            int nPageNum = Sql.GetPageMaxPage( DB.Tab.事务科.低收入居民.TAB, strWhere, ref nRecCount, CONST.PageSize );

            Sql.Close();

            return nPageNum;
        }
        public int GetPageMax( string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            int nRecCount = 0;

            int nPageNum = Sql.GetPageMaxPage( DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员.生活费来源.TAB, strWhere, ref nRecCount, CONST.PageSize );

            Sql.Close();

            return nPageNum;
        }
        public int GetPageMax(string strWhere)
        {
            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            int nRecCount = 0;

            int nPageNum = Sql.GetPageMaxPage(Tab.TEST_LOG.TAB, strWhere, ref nRecCount, FrontFlag.Test.DEF.PageSize);

            Sql.Close();

            return nPageNum;
        }
        public string Save(ref DataTable dt)
        {
            if (!SQL.IsValid(ref dt))
                return "";

            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            string strID = Sql.Save(ref dt);

            Sql.Close();

            return strID;
        }
        public string Save( ref DataTable dt )
        {
            if ( !SQL.IsValid( ref dt ) )
                return "";

            SQL Sql = new SQL( DBParam.Sql.Connect );

            string strID = Sql.Save( ref dt );

            Sql.Close();

            return strID;
        }
        public bool Delete_Where( string strWhere )
        {
            //Not allow delete all data in table
            if ( strWhere.Trim () == "" )
                return false;

            SQL Sql = new SQL ( DBParam.Sql.Connect );

            string strSql = String.Format ( "delete from {0} where {1}" , DB.Tab.基层科.社区服务信息管理_社区公益服务.TAB , strWhere );
            Sql.Exec ( strSql );

            Sql.Close ();

            return true;
        }
        public DataTable GetWhere( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select * from {0} {1} order by ID desc", DB.Tab.事务科.低收入居民.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public DataTable GetCount( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL ( DBParam.Sql.Connect );

            if (strWhere.Trim() != "")
                strWhere = " Where " + strWhere;

            string strSql = String.Format("select Count(*) from {0} {1} ", DB.Tab.基层科.社区服务信息管理_社区公益服务.TAB, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();

            return dt;
        }
        public DataTable GetWhere(string strWhere)
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            if (strWhere.Trim() != "")
                strWhere = " Where " + strWhere;

            string strSql = String.Format("select * from {0} {1} order by ID desc", Tab.TEST_LOG.TAB, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();

            return dt;

        }
        /// <summary>
        /// 查找指定Type的ID.
        /// </summary>
        /// <param name="strName"></param>
        /// <param name="strParenID"></param>
        /// <returns></returns>
        string GetPahtID( string strName, string strParenID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            string strRet = "";

            string strSql = String.Format( "select {0} from {1} where {2}='{3}' and {4}='{5}' ", Tab.ID, Tab.TAB, Tab.Name, strName, Tab.ParentID, strParenID );

            DataTable dt = Sql.ExecDataTable( strSql );

            if( SQL.IsValid( ref dt ) )
            {
                strRet = dt.Rows[0][Tab.ID].ToString().Trim();
            }

            Sql.Close();

            return strRet;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strID"></param>
        /// <returns></returns>
        DIC_STRU GetStru_ByID( string strID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            string strRet = "";

            string strSql = String.Format( "select * from {1} where {2}='{3}' ", Tab.ID, Tab.TAB, Tab.ID, strID );

            DataTable dt = Sql.ExecDataTable( strSql );
            Sql.Close();

            if( !SQL.IsValid( ref dt ) )
                return null;

            DIC_STRU stru = new DIC_STRU();

            DataRow dr = dt.Rows[0];
            stru.Dr2Stru( dr );

            return stru;
        }
        public DataTable Get统计( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( @"select 街道, 
                                            SUM( CASE WHEN 优待证类别 = '黄证' THEN 1 ELSE 0 END) as 黄证,
                                            SUM( CASE WHEN 优待证类别 = '蓝证' THEN 1 ELSE 0 END) as 蓝证,
                                            SUM( CASE WHEN 优待证类别 = '免费乘车证' THEN 1 ELSE 0 END) as 免费乘车证,   
                                            Count(*) as 合计                                            
                                            from {0} {1}  group by 街道 ",
                                            DB.Tab.老龄办.敬老优待证.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public void Update_ByID( string strID, string strFld, string strVal )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            string strSql = String.Format( "update {0} set {1}='{2}' where ID='{3}'", DB.Tab.事务科.低收入居民.TAB, strFld, strVal, strID );
            Sql.Exec( strSql );

            Sql.Close();
        }
        public DataTable GetSum( string strFld, string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select Sum({2}) from {0} {1} ", DB.Tab.老龄办.敬老优待证统计.TAB, strWhere, strFld );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public void Delete_Table()
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            string strSql = String.Format( "delete from {0} ", DB.Tab.优抚科.优抚对象.在乡复员军人.生活费来源.TAB );
            Sql.Exec( strSql );

            Sql.Close();
        }
        public bool FakeDelete_Where( string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            string strSql = String.Format( "update {0} set {1}='True' where {2}", DB.Tab.优抚科.优抚对象.在乡复员军人.生活费来源.TAB, DB.Tab.优抚科.优抚对象.在乡复员军人.生活费来源.DelFlag, strWhere );
            Sql.Exec( strSql );

            Sql.Close();

            return true;
        }