Ejemplo n.º 1
0
        public static ControlMetadata FromFieldMetadata(FieldMetadata fieldMetadata)
        {
            var result = new ControlMetadata
            {
                DisplayType          = fieldMetadata.DisplayType,
                DataType             = fieldMetadata.DataType,
                PickListEntries      = fieldMetadata.PickListEntries,
                Label                = fieldMetadata.Label,
                Name                 = fieldMetadata.Name,
                HelpText             = fieldMetadata.HelpText,
                PortalPrompt         = fieldMetadata.PortalPrompt,
                DefaultValue         = fieldMetadata.DefaultValue,
                IsRequired           = fieldMetadata.IsRequired,
                IsRequiredInPortal   = fieldMetadata.IsRequiredInPortal,
                IsReadOnly           = fieldMetadata.IsReadOnly,
                PortalAccessibility  = fieldMetadata.PortalAccessibility,
                ReferenceType        = fieldMetadata.ReferenceType,
                ReferenceContext     = fieldMetadata.ReferenceTypeContext,
                DataSourceExpression = Formats.GetSafeFieldName(fieldMetadata.Name),
                LookupTableID        = fieldMetadata.LookupTableID
                                       // MS-6019 (Modified 1/9/2015) Need to account for lookup tables
            };

            return(result);
        }
Ejemplo n.º 2
0
            public ControlMetadata FindFieldWithPrefix(string prefixToLookFor)
            {
                ControlMetadata cm = null;

                if (LeftControls != null)
                {
                    cm =
                        LeftControls.Find(
                            x => x.DataSourceExpression != null && x.DataSourceExpression.StartsWith(prefixToLookFor));
                    if (cm != null)
                    {
                        return(cm);
                    }
                }

                if (RightControls != null)
                {
                    cm =
                        RightControls.Find(
                            x => x.DataSourceExpression != null && x.DataSourceExpression.StartsWith(prefixToLookFor));
                    if (cm != null)
                    {
                        return(cm);
                    }
                }

                return(null);
            }