Example #1
0
        /// <summary>
        ///  This Method is for checking duplicate VIN number
        /// </summary>
        /// <param name="VIN"></param>
        /// <returns></returns>
        public VINDecodeList GetDecodeDataFromWeb(string vin, string bodyStylep)
        {
            try
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                VehicleDAL objVehicleDAL = new VehicleDAL();

                return(objVehicleDAL.GetDecodeDataFromWeb(vin, bodyStylep));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
        /// <summary>
        /// This method is used to get data using Decode Vin functionality
        /// </summary>
        /// <param name="Vin"></param>
        /// <returns></returns>
        private VINDecodeList GetDataByDecodeVIN(string Vin)
        {
            VINDecodeList lstVINDecodeList = new VINDecodeList();
            VehicleDAL    vehicleDAL       = new VehicleDAL();

            try
            {
                var lstPsVehicle = vehicleDAL.GetDecodedPortStorageVIN(Vin);
                if (lstPsVehicle != null)
                {
                    lstVINDecodeList.VehicleYear   = lstPsVehicle.VehicleYear;
                    lstVINDecodeList.Make          = lstPsVehicle.Make;
                    lstVINDecodeList.Model         = lstPsVehicle.Model;
                    lstVINDecodeList.Bodystyle     = lstPsVehicle.Bodystyle;
                    lstVINDecodeList.VehicleLength = lstPsVehicle.VehicleLength;
                    lstVINDecodeList.VehicleWidth  = lstPsVehicle.VehicleWidth;
                    lstVINDecodeList.VehicleHeight = lstPsVehicle.VehicleHeight;
                    //lstVINDecodeList.VINDecodeID = (int)lstPsVehicle.VINDecodedInd;
                }
                else
                {
                    var lstDecodeVin = vehicleDAL.GetDecodedVINForVINDecode(Vin);
                    if (lstDecodeVin != null)
                    {
                        lstVINDecodeList.VehicleYear   = lstDecodeVin.VehicleYear;
                        lstVINDecodeList.Make          = lstDecodeVin.Make;
                        lstVINDecodeList.Model         = lstDecodeVin.Model;
                        lstVINDecodeList.Bodystyle     = lstDecodeVin.Bodystyle;
                        lstVINDecodeList.VehicleLength = lstDecodeVin.VehicleLength;
                        lstVINDecodeList.VehicleWidth  = lstDecodeVin.VehicleWidth;
                        lstVINDecodeList.VehicleHeight = lstDecodeVin.VehicleHeight;
                        //lstVINDecodeList.VINDecodeID = (int)lstDecodeVin.VINDecodeID;
                    }
                    else
                    {
                        string Bodystyle     = null;
                        var    lstVINDataWeb = vehicleDAL.GetDecodeDataFromWeb(Vin, Bodystyle);
                        if (lstVINDataWeb != null)
                        {
                            if (lstVINDataWeb.DecodeError.Length == 0)
                            {
                                lstVINDecodeList.VehicleYear   = lstVINDataWeb.VehicleYear;
                                lstVINDecodeList.Make          = lstVINDataWeb.Make;
                                lstVINDecodeList.Model         = lstVINDataWeb.Model;
                                lstVINDecodeList.Bodystyle     = lstVINDataWeb.Bodystyle;
                                lstVINDecodeList.VehicleLength = lstVINDataWeb.VehicleLength;
                                lstVINDecodeList.VehicleWidth  = lstVINDataWeb.VehicleWidth;
                                lstVINDecodeList.VehicleHeight = lstVINDataWeb.VehicleHeight;
                                //lstVINDecodeList.VINDecodeID = (int)lstVINDataWeb.VINDecodeID;
                            }
                            else
                            {
                                lstVINDecodeList = null;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
            return(lstVINDecodeList);
        }