/// <summary> /// The link info from parent link string. /// </summary> /// <param name="singleParentLink"> /// The single parent link. /// </param> /// <returns> /// The <see cref="UPCRMLinkInfo"/>. /// </returns> public UPCRMLinkInfo LinkInfoFromParentLinkString(string singleParentLink) { UPCRMTableInfo tableInfo = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(this.InfoAreaId); string[] stringParts = singleParentLink.Split(':'); return(stringParts.Length > 1 ? tableInfo.LinkInfoForTargetInfoAreaIdLinkId(stringParts[0], stringParts[1].ToInt()) : tableInfo.LinkInfoForTargetInfoAreaIdLinkId(singleParentLink, -1)); }
/// <summary> /// Applies the changes from record. /// </summary> /// <param name="record">The record.</param> public void ApplyChangesFromRecord(UPCRMRecord record) { UPCRMTableInfo tableInfo = this.UndoRequest.DataStore.TableInfoForInfoArea(this.RecordIdentification.InfoAreaId()); if (record.FieldValues != null) { foreach (UPCRMFieldValue value in record.FieldValues) { UPCRMFieldInfo fieldInfo = tableInfo.FieldInfoForFieldId(value.FieldId); if (fieldInfo != null) { UPCRMUndoField undoField = new UPCRMUndoField(fieldInfo.DatabaseFieldName, value.Value, null); this.AddFieldValue(undoField); } } } if (record.Links != null) { foreach (UPCRMLink link in record.Links) { UPCRMLinkInfo linkInfo = tableInfo.LinkInfoForTargetInfoAreaIdLinkId(link.InfoAreaId, link.LinkId); if (linkInfo?.HasColumn ?? false) { UPCRMUndoField undoField = new UPCRMUndoField(linkInfo.LinkFieldName, link.RecordId, null); this.AddFieldValue(undoField); string infoAreaColumnName = linkInfo.InfoAreaLinkFieldName; if (!string.IsNullOrEmpty(infoAreaColumnName)) { undoField = new UPCRMUndoField(infoAreaColumnName, link.InfoAreaId, null); this.AddFieldValue(undoField); } } } } }