public IList<Core.Business.Visitor> GetTopVisitorList(int num, long accountId) { IList<Core.Business.Visitor> visitorList = new List<Core.Business.Visitor>(); SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Num", SqlDbType.BigInt, num); sql.AddParameter("@AccountId", SqlDbType.BigInt, accountId); SqlDataReader reader = sql.ExecuteSPReader("USP_Visitor_SelectTop_By_AccountId"); if (reader != null) { while (reader.Read()) { Core.Business.Visitor visitor = new Visitor(); if (!reader.IsDBNull(0)) visitor.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) visitor.AccountId = reader.GetInt64(1); if (!reader.IsDBNull(2)) visitor.VisitorId = reader.GetInt64(2); if (!reader.IsDBNull(3)) visitor.VisiteDate = reader.GetDateTime(3); if (!reader.IsDBNull(4)) visitor.IP = reader.GetString(4); visitor.MarkOld(); visitorList.Add(visitor); } } return visitorList; }
public IList<Core.Business.Visitor> GetTopVisitorByActivityId(String ActivityId, int PageSize) { IList<Core.Business.Visitor> visitorList = new List<Core.Business.Visitor>(); SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@ActivityId", SqlDbType.NVarChar, ActivityId); sql.AddParameter("@PageSize", SqlDbType.BigInt, PageSize); SqlDataReader reader = sql.ExecuteSPReader("USP_Visitor_SelectTop_By_ActivityId"); if (reader != null) { while (reader.Read()) { Core.Business.Visitor visitor = new Visitor(); if (!reader.IsDBNull(0)) visitor.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) visitor.AccountId = reader.GetInt64(1); if (!reader.IsDBNull(2)) visitor.VisitorId = reader.GetInt64(2); if (!reader.IsDBNull(3)) visitor.VisiteDate = reader.GetDateTime(3); if (!reader.IsDBNull(4)) visitor.IP = reader.GetString(4); if (!reader.IsDBNull(5)) visitor.ActivityId = reader.GetString(5); if (!reader.IsDBNull(6)) visitor.VisitorName = reader.GetString(6); visitor.MarkOld(); visitorList.Add(visitor); } } return visitorList; }