Пример #1
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);


        ClassMetadata cm = new ClassMetadata();

        cm.Fields = MultiStepWizards.PlaceAnOrder.EditOrderLineItemProductDemographics;
        // setup the metadata
        CustomFieldSet1.Metadata = cm;

        DataEntryViewMetadata vm = new DataEntryViewMetadata();

        vm.Sections = new List <MemberSuite.SDK.Manifests.Command.ViewMetadata.ControlSection>();
        ViewMetadata.ControlSection cs = new ViewMetadata.ControlSection();

        foreach (var f in cm.Fields)
        {
            ControlMetadata cm2 = ControlMetadata.FromFieldMetadata(f);
            cm2.IsRequired = null;   // important, we don't want this overrideen
            cs.LeftControls.Add(cm2);
        }
        vm.Sections.Add(cs);
        CustomFieldSet1.PageLayout = vm;

        CustomFieldSet1.Render();
    }
Пример #2
0
    protected DataEntryViewMetadata createViewMetadataFromEntryQuestions()
    {
        var result      = new DataEntryViewMetadata();
        var baseSection = new ViewMetadata.ControlSection();

        baseSection.SubSections = new List <ViewMetadata.ControlSection>();

        var currentSection = new ViewMetadata.ControlSection();

        currentSection.LeftControls = new List <ControlMetadata>();
        baseSection.SubSections.Add(currentSection);
        foreach (var question in targetCompetitionQuestions)
        {
            var field = new ControlMetadata {
                DataSourceExpression = question.Name
            };

            // This isn't necessary - the field is aqequately described already
            ////ControlMetadata field = ControlMetadata.FromFieldMetadata(question.FieldDefinition);

            if (field.DisplayType == FieldDisplayType.Separator)
            {
                if (currentSection.LeftControls != null && currentSection.LeftControls.Count > 0)
                // we have to create a new section
                {
                    currentSection = new ViewMetadata.ControlSection();
                    currentSection.LeftControls = new List <ControlMetadata>();
                    baseSection.SubSections.Add(currentSection);
                }

                currentSection.Name  = Guid.NewGuid().ToString();
                currentSection.Label = field.PortalPrompt ?? field.Label; // set the section label
                continue;
            }

            currentSection.LeftControls.Add(field);
        }

        result.Sections = new List <ViewMetadata.ControlSection> {
            baseSection
        };
        return(result);
    }
    protected DataEntryViewMetadata createViewMetadataFromEntryQuestions()
    {
        var result      = new DataEntryViewMetadata();
        var baseSection = new ViewMetadata.ControlSection();

        baseSection.SubSections = new List <ViewMetadata.ControlSection>();

        var currentSection = new ViewMetadata.ControlSection();

        currentSection.LeftControls = new List <ControlMetadata>();
        baseSection.SubSections.Add(currentSection);
        foreach (var question in targetCompetitionQuestions.OrderBy(o => o.DisplayOrder))
        {
            var field = ControlMetadata.FromFieldMetadata(question.FieldDefinition);

            if (field.DisplayType == FieldDisplayType.Separator)
            {
                if (currentSection.LeftControls != null && currentSection.LeftControls.Count > 0)
                // we have to create a new section
                {
                    currentSection = new ViewMetadata.ControlSection();
                    currentSection.LeftControls = new List <ControlMetadata>();
                    baseSection.SubSections.Add(currentSection);
                }

                currentSection.Name  = Guid.NewGuid().ToString();
                currentSection.Label = field.PortalPrompt ?? field.Label; // set the section label
                continue;
            }

            if (currentSection.LeftControls != null)
            {
                currentSection.LeftControls.Add(field);
            }
        }

        result.Sections = new List <ViewMetadata.ControlSection> {
            baseSection
        };
        return(result);
    }
    protected DataEntryViewMetadata createViewMetadataFromRegistrationFields()
    {
        DataEntryViewMetadata result = new DataEntryViewMetadata();

        ViewMetadata.ControlSection baseSection = null;

        result.Sections = new List <ViewMetadata.ControlSection> ();
        foreach (var field in targetRegistrationFields)
        {
            if (field.DisplayType == FieldDisplayType.Separator || baseSection == null)
            {
                // create a new section
                baseSection = new ViewMetadata.ControlSection
                {
                    Label       = field.Label,
                    SubSections = new List <ViewMetadata.ControlSection>()
                };
                result.Sections.Add(baseSection);
                continue;
            }


            //MS-1358
            field.IsRequired = field.IsRequiredInPortal;

            //MS-1359
            if (field.DisplayType == FieldDisplayType.LargeTextBox)
            {
                field.UseEntireRow = true;
            }

            baseSection.LeftControls.Add(field);
        }

        // remove empty sections
        result.Sections.RemoveAll(x => x.LeftControls == null || x.LeftControls.Count == 0);

        return(result);
    }
    protected DataEntryViewMetadata createViewMetadataFromRegistrationFields()
    {
        DataEntryViewMetadata result = new DataEntryViewMetadata();

        ViewMetadata.ControlSection baseSection = new ViewMetadata.ControlSection();
        baseSection.SubSections = new List <ViewMetadata.ControlSection>();

        var currentSection = new ViewMetadata.ControlSection();

        currentSection.LeftControls = new List <ControlMetadata>();
        baseSection.SubSections.Add(currentSection);
        foreach (var field in targetRegistrationFields)
        {
            if (field.DisplayType == FieldDisplayType.Separator)
            {
                if (currentSection.LeftControls != null && currentSection.LeftControls.Count > 0)
                // we have to create a new section
                {
                    currentSection = new ViewMetadata.ControlSection();
                    currentSection.LeftControls = new List <ControlMetadata>();
                    baseSection.SubSections.Add(currentSection);
                }

                currentSection.Name  = Guid.NewGuid().ToString();
                currentSection.Label = field.PortalPrompt ?? field.Label; // set the section label
                continue;
            }


            currentSection.LeftControls.Add(field);
        }
        result.Sections = new List <ViewMetadata.ControlSection> {
            baseSection
        };
        return(result);
    }
Пример #6
0
    protected DataEntryViewMetadata createViewMetadata(List <FieldMetadata> fields, bool isForSearch)
    {
        DataEntryViewMetadata result = new DataEntryViewMetadata();

        ViewMetadata.ControlSection baseSection = new ViewMetadata.ControlSection();
        baseSection.SubSections = new List <ViewMetadata.ControlSection>();

        var currentSection = new ViewMetadata.ControlSection();

        currentSection.LeftControls = new List <ControlMetadata>();
        baseSection.SubSections.Add(currentSection);
        foreach (var field in fields)
        {
            if (field.DisplayType == FieldDisplayType.Separator)
            {
                if (currentSection.LeftControls != null && currentSection.LeftControls.Count > 0)
                // we have to create a new section
                {
                    currentSection = new ViewMetadata.ControlSection();
                    currentSection.LeftControls = new List <ControlMetadata>();
                    baseSection.SubSections.Add(currentSection);
                }

                currentSection.Name = Guid.NewGuid().ToString();


                currentSection.Label = field.PortalPrompt ?? field.Label; // set the section label

                continue;
            }


            // // MS-1251 - REQUIREMENT to have to/from fields for numeric fields

            var control = ControlMetadata.FromFieldMetadata(field);

            if (isForSearch)
            {
                control.PortalPrompt = null;
            }
            switch (control.DataType)
            {
            case FieldDataType.Integer:
            case FieldDataType.Decimal:
            case FieldDataType.Date:
            case FieldDataType.DateTime:

                // we need to use a range
                var controlTo = control.Clone();
                control.Label += " - Range Start";
                control.Name  += "__from";
                control.DataSourceExpression += "__from";

                currentSection.LeftControls.Add(control);


                controlTo.Label += " - Range End";
                controlTo.Name  += "__to";
                controlTo.DataSourceExpression += "__to";


                currentSection.LeftControls.Add(controlTo);
                break;

            default:
                currentSection.LeftControls.Add(control);
                break;
            }
        }
        result.Sections = new List <ViewMetadata.ControlSection> {
            baseSection
        };
        return(result);
    }