コード例 #1
0
        /// <summary>
        /// Creates the edit field.
        /// </summary>
        /// <returns><see cref="UPMEditField"/></returns>
        public override UPMEditField CreateEditField()
        {
            var field = new UPMRecordSelectorEditField(this.FieldIdentifier);

            this.ApplyAttributesOnEditFieldConfig(field, this.FieldConfig);
            if (this.Selector != null)
            {
                field.SelectorArray = new List <UPRecordSelector> {
                    this.Selector
                };
                field.Delegate = this;
            }

            field.ContinuousUpdate = true;
            this.Catalog           = null;
            if (this.FieldConfig.Field.FieldType == "K")
            {
                this.Catalog = UPCRMDataStore.DefaultStore.CatalogForVariableCatalogId(this.FieldConfig.Field.CatNo);
            }
            else if (this.FieldConfig.Field.FieldType == "X")
            {
                this.Catalog = UPCRMDataStore.DefaultStore.CatalogForFixedCatalogId(this.FieldConfig.Field.CatNo);
            }

            return(field);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPContainerFieldMetaInfo"/> class.
        /// </summary>
        /// <param name="crmField">
        /// The CRM field.
        /// </param>
        /// <param name="functionName">
        /// Name of the function.
        /// </param>
        /// <param name="fieldFormat">
        /// The field format.
        /// </param>
        public UPContainerFieldMetaInfo(UPCRMField crmField, string functionName, object fieldFormat)
        {
            this.CrmField     = crmField;
            this.CrmFieldInfo = UPCRMDataStore.DefaultStore.FieldInfoForField(this.CrmField);
            this.catalog      = null;
#if PORTING
            FieldFormat = fieldFormat;
#endif
            this.FunctionName = functionName;
            this.resultValueMapperInitialized = false;
        }
コード例 #3
0
        private void LoadGroups()
        {
            this.Groups    = new List <UPCharacteristicsGroup>();
            this.groupDict = new Dictionary <string, UPCharacteristicsGroup>();
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            if (this.GroupSearchAndListControl != null)
            {
                this.GroupFieldControl = configStore.FieldControlByNameFromGroup("List", this.GroupSearchAndListControl.FieldGroupName);
                UPConfigFilter filter = null;
                if (!string.IsNullOrEmpty(this.GroupSearchAndListControl.FilterName))
                {
                    filter = configStore.FilterByName(this.GroupSearchAndListControl.FilterName);
                    if (filter != null && this.sourceFieldDictionary != null)
                    {
                        filter = filter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary));
                    }
                }

                UPConfigFieldControlField groupField = this.GroupFieldControl.FieldWithFunction(Constants.FieldGroupString);
                if (this.GroupFieldControl != null && groupField != null)
                {
                    this.crmQuery = new UPContainerMetaInfo(this.GroupFieldControl);
                    if (filter != null)
                    {
                        this.crmQuery.ApplyFilter(filter);
                    }

                    this.currentQueryType = 0;
                    this.crmQuery.Find(this.SourceRequestOption, this);
                }
            }
            else
            {
                bool      showAdditionalFields = !configStore.ConfigValueIsSet("Characteristics.HideAdditionalFields");
                bool      showExpanded         = !configStore.ConfigValueIsSet("Characteristics.CollapseGroups");
                UPCatalog catalog = UPCRMDataStore.DefaultStore.CatalogForCrmField(this.DestinationGroupField.Field);
                foreach (string key in catalog.SortedValues)
                {
                    UPCharacteristicsGroup group = new UPCharacteristicsGroup(catalog.TextValueForKey(key), key, false, this, showExpanded);
                    if (showAdditionalFields)
                    {
                        group.ShowAdditionalFields = true;
                    }

                    this.groupDict[key] = group;
                    this.Groups.Add(group);
                }

                this.LoadItems();
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the answers.
        /// </summary>
        /// <value>
        /// The answers.
        /// </value>
        public List <IQuestionnaireAnswerOption> Answers()
        {
            if (!this.answersInitialized && this.answers == null)
            {
                if (!string.IsNullOrEmpty(this.InfoAreaId) && this.FieldId >= 0)
                {
                    if (this.FieldInfo.IsCatalogField)
                    {
                        UPCatalog catalog = UPCRMDataStore.DefaultStore.CatalogForCrmField(this.Field);
                        if (!catalog.IsDependent)
                        {
                            Dictionary <string, string> values = catalog.TextValuesForFieldValues(false);
                            if (values.Count > 0)
                            {
                                this.answers = UPQuestionnaireAnswer.AnswersFromCatalogValueDictionary(values);
                            }

                            if (this.multiple && !this.Questionnaire.Manager.MultipleAnswersForCatalogs)
                            {
                                this.multiple = false;
                            }
                        }
                    }
                }

                this.answersInitialized = true;
                if (this.answers?.Count > 0)
                {
                    this.answerDictionary = new Dictionary <string, IQuestionnaireAnswerOption>();
                    foreach (IQuestionnaireAnswerOption answerOption in this.answers)
                    {
                        if (answerOption.AnswerId != null)
                        {
                            this.answerDictionary[answerOption.AnswerId] = answerOption;
                        }
                    }
                }
                else
                {
                    this.multiple = false;
                }
            }

            return(this.answers);
        }
コード例 #5
0
        private void HandleGroupsWithAllItems(List <UPCharacteristicsGroup> groupsWithAllItems)
        {
            if (groupsWithAllItems.Count > 0)
            {
                UPCatalog itemCatalog = UPCRMDataStore.DefaultStore.CatalogForCrmField(this.DestinationItemField.Field);
                foreach (UPCharacteristicsGroup group in groupsWithAllItems)
                {
                    List <UPCatalogValue> items = itemCatalog.ValuesForParentValueIncludeHidden(Convert.ToInt32(group.CatalogValue), false);
                    if (items != null)
                    {
                        foreach (UPCatalogValue catalogValue in items)
                        {
                            group.AddItem(new UPCharacteristicsItem(catalogValue.Text, catalogValue.CodeKey, group, group.ShowAdditionalFields ? this.AdditionalFields : null));
                        }
                    }
                }
            }

            this.LoadRecordData();
        }
コード例 #6
0
        /// <summary>
        /// Copies the field values for result.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <returns></returns>
        public Dictionary <string, object> CopyFieldValuesForResult(UPCRMResultRow resultRow)
        {
            Dictionary <string, object> resultDictionary = new Dictionary <string, object>();

            foreach (string key in this.FieldConfigsForFunction.Keys)
            {
                UPConfigFieldControlField fieldConfig = this.FieldConfigsForFunction[key];
                string rawResult = resultRow.RawValueAtIndex(fieldConfig.TabIndependentFieldIndex);
                if (!string.IsNullOrEmpty(rawResult))
                {
                    resultDictionary[key] = rawResult;
                    if (fieldConfig.Field.FieldType == "K")
                    {
                        int catval = Convert.ToInt32(rawResult);
                        if (catval > 0)
                        {
                            UPCatalog      catalog      = fieldConfig.Field.Catalog;
                            UPCatalogValue catalogValue = catalog.ValueForCode(catval);

                            if (!string.IsNullOrEmpty(catalogValue?.ExtKey))
                            {
                                resultDictionary[$"{key}.extkey"] = catalogValue.ExtKey;
                            }

                            resultDictionary[$"{key}.text"] = catalogValue?.Text ?? string.Empty;
                        }
                    }
                }
                else
                {
                    resultDictionary[key] = string.Empty;
                }
            }

            return(resultDictionary.Count > 0 ? resultDictionary : null);
        }
コード例 #7
0
        private UPMEditField CreateDependEditField(IIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup)
        {
            UPCRMField field = null;

            if (catalog == this.ParticipantsControl.RequirementCatalog)
            {
                field = this.ParticipantsControl.RequirementField;
            }
            else if (catalog == this.ParticipantsControl.AcceptanceCatalog)
            {
                field = this.ParticipantsControl.AcceptanceField;
            }

            var editField = new UPMParticipantCatalogEditField(StringIdentifier.IdentifierWithStringId(
                                                                   field != null ? $"dependField_{participantIdentifier}_{field.InfoAreaId}_{field.FieldId}" : $"dependField_{participantIdentifier}_(null)_0"))
            {
                GroupModelController = this,
                Group = editGroup
            };

            if (catalog != null)
            {
                var           possibleValues = catalog.Values;
                List <string> explicitKeyOrder;
                var           possibleValuesAsString      = catalog.TextValuesForFieldValues(false);
                var           configStore                 = ConfigurationUnitStore.DefaultStore;
                var           acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId);
                foreach (var catalogValue in possibleValues)
                {
                    var possibleValue = new UPMCatalogPossibleValue
                    {
                        TitleLabelField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"))
                        {
                            StringValue = catalogValue.Text
                        }
                    };

                    var configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode.ValueOrDefault(catalogValue.CodeKey.ToInt());

                    if (configCatalogValueAttributes != null)
                    {
                        var colorString = configCatalogValueAttributes.ColorKey;
                        if (!string.IsNullOrEmpty(colorString))
                        {
                            possibleValue.IndicatorColor = AureaColor.ColorWithString(colorString);
                        }

                        possibleValue.ImageString = configCatalogValueAttributes.ImageName;
                    }

                    possibleValue.Key = catalogValue.CodeKey;

                    editField.AddPossibleValue(possibleValue);
                }

                if (string.IsNullOrEmpty(possibleValuesAsString.ValueOrDefault("0")))
                {
                    editField.NullValueKey = "0";
                }

                if (acceptanceCatalogAttributes != null && !ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByAttributeFilter"))
                {
                    explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false));
                }
                else if (ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByCode"))
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false);
                }
                else
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);
                }

                if (explicitKeyOrder != null)
                {
                    editField.ExplicitKeyOrder = explicitKeyOrder;
                }

                editField.ContinuousUpdate = true;
                editField.DisplayValues    = possibleValuesAsString.Values.ToList();
            }

            return(editField);
        }
コード例 #8
0
        UPMEditField CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(UPMIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup)
        {
            UPCRMField field;

            if (catalog == this.ParticipantsControl.RequirementCatalog)
            {
                field = this.ParticipantsControl.RequirementField;
            }
            else if (catalog == this.ParticipantsControl.AcceptanceCatalog)
            {
                field = this.ParticipantsControl.AcceptanceField;
            }

            UPMParticipantCatalogEditField editField = new UPMParticipantCatalogEditField(UPMStringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("dependField_%@_%@_%ld", participantIdentifier.Description, field.InfoAreaId, (long)field.FieldId)));

            editField.GroupModelController = this;
            editField.Group = editGroup;
            if (catalog != null)
            {
                ArrayList                 possibleValues = catalog.Values;
                ArrayList                 explicitKeyOrder;
                NSDictionary              possibleValuesAsString      = catalog ? catalog.TextValuesForFieldValues() : null;
                UPConfigurationUnitStore  configStore                 = UPConfigurationUnitStore.DefaultStore();
                UPConfigCatalogAttributes acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId);
                possibleValues.EnumerateObjectsUsingBlock(delegate(object obj, uint idx, bool stop)
                {
                    UPMCatalogPossibleValue possibleValue = new UPMCatalogPossibleValue();
                    UPMStringField valueField             = new UPMStringField(UPMStringIdentifier.IdentifierWithStringId("x"));
                    UPCatalogValue catalogValue           = (UPCatalogValue)obj;
                    valueField.StringValue        = catalogValue.Text;
                    possibleValue.TitleLabelField = valueField;
                    UPConfigCatalogValueAttributes configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode().ObjectForKey(NSNumber.NumberWithInt(catalogValue.CodeKey.IntValue));
                    if (configCatalogValueAttributes)
                    {
                        string colorString = configCatalogValueAttributes.ColorKey();
                        if (colorString)
                        {
                            possibleValue.IndicatorColor = UPColor.ColorWithString(colorString);
                        }

                        possibleValue.ImageString = configCatalogValueAttributes.ImageName();
                    }

                    editField.AddPossibleValueForKey(possibleValue, catalogValue.CodeKey);
                });
                if (((string)possibleValuesAsString.ObjectForKey("0")).Length == 0)
                {
                    editField.NullValueKey = "0";
                }

                if (catalog != null && acceptanceCatalogAttributes != null && !UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByAttributeFilter"))
                {
                    explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false));
                }
                else if (catalog != null && UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByCode"))
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false);
                }
                else
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);
                }

                if (explicitKeyOrder != null)
                {
                    editField.ExplicitKeyOrder = explicitKeyOrder;
                }

                editField.ContinuousUpdate = true;
            }

            return(editField);
        }