Esempio n. 1
0
 public static ChartGraph MarketData(string vin, IAuctionManagement manheimAuctionManagement)
 {
     try
     {
         var user = new UserViewModel();
         return(MarketDataHelper.GetMarketCarsOnAutoTraderVersion2(manheimAuctionManagement.GetVehicle(vin), user));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 2
0
        public static List <ManheimWholesaleViewModel> ManheimData(string vin, string manheimUsername, string manheimPassword, IAuctionManagement manheimAuctionManagement)
        {
            var result = new List <ManheimWholesaleViewModel>();

            try
            {
                if (!string.IsNullOrEmpty(vin))
                {
                    var model = manheimAuctionManagement.GetVehicle(vin);

                    if (model.Mmr > 0 && model.MmrAbove > 0 && model.MmrBelow > 0)
                    {
                        var newRecord = new ManheimWholesaleViewModel()
                        {
                            LowestPrice  = (model.MmrBelow),
                            AveragePrice = (model.Mmr),
                            HighestPrice = (model.MmrAbove),
                            Year         = model.Year,
                            TrimName     = model.Trim
                        };
                        result.Add(newRecord);
                    }
                    else
                    {
                        //manheimService.ExecuteByVin(SessionHandler.User.Setting.Manheim, SessionHandler.User.Setting.ManheimPassword, vin.Trim());
                        var manheimService = new ManheimService();
                        result = manheimService.ManheimReport(model, manheimUsername, manheimPassword);
                    }
                }
                else
                {
                    result = new List <ManheimWholesaleViewModel>();
                }
            }
            catch (Exception)
            {
                result = new List <ManheimWholesaleViewModel>();
            }

            return(result);
        }
Esempio n. 3
0
        void LoadManheimWorkertranactionDoWork(object sender, DoWorkEventArgs e)
        {
            _manheimData = new List <ManheimWholesaleViewModel>();
            if (!string.IsNullOrEmpty(_vin))
            {
                var model = _manheimAuctionManagement.GetVehicle(_vin);

                if (model.Mmr > 0 && model.MmrAbove > 0 && model.MmrBelow > 0)
                {
                    var newRecord = new ManheimWholesaleViewModel
                    {
                        LowestPrice  = Convert.ToDecimal(model.MmrBelow),
                        AveragePrice = Convert.ToDecimal(model.Mmr),
                        HighestPrice = Convert.ToDecimal(model.MmrAbove),
                        Year         = model.Year,
                        TrimName     = model.Trim
                    };
                    _manheimData.Add(newRecord);
                }
                else
                {
                    var client = new WebClient();
                    client.Headers["Content-type"] = "application/json";

                    // invoke the REST method
                    byte[] data = client.DownloadData(string.Format("http://www.carslisting.us:3311/Vinsell/ManheimData/{0}/{1}/{2}",
                                                                    _vin, _manheimVehicle.Odometer, _dealer.DealerId));

                    // put the downloaded data in a memory stream
                    var ms = new MemoryStream(data);

                    // deserialize from json
                    var ser =
                        new DataContractJsonSerializer(typeof(List <ManheimWholesaleViewModel>));

                    _manheimData = ser.ReadObject(ms) as List <ManheimWholesaleViewModel>;
                }
            }
        }