/// <summary> /// The document data for result row. /// </summary> /// <param name="resultRow"> /// The result row. /// </param> /// <returns> /// The <see cref="DocumentData"/>. /// </returns> public DocumentData DocumentDataForResultRow(UPCRMResultRow resultRow) { var tab = this.FieldControl.TabAtIndex(0); var title = this.ResultIndexOfTitle >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfTitle) : null; var length = this.ResultIndexOfLength >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfLength).ToUInt64() : 0; var dateString = this.ResultIndexOfDate >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfDate) : null; var mimeType = this.ResultIndexOfMimeType >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfMimeType) : null; var updDateString = this.ResultIndexOfUpdDate >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfUpdDate) : null; var updTimeString = this.ResultIndexOfUpdTime >= 0 ? resultRow.RawValueAtIndex(this.ResultIndexOfUpdTime) : null; var displayText = this.ResultIndexOfDisplayText >= 0 ? resultRow.FormattedFieldValueAtIndex(this.ResultIndexOfDisplayText, null, tab) : null; var displayDateString = this.ResultIndexOfDisplayDate >= 0 ? resultRow.FormattedFieldValueAtIndex(this.ResultIndexOfDisplayDate, null, tab) : null; DateTime?documentDate = null; if (!string.IsNullOrEmpty(dateString)) { documentDate = dateString.DateFromCrmValue(); displayDateString = DateExtensions.LocalizedFormattedDate(documentDate); } DateTime?updateDate = null; if (!string.IsNullOrEmpty(updDateString)) { updateDate = updDateString.DateTimeFromCrmValue(); } string recordIdentification; if (resultRow.NumberOfRecordIds() > this.RecordIndex) { recordIdentification = resultRow.RecordIdentificationAtIndex(this.RecordIndex); } else { recordIdentification = resultRow.RootRecordIdentification; } string d1RecordId = resultRow.RecordIdentificationForLinkInfoAreaIdLinkId("D1", -1); return(new DocumentData( recordIdentification, title, mimeType, documentDate, length, updateDate, displayText, displayDateString, d1RecordId)); }