Пример #1
0
        private UPCRMFieldInfo CreateFieldInfo(
            UPCRMLinkInfoField linkInfoField,
            UPCRMLink link,
            ref bool linkInitialized,
            ref int firstField,
            ref int secondField)
        {
            var fieldInfo = this.tableInfo.FieldInfoForFieldId(linkInfoField.FieldId);

            if (!linkInitialized)
            {
                var targetTableInfo = this.dataStore.TableInfoForInfoArea(link.InfoAreaId);
                var targetIdentLink = targetTableInfo.IdentLink;
                firstField      = targetIdentLink?.FirstField.TargetFieldId ?? -1;
                secondField     = targetIdentLink?.SecondField.TargetFieldId ?? -1;
                linkInitialized = true;
            }

            return(fieldInfo);
        }
Пример #2
0
        private Dictionary <int, string> ApplyFieldInfo(
            bool onlyOffline,
            UPCRMFieldInfo fieldInfo,
            string sourceValue,
            Dictionary <int, string> rawValuesForUnknownFields,
            UPCRMLinkInfoField linkInfoField)
        {
            if (fieldInfo == null && !string.IsNullOrWhiteSpace(sourceValue))
            {
                if (rawValuesForUnknownFields == null)
                {
                    rawValuesForUnknownFields = new Dictionary <int, string>
                    {
                        { linkInfoField.FieldId, sourceValue }
                    };
                }
                else
                {
                    rawValuesForUnknownFields[linkInfoField.FieldId] = sourceValue;
                }
            }
            else if (!string.IsNullOrEmpty(sourceValue))
            {
                var fieldValue = this.Record.FieldValueForFieldIndex(linkInfoField.FieldId);
                if (fieldValue == null)
                {
                    this.Record.AddValue(
                        new UPCRMFieldValue(sourceValue, this.infoAreaId, linkInfoField.FieldId, onlyOffline));
                }
                else if (fieldInfo.IsEmptyValue(fieldValue.Value))
                {
                    fieldValue.ChangeValueOldValue(sourceValue, null);
                }
            }

            return(rawValuesForUnknownFields);
        }