private void  fromJSONPayment(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        MoneyJSON convert_classy = MoneyJSON.from_json(json_value, ignore_extras, true);

        setPayment(convert_classy);
    }
コード例 #2
0
    private void  fromJSONInputValue(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        JSONArrayValue json_array1 = json_value.array_value();

        if (json_array1 == null)
        {
            throw new Exception("The value for field InputValue of CurrencyConversionJSON is not an array.");
        }
        int count1 = json_array1.componentCount();

        if (count1 < 1)
        {
            throw new Exception("The value for field InputValue of CurrencyConversionJSON has too few elements.");
        }
        List <MoneyJSON> vector_InputValue1 = new List <MoneyJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            MoneyJSON convert_classy = MoneyJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_InputValue1.Add(convert_classy);
        }
        Debug.Assert(vector_InputValue1.Count >= 1);
        initInputValue();
        for (int num1 = 0; num1 < vector_InputValue1.Count; ++num1)
        {
            appendInputValue(vector_InputValue1[num1]);
        }
        for (int num1 = 0; num1 < vector_InputValue1.Count; ++num1)
        {
        }
    }
    private void  fromJSONDownPayment(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        TypeDownPayment or_result = new TypeDownPayment();
        bool            or_done   = false;

        if (!or_done)
        {
            try
            {
                MoneyJSON convert_classy = MoneyJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice0 = convert_classy;
                or_result.key       = 0;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            try
            {
                JSONRationalValue json_rational = json_value.rational_value();
                double            the_double;
                if (json_rational != null)
                {
                    the_double = json_rational.getDouble();
                }
                else
                {
                    JSONIntegerValue json_integer = json_value.integer_value();
                    if (json_integer != null)
                    {
                        the_double = json_integer.getLongInt();
                    }
                    else
                    {
                        throw new Exception("The value for ??? is not a number.");
                    }
                }
                if (the_double < 0)
                {
                    throw new Exception("The value for ??? is less than the lower bound (0) for that field.");
                }
                or_result.u.choice1 = the_double;
                or_result.key       = 1;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field DownPayment of MortgageCalculatorInputVariableDownPaymentJSON is not one of the allowed values.");
        }
        setDownPayment(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }