Example #1
0
        public StyleInformation getStyleInformationFromStyleName(int m_modelYear, string m_makeName, string m_modelName, string m_trimName, string m_manufacturerModelCode, double m_wheelBase, string[] m_manufacturerOptionCodes, string[] m_equipmentDescriptions, string m_exteriorColorName, string m_interiorColorName)
        {
            StyleInformationFromStyleNameRequest m_Sifsmr = new StyleInformationFromStyleNameRequest();



            ReturnParameters rd = new ReturnParameters();

            rd.excludeFleetOnlyStyles                 = true;
            rd.useSafeStandards                       = true;
            rd.includeAvailableEquipment              = true;
            rd.includeExtendedDescriptions            = true;
            rd.includeConsumerInformation             = false;
            rd.includeExtendedTechnicalSpecifications = true;
            rd.includeRegionSpecificStyles            = false;
            rd.enableEnrichedVehicleEquipment         = true;



            m_Sifsmr.accountInfo             = this.getAccountInfo();
            m_Sifsmr.modelYear               = m_modelYear;
            m_Sifsmr.makeName                = m_makeName;
            m_Sifsmr.modelName               = m_modelName;
            m_Sifsmr.trimName                = m_trimName;
            m_Sifsmr.manufacturerModelCode   = m_manufacturerModelCode;
            m_Sifsmr.wheelBase               = m_wheelBase;
            m_Sifsmr.manufacturerOptionCodes = m_manufacturerOptionCodes;
            m_Sifsmr.equipmentDescriptions   = m_equipmentDescriptions;
            m_Sifsmr.exteriorColorName       = m_exteriorColorName;
            m_Sifsmr.interiorColorName       = m_interiorColorName;
            m_Sifsmr.returnParameters        = rd;

            StyleInformation temp = vinService.getStyleInformationFromStyleName(m_Sifsmr);

            if (temp != null)
            {
                if (temp.responseStatus.responseCode.Equals(ResponseCode.Successful))
                {
                    return(temp);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="token"></param>
        /// <param name="classApi"></param>
        public MethodApi(JToken token, ClassApi classApi)
        {
            MethodType = token["method"].ToString();
            MethodName = token["name"].ToString();
            Comment    = token["description"] + "";
            ClassApi   = classApi;

            var returns = token["returns"];

            if (returns != null)
            {
                ReturnType = returns["type"] + "";

                if (returns["properties"] != null)
                {
                    ReturnParameters.AddRange(returns["properties"]
                                              .Select(a => new ParameterApi(a.Parent[((JProperty)a).Name]))
                                              .ToArray());
                }
                else if (returns["items"] != null && returns["items"]["properties"] != null)
                {
                    ReturnParameters.AddRange(returns["items"]["properties"]
                                              .Select(a => new ParameterApi(a.Parent[((JProperty)a).Name]))
                                              .ToArray());
                }

                if (returns["links"] != null)
                {
                    ReturnLinkHRef = returns["links"][0]["href"].ToString();
                    ReturnLinkRel  = returns["links"][0]["rel"].ToString();
                }
            }

            if (token["parameters"] != null && token["parameters"]["properties"] != null)
            {
                Parameters.AddRange(token["parameters"]["properties"]
                                    .Select(a => new ParameterApi(a.Parent[((JProperty)a).Name]))
                                    .ToArray());
            }

            ReturnIsArray = ReturnType == "array";
            ReturnIsNull  = ReturnType == "null";
        }
    /******************  Getting needed parameters ******************/

    /// <summary>
    /// Calls the parameter form to get the output file path.
    /// </summary>
    /// <returns>
    /// 1 on success
    /// </returns>
    public int CallParameterForm()
    {
        ParameterForm frm = new ParameterForm();

        try
        {
            frm.ShowDialog();
            ProdLoggerInputParameters t = new ProdLoggerInputParameters
            {
                ParamName  = "OutputFile",
                ParamType  = "string",
                ParamValue = frm.SavePath
            };
            ReturnParameters.Add(t);

            return(1);
        }
        finally
        {
            frm.Dispose();
        }
    }
Example #4
0
        public VehicleInformation getVehicleInformationFromVin(string m_Vin)
        {
            var rd = new ReturnParameters();

            rd.excludeFleetOnlyStyles                 = false;
            rd.useSafeStandards                       = true;
            rd.includeAvailableEquipment              = true;
            rd.includeExtendedDescriptions            = true;
            rd.includeConsumerInformation             = true;
            rd.includeExtendedTechnicalSpecifications = true;
            rd.includeRegionSpecificStyles            = false;
            rd.enableEnrichedVehicleEquipment         = true;

            var m_Vifver = new VehicleInformationFromVinRequest();

            m_Vifver.accountInfo      = this.getAccountInfo();
            m_Vifver.vin              = m_Vin;
            m_Vifver.returnParameters = rd;

            var temp = vinService.getVehicleInformationFromVin(m_Vifver);

            if (temp != null)
            {
                if (temp.responseStatus.responseCode.Equals(ResponseCode.Successful) || temp.responseStatus.responseCode.Equals(ResponseCode.SuccessfulUsingAlternateLocale))
                {
                    return(temp);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        public VehicleInformation getVehicleInformationFromVin(string m_Vin, string m_manufacturerModelCode, string m_trimName, double m_wheelBase, string[] m_manufacturerOptionCodes, string[] m_equipmentDescriptions, string[] m_secondaryequipmentDescriptions, string m_exteriorColorName, string m_interiorColorName, int[] m_reducingStyleIds, ReturnParameters m_returnparameters)
        {
            VehicleInformationFromVinRequest m_Vifver = new VehicleInformationFromVinRequest();

            m_Vifver.accountInfo                    = this.getAccountInfo();
            m_Vifver.vin                            = m_Vin;
            m_Vifver.manufacturerModelCode          = m_manufacturerModelCode;
            m_Vifver.trimName                       = m_trimName;
            m_Vifver.wheelBase                      = m_wheelBase;
            m_Vifver.manufacturerModelCode          = m_manufacturerModelCode;
            m_Vifver.equipmentDescriptions          = m_equipmentDescriptions;
            m_Vifver.secondaryEquipmentDescriptions = m_secondaryequipmentDescriptions;
            m_Vifver.exteriorColorName              = m_exteriorColorName;
            m_Vifver.interiorColorName              = m_interiorColorName;
            m_Vifver.reducingStyleIds               = m_reducingStyleIds;
            m_Vifver.returnParameters               = m_returnparameters;

            VehicleInformation temp = vinService.getVehicleInformationFromVin(m_Vifver);

            if (temp != null)
            {
                if (temp.responseStatus.responseCode.Equals(ResponseCode.Successful))
                {
                    return(temp);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        private static ReturnParameters GetSqlParameters(T entity, PropertyInfo[] propery, object pk = null, bool setNull = false)
        {
            var paramters = new ReturnParameters();

            foreach (var propertyInfo in propery)
            {
                if (propertyInfo.GetValue(entity, null) == null || pk != null && (string)pk == propertyInfo.Name)
                {
                    continue;
                }

                #region test
                //if ((propertyInfo.PropertyType != typeof(Int32) &&
                //    propertyInfo.PropertyType != typeof(int) &&
                //    propertyInfo.PropertyType != typeof(double) &&
                //    propertyInfo.PropertyType != typeof(Double) &&
                //    propertyInfo.PropertyType != typeof(decimal) &&
                //    propertyInfo.PropertyType != typeof(Decimal) &&
                //    propertyInfo.PropertyType != typeof(float) &&
                //    propertyInfo.PropertyType != typeof(Boolean) &&
                //    propertyInfo.PropertyType != typeof(bool) &&
                //    propertyInfo.PropertyType != typeof(Byte)&&
                //    propertyInfo.PropertyType != typeof(byte) &&
                //    propertyInfo.PropertyType != typeof(SByte) &&
                //    propertyInfo.PropertyType != typeof(sbyte))
                //    && propertyInfo.GetValue(entity, null).Equals(propertyInfo.PropertyType.GetDefault()) || propertyInfo.GetValue(entity, null) == null)
                //{
                //    continue;
                //}
                #endregion

                if (((
                         propertyInfo.PropertyType == typeof(String) ||
                         propertyInfo.PropertyType == typeof(string) ||
                         propertyInfo.PropertyType == typeof(DateTime) ||
                         propertyInfo.PropertyType == typeof(Guid)) &&
                     propertyInfo.GetValue(entity, null).Equals(propertyInfo.PropertyType.GetDefault())))
                {
                    continue;
                }

                if (setNull == false)
                {
                    if (((
                             propertyInfo.PropertyType == typeof(DateTime?) ||
                             propertyInfo.PropertyType == typeof(Guid?)) &&
                         propertyInfo.GetValue(entity, null).Equals(propertyInfo.PropertyType.GetDefault())) ||
                        propertyInfo.GetValue(entity, null) == null
                        )
                    {
                        continue;
                    }
                }



                string prmName;
                if (paramters.Parameters.Any(x => x.ParameterName == "@" + propertyInfo.Name))
                {
                    prmName = "@" + propertyInfo.Name + "1";
                }
                else
                {
                    prmName = "@" + propertyInfo.Name + "";
                }

                paramters.paramKey   += "[" + propertyInfo.Name + "],";
                paramters.paramValue += prmName + ",";

                paramters.updateParameters += $"{"[" + propertyInfo.Name + "]"}={prmName},";

                paramters.Parameters.Add(new SqlParameter()
                {
                    ParameterName = prmName,
                    Value         = propertyInfo.GetValue(entity, null)
                });
            }
            return(paramters);
        }