/// <summary> /// Creates the node from result row. /// </summary> /// <param name="row">The row.</param> /// <param name="currentDepth">The current depth.</param> /// <param name="expandChecker">The expand checker.</param> /// <param name="infoAreaConfigs">The information area configs.</param> /// <param name="infoAreaMapping">The information area mapping.</param> /// <returns></returns> public static UPMCoINode CreateNodeFromResultRow(UPCRMResultRow row, int currentDepth, UPConfigExpand expandChecker, List <CoITreeInfoAreaConfig> infoAreaConfigs, Dictionary <string, CoITreeInfoAreaConfig> infoAreaMapping) { string trgtNodeFieldSuffix = string.Empty; string recordIdentification = row.RootRecordIdentification; string rootInfoAreaId = recordIdentification.InfoAreaId(); if (infoAreaConfigs != null) { foreach (CoITreeInfoAreaConfig infoAreaConfig in infoAreaConfigs) { string linkRecordIdentifictaion = row.RecordIdentificationForLinkInfoAreaIdLinkId(infoAreaConfig.InfoAreaId, infoAreaConfig.LinkId); if (!string.IsNullOrEmpty(linkRecordIdentifictaion.RecordId())) { trgtNodeFieldSuffix = infoAreaConfig.FunctionNameSuffix; recordIdentification = linkRecordIdentifictaion; infoAreaMapping[recordIdentification] = infoAreaConfig; break; } } } string virtualInfoAreaId = row.RootVirtualInfoAreaId == rootInfoAreaId ? null : row.RootVirtualInfoAreaId; UPMCoINode node = CreateNodeFromResultRow(row, virtualInfoAreaId, recordIdentification, currentDepth, infoAreaConfigs == null, expandChecker, trgtNodeFieldSuffix, recordIdentification.InfoAreaId()); return(node); }
private void SourceCopyFieldGroupLoaded(UPCRMResultRow resultRow) { this.Parameters = resultRow.ValuesWithFunctions(); UPQuestionnaireManager questionnaireManager = null; //ServerSession.CurrentSession.QuestionnaireManager; if (this.QuestionnaireLinkName == "RecordLink") { string questionnaireRecordIdentification = resultRow.RecordIdentificationForLinkInfoAreaIdLinkId(questionnaireManager.QuestionnaireList.InfoAreaId, -1); if (questionnaireRecordIdentification.Length == 0 && this.questionnairelinkFieldMetaInfo != null) { string questionnaireRecordId = resultRow.RawValueAtIndex(this.questionnairelinkFieldMetaInfo.PositionInResult); if (!string.IsNullOrEmpty(questionnaireRecordId)) { questionnaireRecordIdentification = StringExtensions.InfoAreaIdRecordId(questionnaireManager.QuestionnaireList.InfoAreaId, questionnaireRecordId); } } if (!string.IsNullOrEmpty(questionnaireRecordIdentification)) { this.Questionnaire = questionnaireManager.LoadQuestionaire(questionnaireRecordIdentification, this); } else { this.TheDelegate.SurveyDidFailWithError(this, new Exception("cannot load questionnaire, recordIdentification empty")); return; } } else { int catalogCode = Convert.ToInt32(this.Parameters.ValueOrDefault(this.QuestionnaireLinkName)); if (catalogCode > 0) { this.Questionnaire = questionnaireManager.LoadQuestionaire(catalogCode, this); } else { this.TheDelegate.SurveyDidFailWithError(this, new Exception("cannot load questionnaire with code, catalogCode empty")); return; } } if (this.Questionnaire != null) { this.QuestionnaireLoaded(); } }
/// <summary> /// Creates the edge from result row source node DST node. /// </summary> /// <param name="row">The row.</param> /// <param name="srcNode">The source node.</param> /// <param name="dstNode">The DST node.</param> /// <returns></returns> protected override UPMCoIEdge CreateEdgeFromResultRow(UPCRMResultRow row, UPMCoINode srcNode, UPMCoINode dstNode) { string trgtNodeFieldSuffix = string.Empty; if (this.infoAreaConfigs != null) { foreach (CoITreeInfoAreaConfig infoAreaConfig in this.infoAreaConfigs) { string linkRecordIdentifictaion = row.RecordIdentificationForLinkInfoAreaIdLinkId(infoAreaConfig.InfoAreaId, infoAreaConfig.LinkId); if (!string.IsNullOrEmpty(linkRecordIdentifictaion.RecordId())) { trgtNodeFieldSuffix = infoAreaConfig.FunctionNameSuffix; break; } } } UPMCoIEdge edge = CreateEdgeFromResultRow(row, trgtNodeFieldSuffix, srcNode, dstNode); return(edge); }
/// <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)); }