Beispiel #1
0
        public double GetItemValue(List <ItemPropDefinition> list, int label)
        {
            if (list == null)
            {
                return(0);
            }

            ItemPropDefinition l = list.FirstOrDefault();

            double v1 = 0;
            double v2 = 0;

            if (l != null && l.EquipmentItem.Any(r => r.LabelNumber == label))
            {
                ValuedProperty first = null;

                for (var index = 0; index < l.EquipmentItem.Count; index++)
                {
                    var r = l.EquipmentItem[index];

                    if (r.LabelNumber == label)
                    {
                        first = r;
                        break;
                    }
                }

                if (first != null)
                {
                    v1 = first.Value;
                }
            }

            if (l != null && l.SelectItem.Any(r => r.LabelNumber == label))
            {
                ValuedProperty first = null;

                for (var index = 0; index < l.SelectItem.Count; index++)
                {
                    var r = l.SelectItem[index];

                    if (r.LabelNumber == label)
                    {
                        first = r;
                        break;
                    }
                }

                if (first != null)
                {
                    v2 = first.Value;
                }
            }

            return(v2 - v1);
        }
Beispiel #2
0
        public double GetItemValue(List <ItemPropDefinition> list, int label)
        {
            if (list == null)
            {
                return(0);
            }

            ItemPropDefinition l = list.FirstOrDefault();

            double v1 = 0;
            double v2 = 0;

            if (l.EquipmentItem.Any(r => r.LabelNumber == label))
            {
                v1 = l.EquipmentItem.FirstOrDefault(r => r.LabelNumber == label).Value;
            }

            if (l.SelectItem.Any(r => r.LabelNumber == label))
            {
                v2 = l.SelectItem.FirstOrDefault(r => r.LabelNumber == label).Value;
            }

            return(v2 - v1);
        }