public IList<Core.Business.PV> GetAllPV() { IList<Core.Business.PV> pVlist = new List<Core.Business.PV>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPVsAll"); if(reader != null) { while(reader.Read()) { Core.Business.PV pV = new Core.Business.PV(); if (!reader.IsDBNull(0)) pV.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) pV.IP = reader.GetString(1); if (!reader.IsDBNull(2)) pV.VisitDate = reader.GetDateTime(2); pV.MarkOld(); pVlist.Add(pV); } reader.Close(); } return pVlist; }
public IList<PV> GetPVDynamic(string whereCondition, string orderByExpression) { if (string.IsNullOrEmpty(whereCondition)) { return this.GetAllPV(); } IList<Core.Business.PV> pVlist = new List<Core.Business.PV>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition); sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPVsDynamic"); if (reader != null) { while (reader.Read()) { Core.Business.PV pV = new Core.Business.PV(); if (!reader.IsDBNull(0)) pV.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) pV.IP = reader.GetString(1); if (!reader.IsDBNull(2)) pV.VisitDate = reader.GetDateTime(2); pV.MarkOld(); pVlist.Add(pV); } reader.Close(); } return pVlist; }
public Core.Business.PV Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPV"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.PV pV = new Core.Business.PV(); if (!reader.IsDBNull(0)) pV.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) pV.IP = reader.GetString(1); if (!reader.IsDBNull(2)) pV.VisitDate = reader.GetDateTime(2); reader.Close(); return pV; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }