コード例 #1
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public Plan_Beginwork_StepList GetDataList(Plan_Beginwork_StepQueryCondition 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_Plan_Beginwork_Step where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_Beginwork_Step where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_Beginwork_Step 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];
            Plan_Beginwork_StepList list = null;

            if (dt.Rows.Count > 0)
            {
                list = new Plan_Beginwork_StepList();
                foreach (DataRow dr in dt.Rows)
                {
                    Plan_Beginwork_Step _Plan_Beginwork_Step = new Plan_Beginwork_Step();
                    DataRowToModel(_Plan_Beginwork_Step, dr);
                    list.Add(_Plan_Beginwork_Step);
                }
            }
            return(list);
        }
コード例 #2
0
        /// <summary>
        /// 获得记录总数
        /// </summary>
        public int GetDataCount(Plan_Beginwork_StepQueryCondition 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_Plan_Beginwork_Step where 1=1" + strSqlOption.ToString());
            return(ObjectConvertClass.static_ext_int(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams)));
        }
コード例 #3
0
        /// <summary>
        /// 获得数据DataTable
        /// </summary>
        public DataTable GetDataTable(Plan_Beginwork_StepQueryCondition 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_Plan_Beginwork_Step where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_Beginwork_Step where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_Beginwork_Step where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            return(SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]);
        }