/// <summary> /// 获得数据List /// </summary> public RunRecordFileMainList GetDataList(RunRecordMainQueryCondition 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_EndWork_RunRecrod_Main where 1=1 " + strSqlOption.ToString()); } else { strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from Tab_EndWork_RunRecrod_Main where 1 = 1 " + strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows + " nID from Tab_EndWork_RunRecrod_Main 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]; RunRecordFileMainList list = new RunRecordFileMainList(); foreach (DataRow dr in dt.Rows) { RunRecordFileMain _EndWork_RunRecrod_Main = new RunRecordFileMain(); DataRowToModel(_EndWork_RunRecrod_Main, dr); list.Add(_EndWork_RunRecrod_Main); } return(list); }
/// <summary> /// 获得记录总数 /// </summary> public int GetDataCount(RunRecordMainQueryCondition 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_EndWork_RunRecrod_Main where 1=1" + strSqlOption.ToString()); return(ObjectConvertClass.static_ext_int(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams))); }
/// <summary> /// 获得一个实体对象 /// </summary> public RunRecordFileMain GetModel(RunRecordMainQueryCondition 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_EndWork_RunRecrod_Main where 1=1 " + strSqlOption.ToString()); DataTable dt = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]; RunRecordFileMain _EndWork_RunRecrod_Main = null; if (dt.Rows.Count > 0) { _EndWork_RunRecrod_Main = new RunRecordFileMain(); DataRowToModel(_EndWork_RunRecrod_Main, dt.Rows[0]); } return(_EndWork_RunRecrod_Main); }
/// <summary> /// 获得数据DataTable /// </summary> public DataTable GetDataTable(RunRecordMainQueryCondition 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_EndWork_RunRecrod_Main where 1=1 " + strSqlOption.ToString()); } else { strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from Tab_EndWork_RunRecrod_Main where 1 = 1 " + strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows + " nID from Tab_EndWork_RunRecrod_Main where 1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc"); } return(SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]); }