Example #1
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public ZXYJInfoList GetDataList(ZXYJQueryCondition 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_RunEvent_ZXYJ where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_RunEvent_ZXYJ where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_RunEvent_ZXYJ where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            DataTable    dt   = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            ZXYJInfoList list = new ZXYJInfoList();

            foreach (DataRow dr in dt.Rows)
            {
                ZXYJInfo ZXYJ = new ZXYJInfo();
                DataRowToModel(ZXYJ, dr);
                list.Add(ZXYJ);
            }
            return(list);
        }
Example #2
0
        /// <summary>
        /// 获得记录总数
        /// </summary>
        public int GetDataCount(ZXYJQueryCondition 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_RunEvent_ZXYJ where 1=1" + strSqlOption.ToString());
            return(ObjectConvertClass.static_ext_int(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams)));
        }
Example #3
0
        /// <summary>
        /// 获得一个实体对象
        /// </summary>
        public ZXYJInfo GetModel(ZXYJQueryCondition 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_Plan_RunEvent_ZXYJ where 1=1 " + strSqlOption.ToString());
            DataTable dt    = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            ZXYJInfo  _ZXYJ = null;

            if (dt.Rows.Count > 0)
            {
                _ZXYJ = new ZXYJInfo();
                DataRowToModel(_ZXYJ, dt.Rows[0]);
            }
            return(_ZXYJ);
        }
Example #4
0
        /// <summary>
        /// 获得数据DataTable
        /// </summary>
        public DataTable GetDataTable(ZXYJQueryCondition 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_RunEvent_ZXYJ where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_RunEvent_ZXYJ where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_RunEvent_ZXYJ where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            return(SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]);
        }