示例#1
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }
            PdszDatabase.SaLaPa saLaPaById = ClientContext.GetDatabase(vec)?.GetSaLaPaById(this.value.ToString(CultureInfo.InvariantCulture));
            if (saLaPaById == null)
            {
                return(false);
            }
            if (saLaPaById.ProductType != vec.Prodart)
            {
                return(false);
            }
            bool flag;

            if (vec.FA != null && vec.VehicleIdentLevel != IdentificationLevel.BasicFeatures && vec.VehicleIdentLevel != IdentificationLevel.VINOnly)
            {
                if (vec.VehicleIdentLevel != IdentificationLevel.VINBasedFeatures)
                {
                    flag = vec.hasSA(saLaPaById.Name);
                    return(flag);
                }
            }
            flag = true;
            return(flag);
        }
示例#2
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                //Log.Warning("EcuGroupExpression.Evaluate()", "vec was null", Array.Empty<object>());
                return(false);
            }
            PdszDatabase.EcuGroup ecuGroupById = ClientContext.GetDatabase(vec)?.GetEcuGroupById(this.value.ToString(CultureInfo.InvariantCulture));
            if (ecuGroupById == null || string.IsNullOrEmpty(ecuGroupById.Name))
            {
                return(false);
            }
            if (vec.VCI != null && (vec.VehicleIdentLevel == IdentificationLevel.BasicFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINBasedFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINOnly))
            {
                return(true);
            }
            if (vec.VehicleIdentLevel == IdentificationLevel.VINBasedOnlineUpdated && vec.ECU != null && vec.ECU.Count == 0)
            {
                return(true);
            }
            bool flag;

            if (!(flag = (vec.getECUbyECU_GRUPPE(ecuGroupById.Name) != null)) && "d_0044".Equals(ecuGroupById.Name, StringComparison.OrdinalIgnoreCase) && vec.BNType == BNType.BN2000_PGO)
            {
                //Log.Info("EcuGroupExpression.Evaluate()", "check for D_0044 (EWS3) => EWS3P", Array.Empty<object>());
                flag = true;
            }
            return(flag);
        }
示例#3
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            bool         flag     = false;
            PdszDatabase database = ClientContext.GetDatabase(vec);

            if (database == null)
            {
                return(false);
            }

            PdszDatabase.EcuClique ecuClique = database.GetEcuCliqueById(this.value.ToString(CultureInfo.InvariantCulture));
            if (vec == null)
            {
                return(false);
            }
            if (ecuClique == null)
            {
                return(true);
            }
            if (!database.EvaluateXepRulesById(ecuClique.Id, vec, ffmResolver, null))
            {
                return(false);
            }
            List <PdszDatabase.EcuVar> ecuVariantsByEcuCliquesId = ClientContext.GetDatabase(vec)?.GetEcuVariantsByEcuCliquesId(ecuClique.Id);

            if (ecuVariantsByEcuCliquesId == null || ecuVariantsByEcuCliquesId.Count == 0)
            {
                return(false);
            }
            if (vec.VCI != null && vec.VCI.VCIType == VCIDeviceType.INFOSESSION && (vec.VehicleIdentLevel == IdentificationLevel.BasicFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINBasedFeatures || (vec.VehicleIdentLevel == IdentificationLevel.VINBasedOnlineUpdated && (vec.ECU == null || (vec.ECU != null && vec.ECU.Count == 0))) || vec.VehicleIdentLevel == IdentificationLevel.VINOnly))
            {
                foreach (PdszDatabase.EcuVar ecuVar in ecuVariantsByEcuCliquesId)
                {
                    flag = database.EvaluateXepRulesById(ecuVar.Id, vec, ffmResolver, null);
                    if (flag && !string.IsNullOrEmpty(ecuVar.GroupId))
                    {
                        flag = database.EvaluateXepRulesById(ecuVar.GroupId, vec, ffmResolver, null);
                        if (flag)
                        {
                            break;
                        }
                    }
                }
                return(flag);
            }
            foreach (PdszDatabase.EcuVar ecuVar in ecuVariantsByEcuCliquesId)
            {
                if (!(flag = (vec.getECUbyECU_SGBD(ecuVar.Name) != null)) && "EWS3".Equals(ecuVar.Name, StringComparison.OrdinalIgnoreCase) && vec.BNType == BNType.BN2000_PGO)
                {
                    //Log.Info("EcuCliqueExpression.Evaluate()", "check for EWS3 => EWS3P", Array.Empty<object>());
                    flag = true;
                }
                if (flag)
                {
                    break;
                }
            }
            return(flag);
        }
示例#4
0
 public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
 {
     if (vec == null)
     {
         return(false);
     }
     internalResult.RuleExpression = this;
     return(!RuleExpression.Evaluate(vec, this.operand, ffmResolver, internalResult));
 }
示例#5
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            this.vecInfo = vec;
            PdszDatabase database = ClientContext.GetDatabase(this.vecInfo);

            if (database == null)
            {
                return(false);
            }
            PdszDatabase.EcuVar ecuVariantById = database.GetEcuVariantById(this.value.ToString(CultureInfo.InvariantCulture));
            if (ecuVariantById == null)
            {
                return(false);
            }
            if (vec.VCI != null && (vec.VehicleIdentLevel == IdentificationLevel.BasicFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINBasedFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINOnly))
            {
                if (!database.EvaluateXepRulesById(ecuVariantById.Id, vec, ffmResolver, null))
                {
                    return(false);
                }
                IEcuVariantLocator ecuVariantLocator = new EcuVariantLocator(ecuVariantById, vec, ffmResolver);
                if (ecuVariantLocator == null)
                {
                    return(true);
                }
                if (ecuVariantLocator.Parents != null && ecuVariantLocator.Parents.Any <ISPELocator>())
                {
                    foreach (ISPELocator ispelocator in ecuVariantLocator.Parents)
                    {
                        IEcuGroupLocator ecuGroupLocator = ispelocator as IEcuGroupLocator;
                        if (ecuGroupLocator != null)
                        {
                            if (database.EvaluateXepRulesById(ecuGroupLocator.SignedId, vec, ffmResolver, null))
                            {
                                return(true);
                            }
                        }
                    }
                    return(false);
                }
                return(true);
            }
            else
            {
                if (vec.VehicleIdentLevel == IdentificationLevel.VINBasedOnlineUpdated && vec.ECU != null && vec.ECU.Count == 0)
                {
                    return(true);
                }
                bool flag;
                if (!(flag = (vec.getECUbyECU_SGBD(this.VariantName) != null)) && "EWS3".Equals(this.VariantName, StringComparison.OrdinalIgnoreCase) && vec.BNType == BNType.BN2000_PGO)
                {
                    //Log.Info("EcuVariantExpression.Evaluate()", "check for EWS3 => EWS3P", Array.Empty<object>());
                    flag = true;
                }
                return(flag);
            }
        }
示例#6
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            bool flag = false;

            internalResult.RuleExpression = this;
            foreach (RuleExpression ruleExpression in this.operands)
            {
                flag |= RuleExpression.Evaluate(vec, ruleExpression, ffmResolver, internalResult);
            }
            return(flag);
        }
示例#7
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            bool result;

            try
            {
                if (vec == null)
                {
                    //Log.Warning("EcuProgrammingVariantExpression.Evaluate()", "vec was null", Array.Empty<object>());
                    result = false;
                }
                else
                {
                    this.programmingVariant = ClientContext.GetDatabase(vec)?.GetEcuProgrammingVariantById(this.value.ToString(CultureInfo.InvariantCulture), vec, ffmResolver);
                    if (this.programmingVariant == null)
                    {
                        result = false;
                    }
                    else
                    {
                        this.ecuVariant = ClientContext.GetDatabase(vec)?.GetEcuVariantById(this.programmingVariant.EcuVarId);
                        if (this.ecuVariant == null)
                        {
                            result = false;
                        }
                        else if ((from c in vec.ECU
                                  where c.ProgrammingVariantName != null && c.VARIANTE != null && c.ProgrammingVariantName.Equals(this.programmingVariant.Name, StringComparison.OrdinalIgnoreCase) && c.VARIANTE.Equals(this.ecuVariant.Name, StringComparison.OrdinalIgnoreCase)
                                  select c).Any <ECU>())
                        {
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                    }
                }
            }
            catch (Exception)
            {
                //Log.WarningException("EcuProgrammingVariantExpression.Evaluate()", exception);
                result = false;
            }
            finally
            {
                //Log.Info(Log.CurrentMethod(), this.ToString(), Array.Empty<object>());
            }
            return(result);
        }
示例#8
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            this.vecInfo = vec;
            bool flag = false;

            try
            {
                string outletCountry = ClientContext.GetCountry(this.vecInfo);
                flag = (outletCountry == this.CountryCode);
            }
            catch (Exception)
            {
                //Log.WarningException("CountryExpression.Evaluate()", exception);
            }
            return(flag);
        }
示例#9
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }
#if false
            Dealer instance = Dealer.Instance;
            if (instance != null && vec.BrandName != null)
            {
                bool flag = instance.HasProtectionVehicleService(vec.BrandName.Value);
                return(flag);
            }
#endif
            return(false);
        }
示例#10
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }

            this.vecInfo = vec;
            bool flag;

            if (!string.IsNullOrEmpty(vec.ILevel) && !(vec.ILevel == "0"))
            {
                flag = (vec.ILevel == this.IStufe);
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
示例#11
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                //Log.Warning("EcuRepresentativeExpression.Evaluate()", "vec was null", Array.Empty<object>());
                return(false);
            }
            PdszDatabase.EcuReps ecuRepsById = ClientContext.GetDatabase(vec)?.GetEcuRepsById(this.value.ToString(CultureInfo.InvariantCulture));
            if (ecuRepsById == null)
            {
                return(false);
            }
            if (vec.VCI != null && (vec.VehicleIdentLevel == IdentificationLevel.BasicFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINBasedFeatures || vec.VehicleIdentLevel == IdentificationLevel.VINOnly))
            {
                return(true);
            }
            if (vec.VehicleIdentLevel == IdentificationLevel.VINBasedOnlineUpdated && vec.ECU != null && vec.ECU.Count == 0)
            {
                return(true);
            }
            bool flag = vec.getECUbyTITLE_ECUTREE(ecuRepsById.EcuShortcut) != null;

            return(flag);
        }
        private bool HandleHeatMotorCharacteristic(Func <HeatMotor, string> getProperty, long datavalueId, ValidationRuleInternalResults internalResult, out string value, string rootNodeClass, decimal characteristicNodeclass)
        {
            decimal rootClassValue;

            if (!decimal.TryParse(rootNodeClass, NumberStyles.Integer, CultureInfo.InvariantCulture, out rootClassValue))
            {
                rootClassValue = 0;
            }
            using (List <HeatMotor> .Enumerator enumerator = this.vehicle.HeatMotors.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    HeatMotor hm = enumerator.Current;
                    ValidationRuleInternalResult validationRuleInternalResult = internalResult.FirstOrDefault((ValidationRuleInternalResult r) => r.Id == hm.DriveId && r.Type == ValidationRuleInternalResult.CharacteristicType.HeatMotor && r.CharacteristicId == rootClassValue);
                    bool flag = database.LookupVehicleCharIdByName(getProperty(hm), new decimal?(characteristicNodeclass)) == datavalueId;
                    if (validationRuleInternalResult == null)
                    {
                        validationRuleInternalResult = new ValidationRuleInternalResult
                        {
                            Type             = ValidationRuleInternalResult.CharacteristicType.HeatMotor,
                            Id               = hm.DriveId,
                            CharacteristicId = rootClassValue
                        };
                        if (!(internalResult.RuleExpression is OrExpression))
                        {
                            validationRuleInternalResult.IsValid = true;
                        }
                        internalResult.Add(validationRuleInternalResult);
                    }
                    RuleExpression ruleExpression = internalResult.RuleExpression;
                    if (!(ruleExpression is AndExpression))
                    {
                        if (!(ruleExpression is OrExpression))
                        {
                            if (ruleExpression is NotExpression)
                            {
                                validationRuleInternalResult.IsValid &= !flag;
                            }
                        }
                        else
                        {
                            validationRuleInternalResult.IsValid = flag;
                        }
                    }
                    else
                    {
                        validationRuleInternalResult.IsValid = flag;
                    }
                }
            }
            value = string.Join(",", from hm in this.vehicle.HeatMotors
                                select getProperty(hm));
            bool flag2 = (from r in internalResult
                          group r by r.Id).Any((IGrouping <string, ValidationRuleInternalResult> g) => g.All((ValidationRuleInternalResult c) => c.IsValid));

            if (!(internalResult.RuleExpression is NotExpression))
            {
                return(flag2);
            }
            return(!flag2);
        }
示例#13
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }
            bool result;

            try
            {
                long num = (long)(Convert.ToInt32(vec.Modelljahr, CultureInfo.InvariantCulture) * 100 + Convert.ToInt32(vec.Modellmonat, CultureInfo.InvariantCulture));
                switch (this.compareOperator)
                {
                case CompareExpression.ECompareOperator.EQUAL:
                {
                    result = (num == this.datevalue);
                    break;
                }

                case CompareExpression.ECompareOperator.NOT_EQUAL:
                {
                    result = (num != this.datevalue);
                    break;
                }

                case CompareExpression.ECompareOperator.GREATER:
                {
                    result = (num > this.datevalue);
                    break;
                }

                case CompareExpression.ECompareOperator.GREATER_EQUAL:
                {
                    result = (num >= this.datevalue);
                    break;
                }

                case CompareExpression.ECompareOperator.LESS:
                {
                    result = (num < this.datevalue);
                    break;
                }

                case CompareExpression.ECompareOperator.LESS_EQUAL:
                {
                    result = (num <= this.datevalue);
                    break;
                }

                default:
                    result = false;
                    break;
                }
            }
            catch (Exception)
            {
                //Log.WarningException("DateExpression.Evaluate()", exception);
                result = false;
            }
            return(result);
        }
示例#14
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            string text = null;
            bool   flag;

            this.vecInfo = vec;
            if (vec != null && vec.VCI != null)
            {
                if (vec.VCI.VCIType != VCIDeviceType.UNKNOWN)
                {
                    flag = vec.getISTACharacteristics(this.dataclassId, out text, this.datavalueId, internalResult);
                    return(flag);
                }
            }

            if (this.CharacteristicRoot.Equals("Marke"))
            {
                string text2;
                switch (ClientContext.GetBrand(vec))
                {
                case EnumBrand.BMWBMWiMINI:
                    text2 = "BMW/BMW I/MINI";
                    goto IL_133;

                case EnumBrand.BMWBMWi:
                    text2 = "BMW/BMW I";
                    goto IL_133;

                case EnumBrand.BMWiMINI:
                    text2 = "BMW I/MINI";
                    goto IL_133;

                case EnumBrand.BMWMINI:
                    text2 = "BMW/MINI";
                    goto IL_133;

                case EnumBrand.BMWPKW:
                    text2 = "BMW PKW";
                    goto IL_133;

                case EnumBrand.Mini:
                    text2 = "MINI PKW";
                    goto IL_133;

                case EnumBrand.RollsRoyce:
                    text2 = "ROLLS-ROYCE PKW";
                    goto IL_133;

                case EnumBrand.BMWMotorrad:
                    text2 = "BMW MOTORRAD";
                    goto IL_133;

                case EnumBrand.WIESMANN:
                    text2 = "WIESMANN";
                    goto IL_133;

                case EnumBrand.MORGAN:
                    text2 = "MORGAN";
                    goto IL_133;

                case EnumBrand.RODING:
                    text2 = "RODING";
                    goto IL_133;

                case EnumBrand.PGO:
                    text2 = "PGO";
                    goto IL_133;

                case EnumBrand.GIBBS:
                    text2 = "GIBBS";
                    goto IL_133;

                case EnumBrand.BMWi:
                    text2 = "BMW I";
                    goto IL_133;

                case EnumBrand.TOYOTA:
                    text2 = "TOYOTA";
                    goto IL_133;

                case EnumBrand.ZINORO:
                    text2 = "ZINORO";
                    goto IL_133;
                }
                text2 = "-";
IL_133:
                text = text2;
                if (string.Compare(text2, this.CharacteristicValue, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    flag = true;
                }
                else if ((this.CharacteristicValue == "MINI PKW" || this.CharacteristicValue == "BMW PKW") && string.Compare(text2, "BMW/MINI", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    flag = true;
                }
                else if (this.CharacteristicValue.Equals("BMW I", StringComparison.OrdinalIgnoreCase) && string.Compare(text2, "BMW/MINI", StringComparison.OrdinalIgnoreCase) == 0 /*&& Dealer.Instance != null && Dealer.Instance.HasLicenseForBrand(new BrandName?(BrandName.BMWi))*/)
                {
                    flag = true;
                }
                else
                {
                    if ((this.CharacteristicValue == "MINI PKW" || this.CharacteristicValue == "BMW PKW" || this.CharacteristicValue == "BMW I") && string.Compare(text2, "BMW/BMW I/MINI", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        return(true);
                    }
                    if ((this.CharacteristicValue == "BMW PKW" || this.CharacteristicValue == "BMW I") && string.Compare(text2, "BMW/BMW I", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        return(true);
                    }
                    if ((this.CharacteristicValue == "BMW I" || this.CharacteristicValue == "MINI PKW") && string.Compare(text2, "BMW I/MINI", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        return(true);
                    }
                    flag = false;
                }
            }
            else if (!"Sicherheitsrelevant".Equals(this.CharacteristicRoot, StringComparison.OrdinalIgnoreCase) && !"Sicherheitsfahrzeug".Equals(this.CharacteristicRoot, StringComparison.OrdinalIgnoreCase))
            {
                flag = true;
            }
            else
            {
                flag = false;
            }
            return(flag);
        }
示例#15
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            bool flag = DateTime.Now >= DateTime.FromBinary(this.value);

            return(flag);
        }
示例#16
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }
            long ticks;

            try
            {
                if (!DateTime.MinValue.Ticks.Equals(vec.ProductionDate.Ticks))
                {
                    ticks = vec.ProductionDate.Ticks;
                }
                else
                {
                    if (string.IsNullOrEmpty(vec.Modelljahr) || string.IsNullOrEmpty(vec.Modellmonat))
                    {
                        return(false);
                    }
                    ticks = new DateTime(Convert.ToInt32(vec.Modelljahr, CultureInfo.InvariantCulture), Convert.ToInt32(vec.Modellmonat, CultureInfo.InvariantCulture), 1).Ticks;
                }
            }
            catch (Exception)
            {
                //Log.WarningException("ManufactoringDateExpression.Evaluate()", exception);
                return(false);
            }
            bool flag;

            switch (this.compareOperator)
            {
            case CompareExpression.ECompareOperator.EQUAL:
                flag = (ticks == this.datevalue);
                break;

            case CompareExpression.ECompareOperator.NOT_EQUAL:
                flag = (ticks != this.datevalue);
                break;

            case CompareExpression.ECompareOperator.GREATER:
                flag = (ticks > this.datevalue);
                break;

            case CompareExpression.ECompareOperator.GREATER_EQUAL:
                flag = (ticks >= this.datevalue);
                break;

            case CompareExpression.ECompareOperator.LESS:
                flag = (ticks < this.datevalue);
                break;

            case CompareExpression.ECompareOperator.LESS_EQUAL:
                flag = (ticks <= this.datevalue);
                break;

            default:
                flag = false;
                break;
            }
            return(flag);
        }
        public bool GetISTACharacteristics(PdszDatabase.CharacteristicRoots characteristicRoots, out string value, decimal id, Vehicle vec, long dataValueId, ValidationRuleInternalResults internalResult)
        {
            this.characteristicRoots = characteristicRoots;
            this.characteristicId    = id;
            this.vehicle             = vec;
            this.datavalueId         = dataValueId;
            this.internalResult      = internalResult;
            this.database            = ClientContext.GetDatabase(vehicle);
            bool result = base.ComputeCharacteristic(characteristicRoots.NodeClass, Array.Empty <object>());

            value = this.characteristicValue;
            return(result);
        }
示例#18
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            if (vec == null)
            {
                return(false);
            }

            this.vecInfo = vec;
            string ilevelOperand = this.GetILevelOperand(vec);
            string istufeById    = ClientContext.GetDatabase(this.vecInfo)?.GetIStufeById(this.iLevelId.ToString(CultureInfo.InvariantCulture));

            if (string.IsNullOrEmpty(istufeById))
            {
                return(false);
            }
            if (string.IsNullOrEmpty(ilevelOperand) || "0".Equals(ilevelOperand))
            {
                return(true);
            }
            string[] ilevelParts = this.GetILevelParts(istufeById);
            if (ilevelParts.Length > 1 && string.Compare(ilevelParts[0], 0, ilevelOperand, 0, ilevelParts[0].Length, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }
            bool flag;

            switch (this.compareOperator)
            {
            case CompareExpression.ECompareOperator.EQUAL:
            {
                int?num  = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num2 = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = (num.GetValueOrDefault() == num2.GetValueOrDefault() & num != null == (num2 != null));
                break;
            }

            case CompareExpression.ECompareOperator.NOT_EQUAL:
            {
                int?num2 = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num  = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = !(num2.GetValueOrDefault() == num.GetValueOrDefault() & num2 != null == (num != null));
                break;
            }

            case CompareExpression.ECompareOperator.GREATER:
            {
                int?num  = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num2 = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = (num.GetValueOrDefault() > num2.GetValueOrDefault() & (num != null & num2 != null));
                break;
            }

            case CompareExpression.ECompareOperator.GREATER_EQUAL:
            {
                int?num2 = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num  = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = (num2.GetValueOrDefault() >= num.GetValueOrDefault() & (num2 != null & num != null));
                break;
            }

            case CompareExpression.ECompareOperator.LESS:
            {
                int?num  = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num2 = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = (num.GetValueOrDefault() < num2.GetValueOrDefault() & (num != null & num2 != null));
                break;
            }

            case CompareExpression.ECompareOperator.LESS_EQUAL:
            {
                int?num2 = FormatConverter.ExtractNumericalILevel(ilevelOperand);
                int?num  = FormatConverter.ExtractNumericalILevel(istufeById);
                flag = (num2.GetValueOrDefault() <= num.GetValueOrDefault() & (num2 != null & num != null));
                break;
            }

            default:
                flag = false;
                break;
            }
            return(flag);
        }
示例#19
0
        public override bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
        {
            PdszDatabase database = ClientContext.GetDatabase(vec);

            if (database == null)
            {
                return(false);
            }
            if (vec == null)
            {
                //Log.Error("EquipmentExpression.Evaluate()", "vec was null", Array.Empty<object>());
                return(false);
            }
            if (vec.VehicleIdentLevel == IdentificationLevel.None)
            {
                return(false);
            }
            PdszDatabase.Equipment equipmentById = database.GetEquipmentById(this.value.ToString(CultureInfo.InvariantCulture));
            if (equipmentById == null)
            {
                return(false);
            }
            object obj = EquipmentExpression.evaluationLockObject;
            bool   result;

            lock (obj)
            {
                bool?flag2 = vec.hasFFM(equipmentById.Name);
                if (flag2 != null)
                {
                    result = flag2.Value;
                }
                else
                {
                    bool flag3 = database.EvaluateXepRulesById(this.value.ToString(CultureInfo.InvariantCulture), vec, ffmResolver, null);
#if false
                    if (ffmResolver != null && flag3)
                    {
                        ObservableCollectionEx <IXepInfoObject> infoObjectsByDiagObjectControlId = DatabaseProviderFactory.Instance.GetInfoObjectsByDiagObjectControlId(this.value, vec, ffmResolver, true, null);
                        if (infoObjectsByDiagObjectControlId != null && infoObjectsByDiagObjectControlId.Count != 0)
                        {
                            bool?flag4 = ffmResolver.Resolve(this.value, infoObjectsByDiagObjectControlId.First <IXepInfoObject>());
                            vec.AddOrUpdateFFM(new FFMResult(equipmentById.ID, equipmentById.NAME, "FFMResolver", flag4, false));
                            if (flag4 != null)
                            {
                                result = flag4.Value;
                            }
                            else
                            {
                                result = true;
                            }
                        }
                        else
                        {
                            result = false;
                        }
                    }
                    else
#endif
                    if (flag3)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            return(result);
        }
示例#20
0
 public virtual bool Evaluate(Vehicle vec, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult)
 {
     return(false);
 }
示例#21
0
 public static bool Evaluate(Vehicle vec, RuleExpression exp, IFFMDynamicResolver ffmResolver, ValidationRuleInternalResults internalResult = null)
 {
     if (internalResult == null)
     {
         internalResult = new ValidationRuleInternalResults();
     }
     if (exp is AndExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is OrExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is CharacteristicExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is DateExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is EcuCliqueExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is NotExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is SaLaPaExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is CountryExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is IStufeExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is IStufeXExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is EquipmentExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is ValidFromExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is ValidToExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is SiFaExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is EcuRepresentativeExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is ManufactoringDateExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is EcuVariantExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     if (exp is EcuProgrammingVariantExpression)
     {
         return(exp.Evaluate(vec, ffmResolver, internalResult));
     }
     return(false);
 }