Ejemplo n.º 1
0
        /// <summary>Corrects attribute values and display values</summary>
        /// <param name="att">The instance of the ItemAttributeData class to correct</param>
        public static void CorrectAttributeValue(ItemAttribData att)
        {
            if (att == null)
            {
                return;
            }

            // Alter data based on unit ID
            switch (AttributeTypes[att.Id].UnitId)
            {
            case 108:
                att.Value        = 100 - (att.Value * 100);
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                break;

            case 109:
                att.Value        = (att.Value * 100) - 100;
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                break;

            case 111:
                att.Value        = (att.Value - 1) * 100;
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                break;

            case 101:
                att.Value        = att.Value / 1000;
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                break;

            case 115:

                // groupID
                if (TypeGroups.ContainsKey(Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)))
                {
                    att.DisplayValue = TypeGroups[Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)];
                }
                else
                {
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                }
                att.Unit = string.Empty;
                break;

            case 116:

                // typeID
                att.DisplayValue = "Unknown";
                if (Types.ContainsKey(Convert.ToInt32(att.Value)))
                {
                    att.DisplayValue = Types[Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)].Name;
                }

                att.Unit = string.Empty;
                break;

            case 119:
            case 140:
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                att.Unit         = string.Empty;
                break;

            default:
                att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>Corrects attribute values and display values</summary>
        /// <param name="att">The instance of the ItemAttributeData class to correct</param>
        public static void CorrectAttributeValue(ItemAttribData att)
        {
            if (att == null)
            {
                return;
            }

            // Alter data based on unit ID
            switch (AttributeTypes[att.Id].UnitId)
            {
                case 108:
                    att.Value = 100 - (att.Value*100);
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    break;
                case 109:
                    att.Value = (att.Value*100) - 100;
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    break;
                case 111:
                    att.Value = (att.Value - 1)*100;
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    break;
                case 101:
                    att.Value = att.Value/1000;
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    break;
                case 115:

                    // groupID
                    if (TypeGroups.ContainsKey(Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)))
                    {
                        att.DisplayValue = TypeGroups[Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)];
                    }
                    else
                    {
                        att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    }
                    att.Unit = string.Empty;
                    break;
                case 116:

                    // typeID
                    att.DisplayValue = "Unknown";
                    if (Types.ContainsKey(Convert.ToInt32(att.Value)))
                    {
                        att.DisplayValue = Types[Convert.ToInt32(att.Value, CultureInfo.CurrentCulture)].Name;
                    }

                    att.Unit = string.Empty;
                    break;
                case 119:
                case 140:
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    att.Unit = string.Empty;
                    break;
                default:
                    att.DisplayValue = Convert.ToString(att.Value, CultureInfo.CurrentCulture);
                    break;
            }
        }