Exemplo n.º 1
0
        /// <summary>
        /// 获得数据List
        /// <summary>
        public List <Base_TrainNo> GetDataList(Base_TrainNoQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            if (QueryCondition.page == 0)
            {
                strSql.Append("select * ");
                strSql.Append(" FROM TAB_Base_TrainNo where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Base_TrainNo where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Base_TrainNo where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            DataTable           dt   = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            List <Base_TrainNo> list = new List <Base_TrainNo>();

            foreach (DataRow dr in dt.Rows)
            {
                Base_TrainNo _Base_TrainNo = new Base_TrainNo();
                DataRowToModel(_Base_TrainNo, dr);
                list.Add(_Base_TrainNo);
            }
            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得记录总数
        /// <summary>
        public int GetDataCount(Base_TrainNoQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(*) ");
            strSql.Append(" FROM TAB_Base_TrainNo where 1=1" + strSqlOption.ToString());
            return(ObjectConvertClass.static_ext_int(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得一个实体对象
        /// <summary>
        public Base_TrainNo GetModel(Base_TrainNoQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * ");
            strSql.Append(" FROM TAB_Base_TrainNo where 1=1 " + strSqlOption.ToString());
            DataTable    dt            = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            Base_TrainNo _Base_TrainNo = null;

            if (dt.Rows.Count > 0)
            {
                _Base_TrainNo = new Base_TrainNo();
                DataRowToModel(_Base_TrainNo, dt.Rows[0]);
            }
            return(_Base_TrainNo);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得数据DataTable
        /// <summary>
        public DataTable GetDataTable(Base_TrainNoQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            if (QueryCondition.page == 0)
            {
                strSql.Append("select * ");
                strSql.Append(" FROM TAB_Base_TrainNo where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Base_TrainNo where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Base_TrainNo where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            return(SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]);
        }