public static AttributeMetadata CreateText(int?maxLength = null, StringFormatName formatName = null, ImeMode?imeMode = ImeMode.Auto, string yomiOf = null, string formulaDefinition = null)
        {
            maxLength = formulaDefinition != null && maxLength == null ? 4000 : 100;

            return(new StringAttributeMetadata
            {
                FormatName = formatName ?? StringFormatName.Text,
                ImeMode = imeMode,
                MaxLength = maxLength,
                YomiOf = yomiOf,
                FormulaDefinition = formulaDefinition
            });
        }
        public static AttributeMetadata CreateText(int? maxLength = null, StringFormatName formatName = null, ImeMode? imeMode = ImeMode.Auto, string yomiOf = null, string formulaDefinition = null)
        {
            maxLength = formulaDefinition != null && maxLength == null ? 4000 : 100;

            return new StringAttributeMetadata
            {
                FormatName = formatName ?? StringFormatName.Text,
                ImeMode = imeMode,
                MaxLength = maxLength,
                YomiOf = yomiOf,
                FormulaDefinition = formulaDefinition
            };
        }
        public static AttributeMetadata CreateText(int? maxLength = null, StringFormat? format = StringFormat.Text, StringFormatName formatName = null, ImeMode? imeMode = ImeMode.Auto, string yomiOf = null, string formulaDefinition = null)
        {
            maxLength = formulaDefinition != null && maxLength == null ? 4000 : 100;

            if (formatName == null)
            {
                switch (format)
                {
                    case StringFormat.Email:
                        formatName = StringFormatName.Email;
                        break;
                    case StringFormat.Text:
                        formatName = StringFormatName.Text;
                        break;
                    case StringFormat.TextArea:
                        formatName = StringFormatName.TextArea;
                        break;
                    case StringFormat.Url:
                        formatName = StringFormatName.Url;
                        break;
                    case StringFormat.TickerSymbol:
                        formatName = StringFormatName.TickerSymbol;
                        break;
                    case StringFormat.PhoneticGuide:
                        formatName = StringFormatName.PhoneticGuide;
                        break;
                    case StringFormat.VersionNumber:
                        formatName = StringFormatName.VersionNumber;
                        break;
                    case StringFormat.Phone:
                        formatName = StringFormatName.Url;
                        break;
                    case null:
                        break;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(format), format, "Unable to determine format Name for format: " + format);
                }
            }

            return new StringAttributeMetadata
            {
                Format = format,
                FormatName = formatName,
                ImeMode = imeMode,
                MaxLength = maxLength,
                YomiOf = yomiOf,
                FormulaDefinition = formulaDefinition
            };
        }
Esempio n. 4
0
        public static AttributeMetadata CreateText(int?maxLength = null, StringFormat?format = StringFormat.Text, StringFormatName formatName = null, ImeMode?imeMode = ImeMode.Auto, string yomiOf = null, string formulaDefinition = null)
        {
            maxLength = formulaDefinition != null && maxLength == null ? 4000 : 100;

            if (formatName == null)
            {
                switch (format)
                {
                case StringFormat.Email:
                    formatName = StringFormatName.Email;
                    break;

                case StringFormat.Text:
                    formatName = StringFormatName.Text;
                    break;

                case StringFormat.TextArea:
                    formatName = StringFormatName.TextArea;
                    break;

                case StringFormat.Url:
                    formatName = StringFormatName.Url;
                    break;

                case StringFormat.TickerSymbol:
                    formatName = StringFormatName.TickerSymbol;
                    break;

                case StringFormat.PhoneticGuide:
                    formatName = StringFormatName.PhoneticGuide;
                    break;

                case StringFormat.VersionNumber:
                    formatName = StringFormatName.VersionNumber;
                    break;

                case StringFormat.Phone:
                    formatName = StringFormatName.Url;
                    break;

                case null:
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(format), format, "Unable to determine format Name for format: " + format);
                }
            }

            return(new StringAttributeMetadata
            {
                Format = format,
                FormatName = formatName,
                ImeMode = imeMode,
                MaxLength = maxLength,
                YomiOf = yomiOf,
                FormulaDefinition = formulaDefinition
            });
        }
Esempio n. 5
0
        public List <DxEntityAttribute> GetListAttribute(DataRow[] rows)
        {
            List <DxEntityAttribute> lEntities      = new List <DxEntityAttribute>();
            StringFormatName         stringFormat   = null;
            DateTimeFormat           dateTimeFormat = new DateTimeFormat();

            foreach (var dataRow in rows)
            {
                #region Formato del String
                switch (dataRow["StringFormat"].ToString())
                {
                case "Text":
                    stringFormat = StringFormatName.Text;
                    break;

                case "Email":
                    stringFormat = StringFormatName.Email;
                    break;

                case "Phone":
                    stringFormat = StringFormatName.Phone;
                    break;

                case "TextArea":
                    stringFormat = StringFormatName.TextArea;
                    break;

                case "Url":
                    stringFormat = StringFormatName.Url;
                    break;
                }
                #endregion

                #region Formato del Date

                switch (dataRow["DateFormat"].ToString())
                {
                case "Date":
                    dateTimeFormat = DateTimeFormat.DateOnly;
                    break;

                case "DateTime":
                    dateTimeFormat = DateTimeFormat.DateAndTime;
                    break;
                }
                #endregion

                var attribute = new DxEntityAttribute()
                {
                    PDescription = dataRow["Description"].ToString(),
                    PSchemaName  = dataRow["Name"].ToString().ToLower().Replace(" ", ""),
                    PDisplayName = dataRow["DisplayName"].ToString()
                };

                if (dataRow["Type"].Equals("String"))
                {
                    DxStringAttribute stringAttribute = new DxStringAttribute();

                    stringAttribute.PMaxLength = dataRow["MaxLength"] != null ? 100 : int.Parse(dataRow["MaxLength"].ToString());
                    if (stringFormat != null)
                    {
                        stringAttribute.PStringFormatName = stringFormat;
                    }

                    attribute.PType           = 1;
                    attribute.StringAttribute = stringAttribute;
                }
                else if (dataRow["Type"].Equals("Decimal"))
                {
                    DxDecimalAttribute decimalAttribute = new DxDecimalAttribute();
                    decimalAttribute.PMaxValue  = int.Parse(dataRow["MaxValue"].ToString());
                    decimalAttribute.PMinValue  = int.Parse(dataRow["MinValue"].ToString());
                    decimalAttribute.PPrecision = int.Parse(dataRow["Precision"].ToString());

                    attribute.PType            = 2;
                    attribute.DecimalAttribute = decimalAttribute;
                }
                else if (dataRow["Type"].Equals("Int"))
                {
                    DxIntegerAttributeMetadata integerAttribute = new DxIntegerAttributeMetadata();
                    integerAttribute.PMaxValue = int.Parse(dataRow["MaxValue"].ToString());
                    integerAttribute.PMinValue = int.Parse(dataRow["MinValue"].ToString());
                    integerAttribute.PFormat   = IntegerFormat.None;
                    attribute.PType            = 3;
                    attribute.IntegerAttribute = integerAttribute;
                }
                else if (dataRow["Type"].Equals("Money"))
                {
                    DxMoneyAttributeMetadata moneyAttribute = new DxMoneyAttributeMetadata();
                    moneyAttribute.PImeMode         = ImeMode.Auto;
                    moneyAttribute.PMaxValue        = Double.Parse(dataRow["MaxValue"].ToString());
                    moneyAttribute.PMinValue        = Double.Parse(dataRow["MinValue"].ToString());
                    moneyAttribute.PPrecision       = int.Parse(dataRow["Precision"].ToString());
                    moneyAttribute.PPrecisionSource = int.Parse(dataRow["PrecisionSource"].ToString());
                    attribute.PType          = 4;
                    attribute.MoneyAttribute = moneyAttribute;
                }
                else if (dataRow["Type"].Equals("Date"))
                {
                    DxDateTimeAttributeMetadata dateTimeAttribute = new DxDateTimeAttributeMetadata();
                    dateTimeAttribute.PFormat  = dateTimeFormat;
                    dateTimeAttribute.PImeMode = ImeMode.Auto;

                    attribute.PType             = 5;
                    attribute.DateTimeAttribute = dateTimeAttribute;
                }

                lEntities.Add(attribute);
            }

            return(lEntities);
        }