コード例 #1
0
        /// <summary>
        /// Gets the plates by model id.
        /// </summary>
        /// <param name="modelId">The model id.</param>
        /// <param name="section">The section.</param>
        /// <returns>List of year plates</returns>
        public List <IYearPlate> GetPlatesByModelId(int modelId, CarValuationSection section)
        {
            int sectionYearFromPlateId = GetFromYearPlateIdForSection(section);
            int sectionYearToPlateId   = GetToYearPlateIdForSection(section);

            ICarModel model = CarModel.FromId(modelId);

            if (model.FromYearPlate == null || model.ToYearPlate == null)
            {
                return(null);
            }

            int plateFrom = model.FromYearPlate.Id;
            int plateTo   = model.ToYearPlate.Id;

            if (sectionYearFromPlateId > plateFrom)
            {
                plateFrom = sectionYearFromPlateId;
            }

            if (sectionYearToPlateId < plateTo)
            {
                plateTo = sectionYearToPlateId;
            }

            return(yearPlateProvider.GetRange(plateFrom, plateTo));
        }
コード例 #2
0
        /// <summary>
        /// All models having a derivative with the given insurance group
        /// </summary>
        /// <param name="group">The insurance group</param>
        /// <returns>List of models in the group</returns>
        public List <ICarModel> GetModelsByInsuranceGroup(int group)
        {
            List <ICarModel> result = new List <ICarModel>();

            Sproc procedure = new Sproc("ModIds_Select_ByIG", DatabaseName);

            procedure.Parameters.Add("@IG", SqlDbType.Int).Value = group;

            using (SqlDataReader dr = procedure.ExecuteReader())
            {
                if (dr != null && dr.HasRows)
                {
                    while (dr.Read())
                    {
                        result.Add(CarModel.FromId((int)dr["CARModId"]));
                    }
                }
            }

            return(result);
        }
コード例 #3
0
 /// <summary>
 /// Backs the base.Model property
 /// </summary>
 /// <returns></returns>
 protected override IModel GetModel()
 {
     return(CarModel.FromId(_modelId));
 }