/// <summary> /// Gets the models by range and manufacturer identifier. /// </summary> /// <param name="rangeName">The range name.</param> /// <param name="manufacturerId">The manufacturer identifier.</param> /// <returns>the car models</returns> public List <ICarModel> GetModelsByRangeNameAndManufacturer(string rangeName, int manufacturerId) { List <ICarModel> result = new List <ICarModel>(); Sproc procedure = new Sproc("ModelIds_Select_ByRangeAndManufacturer", DatabaseName); procedure.Parameters.Add("@manufacturerId", SqlDbType.Int).Value = manufacturerId; procedure.Parameters.Add("@range", SqlDbType.VarChar).Value = rangeName; using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader != null && reader.HasRows) { while (reader.Read()) { int id; if (Int32.TryParse(reader["CARModId"].ToString(), out id)) { result.Add(this.GetModelFromId(id)); } } } } return(result); }
/// <summary> /// Gets the tech data derivatives from id. /// </summary> /// <param name="modelId">The model id.</param> /// <returns>List of van derivatives</returns> public List <IVanDerivative> GetTechDataDerivativesFromId(int modelId) { Sproc sp = new Sproc("Review_Select_DerivativesByModel", DatabaseName); sp.Parameters.Add("@VANModId", SqlDbType.Int).Value = modelId; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr != null && dr.HasRows) { List <IVanDerivative> result = new List <IVanDerivative>(); IVanProvider vanProvider = ObjectFactory.GetInstance <IVanProvider>(); while (dr.Read()) { IVanDerivative d = vanProvider.GetDerivativeFromId((int)dr["VANDerId"]); if (d.HasTechData) { result.Add(d); } } return(result); } } return(null); }
/// <summary> /// Calls Der_Select_ById or Der_S_AllInModelById to create a derivative /// </summary> /// <param name="id">The derivative id</param> /// <param name="hintModel">If true, precache all derivatives for this model if this derivative is not already cached</param> /// <returns>A car derivative</returns> private ICarDerivative GetDerivativeFromId(int id, bool hintModel) { if (id <= 0) { return(null); } CarDerivative result = null; Sproc procedure = new Sproc("Der_Select_ById", DatabaseName); procedure.Parameters.Add("@Id", SqlDbType.Int).Value = id; using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader != null && dataReader.HasRows) { while (dataReader.Read()) { CarDerivative derivative = this.GetDerivativeFromDataReader(dataReader); if (derivative.Id == id) { result = derivative; } } } } return(result); }
/// <summary> /// Calls Man_Select_ById or Man_S_All to create a manufacturer /// </summary> /// <param name="id">The manufacturer id</param> /// <param name="hintAll">Precache all manufacturers if the requested manufacturer is not already cached</param> /// <returns>A car manufacturer</returns> private ICarManufacturer GetManufacturerFromId(int id, bool hintAll) { if (id == 0) { return(null); } CarManufacturer result = null; Sproc procedure = new Sproc("Man_S_All", DatabaseName); if (hintAll == false) { procedure.Name = "Man_Select_ById"; procedure.Parameters.Add("@Id", SqlDbType.Int).Value = id; } using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader.HasRows) { while (dataReader.Read()) { CarManufacturer manufacturer = this.GetManufacturerFromDataReader(dataReader); if (manufacturer.Id == id) { result = manufacturer; } } } } return(result); }
/// <summary> /// Gets the derivatives by model and plate id. /// </summary> /// <param name="modelId">The model id.</param> /// <param name="plateId">The plate id.</param> /// <param name="section">The section.</param> /// <returns> List of van derivatives </returns> public List <IVanDerivative> GetDerivativesByModelAndPlateId(int modelId, int plateId, VanValuationSection section) { if (plateId >= GetYearPlateFromForSection(section) && plateId <= GetYearPlateToForSection(section)) { Sproc sp = new Sproc("Used_Select_DerivsByModelAndPlate", Database); sp.Parameters.Add("@VANModId", SqlDbType.Int).Value = modelId; sp.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = plateId; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr != null && dr.HasRows) { List <IVanDerivative> result = new List <IVanDerivative>(); IVanProvider vanProvider = ObjectFactory.GetInstance <IVanProvider>(); while (dr.Read()) { result.Add(vanProvider.GetDerivativeFromId((int)dr["VANDerId"])); } return(result); } } return(null); } else { return(null); } }
/// <summary> /// Populates the mileage adjusted valuation. /// </summary> /// <param name="derivId">The deriv identifier.</param> /// <param name="plateId">The plate identifier.</param> /// <param name="section">The section.</param> /// <param name="valuation">The valuation.</param> private static void PopulateVanValuation(int derivId, int plateId, VanValuationSection section, VanValuation valuation) { if (plateId >= GetYearPlateFromForSection(section) && plateId <= GetYearPlateToForSection(section)) { valuation.Result = ValuationResultType.Error; IVanProvider vanProvider = ObjectFactory.GetInstance <IVanProvider>(); IYearPlateProvider yearPlateProvider = ObjectFactory.GetInstance <IYearPlateProvider>(); valuation.Derivative = vanProvider.GetDerivativeFromId(derivId); valuation.YearPlate = yearPlateProvider.FromId(plateId); valuation.ValuationSegments = new Dictionary <int, IVanValuationSegment>(); valuation.OriginalPrice = GetOriginalPrice(derivId, plateId); Sproc sp = new Sproc("Used_Select_Valuation", Database); sp.Parameters.Add("@VANDerId", SqlDbType.Int).Value = derivId; sp.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = plateId; using (SqlDataReader dataReader = sp.ExecuteReader()) { if (dataReader != null) { while (dataReader.Read()) { PopulateValuationSegmentFromDataReader(dataReader, valuation); } valuation.Result = ValuationResultType.VanEstimatedMileage; } } } }
/// <summary> /// Gets the available options. /// </summary> /// <param name="derivId">The derivative id.</param> /// <param name="plateId">The plate id.</param> /// <returns>List of valuation options</returns> public List <IValuationOption> GetAvailableOptions(int derivId, int plateId) { Sproc procedure = new Sproc("Used_Select_Options", DatabaseName); procedure.Parameters.Add("@CARDerId", SqlDbType.Int).Value = derivId; procedure.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = plateId; using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader != null && reader.HasRows) { List <IValuationOption> result = new List <IValuationOption>(); while (reader.Read()) { ValuationOption opt = new ValuationOption(); opt.OptionCode = (int)reader["OptionCode"]; opt.Category = (string)reader["Category"]; opt.Item = ((string)reader["Item"]).Trim(); opt.Cost = (decimal)reader["Cost"]; opt.Value = (decimal)(double)reader["Value"]; result.Add(opt); } return(result); } } return(null); }
public IComingSoon GetComingSoonFromId(int id) { Sproc sp = new Sproc("ComingSoon_Select", _database); sp.Parameters.Add("@PageId", SqlDbType.Int).Value = id; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr != null && dr.Read()) { return(GetComingSoonFromDataReader(dr)); } } return(null); }
/// <summary> /// Gets the range from id. /// </summary> /// <param name="id">The range id.</param> /// <returns>The Van range</returns> public IVanRange GetRangeFromId(int id) { Sproc sp = new Sproc("Ran_Select_ById", DatabaseName); sp.Parameters.Add("@Id", SqlDbType.Int).Value = id; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr.HasRows && dr.Read()) { return(this.GetRangeFromDataReader(dr)); } } return(null); }
/// <summary> /// Calls Der_Select_ByCapCode to create a derivative /// </summary> /// <param name="capCode">The cap code</param> /// <returns>A Car Derivative</returns> public ICarDerivative GetDerivativeFromCapCode(string capCode) { Sproc sp = new Sproc("Der_Select_ByCapCode", DatabaseName); sp.Parameters.Add("@CapCode", SqlDbType.VarChar).Value = capCode; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr.HasRows && dr.Read()) { return(this.GetDerivativeFromDataReader(dr)); } } return(null); }
/// <summary> /// Get the review for a given CARModId /// </summary> /// <param name="id">The CARModiI</param> /// <returns>The review</returns> public ICarReview GetReviewFromId(int id) { ICarReview result = null; Sproc procedure = new Sproc("Mod_Select_ById", DatabaseName); procedure.Parameters.Add("@Id", SqlDbType.Int).Value = id; using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader.HasRows && dataReader.Read()) { result = this.GetReviewFromDataReader(dataReader); } } return(result); }
public IVanReview GetReviewFromId(int id) { Sproc sp = new Sproc("Mod_Select_ById", _database); sp.Parameters.Add("@Id", SqlDbType.Int).Value = id; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr.HasRows && dr.Read()) { if ((bool)dr["Review"]) { return(GetReviewFromDataReader(dr)); } } } return(null); }
public static List <IPlace> GetPlacesFromString(string input) { List <IPlace> result = new List <IPlace>(); if (String.IsNullOrEmpty(input)) { return(result); } Postcode pc = new Postcode(input); if (pc.Outcode != null) { result.Add(pc); return(result); } Sproc sp = new Sproc("Geonames_S_FindLocation", _database); sp.Parameters.Add("@Search", SqlDbType.VarChar).Value = input.Replace(',', ' '); using (SqlDataReader dr = sp.ExecuteReader()) { bool hasWholeWordMatch = false; bool hasSimpleNameMatch = false; if (dr != null && dr.HasRows) { while (dr.Read()) { hasWholeWordMatch = hasWholeWordMatch || DataUtil.GetBoolean(dr, "WholeWord"); hasSimpleNameMatch = hasSimpleNameMatch || DataUtil.GetBoolean(dr, "ExcludingCounty"); if (hasWholeWordMatch == false || DataUtil.GetBoolean(dr, "WholeWord")) { if (hasSimpleNameMatch == false || DataUtil.GetBoolean(dr, "ExcludingCounty")) { result.Add(FromDataRecord(dr)); } } } } } return(result); }
/// <summary> /// Gets the original price. /// </summary> /// <param name="derivId">The deriv identifier.</param> /// <param name="yearPlateId">The year plate identifier.</param> /// <returns> /// the original price for derivative /// </returns> private static int GetOriginalPrice(int derivId, int yearPlateId) { int result = 0; Sproc sp = new Sproc("Used_Select_OriginalPrice", Database); sp.Parameters.Add("@VANDerId", SqlDbType.Int).Value = derivId; sp.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = yearPlateId; using (SqlDataReader dataReader = sp.ExecuteReader()) { if (dataReader != null && dataReader.Read()) { result = DataUtil.GetInt32(dataReader, "New"); } } return(result); }
public List <IComingSoon> GetActiveComingSoons() { Sproc sp = new Sproc("ComingSoon_Select_Active", _database); using (SqlDataReader dr = sp.ExecuteReader()) { if (dr != null && dr.HasRows) { List <IComingSoon> results = new List <IComingSoon>(); while (dr.Read()) { results.Add(GetComingSoonFromId((int)dr["PageId"])); } return(results); } } return(null); }
/// <summary> /// Returns a grid reference for the postcode, or null if none can be determined. /// </summary> /// <returns></returns> public GridRef GetLocation() { if (_gridRef == null) { // If we have a complete postcode, get a location from Capscan if (_isValid) { com.bauerhosting.postcodes.GridRef g = _service.GetLocation(_value, _siteName); if (g != null) { _gridRef = new GridRef(g.Easting, g.Northing, g.Latitude, g.Longitude); } //_gridRef = CapScanUtil.GetLocation( _value ); } // If this is a Belfast postcode and Capscan reports that it is east of Douglas, something // has gone wrong. Throw the grid ref away and get one from the database. if (_gridRef != null && _outcode != null && _outcode.StartsWith("BT") && _gridRef.Easting > 237800) { _gridRef = null; } // If we have an outcode but no grid ref, get a approximate location from the database if (_gridRef == null && _outcode != null) { Sproc sp = new Sproc("PostcodeDistrict_Select", "ParkersMeta"); sp.Parameters.Add("@Postcode", SqlDbType.VarChar, 10).Value = _outcode; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr.HasRows && dr.Read()) { _gridRef = new GridRef((int)dr["Easting"], (int)dr["Northing"], (double)dr["Latitude"], (double)dr["Longitude"]); } else { _gridRef = null; } } } } return(_gridRef); }
/// <summary> /// Populates a valuation object based on the mileage /// </summary> /// <param name="derivId">The derivative id</param> /// <param name="plateId">The plate id</param> /// <param name="mileage">The mileage</param> /// <param name="section">The valuation section</param> /// <param name="valuation">The valuation</param> private static void PopulateMileageAdjustedValuation(int derivId, int plateId, int mileage, CarValuationSection section, Valuation valuation) { if (plateId >= GetFromYearPlateIdForSection(section) && plateId <= GetToYearPlateIdForSection(section)) { Sproc procedure = new Sproc("Used_Select_Valuation", DatabaseName); procedure.Parameters.Add("@CARDerId", SqlDbType.Int).Value = derivId; procedure.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = plateId; if (mileage > 0) { procedure.Parameters.Add("@Mileage", SqlDbType.Int).Value = mileage; } else { procedure.Parameters.Add("@Mileage", SqlDbType.Int).Value = DBNull.Value; } valuation.Result = ValuationResultType.Error; using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader != null && reader.Read()) { PopulateValuationFromDataReader(reader, valuation); if (mileage == 0) { valuation.Result = ValuationResultType.StandardMileage; } else if (mileage == valuation.Mileage) { valuation.Result = ValuationResultType.MileageAdjusted; } else if (mileage > valuation.Mileage) { valuation.Result = ValuationResultType.MaximumMileage; } else if (mileage < valuation.Mileage) { valuation.Result = ValuationResultType.MinimumMileage; } } } } }
/// <summary> /// Gets the manufacturer ids with car tax data /// </summary> /// <returns>The list of manufacturer ids</returns> public List <int> GetManufacturerIdsWithCarTaxData() { Sproc procedure = new Sproc("Man_Ved_S", DatabaseName); List <int> manufacturerIdsWithCarTax = new List <int>(); using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { manufacturerIdsWithCarTax.Add(reader.GetInt32(0)); } } } return(manufacturerIdsWithCarTax); }
/// <summary> /// Calls Mod_Select_ById or Mod_S_AllInManById to create a model /// </summary> /// <param name="id">The model id</param> /// <param name="hintManufacturer">If true, cache all models from this manufacturer is the requested range is not already cached</param> /// <param name="hintReview">If true,cache the CarReview at the same time if the model is not already cached</param> /// <param name="hintRange">If true, cache the CarRange object at the same time if the model is not already cached</param> /// <returns>A car model</returns> private ICarModel GetModelFromId(int id, bool hintManufacturer, bool hintReview, bool hintRange) { if (id == 0) { return(null); } CarModel result = null; Sproc procedure = new Sproc("Mod_Select_ById", DatabaseName); if (hintManufacturer) { procedure.Name = "Mod_S_AllInManById"; procedure.Parameters.Add("@CARModId", SqlDbType.Int).Value = id; } else { procedure.Parameters.Add("@Id", SqlDbType.Int).Value = id; } using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader != null && dataReader.HasRows) { while (dataReader.Read()) { CarModel model = this.GetModelFromDataReader(dataReader); if (hintRange && hintManufacturer) { GetRangeFromId(model.RangeId, hintManufacturer); } if (model.Id == id) { result = model; } } } } return(result); }
/// <summary> /// Gets the tax years. /// </summary> /// <returns>Returns a list of tax years</returns> public IEnumerable <ITaxYear> GetTaxYears() { List <ITaxYear> result = new List <ITaxYear>(); Sproc storedProcedure = new Sproc("GetTaxYears", ParkersMetaDatabase); using (SqlDataReader reader = storedProcedure.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { result.Add(this.GetTaxYearFromDatabase(reader)); } } } return(result); }
/// <summary> /// A list of manufacturers which have at least one CarCheck /// </summary> /// <returns>The manufacturer ids with a checklist</returns> public List <int> GetManufacturerIdsWithChecklist() { Sproc procedure = new Sproc("CarCheck_Select_Manufacturers", "ParkersTransactionNew"); List <int> result = new List <int>(); using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader != null && dataReader.HasRows) { while (dataReader.Read()) { result.Add(dataReader.GetInt32(0)); } } } return(result); }
/// <summary> /// Gets the manufacturer ids with insurance infro /// </summary> /// <returns>List of manufacturer ids</returns> public List <int> GetManufacturerIdsWithInsuranceInfo() { Sproc procedure = new Sproc("Man_Ins_S", DatabaseName); List <int> result = new List <int>(); using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader != null && dataReader.HasRows) { while (dataReader.Read()) { result.Add(dataReader.GetInt32(0)); } } } return(result); }
/// <summary> /// The trims and equipment details for a model /// </summary> /// <param name="modelId">The model id</param> /// <returns>The trim list</returns> public TrimList GetTrimListFromModelId(int modelId) { TrimList result = new TrimList(); Sproc procedure = new Sproc("Trim_S_ByModel", DatabaseName); procedure.Parameters.Add("@CARModId", SqlDbType.Int).Value = modelId; using (SqlDataReader datareader = procedure.ExecuteReader()) { if (datareader != null && datareader.HasRows) { this.ProcessTrims(result, datareader); datareader.NextResult(); this.ProcessTrimEquipment(result, datareader); } } return(result); }
/// <summary> /// Gets the company car tax from the database /// </summary> /// <param name="derivativeId">The derivative id</param> /// <param name="taxYear">The tax year</param> /// <param name="taxRate">The tax rate</param> /// <param name="p11DOverrideValue">The P11D override value</param> /// <param name="plateId">The yearplate id</param> /// <returns>CompanyCarTaxResults representing the data</returns> public ICompanyCarTaxResults GetCompanyCarTax(int derivativeId, int taxYear, int taxRate, int p11DOverrideValue, int plateId) { Sproc procedure = new Sproc("CompanyCarTaxCalculator", DatabaseName); procedure.Parameters.Add("@year", SqlDbType.Int).Value = taxYear; procedure.Parameters.Add("@DerId", SqlDbType.Int).Value = derivativeId; procedure.Parameters.Add("@taxrate", SqlDbType.Int).Value = taxRate; procedure.Parameters.Add("@P11DPrice", SqlDbType.Int).Value = p11DOverrideValue; procedure.Parameters.Add("@YearPlateId", SqlDbType.Int).Value = plateId; using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader.HasRows && reader.Read()) { return(this.GetTaxFromDataReader(reader)); } } return(null); }
/// <summary> /// Gets the VED details by derivate id /// </summary> /// <param name="derivId">The derivative id</param> /// <returns>The VED Details set</returns> public List <IVEDDetailsSet> GetVEDDetailsByDerivId(int derivId) { List <IVEDDetailsSet> results = new List <IVEDDetailsSet>(); Sproc procedure = new Sproc("VED_S", DatabaseName); procedure.Parameters.Add("@CARDerId", SqlDbType.Int).Value = derivId; using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader.HasRows) { VEDDetailsSet currentSet = null; while (reader.Read()) { IVEDDetails ved = GetVEDFromDataReader(reader); if (currentSet == null || ved.EffectivePeriod != currentSet.EffectivePeriod) { currentSet = new VEDDetailsSet { EffectivePeriod = ved.EffectivePeriod }; results.Add(currentSet); } currentSet.Values.Add(ved); if (ved.FirstYearApplies) { currentSet.FirstYearApplies = true; } } } } foreach (IVEDDetailsSet item in results) { item.CombineResults(); } return(results); }
/// <summary> /// Gets all derivatives. /// </summary> /// <returns>All the derivatives</returns> public List <ICarDerivative> GetAllDerivatives() { List <ICarDerivative> result = new List <ICarDerivative>(); Sproc procedure = new Sproc("Der_Select", DatabaseName); using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader.HasRows && reader.Read()) { while (reader.Read()) { result.Add(this.GetDerivativeFromDataReader(reader)); } } } return(result); }
public List <IVanDerivative> GetDerivativesFromId(int modelId) { Sproc sp = new Sproc("Review_Select_DerivativesByModel", _database); sp.Parameters.Add("@VanModId", SqlDbType.Int).Value = modelId; using (SqlDataReader dr = sp.ExecuteReader()) { if (dr != null && dr.HasRows) { List <IVanDerivative> result = new List <IVanDerivative>(); while (dr.Read()) { result.Add(vanProvider.GetDerivativeFromId((int)dr["VanDerId"])); } return(result); } } return(null); }
/// <summary> /// Alll gallery images for a given model /// </summary> /// <param name="modelId">The model id</param> /// <returns>Collection of review images</returns> public ReviewImageCollection GetImagesByModelId(int modelId) { ReviewImageCollection result = new ReviewImageCollection(); Sproc procedure = new Sproc("ImgArchive_Select_ByModel", DatabaseName); procedure.Parameters.Add("@CARModId", SqlDbType.Int).Value = modelId; using (SqlDataReader dataReader = procedure.ExecuteReader()) { if (dataReader != null && dataReader.HasRows) { while (dataReader.Read()) { result.Add(this.GetReviewImageFromDataReader(dataReader)); } } } return(result); }
/// <summary> /// Populates the collection of classifications from the database. /// </summary> private static void PopulateFromDatabase() { classifications = new List <IVanClassification>(); Sproc procedure = new Sproc("Classification_Select", "ParkersVAN"); using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader != null && reader.HasRows) { while (reader.Read()) { int id; if (Int32.TryParse(reader["ClassificationId"].ToString(), out id)) { classifications.Add(new VanClassification { Id = id, Name = reader["ClassificationName"].ToString(), Description = reader["ClassificationDescription"].ToString(), LongDescription = reader["ClassificationDescriptionLong"].ToString(), AverageMileage = new Dictionary <int, int> { { 1, Convert.ToInt32(reader["AverageMileageYear1"].ToString()) }, { 2, Convert.ToInt32(reader["AverageMileageYear2"].ToString()) }, { 3, Convert.ToInt32(reader["AverageMileageYear3"].ToString()) }, { 4, Convert.ToInt32(reader["AverageMileageYear4"].ToString()) }, { 5, Convert.ToInt32(reader["AverageMileageYear5"].ToString()) }, { 6, Convert.ToInt32(reader["AverageMileageYear6"].ToString()) }, { 7, Convert.ToInt32(reader["AverageMileageYear7"].ToString()) }, { 8, Convert.ToInt32(reader["AverageMileageYear8"].ToString()) }, { 9, Convert.ToInt32(reader["AverageMileageYear9"].ToString()) }, { 10, Convert.ToInt32(reader["AverageMileageYear10"].ToString()) } }, }); } } } } }
/// <summary> /// Populates the dictionary. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="storedProcedureName">Name of the stored proceudre.</param> /// <param name="codeColumnName">Name of the code column.</param> /// <param name="descriptionColumnName">Name of the description column.</param> private static void PopulateDictionary(Dictionary <string, string> dictionary, string storedProcedureName, string codeColumnName, string descriptionColumnName) { Sproc procedure = new Sproc(storedProcedureName, DatabaseName); using (SqlDataReader reader = procedure.ExecuteReader()) { if (reader != null && reader.HasRows) { while (reader.Read()) { string code = DataUtil.GetString(reader, codeColumnName).Trim(); string name = DataUtil.GetString(reader, descriptionColumnName).Trim(); if (!String.IsNullOrEmpty(code) && !String.IsNullOrEmpty(name)) { dictionary.Add(code, name); } } } } }