/// <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);
        }
예제 #2
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>
        /// Fields the context for.
        /// </summary>
        /// <param name="fieldConfig">
        /// The field configuration.
        /// </param>
        /// <param name="fieldIdentifier">
        /// The field identifier.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <param name="childFields">
        /// The child fields.
        /// </param>
        /// <returns>
        /// The <see cref="UPEditFieldContext"/>.
        /// </returns>
        public static UPEditFieldContext FieldContextFor(
            UPConfigFieldControlField fieldConfig,
            IIdentifier fieldIdentifier,
            string value,
            List <UPEditFieldContext> childFields)
        {
            var fieldType = fieldConfig?.Field?.FieldType;

            if (string.IsNullOrEmpty(fieldType))
            {
                return(null);
            }

            var gps = fieldConfig.Attributes?.ExtendedOptionForKey("GPS");

            if (!string.IsNullOrEmpty(gps))
            {
                return(new UPGpsEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));
            }

            switch (fieldType[0])
            {
            case 'X':
                return(new UPFixedCatalogEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));

            case 'K':
                return(new UPVariableCatalogEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));

            case 'D':
                return(new UPDateEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));

            case 'T':
                return(new UPTimeEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));

            case 'B':
                return(new UPBooleanEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));

            case 'N':
            case 'L':
            case 'S':
            case 'F':
                if (fieldType[0] == 'L' && fieldConfig.Field.IsRepField)
                {
                    var repId = UPCRMReps.FormattedRepId(value);
                    return(new UPRepEditFieldContext(fieldConfig, fieldIdentifier, repId, childFields));
                }
                else
                {
                    return(new UPNumberEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));
                }

            case 'Z':
            {
                return(new UPEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));
            }

            default:
                return(new UPEditFieldContext(fieldConfig, fieldIdentifier, value, childFields));
            }
        }
        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);
        }
 /// <summary>
 /// Sets the value.
 /// </summary>
 /// <param name="value">
 /// The value.
 /// </param>
 public override void SetValue(string value)
 {
     if (value?.Length > 0 && value.Length != 9)
     {
         base.SetValue(UPCRMReps.FormattedRepId(value));
     }
     else
     {
         base.SetValue(value);
     }
 }
예제 #6
0
        UPMEditField CreateMainEditFieldWithParticipantIdentifierEditGroup(UPMIdentifier participantIdentifier, UPMGroup editGroup)
        {
            UPMRepEditField editField = new UPMRepEditField(participantIdentifier);

            editField.Group = editGroup;
            editField.GroupModelController = this;
            editField.MultiSelectMode      = true;
            editField.HelpIdentifier       = UPMStringIdentifier.IdentifierWithStringId("RepPartitipant");
            UPCRMRepType   repType     = UPCRMReps.RepTypeFromString(this.ParticipantsField.Field.RepType);
            UPMRepContaner repContaner = UPRepsService.CreateRepContanerForRepType(repType);

            editField.RepContaner      = repContaner;
            editField.ContinuousUpdate = true;
            return(editField);
        }