Beispiel #1
0
        public static IQueryable <MarketCarInfo> GetCarsComMarketCarQuery(vincontrolscrappingEntities context, int?year)
        {
            if (!year.HasValue)
            {
                return(null);
            }

            if (year.Value <= 2000)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_lessorequal_year2000).Where(x => x.Year == year));
            }
            else if (year.Value >= 2001 && year.Value <= 2003)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_from_year2001_to_year2003).Where(x => x.Year == year));
            }
            else if (year.Value >= 2004 && year.Value <= 2005)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_from_year2004_to_year2005).Where(x => x.Year == year));
            }
            else if (year.Value == 2006)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2006));
            }
            else if (year.Value == 2007)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2007));
            }
            else if (year.Value == 2008)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2008));
            }
            else if (year.Value == 2009)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2009));
            }
            else if (year.Value == 2010)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2010));
            }
            else if (year.Value == 2011)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2011));
            }
            else if (year.Value == 2012)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2012));
            }
            else if (year.Value == 2013)
            {
                return(CarsComMapper.GetMarketCarInfoQuery(context.carscom_year2013));
            }

            return(null);
        }
Beispiel #2
0
        public static IQueryable <manheim_auctions> GetManheimAuctionMarketData(int year, string make, string modelWord, string trim)
        {
            var context = new vincontrolscrappingEntities();

            if (make.ToLower().Equals("bmw") && modelWord.ToLower().Contains("series"))
            {
                modelWord = trim;
            }

            if (make.ToLower().Equals("mercedes-benz") && modelWord.ToLower().Contains("class"))
            {
                modelWord = trim;

                modelWord = modelWord.Replace("Sport", "");

                modelWord = modelWord.Replace("Luxry", "");

                modelWord = modelWord.Replace("BlueTEC", "");


                modelWord = modelWord.Replace("BTC", "");

                modelWord = modelWord.Replace("CDI", "");

                modelWord = modelWord.Replace("BLK", "");



                if (modelWord.Length >= 2)
                {
                    if (modelWord.Substring(modelWord.Length - 2, 2).Equals("S4"))
                    {
                        modelWord = modelWord.Replace("S4", "");
                    }

                    if (modelWord.Substring(modelWord.Length - 2, 2).Equals("V4"))
                    {
                        modelWord = modelWord.Replace("V4", "");
                    }

                    if (modelWord.Substring(modelWord.Length - 2, 2).Equals("W4"))
                    {
                        modelWord = modelWord.Replace("W4", "");
                    }

                    if (modelWord.Substring(modelWord.Length - 2, 2).Equals("AE"))
                    {
                        modelWord = modelWord.Replace("AE", "");
                    }

                    if (modelWord.Substring(modelWord.Length - 2, 2).Equals("WZ"))
                    {
                        modelWord = modelWord.Replace("WZ", "");
                    }
                }

                if (modelWord[modelWord.Length - 1] == 'W')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }


                if (modelWord[modelWord.Length - 1] == 'R')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }



                if (modelWord[modelWord.Length - 1] == 'V')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }
                if (modelWord[modelWord.Length - 1] == 'C')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }


                if (modelWord[modelWord.Length - 1] == 'A')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }
                if (modelWord[modelWord.Length - 1] == 'K')
                {
                    modelWord = modelWord.Substring(0, modelWord.Length - 1);
                }
            }

            modelWord = FilterCarModelForMarket(modelWord);

            if (!make.ToLower().Equals("land rover"))
            {
                var result = context.manheim_auctions.Where(i => i.Year == year && i.Make == make &&
                                                            ((i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                              i.Trim.Replace(" ", "").Trim().ToLower()).Contains(modelWord.Replace(" ", "").ToLower())) && i.Mmr > 0);

                return(result);
            }

            else
            {
                if (modelWord.ToLower().Contains("rangeroversport"))
                {
                    var result = context.manheim_auctions.Where(i => i.Year == year && i.Make == make &&
                                                                ((i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                  i.Trim.Replace(" ", "").ToLower()).Contains("rangeroversport") &&
                                                                 i.Mmr > 0));

                    return(result);
                }
                else if (modelWord.ToLower().Contains("rangeroverevoque"))
                {
                    var result = context.manheim_auctions.Where(i => i.Year == year && i.Make == make &&
                                                                ((i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                  i.Trim.Replace(" ", "").ToLower()).Contains("rangeroverevoque") &&
                                                                 i.Mmr > 0));

                    return(result);
                }
                else if (modelWord.ToLower().Equals("rangerover"))
                {
                    var result = context.manheim_auctions.Where(i => i.Year == year && i.Make == make &&
                                                                ((i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                  i.Trim.Replace(" ", "").ToLower()).Contains("rangerover") &&
                                                                 !(i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                   i.Trim.Replace(" ", "").ToLower()).Contains("sport") &&
                                                                 !(i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                   i.Trim.Replace(" ", "").ToLower()).Contains("evoque") && i.Mmr > 0));

                    return(result);
                }
                else
                {
                    var result = context.manheim_auctions.Where(i => i.Year == year && i.Make == make &&
                                                                ((i.Model.Replace("-", "").Replace(" ", "").ToLower() +
                                                                  i.Trim.Replace(" ", "").Trim().ToLower()).Contains(modelWord.Replace(" ", "").ToLower())) &&
                                                                i.Mmr > 0);

                    return(result);
                }
            }
        }