private void AddDetailsActionFromRowToListRow(AnalysisRow row, UPMResultRow listRow) { if (row.ResultRows.Count > 0 && row.Result.DetailsFields.Count > 0) { var action = new UPMOrganizerDrillThruAction(StringIdentifier.IdentifierWithStringId("drillThru")) { AnalysisRow = row }; action.SetTargetAction(this, this.PerformDrillThru); action.LabelText = LocalizedString.TextAnalysesDetails; listRow.AddDetailAction(action); } }
private void ProcessSearchPage(UPMGridPage searchPage, IReadOnlyList <string> contextMenuOptions, ICrmDataSourceRow crmRow, UPMResultRow listRow, AnalysisResult analysisResult, Page oldPage, int i) { var dataSource = analysisResult.DataSource; for (var j = 0; j < dataSource.NumberOfResultTables; j++) { var label = contextMenuOptions[j]; if (string.IsNullOrEmpty(label)) { continue; } var recordIdentification = crmRow.RecordIdentificationAtIndex(j); if (recordIdentification?.Length > 0) { var showRecordAction = new UPMOrganizerAnalysisShowRecordAction(StringIdentifier.IdentifierWithStringId($"action.row {i} record {j}")) { RecordIdentification = recordIdentification }; showRecordAction.SetTargetAction(this, this.PerformShowRecordAction); showRecordAction.LabelText = label; listRow.AddDetailAction(showRecordAction); } var backAction = new UPMOrganizerAnalysisBackAction(StringIdentifier.IdentifierWithStringId("action.back")) { AnalysisResult = analysisResult }; backAction.SetTargetAction(this, this.PerformBackToAnalysis); backAction.LabelText = LocalizedString.TextAnalysesBackToAnalysis; searchPage.AddHeadOption(new UPMGridHeadOption(backAction.LabelText, backAction)); searchPage.FixedFirstColumn = false; searchPage.SumRowAtEnd = false; var hasOnlyEmptyLabels = true; foreach (var lbl in contextMenuOptions) { if (lbl.Length > 0) { hasOnlyEmptyLabels = false; break; } } searchPage.ShowMenu = !hasOnlyEmptyLabels; this.TopLevelElement = searchPage; this.InformAboutDidChangeTopLevelElement(oldPage, searchPage, null, null); } }
private void AddDrilldownActionsFromRowToListRow(AnalysisRow row, UPMResultRow listRow) { string drilldownText = LocalizedString.TextAnalysesDrilldown; foreach (AnalysisDrilldownOption drilldownOption in row.DrilldownOptions) { var action = new UPMOrganizerDrilldownAction(StringIdentifier.IdentifierWithStringId($"action.{drilldownOption.Key}")) { DrilldownOption = drilldownOption, AnalysisRow = row }; action.SetTargetAction(this, this.PerformDrilldown); action.LabelText = drilldownText.Replace("%@", drilldownOption.Label); listRow.AddDetailAction(action); } }
/// <summary> /// Adds row actions /// </summary> /// <param name="expand">Expand</param> /// <param name="resultRow">Result row</param> /// <param name="recordId">Record id</param> public override void AddRowActions(UPConfigExpand expand, UPMResultRow resultRow, string recordId) { base.AddRowActions(expand, resultRow, recordId); if (this.PreparedSearch.FilterBasedDecision != null) { var rowContext = this.ResultContext.RowDictionary[resultRow.Key]; var actionButtons = this.PreparedSearch.FilterBasedDecision.ButtonsForResultRow(rowContext.Row); if (actionButtons.Count > 0) { foreach (UPConfigButton buttonDef in actionButtons) { string iconName = string.Empty; string buttonName = buttonDef.UnitName; if (buttonDef.ViewReference != null) { var action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId($"action.{buttonName}")); var viewReference = buttonDef.ViewReference.ViewReferenceWith(recordId); viewReference = viewReference.ViewReferenceWith(new Dictionary <string, object> { { ".fromPopup", 1 } }); action.ViewReference = viewReference; if (!string.IsNullOrEmpty(iconName)) { action.IconName = iconName; } action.LabelText = buttonDef.Label; resultRow.AddDetailAction(action); } } } } }
private void UpdatePageFromQueryResult(UPCRMResult result) { this.QueryResult = result; UPMGridPage searchPage = (UPMGridPage)this.CreatePageInstance(); Page oldPage = this.Page; int i, j; int columnCount = result.ColumnCount; StringIdentifier identifier = StringIdentifier.IdentifierWithStringId("columnHeader"); UPMResultSection section = new UPMResultSection(identifier); UPMResultRow columnHeaderListRow = new UPMResultRow(identifier); var fieldArray = new List <UPMField>(); searchPage.FixedFirstColumn = false; searchPage.ShowMenu = true; searchPage.SumRowAtEnd = false; for (i = 0; i < columnCount; i++) { UPContainerFieldMetaInfo fieldMetaInfo = result.ColumnFieldMetaInfoAtIndex(i); string fieldType = fieldMetaInfo.CrmFieldInfo.FieldType; if (fieldType == "F" || fieldType == "L" || fieldType == "S") { searchPage.SetColumnInfoAtIndexDataTypeSpecialSort(i, UPMColumnDataType.Numeric, false); } else if (fieldType == "D") { searchPage.SetColumnInfoAtIndexDataTypeSpecialSort(i, UPMColumnDataType.Date, true); } UPMGridColumnHeaderStringField field = new UPMGridColumnHeaderStringField(StringIdentifier.IdentifierWithStringId($"col {i}")) { StringValue = result.ColumnNameAtIndex(i) }; fieldArray.Add(field); } columnHeaderListRow.Fields = fieldArray; section.AddResultRow(columnHeaderListRow); searchPage.AddResultSection(section); int numberOfResultTables = result.NumberOfResultTables; List <object> contextMenuOptions = new List <object>(numberOfResultTables); var configStore = ConfigurationUnitStore.DefaultStore; for (j = 0; j < numberOfResultTables; j++) { string infoAreaId = result.ResultTableAtIndex(j).InfoAreaId; string infoAreaLabel = string.Empty; if (infoAreaId?.Length > 0) { InfoArea configInfoArea = configStore.InfoAreaConfigById(infoAreaId); UPConfigExpand expand = configStore.ExpandByName(infoAreaId); FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Details", expand.FieldGroupName); if (configInfoArea != null && expand != null && fieldControl != null) { infoAreaLabel = LocalizedString.TextAnalysesShowParam.Replace("%@", configInfoArea.SingularName); } } contextMenuOptions.Add(infoAreaLabel); } for (i = 0; i < result.RowCount; i++) { identifier = StringIdentifier.IdentifierWithStringId($"row {i}"); var listRow = new UPMResultRow(identifier); var crmRow = result.ResultRowAtIndex(i) as UPCRMResultRow; fieldArray = new List <UPMField>(); var v = crmRow.Values(); for (j = 0; j < v.Count; j++) { UPMStringField field2 = new UPMStringField(StringIdentifier.IdentifierWithStringId($"cell{i}_{j}")) { StringValue = v[j], RawStringValue = crmRow.RawValueAtIndex(j) }; fieldArray.Add(field2); } listRow.Fields = fieldArray; section.AddResultRow(listRow); for (j = 0; j < numberOfResultTables; j++) { var label = contextMenuOptions[j] as string; if (label.Length == 0) { continue; } string recordIdentification = crmRow.RecordIdentificationAtIndex(j); if (recordIdentification?.Length > 0) { UPMOrganizerAnalysisShowRecordAction showRecordAction = new UPMOrganizerAnalysisShowRecordAction(StringIdentifier.IdentifierWithStringId($"action.row {i} record {j}")) { RecordIdentification = recordIdentification }; showRecordAction.SetTargetAction(this, this.PerformShowRecordAction); showRecordAction.LabelText = label; listRow.AddDetailAction(showRecordAction); } } } this.TopLevelElement = searchPage; this.InformAboutDidChangeTopLevelElement(oldPage, searchPage, null, null); }