/// <summary> /// Catalogs the value set with dependent values. /// </summary> /// <param name="values"> /// The values. /// </param> /// <returns> /// a catalog value set /// </returns> public static CatalogValueSet CatalogValueSetWithDependentValues(List <object> values) { var valueSet = new CatalogValueSet(); if (values == null) { return(valueSet); } foreach (JArray catval in values) { var catvaldef = catval?.ToObject <List <object> >(); var value = new UPCatalogValue(catvaldef); valueSet.AddWithOwnership( new DependentCatalogValue( value.Code, value.ParentCode, value.Text, value.Tenant, value.ExtKey, value.Sortinfo, value.Access, true)); } return(valueSet); }
/// <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); }
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); }