private AttributeMetadata GetNewAttributeType()
        {
            if (!chkConvertAttributeType.Checked)
            {
                return(null);
            }
            AttributeMetadata att;

            switch (cmbNewAttributeType.Text)
            {
            case "Single Line of Text":
                att = NewTypeAttributeCreationLogic.CreateText(formatName: GetStringFormat());
                break;

            case "Global Option Set":
                var optionSet    = (ObjectCollectionItem <OptionSetMetadata>)optAttGlobalOptionSetCmb.SelectedItem;
                var defaultValue = (ObjectCollectionItem <int?>)optAttDefaultValueCmb.SelectedItem;
                att = NewTypeAttributeCreationLogic.CreateOptionSet(optionSet.Value, defaultValue?.Value);
                break;

            case "Local Option Set":
                // TODO Read from Tab
                att = NewTypeAttributeCreationLogic.CreateOptionSet(null);
                break;

            case "Two Options":
                // TODO: new BooleanOptionSetMetadata()
                att = NewTypeAttributeCreationLogic.CreateTwoOptions(null);
                break;

            case "Image":
                att = NewTypeAttributeCreationLogic.CreateImage(null);
                break;

            case "Whole Number":
                int tmp;
                int?min = null;
                int?max = null;
                if (int.TryParse(numAttMinTxt.Text, out tmp))
                {
                    min = tmp;
                }
                if (int.TryParse(numAttMaxTxt.Text, out tmp))
                {
                    max = tmp;
                }
                att = NewTypeAttributeCreationLogic.CreateWholeNumber(GetIntergerFormat(), min, max);
                break;

            case "Floating Point Number":
                att = NewTypeAttributeCreationLogic.CreateFloatingPoint();
                break;

            case "Decimal Number":
                att = NewTypeAttributeCreationLogic.CreateDecimal();
                break;

            case "Currency":
                att = NewTypeAttributeCreationLogic.CreateCurrency();
                break;

            case "Multiple Lines of Text":
                att = NewTypeAttributeCreationLogic.CreateText(2000, GetStringFormat());
                break;

            case "Date and Time":
                att = NewTypeAttributeCreationLogic.CreateDateTime();
                break;

            case "Lookup":
                att = NewTypeAttributeCreationLogic.CreateLookup(null);
                break;

            case "":
                att = null;
                break;

            default:
                throw new Exception("Unepxected Type: " + cmbNewAttributeType.Text);
            }

            return(att);
        }
        private AttributeMetadata GetNewAttributeType()
        {
            if (!chkConvertAttributeType.Checked)
            {
                return(null);
            }

            int?precision = GetPrecisionSetting();

            AttributeMetadata att;

            switch (cmbNewAttributeType.Text)
            {
            case "Single Line of Text":
                att = NewTypeAttributeCreationLogic.CreateText(int.Parse(strAttTxtMaximumLength.Text), GetStringFormat(), GetStringImeMode());
                break;

            case "Global Option Set":
                var optionSet    = (ObjectCollectionItem <OptionSetMetadata>)optAttGlobalOptionSetCmb.SelectedItem;
                var defaultValue = (ObjectCollectionItem <int?>)optAttDefaultValueCmb.SelectedItem;
                att = NewTypeAttributeCreationLogic.CreateOptionSet(optionSet.Value, defaultValue?.Value);
                break;

            case "Local Option Set":
                // TODO Read from Tab
                att = NewTypeAttributeCreationLogic.CreateOptionSet(null);
                break;

            case "Two Options":
                att = NewTypeAttributeCreationLogic.CreateTwoOptions(new BooleanOptionSetMetadata(TrueOption, FalseOption), DefaultTwoOptionSetValue);
                break;

            case "Image":
                att = NewTypeAttributeCreationLogic.CreateImage(null);
                break;

            case "Whole Number":
                int inttmp;
                int?intmin = null;
                int?intmax = null;
                if (int.TryParse(numAttMinTxt.Text, out inttmp))
                {
                    intmin = inttmp;
                }
                if (int.TryParse(numAttMaxTxt.Text, out inttmp))
                {
                    intmax = inttmp;
                }
                att = NewTypeAttributeCreationLogic.CreateWholeNumber(GetIntergerFormat(), intmin, intmax);
                break;

            case "Floating Point Number":
                double dbltmp;
                double?dblmin = null;
                double?dblmax = null;
                if (double.TryParse(numAttMinTxt.Text, out dbltmp))
                {
                    dblmin = dbltmp;
                }
                if (double.TryParse(numAttMaxTxt.Text, out dbltmp))
                {
                    dblmax = dbltmp;
                }
                att = NewTypeAttributeCreationLogic.CreateFloatingPoint(dblmin, dblmax, precision);
                break;

            case "Decimal Number":
                decimal dectmp;
                decimal?decmin = null;
                decimal?decmax = null;
                if (decimal.TryParse(numAttMinTxt.Text, out dectmp))
                {
                    decmin = dectmp;
                }
                if (decimal.TryParse(numAttMaxTxt.Text, out dectmp))
                {
                    decmax = dectmp;
                }
                att = NewTypeAttributeCreationLogic.CreateDecimal(decmin, decmax, precision);
                break;

            case "Currency":
                double curtmp;
                double?curmin = null;
                double?curmax = null;
                if (double.TryParse(numAttMinTxt.Text, out curtmp))
                {
                    curmin = curtmp;
                }
                if (double.TryParse(numAttMaxTxt.Text, out curtmp))
                {
                    curmax = curtmp;
                }
                int?currencyPrecision = GetCurrencyPrecision();
                att = NewTypeAttributeCreationLogic.CreateCurrency(curmin, curmax, currencyPrecision);
                break;

            case "Multiple Lines of Text":
                att = NewTypeAttributeCreationLogic.CreateMemo(int.Parse(strAttTxtMaximumLength.Text), GetStringImeMode());
                break;

            case "Date and Time":
                att = NewTypeAttributeCreationLogic.CreateDateTime();
                break;

            case "Lookup":
                att = NewTypeAttributeCreationLogic.CreateLookup(null);
                break;

            case "":
                att = null;
                break;

            default:
                throw new Exception("Unexpected Type: " + cmbNewAttributeType.Text);
            }

            return(att);
        }