public DataTable GetUserRedPager(int userid, UserRedPagerType type) { string str = string.Empty; switch (type) { case UserRedPagerType.All: str = " AND IsUsed=0 "; break; case UserRedPagerType.Usable: str = " AND IsUsed=0 and ExpiryTime>getdate()"; break; case UserRedPagerType.Expiry: str = " AND IsUsed=0 and ExpiryTime<getdate()"; break; default: str = " AND IsUsed=0 and ExpiryTime>getdate() "; break; } string query = string.Format("select * FROM vshop_UserRedPager WHERE UserId={0}" + str + " ORDER BY RedPagerID DESC", userid); DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { return(DataHelper.ConverDataReaderToDataTable(reader)); } }
public static DataTable GetUserRedPager(int userid, UserRedPagerType type) { return(new UserRedPagerDao().GetUserRedPager(userid, type)); }