/// <summary> /// Selectors for. /// </summary> /// <param name="infoAreaId"> /// The information area identifier. /// </param> /// <param name="recordIdentification"> /// The record identification. /// </param> /// <param name="linkId"> /// The link identifier. /// </param> /// <param name="definition"> /// The definition. /// </param> /// <param name="filterParameters"> /// The filter parameters. /// </param> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <returns> /// The <see cref="UPSelector"/>. /// </returns> public static UPSelector SelectorFor( string infoAreaId, string recordIdentification, int linkId, object definition, Dictionary <string, object> filterParameters, UPConfigFieldControlField fieldConfig) { var selectorType = SelectorTypeFromDefinition(definition); if (selectorType == "Record") { return(new UPRecordSelector( infoAreaId, recordIdentification, linkId, definition, filterParameters, fieldConfig)); } else { return(new UPSelector( infoAreaId, recordIdentification, linkId, definition, filterParameters, fieldConfig)); } }
/// <summary> /// Initializes a new instance of the <see cref="UPEditFieldContext"/> class. /// </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> public UPEditFieldContext( UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value, List <UPEditFieldContext> childFields) { this.FieldConfig = fieldConfig; this.FieldId = this.FieldConfig?.FieldId ?? 0; this.OriginalValue = value; this.initialValue = value; this.ChildFields = childFields; this.FieldIdentifier = fieldIdentifier; this.WebConfigField = null; this.FieldFunction = fieldConfig?.Function; this.Key = $"{this.FieldId}"; if (this.ChildFields != null) { foreach (var childField in this.ChildFields) { childField.SetParentContext(this); } } this.UniqueKey = NextKey; }
/// <summary> /// Initializes a new instance of the <see cref="UPSerialEntryParentInfoPanelCell"/> class. /// </summary> /// <param name="fieldControlTab">The field control tab.</param> /// <param name="resultRow">The result row.</param> public UPSerialEntryParentInfoPanelCell(FieldControlTab fieldControlTab, UPCRMResultRow resultRow) { int numberOfFields = fieldControlTab.NumberOfFields; List <string> fields = new List <string>(); if (!string.IsNullOrEmpty(fieldControlTab.Label)) { fields.Add(fieldControlTab.Label); } for (int index = 0; index < numberOfFields; index++) { UPConfigFieldControlField field = fieldControlTab.FieldAtIndex(index); if (index == 0) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ImageName = configStore.InfoAreaConfigById(field.InfoAreaId).ImageName; } int offset = 0; string value = resultRow.FormattedFieldValueAtIndex(index, offset, fieldControlTab); index += offset; if (!string.IsNullOrEmpty(value)) { fields.Add(value); } } this.FieldValues = fields; }
/// <summary> /// Hiddens the field for. /// </summary> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <param name="fieldIdentifier"> /// The field identifier. /// </param> /// <param name="value"> /// The value. /// </param> /// <returns> /// The <see cref="UPEditFieldContext"/>. /// </returns> public static UPEditFieldContext HiddenFieldFor( UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value) { return(new UPHiddenEditFieldContext(fieldConfig, fieldIdentifier, value, null)); }
/// <summary> /// Readonlies the field for. /// </summary> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <param name="fieldIdentifier"> /// The field identifier. /// </param> /// <param name="value"> /// The value. /// </param> /// <returns> /// The <see cref="UPEditFieldContext"/>. /// </returns> public static UPEditFieldContext ReadonlyFieldFor( UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value) { return(new UPReadOnlyEditFieldContext(fieldConfig, fieldIdentifier, value, null)); }
/// <summary> /// Childs the field context for field configuration value. /// </summary> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <param name="value"> /// The value. /// </param> /// <returns> /// The <see cref="UPEditFieldContext"/>. /// </returns> public static UPEditFieldContext ChildFieldContextForFieldConfigValue( UPConfigFieldControlField fieldConfig, string value) { if (fieldConfig == null) { return(null); } var gps = fieldConfig.Attributes?.ExtendedOptionForKey("GPS"); if (!string.IsNullOrEmpty(gps)) { return(new UPChildGpsEditFieldContext(fieldConfig, value)); } var fieldType = fieldConfig.Field?.FieldType ?? string.Empty; if (fieldType == "T") { return(new UPChildTimeEditFieldContext(fieldConfig, value)); } if (fieldType == "K" || fieldType == "X") { return(new UPChildCatalogEditFieldContext(fieldConfig, value)); } return(new UPChildEditFieldContext(fieldConfig, value)); }
/// <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)); } }
/// <summary> /// Applies the attributes on edit field configuration. /// </summary> /// <param name="_editField"> /// The _edit field. /// </param> /// <param name="fieldConfig"> /// The field configuration. /// </param> public override void ApplyAttributesOnEditFieldConfig( UPMEditField _editField, UPConfigFieldControlField fieldConfig) { base.ApplyAttributesOnEditFieldConfig(_editField, fieldConfig); ((UPMNumberEditField)_editField).ShowZero = fieldConfig?.Field?.FieldInfo?.ShowZero ?? false; }
private static void ProccessStandardGroup(UPMStandardGroup standardGroup, UPConfigFieldControlField documentFieldConfig, string documentKey, string recordIdentification) { var fieldAttributes = documentFieldConfig?.Attributes; var attribute = fieldAttributes?.AttributForId((int)FieldAttr.Image); if (attribute?.ValueOptionsForKey("previewWidth") != null && attribute.ValueOptionsForKey("previewHeight") != null) { var width = attribute.ValueOptionsForKey("previewWidth"); var height = attribute.ValueOptionsForKey("previewHeight"); standardGroup.ImageDocumentMaxSize = new Size( width.ToInt(), height.ToInt()); } var documentManager = new DocumentManager(); var documentData = documentManager.DocumentForKey(documentKey); var imageDocument = documentData != null ? new UPMDocument(documentData) : new UPMDocument( new RecordIdentifier(recordIdentification), null, null, null, null, ServerSession.CurrentSession.DocumentRequestUrlForDocumentKey(documentKey), null, null, null, null); standardGroup.ImageDocument = imageDocument; }
private int DetermineFieldIdDocumentUploadViewReference(int fieldId, ViewReference documentUploadViewReference) { string configValue = documentUploadViewReference.ContextValueForKey("DocumentFieldFieldGroupName"); if (!string.IsNullOrEmpty(configValue)) { FieldControl fieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("Edit", configValue); if (fieldControl.NumberOfFields > 0) { UPConfigFieldControlField field = fieldControl.FieldAtIndex(0); if (field != null) { fieldId = field.FieldId; } } } if (fieldId == -1) { configValue = documentUploadViewReference.ContextValueForKey("DocumentFieldId"); if (!string.IsNullOrEmpty(configValue)) { fieldId = Convert.ToInt32(configValue); } } return(fieldId); }
private static string FormattedValueForResultRowFieldControlTabFieldIndex(UPCRMResultRow row, FieldControlTab tabConfig, int fieldIndex) { bool found = false; FieldAttributes attributes = tabConfig.FieldAtIndex(fieldIndex).Attributes; List <string> fieldValueArray = new List <string>(attributes.FieldCount); int lastIndex = fieldIndex + attributes.FieldCount; for (int i = fieldIndex; i < lastIndex; i++) { UPConfigFieldControlField field = tabConfig.FieldAtIndex(i); if (field != null) { string v = row.ValueAtIndex(field.TabIndependentFieldIndex); if (v != null) { fieldValueArray.Add(v); if (v.Length > 1) { found = true; } } else { fieldValueArray.Add(string.Empty); } } } return(found ? attributes.FormatValues(fieldValueArray) : string.Empty); }
private UPMGroup GroupFromRow(UPCRMResultRow resultRow) { UPMDocumentsGroup docGroup = null; string recordIdentification = resultRow.RootRecordIdentification; int fieldCount = this.TabConfig.NumberOfFields; DocumentManager documentManager = new DocumentManager(); for (int j = 0; j < fieldCount; j++) { UPConfigFieldControlField fieldConfig = this.TabConfig.FieldAtIndex(j); string documentKey = resultRow.ValueAtIndex(fieldConfig.TabIndependentFieldIndex); if (!string.IsNullOrEmpty(documentKey)) { DocumentData documentData = documentManager.DocumentForKey(documentKey); if (documentData != null) { if (docGroup == null) { docGroup = new UPMDocumentsGroup(this.TabIdentifierForRecordIdentification(recordIdentification)); docGroup.LabelText = this.TabLabel; } UPMDocument document = new UPMDocument(new RecordIdentifier(recordIdentification), fieldConfig.Label, documentData.DateString, documentData.SizeString, null, documentData.Url, documentData.Title, documentData.ServerUpdateDate, documentData.DisplayText, null); docGroup.AddField(document); } } } this.ControllerState = docGroup != null ? GroupModelControllerState.Finished : GroupModelControllerState.Empty; this.Group = docGroup; return(docGroup); }
/// <summary> /// Initializes a new instance of the <see cref="UPSEColumn"/> class. /// </summary> /// <param name="fieldConfig">The field configuration.</param> /// <param name="index">The index.</param> /// <param name="positionInControl">The position in control.</param> public UPSEColumn(UPConfigFieldControlField fieldConfig, int index, int positionInControl) { this.FieldConfig = fieldConfig; this.CrmField = this.FieldConfig.Field; this.PositionInControl = positionInControl; this.Index = index; string functionName = fieldConfig.Function; if (!string.IsNullOrEmpty(functionName)) { var parts = functionName.Split(';'); if (parts.Length > 1) { this.Function = parts[0]; this.InitialValue = parts[1]; } else { this.Function = fieldConfig.Function; } } this.SortInfo = new UPSEColumnSortInfo(this, fieldConfig); if (this.FieldConfig.Attributes.Hide) { this.Hidden = true; } if (this.FieldConfig.Attributes.Must) { this.Must = true; } this.ListingDestinationFunctionName = this.FieldConfig.Attributes.ExtendedOptions?["ListingTarget"]; }
/// <summary> /// Changeds the records. /// </summary> /// <returns></returns> public List <UPCRMRecord> ChangedRecords() { UPCRMRecord changedRecord = null; if (this.Deleted && this.Record != null) { if (this.Deleted && this.Created) { // This happens during conflict handling. Saved offline with new RecordId and in conflict handling remove again. // Remove from crmdata only. this.Record.Deleted = true; changedRecord = this.Record; } else { changedRecord = new UPCRMRecord(this.Record.RecordIdentification, "Delete", null); } } else { if (this.Created) { changedRecord = this.Record == null?UPCRMRecord.CreateNew(this.Group.Characteristics.DestinationFieldControl.InfoAreaId) : new UPCRMRecord(this.Record.RecordIdentification); UPCharacteristics characteristics = this.Group.Characteristics; changedRecord.AddLink(new UPCRMLink(characteristics.RecordIdentification)); changedRecord.NewValueFieldId(this.Group.CatalogValue, characteristics.DestinationGroupField.FieldId); changedRecord.NewValueFieldId(this.CatalogValue, characteristics.DestinationItemField.FieldId); for (int i = 0; i < this.AdditionalFields?.Count; i++) { string newValue = this.values[i]; if (!string.IsNullOrEmpty(newValue)) { UPConfigFieldControlField field = this.AdditionalFields[i]; changedRecord.NewValueFieldId(newValue, field.FieldId); } } } else if ((this.Changed && this.Record != null) || (this.Created && this.Record != null)) { changedRecord = new UPCRMRecord(this.Record.RecordIdentification); for (int i = 0; i < this.AdditionalFields?.Count; i++) { string originalValue = this.OriginalValues[i]; string newValue = this.values[i]; if (originalValue != newValue) { UPConfigFieldControlField field = this.AdditionalFields[i]; changedRecord.NewValueFromValueFieldId(newValue, originalValue, field.FieldId); } } } } return(changedRecord != null ? new List <UPCRMRecord> { changedRecord } : null); }
/// <summary> /// Initializes a new instance of the <see cref="UPRepEditFieldContext"/> class. /// </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> public UPRepEditFieldContext( UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value, List <UPEditFieldContext> childFields) : base(fieldConfig, fieldIdentifier, value, childFields) { }
/// <summary> /// Initializes a new instance of the <see cref="UPCatalogEditFieldContext"/> class. /// </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> public UPCatalogEditFieldContext(UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value, List <UPEditFieldContext> childFields) : base(fieldConfig, fieldIdentifier, value, childFields) { if (childFields == null || childFields.Count == 0) { return; } var childFieldIndex = 0; var checkedChildFields = new List <UPEditFieldContext>(childFields.Count); var originalValue = this.OriginalValue; if (!string.IsNullOrEmpty(originalValue)) { originalValue = string.Empty; } this.arrayValues = new List <string> { originalValue }; var fieldInfo = fieldConfig?.Field?.FieldInfo; foreach (var childEditContext in this.ChildFields) { if (!childEditContext.FieldConfig.Field.FieldType.Equals(fieldInfo?.FieldType) || childEditContext.FieldConfig.Field.FieldInfo.CatNo != fieldInfo?.CatNo) { continue; } checkedChildFields.Add(childEditContext); originalValue = childEditContext.OriginalValue; this.arrayValues.Add(string.IsNullOrEmpty(originalValue) ? string.Empty : originalValue); var catalogContext = childEditContext as UPChildCatalogEditFieldContext; if (catalogContext == null) { continue; } catalogContext.ArrayIndex = ++childFieldIndex; catalogContext.RootEditFieldContext = this; } if (checkedChildFields.Count <= 0) { return; } if (checkedChildFields.Count < this.ChildFields.Count) { this.ChildFields = checkedChildFields; } this.MultiSelect = true; this.ValueCount = this.ChildFields.Count + 1; }
private UPMGroup GroupFromParticipantControl() { UPMRepeatableEditGroup repeatableEditGroup = new UPMRepeatableEditGroup(this.TabIdentifierForRecordIdentification(this.LinkRecordIdentification)); repeatableEditGroup.LabelText = this.TabLabel; this.selectorArray = new List <UPRecordSelector>(); for (int fieldNumber = 0; fieldNumber < this.TabConfig.NumberOfFields; fieldNumber++) { UPConfigFieldControlField configFieldControlField = this.TabConfig.Fields[fieldNumber]; var selector = configFieldControlField.Attributes.Selector; if (selector != null) { var recordSelector = new UPRecordSelector("KP", null, -1, selector, null, this.ParticipantsField); this.selectorArray.Add(recordSelector); } } if (this.selectorArray.Count < 1) { repeatableEditGroup.AddingEnabled = false; if (this.ParticipantsControl.Participants.Count < 1) { this.Group = null; this.ControllerState = GroupModelControllerState.Empty; return(null); } } else { repeatableEditGroup.AddGroupLabelText = LocalizedString.TextAddNewGroup; repeatableEditGroup.AddingEnabled = this.AddRecordEnabled; } foreach (UPCRMLinkParticipant participant in this.ParticipantsControl.Participants) { string recordIdentification = participant.RecordIdentification; IIdentifier participantIdentifier = new RecordIdentifier(recordIdentification); UPMStandardGroup group = new UPMStandardGroup(participantIdentifier); string num = participant.Options.ValueOrDefault("must") as string; group.Deletable = !participant.MayNotBeDeleted && this.DeleteRecordEnabled && num.ToInt() == 0; UPMDependsEditField editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group); editField.MainField.FieldValue = participant.Name; ((UPMParticipantsRecordSelectorEditField)editField.MainField).Participant = participant; editField.DependField.FieldValue = participant.AcceptanceText; editField.DependField2.FieldValue = participant.RequirementText; bool editOfflineRecord = ConfigurationUnitStore.DefaultStore.ConfigValueIsSetDefaultValue("RecordSelect.EditOfflineRecord", false); editField.Deletable = !participant.IsOfflineEmptyParticipant || editOfflineRecord; group.AddField(editField); repeatableEditGroup.AddChild(group); this.AddGroupForKey(group, participant.Key); } this.Group = repeatableEditGroup; this.ControllerState = GroupModelControllerState.Finished; return(repeatableEditGroup); }
/// <summary> /// Initializes a new instance of the <see cref="UPSelectorEditFieldContext"/> class. /// </summary> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <param name="fieldIdentifier"> /// The field identifier. /// </param> /// <param name="value"> /// The value. /// </param> /// <param name="selector"> /// The _selector. /// </param> public UPSelectorEditFieldContext( UPConfigFieldControlField fieldConfig, IIdentifier fieldIdentifier, string value, UPSelector selector) : base(fieldConfig, fieldIdentifier, value, null) { this.selector = selector; }
// functionName == nil => all Fields private static List <UPMStringField> FieldsForResultRow(UPCRMResultRow row, string functionName, int tabIndex, bool addHidden) { List <UPMStringField> fields = new List <UPMStringField>(); FieldControlTab sourceFieldControl = row.Result.MetaInfo.SourceFieldControl.TabAtIndex(tabIndex); int offset = tabIndex == 0 ? 0 : row.Result.MetaInfo.SourceFieldControl.TabAtIndex(0).Fields.Count; int fieldCount = tabIndex == 0 ? sourceFieldControl.Fields.Count : row.NumberOfColumns; for (int rowFieldIndex = 0; rowFieldIndex < fieldCount;) { string fieldFunctionNames = sourceFieldControl.FieldAtIndex(rowFieldIndex)?.Function ?? string.Empty; var functionNames = fieldFunctionNames.Split(',').ToList(); functionNames = functionNames.Count == 0 ? new List <string> { string.Empty } : functionNames; UPConfigFieldControlField configField = sourceFieldControl.FieldAtIndex(rowFieldIndex); FieldAttributes attributes = configField?.Attributes; bool found = false; foreach (string fieldFunctionName in functionNames) { if (functionName == null || fieldFunctionName.StartsWith(functionName)) { UPMStringField stringField = new UPMStringField(new FieldIdentifier(row.RecordIdentificationAtIndex(0), configField.Field.FieldIdentification)); stringField.Hidden = attributes.Hide; if (attributes.FieldCount > 0) { List <string> combineFields = new List <string>(); for (int fieldIndex = 0; fieldIndex < attributes.FieldCount; fieldIndex++) { combineFields.Add(row.ValueAtIndex(rowFieldIndex + offset)); rowFieldIndex++; } stringField.StringValue = attributes.FormatValues(combineFields); } else { stringField.StringValue = row.ValueAtIndex(rowFieldIndex + offset); rowFieldIndex++; } if (addHidden || !stringField.Hidden) { fields.Add(stringField); } found = true; } } if (!found) { rowFieldIndex++; } } return(fields); }
/// <summary> /// Initializes a new instance of the <see cref="EditChildrenGroupModelController"/> class. /// </summary> /// <param name="fieldControl">The field control.</param> /// <param name="tabIndex">Index of the tab.</param> /// <param name="editPageContext">The edit page context.</param> /// <param name="theDelegate">The delegate.</param> /// <exception cref="Exception"> /// TabConfig is null /// or /// ChildFieldControl is null /// </exception> public EditChildrenGroupModelController(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate) : base(fieldControl, tabIndex, editPageContext, theDelegate) { FieldControlTab tabConfig = fieldControl.TabAtIndex(tabIndex); if (tabConfig == null) { throw new Exception("TabConfig is null"); } var typeParts = tabConfig.Type.Split('_'); if (typeParts.Length > 1) { string detailsConfigurationName = (string)typeParts[1]; var configNameParts = detailsConfigurationName.Split('#'); if (configNameParts.Length > 1) { this.LinkId = Convert.ToInt32(configNameParts[1]); detailsConfigurationName = configNameParts[0]; } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ChildFieldControl = configStore.FieldControlByNameFromGroup("Edit", detailsConfigurationName); if (this.ChildFieldControl.NumberOfTabs > 1) { this.ChildFieldControl = this.ChildFieldControl.FieldControlWithSingleTab(0); } this.ChildInfoAreaId = this.ChildFieldControl.InfoAreaId; if (typeParts.Length > 2) { UPConfigFilter templateFilter = configStore.FilterByName((string)typeParts[2]); if (templateFilter != null) { templateFilter = templateFilter.FilterByApplyingReplacements(UPConditionValueReplacement.DefaultParameters); this.initialValues = templateFilter.FieldsWithConditions(false); } } } else if (tabConfig.NumberOfFields > 0) { UPConfigFieldControlField childField = tabConfig.FieldAtIndex(0); this.ChildInfoAreaId = childField.InfoAreaId; this.LinkId = childField.LinkId; this.ChildFieldControl = fieldControl.FieldControlWithSingleTabRootInfoAreaIdRootLinkId(tabIndex, this.ChildInfoAreaId, this.LinkId); } else { this.ChildFieldControl = null; } if (this.ChildFieldControl == null) { throw new Exception("ChildFieldControl is null"); } }
/// <summary> /// Initializes a new instance of the <see cref="UPContainerFieldMetaInfo"/> class. /// </summary> /// <param name="fieldControlField"> /// The field control field. /// </param> public UPContainerFieldMetaInfo(UPConfigFieldControlField fieldControlField) : this(fieldControlField?.Field, fieldControlField?.Function, #if PORTING fieldControlField?.Attributes.FieldFormatForFieldType(fieldControlField.Field.FieldType)) #else null) #endif { this.ConfigField = fieldControlField;
private void LoadItems() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.ItemSearchAndListControl != null) { this.ItemFieldControl = configStore.FieldControlByNameFromGroup("List", this.ItemSearchAndListControl.FieldGroupName); UPConfigFilter filter = null; UPConfigFilter groupFilter = null; if (!string.IsNullOrEmpty(this.GroupSearchAndListControl?.FilterName)) { groupFilter = configStore.FilterByName(this.GroupSearchAndListControl.FilterName); if (groupFilter != null && this.sourceFieldDictionary != null) { groupFilter = groupFilter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary)); } } if (!string.IsNullOrEmpty(this.ItemSearchAndListControl.FilterName)) { filter = configStore.FilterByName(this.ItemSearchAndListControl.FilterName); if (filter != null && this.sourceFieldDictionary != null) { filter = filter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary)); } } UPConfigFieldControlField groupField = this.ItemFieldControl.FieldWithFunction(Constants.FieldGroupString); UPConfigFieldControlField itemField = this.ItemFieldControl.FieldWithFunction(Constants.FieldItemString); if (this.ItemFieldControl != null && groupField != null && itemField != null) { this.crmQuery = new UPContainerMetaInfo(this.ItemFieldControl); if (groupFilter != null) { this.crmQuery.ApplyFilter(groupFilter); } if (filter != null) { this.crmQuery.ApplyFilter(filter); } this.currentQueryType = 1; this.crmQuery.Find(this.SourceRequestOption, this); } else { this.HandleGroupsWithAllItems(this.Groups); } } else { this.HandleGroupsWithAllItems(this.Groups); } }
private void HandleResult(UPCRMResult result) { this.currencyDictionary = new Dictionary <int, object>(); if (result != null && result.RowCount > 0) { UPConfigFieldControlField currencyField = null, baseCurrencyField = null, exchangeRateField = null, baseCurrency2Field = null, exchangeRate2Field = null; foreach (FieldControlTab tab in this.fieldControl.Tabs) { foreach (UPConfigFieldControlField field in tab.Fields) { if (field.Function == "Currency") { currencyField = field; } else if (field.Function == "BaseCurrency") { baseCurrencyField = field; } else if (field.Function == "ExchangeRate") { exchangeRateField = field; } else if (field.Function == "BaseCurrency2") { baseCurrency2Field = field; } else if (field.Function == "ExchangeRate2") { exchangeRate2Field = field; } } } if (currencyField != null && baseCurrencyField != null && exchangeRateField != null && result.RowCount > 0) { int i, count = result.RowCount; for (i = 0; i < count; i++) { UPCRMResultRow row = result.ResultRowAtIndex(i) as UPCRMResultRow; int code = row.RawValueAtIndex(currencyField.TabIndependentFieldIndex).ToInt(); int baseCurrencyValue = row.RawValueAtIndex(baseCurrencyField.TabIndependentFieldIndex).ToInt(); double exchangeRate = row.RawValueAtIndex(exchangeRateField.TabIndependentFieldIndex).ToDouble(); double exchangeRate2 = 0; int baseCurrency2Value = 0; if (baseCurrency2Field != null && exchangeRate2Field != null) { baseCurrency2Value = row.RawValueAtIndex(baseCurrency2Field.TabIndependentFieldIndex).ToInt(); exchangeRate2 = row.RawValueAtIndex(exchangeRate2Field.TabIndependentFieldIndex).ToDouble(); } this.AddCurrency(new Currency(code, baseCurrencyValue, exchangeRate, baseCurrency2Value, exchangeRate2)); } } } }
/// <summary> /// Initializes a new instance of the <see cref="UPCRMParticipants"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> /// <param name="rootInfoAreaId">The root information area identifier.</param> /// <param name="linkParticipantsInfoAreaId">The link participants information area identifier.</param> /// <param name="linkParticipantsLinkId">The link participants link identifier.</param> /// <param name="recordIdentification">The record identification.</param> /// <param name="theDelegate">The delegate.</param> public UPCRMParticipants(ViewReference viewReference, string rootInfoAreaId, string linkParticipantsInfoAreaId, int linkParticipantsLinkId, string recordIdentification, UPCRMParticipantsDelegate theDelegate) { this.RecordIdentification = recordIdentification; this.TheDelegate = theDelegate; this.RootInfoAreaId = rootInfoAreaId ?? recordIdentification.InfoAreaId(); if (string.IsNullOrEmpty(this.RootInfoAreaId)) { this.RootInfoAreaId = "MA"; } this.linkParticipantsInfoAreaId = linkParticipantsInfoAreaId; this.linkParticipantsLinkId = linkParticipantsLinkId; if (viewReference == null) { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName($"Configuration:{this.RootInfoAreaId}Participants"); this.ViewReference = menu?.ViewReference; } else { this.ViewReference = viewReference; } this.RepParticipantsRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference?.ContextValueForKey("RepAcceptanceRequestOption"), UPRequestOption.FastestAvailable); this.AcceptanceFieldId = -1; string configName = this.ViewReference?.ContextValueForKey("RepAcceptanceConfigName"); if (!string.IsNullOrEmpty(configName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(configName); if (!string.IsNullOrEmpty(searchAndList.FieldGroupName)) { configName = searchAndList.FieldGroupName; } FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Edit", configName) ?? configStore.FieldControlByNameFromGroup("List", configName); if (fieldControl != null) { UPConfigFieldControlField field = fieldControl.FieldWithFunction(Constants.UPRepAcceptanceFunctionName_Acceptance); if (field != null) { this.AcceptanceFieldId = field.FieldId; } this.RepAcceptanceInfoAreaId = fieldControl.InfoAreaId; } } }
/// <summary> /// The formatted field value at index. /// </summary> /// <param name="index"> /// The index. /// </param> /// <param name="offset"> /// The offset. /// </param> /// <param name="tab"> /// The tab. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public string FormattedFieldValueAtIndex(int index, int?offset, FieldControlTab tab) { UPConfigFieldControlField field = tab.FieldAtIndex(index); if (field != null) { return(this.FormattedFieldValueAtIndex(field.TabIndependentFieldIndex, offset, tab.FieldControl)); } return(null); }
/// <summary> /// Selectors for. /// </summary> /// <param name="recordIdentification"> /// The record identification. /// </param> /// <param name="definition"> /// The definition. /// </param> /// <param name="filterParameters"> /// The filter parameters. /// </param> /// <param name="fieldConfig"> /// The field configuration. /// </param> /// <returns> /// The <see cref="UPSelector"/>. /// </returns> public static UPSelector SelectorFor( string recordIdentification, object definition, Dictionary <string, object> filterParameters, UPConfigFieldControlField fieldConfig) { var selectorType = SelectorTypeFromDefinition(definition); return(selectorType == "Record" ? new UPRecordSelector(recordIdentification, definition, filterParameters, fieldConfig) : new UPSelector(recordIdentification, definition, filterParameters, fieldConfig)); }
/// <summary> /// Initializes a new instance of the <see cref="UPSEColumn"/> class. /// </summary> /// <param name="fieldConfig">The field configuration.</param> /// <param name="column">The column.</param> public UPSEColumn(UPConfigFieldControlField fieldConfig, UPSEColumn column) { this.FieldConfig = fieldConfig; this.CrmField = column.CrmField; this.PositionInControl = column.PositionInControl; this.Index = column.Index; this.Function = column.Function; this.InitialValue = column.InitialValue; this.SortInfo = column.SortInfo; this.Hidden = column.Hidden; this.ListingDestinationFunctionName = column.ListingDestinationFunctionName; }
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(); } }
private void ApplySubTitleFromResultRow(UPCRMResultRow resultRow) { Dictionary <string, UPConfigFieldControlField> fieldMapping = this.detailsControl.FunctionNames(); UPConfigFieldControlField fieldControl = fieldMapping.ValueOrDefault("OrganizerHeaderSubLabel"); if (fieldControl != null) { ((DetailOrganizerModelController)this.ParentOrganizerModelController) .SetRecordTitleForOrganizerHeader( resultRow.FormattedFieldValueAtIndex(fieldControl.TabIndependentFieldIndex, null, this.detailsControl)); } }
/// <summary> /// Adds the field. /// </summary> /// <param name="field"> /// The field. /// </param> public void AddField(UPConfigFieldControlField field) { if (this._fields == null) { this._fields = new List <UPConfigFieldControlField> { field }; } else { this._fields.Add(field); } }