private static string BuildQuery(ADZoneSearchType listType, string keywords) { switch (listType) { case ADZoneSearchType.ZoneName: return("ZoneName LIKE '%" + DBHelper.FilterBadChar(keywords) + "%'"); case ADZoneSearchType.ZoneIntro: return("ZoneIntro LIKE '%" + DBHelper.FilterBadChar(keywords) + "%'"); } return(null); }
public static int GetTotalOfADZone(ADZoneSearchType listType, string keyword) { return(dal.GetTotalOfADZone()); }
public static IList <ADZoneInfo> GetADZoneList(int startRowIndex, int maximumRows, ADZoneSearchType listType, string keyword) { return(dal.GetAllADZone(startRowIndex, maximumRows, listType, keyword)); }
public IList <ADZoneInfo> GetAllADZone(int startRowIndexId, int maxNumberRows, ADZoneSearchType listType, string keywords) { Database database = DatabaseFactory.CreateDatabase(); IList <ADZoneInfo> list = new List <ADZoneInfo>(); string storedProcedureName = "PR_Common_GetList"; string str2 = BuildQuery(listType, keywords); DbCommand storedProcCommand = database.GetStoredProcCommand(storedProcedureName); database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxNumberRows); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "ZoneID"); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "*"); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC"); database.AddInParameter(storedProcCommand, "@Filter", DbType.String, str2); database.AddInParameter(storedProcCommand, "@TableName", DbType.String, "PE_AdZone"); database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxNumberRows); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { list.Add(GetAdZoneInfoFromrdr(reader)); } } this.m_NumADZones = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(list); }