Beispiel #1
0
        public List <VinControlVehicleReport> GetNext7DaysBucketJumpVehicles(int dealerId)
        {
            var mProducts = new List <VinControlVehicleReport>();

            var context = new whitmanenterprisewarehouseEntities();

            IQueryable <whitmanenterprisedealershipinventory> avaiInventory =
                from e in InventoryQueryHelper.GetSingleOrGroupInventory(context)
                where e.NewUsed.ToLower().Equals("used") && (e.Recon == null || !((bool)e.Recon))
                select e;

            var dtDealerSetting = InventoryQueryHelper.GetSingleOrGroupSetting(context).ToList();

            var dtDealerInfo = InventoryQueryHelper.GetSingleOrGroupDealer(context).ToList();

            for (int i = 1; i <= 7; i++)
            {
                foreach (var tmp in avaiInventory.OrderBy(x => x.Make))
                {
                    int daysInInvenotry = DateTime.Now.AddDays(i).Subtract(tmp.DateInStock.GetValueOrDefault()).Days;

                    bool flag = dtDealerSetting.FirstOrDefault(item => tmp.DealershipId == item.DealershipId).IntervalBucketJump != 0 && ((daysInInvenotry == dtDealerSetting.FirstOrDefault(item => tmp.DealershipId == item.DealershipId).FirstTimeRangeBucketJump) || (daysInInvenotry == dtDealerSetting.FirstOrDefault(item => tmp.DealershipId == item.DealershipId).SecondTimeRangeBucketJump) || ((daysInInvenotry - dtDealerSetting.FirstOrDefault(item => tmp.DealershipId == item.DealershipId).SecondTimeRangeBucketJump) % dtDealerSetting.FirstOrDefault(item => tmp.DealershipId == item.DealershipId).IntervalBucketJump) == 0);

                    if (flag)
                    {
                        var v = new VinControlVehicleReport
                        {
                            AutoId          = mProducts.Count + 1,
                            ModelYear       = tmp.ModelYear.GetValueOrDefault(),
                            Make            = String.IsNullOrEmpty(tmp.Make) ? "" : tmp.Make,
                            Model           = String.IsNullOrEmpty(tmp.Model) ? "" : tmp.Model,
                            Trim            = String.IsNullOrEmpty(tmp.Trim) ? "" : tmp.Trim,
                            StockNumber     = String.IsNullOrEmpty(tmp.StockNumber) ? "" : tmp.StockNumber,
                            Vin             = String.IsNullOrEmpty(tmp.VINNumber) ? "" : tmp.VINNumber,
                            Mileage         = String.IsNullOrEmpty(tmp.Mileage) ? "" : tmp.Mileage,
                            ExteriorColor   = String.IsNullOrEmpty(tmp.ExteriorColor) ? "" : tmp.ExteriorColor,
                            SalePrice       = String.IsNullOrEmpty(tmp.SalePrice) ? "" : tmp.SalePrice,
                            DaysInInvenotry = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                            DealershipName  = String.IsNullOrEmpty(dtDealerInfo.FirstOrDefault(item => tmp.DealershipId == item.idWhitmanenterpriseDealership).DealershipName)
                                                 ? ""
                                                 : dtDealerInfo.FirstOrDefault(item => tmp.DealershipId == item.idWhitmanenterpriseDealership).DealershipName,
                            Engine = String.IsNullOrEmpty(tmp.EngineType) ? "" : tmp.EngineType,
                            Style  = String.IsNullOrEmpty(tmp.BodyType) ? "" : tmp.BodyType,
                            Date   = new DateTime(DateTime.Now.AddDays(i).Year, DateTime.Now.AddDays(i).Month, DateTime.Now.AddDays(i).Day)
                        };


                        if (v.Engine.Contains("Engine"))
                        {
                            v.Engine = v.Engine.Replace("Engine", "");
                        }


                        mProducts.Add(v);
                    }
                }
            }

            return(mProducts);
        }
Beispiel #2
0
        public List <VinControlVehicleReport> GetCertifiedVehicles(int dealerId)
        {
            var mProducts = new List <VinControlVehicleReport>();

            var context = new whitmanenterprisewarehouseEntities();


            IQueryable <whitmanenterprisedealershipinventory> avaiInventory =
                from e in InventoryQueryHelper.GetSingleOrGroupInventory(context)
                where e.Certified.Value
                select e;

            var dtDealerSetting = context.whitmanenterprisesettings.FirstOrDefault(x => x.DealershipId == dealerId);

            var dtDealerInfo = context.whitmanenterprisedealerships.FirstOrDefault(x => x.idWhitmanenterpriseDealership == dealerId);

            foreach (var tmp in avaiInventory.OrderBy(x => x.Make))
            {
                var v = new VinControlVehicleReport
                {
                    AutoId          = mProducts.Count + 1,
                    ModelYear       = tmp.ModelYear.GetValueOrDefault(),
                    Make            = String.IsNullOrEmpty(tmp.Make) ? "" : tmp.Make,
                    Model           = String.IsNullOrEmpty(tmp.Model) ? "" : tmp.Model,
                    Trim            = String.IsNullOrEmpty(tmp.Trim) ? "" : tmp.Trim,
                    StockNumber     = String.IsNullOrEmpty(tmp.StockNumber) ? "" : tmp.StockNumber,
                    Vin             = String.IsNullOrEmpty(tmp.VINNumber) ? "" : tmp.VINNumber,
                    Mileage         = String.IsNullOrEmpty(tmp.Mileage) ? "" : tmp.Mileage,
                    ExteriorColor   = String.IsNullOrEmpty(tmp.ExteriorColor) ? "" : tmp.ExteriorColor,
                    SalePrice       = String.IsNullOrEmpty(tmp.SalePrice) ? "" : tmp.SalePrice,
                    DaysInInvenotry = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                    DealershipName  =
                        String.IsNullOrEmpty(dtDealerInfo.DealershipName) ? "" : dtDealerInfo.DealershipName,
                    Engine = String.IsNullOrEmpty(tmp.EngineType) ? "" : tmp.EngineType,
                };

                if (v.Engine.Contains("Engine"))
                {
                    v.Engine = v.Engine.Replace("Engine", "");
                }

                if (String.IsNullOrEmpty(tmp.CarImageUrl))
                {
                    v.Pics = "0";
                }
                else
                {
                    string[] splitArray =
                        tmp.CarImageUrl.Split(new string[] { ",", "|" }, StringSplitOptions.RemoveEmptyEntries).ToArray
                            ();

                    if (splitArray.Count() > 1)
                    {
                        v.Pics = splitArray.Count().ToString(CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(tmp.DefaultImageUrl) &&
                            !String.IsNullOrEmpty(dtDealerSetting.DefaultStockImageUrl) &&
                            !tmp.CarImageUrl.Equals(tmp.DefaultImageUrl) &&
                            !tmp.CarImageUrl.Equals(dtDealerSetting.DefaultStockImageUrl))
                        {
                            v.Pics = "1";
                        }
                        else
                        {
                            v.Pics = "1(D)";
                        }
                    }
                }



                mProducts.Add(v);
            }

            return(mProducts);
        }
Beispiel #3
0
        public List <VinControlVehicleReport> GetKarPowerVehicles(int dealerId)
        {
            var mProducts = new List <VinControlVehicleReport>();

            var context = new whitmanenterprisewarehouseEntities();

            var avaiInventory =
                from e in InventoryQueryHelper.GetSingleOrGroupInventory(context)
                from et in context.whitmanenterprisekbbs
                where
                e.NewUsed.ToLower().Equals("used") && e.KBBTrimId > 0 &&
                e.KBBTrimId == et.TrimId && e.VINNumber == et.Vin &&
                (e.Recon ==
                 null ||
                 !((bool)
                   e.Recon))
                select new
            {
                e.Make,
                e.ModelYear,
                e.Model,
                e.StockNumber,
                e.VINNumber,
                e.Mileage,
                e.ExteriorColor,
                e.SalePrice,
                e.DateInStock,
                e.DealershipName,
                e.KBBTrimId,
                et.BaseWholeSale,
                et.MileageAdjustment,
                et.WholeSale,
                e.EngineType
            };

            foreach (var tmp in avaiInventory.OrderBy(x => x.Make))
            {
                var number = CommonHelper.RemoveSpecialCharactersAndReturnNumber(tmp.BaseWholeSale);

                if (number > 0)
                {
                    var v = new VinControlVehicleReport
                    {
                        AutoId            = mProducts.Count + 1,
                        ModelYear         = tmp.ModelYear.GetValueOrDefault(),
                        Make              = String.IsNullOrEmpty(tmp.Make) ? "" : tmp.Make,
                        Model             = String.IsNullOrEmpty(tmp.Model) ? "" : tmp.Model,
                        StockNumber       = String.IsNullOrEmpty(tmp.StockNumber) ? "" : tmp.StockNumber,
                        Vin               = String.IsNullOrEmpty(tmp.VINNumber) ? "" : tmp.VINNumber,
                        Mileage           = String.IsNullOrEmpty(tmp.Mileage) ? "" : tmp.Mileage,
                        ExteriorColor     = String.IsNullOrEmpty(tmp.ExteriorColor) ? "" : tmp.ExteriorColor,
                        SalePrice         = String.IsNullOrEmpty(tmp.SalePrice) ? "" : tmp.SalePrice,
                        DaysInInvenotry   = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                        DealershipName    = tmp.DealershipName,
                        BasewholeSale     = tmp.BaseWholeSale,
                        MileageAdjustment = tmp.MileageAdjustment,
                        WholeSale         = tmp.WholeSale,
                        Engine            = String.IsNullOrEmpty(tmp.EngineType) ? "" : tmp.EngineType,
                    };

                    if (v.Engine.Contains("Engine"))
                    {
                        v.Engine = v.Engine.Replace("Engine", "");
                    }

                    mProducts.Add(v);
                }
            }

            return(mProducts);
        }
Beispiel #4
0
        public List <VinControlVehicleReport> GetManheimInventoryVehicles(int dealerId)
        {
            var mProducts = new List <VinControlVehicleReport>();
            var context   = new whitmanenterprisewarehouseEntities();

            IQueryable <whitmanenterprisedealershipinventory> avaiInventory =
                from e in InventoryQueryHelper.GetSingleOrGroupInventory(context)
                where (e.Recon == false || e.Recon == null)
                select e;

            var dtDealerSetting = InventoryQueryHelper.GetSingleOrGroupSetting(context).ToList();

            foreach (var tmp in avaiInventory.OrderBy(x => x.Make))
            {
                if (dtDealerSetting != null)
                {
                    var manheimWholesales = LinqHelper.ManheimReport(tmp /*, dtDealerSetting.Manheim.Trim(), dtDealerSetting.ManheimPassword.Trim()*/);
                    if (manheimWholesales.Count > 0)
                    {
                        foreach (var item in manheimWholesales)
                        {
                            var v = new VinControlVehicleReport
                            {
                                AutoId              = mProducts.Count + 1,
                                ListingId           = tmp.ListingID,
                                ModelYear           = tmp.ModelYear.GetValueOrDefault(),
                                Make                = tmp.Make ?? string.Empty,
                                Model               = tmp.Model ?? string.Empty,
                                Trim                = tmp.Trim ?? string.Empty,
                                StockNumber         = tmp.StockNumber ?? string.Empty,
                                Vin                 = tmp.VINNumber ?? string.Empty,
                                Mileage             = tmp.Mileage ?? string.Empty,
                                Engine              = tmp.EngineType ?? string.Empty,
                                Cylinder            = tmp.Cylinders ?? string.Empty,
                                Tranmission         = tmp.Tranmission ?? string.Empty,
                                ExteriorColor       = tmp.ExteriorColor ?? string.Empty,
                                SalePrice           = tmp.SalePrice ?? string.Empty,
                                DealerCost          = tmp.DealerCost ?? string.Empty,
                                DaysInInvenotry     = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                                DealershipName      = tmp.DealershipName ?? string.Empty,
                                RetailPrice         = tmp.RetailPrice ?? string.Empty,
                                Style               = tmp.BodyType ?? string.Empty,
                                ManheimLowestPrice  = item.LowestPrice ?? string.Empty,
                                ManheimAveragePrice = item.AveragePrice ?? string.Empty,
                                ManheimHighestPrice = item.HighestPrice ?? string.Empty,
                                ManheimTrim         = item.TrimName ?? string.Empty
                            };

                            if (v.Engine.Contains("Engine"))
                            {
                                v.Engine = v.Engine.Replace("Engine", "");
                            }

                            if (String.IsNullOrEmpty(tmp.CarImageUrl))
                            {
                                v.Pics = "0";
                            }
                            else
                            {
                                string[] splitArray = tmp.CarImageUrl.Split(new string[] { ",", "|" }, StringSplitOptions.RemoveEmptyEntries).ToArray();

                                if (splitArray.Count() > 1)
                                {
                                    v.Pics = splitArray.Count().ToString(CultureInfo.InvariantCulture);
                                }
                                else
                                {
                                    if (!String.IsNullOrEmpty(tmp.DefaultImageUrl) &&
                                        !String.IsNullOrEmpty(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl) &&
                                        !tmp.CarImageUrl.Equals(tmp.DefaultImageUrl) &&
                                        !tmp.CarImageUrl.Equals(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl))
                                    {
                                        v.Pics = "1";
                                    }
                                    else
                                    {
                                        v.Pics = "1(D)";
                                    }
                                }
                            }

                            mProducts.Add(v);
                        }
                    }
                    else
                    {
                        var v = new VinControlVehicleReport
                        {
                            AutoId              = mProducts.Count + 1,
                            ListingId           = tmp.ListingID,
                            ModelYear           = tmp.ModelYear.GetValueOrDefault(),
                            Make                = tmp.Make ?? string.Empty,
                            Model               = tmp.Model ?? string.Empty,
                            Trim                = tmp.Trim ?? string.Empty,
                            StockNumber         = tmp.StockNumber ?? string.Empty,
                            Vin                 = tmp.VINNumber ?? string.Empty,
                            Mileage             = tmp.Mileage ?? string.Empty,
                            Engine              = tmp.EngineType ?? string.Empty,
                            Cylinder            = tmp.Cylinders ?? string.Empty,
                            Tranmission         = tmp.Tranmission ?? string.Empty,
                            ExteriorColor       = tmp.ExteriorColor ?? string.Empty,
                            SalePrice           = tmp.SalePrice ?? string.Empty,
                            DealerCost          = tmp.DealerCost ?? string.Empty,
                            DaysInInvenotry     = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                            DealershipName      = tmp.DealershipName ?? string.Empty,
                            RetailPrice         = tmp.RetailPrice ?? string.Empty,
                            Style               = tmp.BodyType ?? string.Empty,
                            ManheimLowestPrice  = string.Empty,
                            ManheimAveragePrice = string.Empty,
                            ManheimHighestPrice = string.Empty,
                            ManheimTrim         = tmp.Trim ?? string.Empty
                        };

                        if (v.Engine.Contains("Engine"))
                        {
                            v.Engine = v.Engine.Replace("Engine", "");
                        }

                        if (String.IsNullOrEmpty(tmp.CarImageUrl))
                        {
                            v.Pics = "0";
                        }
                        else
                        {
                            string[] splitArray = tmp.CarImageUrl.Split(new string[] { ",", "|" }, StringSplitOptions.RemoveEmptyEntries).ToArray();

                            if (splitArray.Count() > 1)
                            {
                                v.Pics = splitArray.Count().ToString(CultureInfo.InvariantCulture);
                            }
                            else
                            {
                                if (!String.IsNullOrEmpty(tmp.DefaultImageUrl) &&
                                    !String.IsNullOrEmpty(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl) &&
                                    !tmp.CarImageUrl.Equals(tmp.DefaultImageUrl) &&
                                    !tmp.CarImageUrl.Equals(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl))
                                {
                                    v.Pics = "1";
                                }
                                else
                                {
                                    v.Pics = "1(D)";
                                }
                            }
                        }

                        mProducts.Add(v);
                    }
                }
            }

            return(mProducts);
        }
Beispiel #5
0
        public List <VinControlVehicleReport> GetTodayBucketJumpVehicles(int dealerId)
        {
            var mProducts = new List <VinControlVehicleReport>();

            var context = new whitmanenterprisewarehouseEntities();

            IQueryable <whitmanenterprisedealershipinventory> avaiInventory =
                from e in InventoryQueryHelper.GetSingleOrGroupInventory(context)
                where e.NewUsed.ToLower().Equals("used") && (e.Recon == null || !((bool)e.Recon))
                select e;

            var dtDealerSetting = InventoryQueryHelper.GetSingleOrGroupSetting(context).ToList();

            var dtDealerInfo = InventoryQueryHelper.GetSingleOrGroupDealer(context).ToList();

            foreach (var tmp in avaiInventory.OrderBy(x => x.Make))
            {
                int daysInInvenotry = DateTime.Now.Subtract(tmp.DateInStock.GetValueOrDefault()).Days;

                bool flag = ((daysInInvenotry == dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).FirstTimeRangeBucketJump) || (daysInInvenotry == dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).SecondTimeRangeBucketJump) || ((daysInInvenotry - dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).SecondTimeRangeBucketJump) % dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).IntervalBucketJump) == 0);

                if (flag)
                {
                    var v = new VinControlVehicleReport
                    {
                        AutoId          = mProducts.Count + 1,
                        ModelYear       = tmp.ModelYear.GetValueOrDefault(),
                        Make            = String.IsNullOrEmpty(tmp.Make) ? "" : tmp.Make,
                        Model           = String.IsNullOrEmpty(tmp.Model) ? "" : tmp.Model,
                        Trim            = String.IsNullOrEmpty(tmp.Trim) ? "" : tmp.Trim,
                        StockNumber     = String.IsNullOrEmpty(tmp.StockNumber) ? "" : tmp.StockNumber,
                        Vin             = String.IsNullOrEmpty(tmp.VINNumber) ? "" : tmp.VINNumber,
                        Mileage         = String.IsNullOrEmpty(tmp.Mileage) ? "" : tmp.Mileage,
                        ExteriorColor   = String.IsNullOrEmpty(tmp.ExteriorColor) ? "" : tmp.ExteriorColor,
                        SalePrice       = String.IsNullOrEmpty(tmp.SalePrice) ? "" : tmp.SalePrice,
                        DaysInInvenotry = DateTime.Now.Subtract(tmp.DateInStock.Value).Days,
                        DealershipName  = String.IsNullOrEmpty(dtDealerInfo.FirstOrDefault(i => tmp.DealershipId == i.idWhitmanenterpriseDealership).DealershipName)
                                             ? ""
                                             : dtDealerInfo.FirstOrDefault(i => tmp.DealershipId == i.idWhitmanenterpriseDealership).DealershipName,
                        Engine = String.IsNullOrEmpty(tmp.EngineType) ? "" : tmp.EngineType,
                    };


                    if (v.Engine.Contains("Engine"))
                    {
                        v.Engine = v.Engine.Replace("Engine", "");
                    }

                    if (String.IsNullOrEmpty(tmp.CarImageUrl))
                    {
                        v.Pics = "0";
                    }
                    else
                    {
                        string[] splitArray =
                            tmp.CarImageUrl.Split(new string[] { ",", "|" }, StringSplitOptions.RemoveEmptyEntries).
                            ToArray
                                ();

                        if (splitArray.Count() > 1)
                        {
                            v.Pics = splitArray.Count().ToString(CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(tmp.DefaultImageUrl) &&
                                !String.IsNullOrEmpty(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl) &&
                                !tmp.CarImageUrl.Equals(tmp.DefaultImageUrl) &&
                                !tmp.CarImageUrl.Equals(dtDealerSetting.FirstOrDefault(i => tmp.DealershipId == i.DealershipId).DefaultStockImageUrl))
                            {
                                v.Pics = "1";
                            }
                            else
                            {
                                v.Pics = "1(D)";
                            }
                        }
                    }



                    mProducts.Add(v);
                }
            }

            return(mProducts);
        }