Exemplo n.º 1
0
        public List <ExtendedFactoryOptions> GetNonInstalledOptions(VehicleDescription vehicleInfo)
        {
            var listNonInstalledOptions = new List <ExtendedFactoryOptions>();
            var hash = new HashSet <string>();

            if (vehicleInfo.factoryOption != null && vehicleInfo.factoryOption.Any())
            {
                foreach (var fo in vehicleInfo.factoryOption.Where(x => x.standard == false))
                {
                    if (fo.description.Any())
                    {
                        {
                            var optionsName = fo.description.FirstOrDefault();
                            if (optionsName == null || hash.Contains(optionsName))
                            {
                                continue;
                            }

                            if (fo.price.msrpMax > 0 && !optionsName.Contains("PKG") && !optionsName.Contains("PACKAGE") && !optionsName.Contains("EDITION"))
                            {
                                var efo = new ExtendedFactoryOptions();
                                efo.setMSRP(fo.price.msrpMax.ToString("C"));
                                efo.setName(CommonHelper.UpperFirstLetterOfEachWord(optionsName.Replace(",", "")));
                                efo.setStandard(fo.standard);
                                efo.setCategoryName(fo.header != null ? fo.header.Value : string.Empty);
                                efo.Description = fo.description.FirstOrDefault();

                                listNonInstalledOptions.Add(efo);
                                hash.Add(optionsName);
                            }
                        }
                    }
                }
            }

            // Get addtional options from generic equipment
            if (vehicleInfo.genericEquipment != null && vehicleInfo.genericEquipment.Any())
            {
                foreach (var ge in vehicleInfo.genericEquipment)
                {
                    var category = ((CategoryDefinition)(ge.Item)).category.Value;
                    if (!hash.Contains(category) && ge.installed == null)
                    {
                        var efo = new ExtendedFactoryOptions();
                        efo.setMSRP("$0");
                        efo.setName(CommonHelper.UpperFirstLetterOfEachWord(category));
                        efo.setStandard(false);
                        efo.setCategoryName(category);
                        efo.Description = category;

                        listNonInstalledOptions.Add(efo);
                        hash.Add(category);
                    }
                }
            }

            return(listNonInstalledOptions);
        }
Exemplo n.º 2
0
        public List <ExtendedFactoryOptions> GetPackageOptions(VehicleDescription vehicleInfo)
        {
            var listPackageOptions = new List <ExtendedFactoryOptions>();
            var hash = new HashSet <string>();

            if (vehicleInfo.factoryOption != null && vehicleInfo.factoryOption.Any())
            {
                foreach (var fo in vehicleInfo.factoryOption.Where(x => x.standard == false))
                {
                    if (fo.description.Any())
                    {
                        {
                            var optionsName = fo.description.FirstOrDefault();
                            if (optionsName == null || hash.Contains(optionsName))
                            {
                                continue;
                            }

                            if (fo.price.msrpMax > 0 && (optionsName.Contains("PKG") || optionsName.Contains("PACKAGE") || optionsName.Contains("EDITION")))
                            {
                                var efo = new ExtendedFactoryOptions();
                                efo.setMSRP(fo.price.msrpMax.ToString("C"));
                                efo.setName(CommonHelper.UpperFirstLetterOfEachWord(optionsName.Replace(",", "")));
                                efo.setStandard(fo.standard);
                                efo.setCategoryName(fo.header != null ? fo.header.Value : string.Empty);
                                efo.Description = (fo.description.Count() >= 2) ? fo.description[1] : fo.description[0];

                                listPackageOptions.Add(efo);
                                hash.Add(optionsName);
                            }
                        }
                    }
                }
            }

            return(listPackageOptions);
        }