예제 #1
0
        private UPMEditField CreateMainEditFieldWithParticipantIdentifierEditGroup(IIdentifier participantIdentifier, UPMGroup editGroup)
        {
            var field = new UPMRepEditField(participantIdentifier)
            {
                Group = editGroup,
                GroupModelController = this,
                MultiSelectMode      = false,
                HelpIdentifier       = StringIdentifier.IdentifierWithStringId("RepPartitipant")
            };

            var repType          = UPCRMReps.RepTypeFromString(this.ParticipantsField.Field.RepType);
            var possibleValues   = UPCRMDataStore.DefaultStore.Reps.AllRepsOfTypes(repType);
            var explicitKeyOrder = UPCRMDataStore.DefaultStore.Reps.AllRepIdsOfTypes(repType);
            var repContainer     = UPRepsService.CreateRepContainerForRepType(repType);

            field.RepContainer = repContainer;

            // Adding all rep values from UPCRMDataStore to the PossibleValues list.
            foreach (var obj in possibleValues)
            {
                var possibleValue = new UPMCatalogPossibleValue();
                var valueField    = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"));
                var rep           = obj;
                valueField.StringValue        = rep.RepName;
                possibleValue.TitleLabelField = valueField;
                possibleValue.Key             = rep.RepId;
                field.AddPossibleValue(possibleValue);
            }

            field.NullValueKey     = "0";
            field.ExplicitKeyOrder = explicitKeyOrder;

            return(field);
        }
        /// <summary>
        /// The create edit field.
        /// </summary>
        /// <returns>
        /// The <see cref="UPMEditField"/>.
        /// </returns>
        public override UPMEditField CreateEditField()
        {
            UPMRepEditField field            = new UPMRepEditField(this.FieldIdentifier);
            UPCRMRepType    repType          = UPCRMReps.RepTypeFromString(this.FieldConfig.Field.RepType);
            var             possibleValues   = UPCRMDataStore.DefaultStore.Reps.AllRepsOfTypes(repType);
            var             explicitKeyOrder = UPCRMDataStore.DefaultStore.Reps.AllRepIdsOfTypes(repType);
            var             repContainer     = UPRepsService.CreateRepContainerForRepType(repType);

            field.RepContainer = repContainer;

            // Adding all rep values from UPCRMDataStore to the PossibleValues list.
            foreach (var obj in possibleValues)
            {
                UPMCatalogPossibleValue possibleValue = new UPMCatalogPossibleValue();
                UPMStringField          valueField    = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"));
                UPCRMRep rep = obj;
                valueField.StringValue        = rep.RepName;
                possibleValue.TitleLabelField = valueField;
                possibleValue.Key             = rep.RepId;
                field.AddPossibleValue(possibleValue);
            }

            field.SetFieldValue(this.OriginalValue);
            field.NullValueKey     = "0";
            field.ExplicitKeyOrder = explicitKeyOrder;
            this.ApplyAttributesOnEditFieldConfig(field, this.FieldConfig);

            return(field);
        }
        private static UPMFilter GetRepFilter(FieldIdentifier identifier, UPCRMFieldInfo fieldInfo)
        {
            var repType   = UPCRMReps.RepTypeFromString(fieldInfo.RepType);
            var repFilter = new UPMRepFilter(identifier)
            {
                RepContaner = UPRepsService.CreateRepContainerForRepType(repType)
            };

            return(repFilter);
        }