private void RefreshTableCaption() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; var crmStore = UPCRMDataStore.DefaultStore; string tableCaptionName = this.ExpandConfig.TableCaptionName; if (string.IsNullOrEmpty(tableCaptionName)) { tableCaptionName = this.InfoAreaId; } UPConfigTableCaption tableCaption = configStore.TableCaptionByName(tableCaptionName); string recordTableCaption = tableCaption?.TableCaptionForRecordIdentification(this.RecordIdentification); if (string.IsNullOrEmpty(recordTableCaption) && !crmStore.RecordExistsOffline(this.RecordIdentification)) { this.Organizer.TitleText = configStore.BasicTextByIndex(4); tableCaption?.RequestTableCaptionForRecordIdentification(this.RecordIdentification, this); } else { this.Organizer.TitleText = recordTableCaption; } string subTitleText = null; if (!string.IsNullOrEmpty(this.ExpandConfig.HeaderGroupName)) { UPConfigHeader header = configStore.HeaderByNameFromGroup("Expand", this.ExpandConfig.HeaderGroupName); subTitleText = header?.Label; } if (string.IsNullOrEmpty(subTitleText)) { InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId); subTitleText = infoAreaConfig.SingularName; if (string.IsNullOrEmpty(subTitleText)) { subTitleText = crmStore.TableInfoForInfoArea(this.InfoAreaId).Label; } } this.Organizer.SubtitleText = subTitleText; this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("TableCaptionChanged")); }
/// <summary> /// Updates the title text. /// </summary> private void UpdateTitleText() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.Organizer.SubtitleText = configStore.InfoAreaConfigById(this.RecordIdentification.InfoAreaId()).SingularName; UPConfigTableCaption tableCaption = configStore.TableCaptionByName(this.RecordIdentification.InfoAreaId()); if (tableCaption != null) { string recordTableCaption = tableCaption.TableCaptionForRecordIdentification(this.RecordIdentification); this.Organizer.TitleText = recordTableCaption; } else { this.Organizer.TitleText = this.RecordIdentification; } }
/// <summary> /// Initializes a new instance of the <see cref="UPCRMRecordTile"/> class. /// </summary> /// <param name="tiles">The tiles.</param> /// <param name="viewReference">The view reference.</param> /// <param name="parameters">The parameters.</param> /// <param name="menuAction">The menu action.</param> /// <exception cref="Exception"> /// RecordIdentification is null /// or /// TableCaptionName is null /// </exception> public UPCRMRecordTile(UPCRMTiles tiles, ViewReference viewReference, Dictionary <string, object> parameters, Menu menuAction) : base(tiles, viewReference, parameters, menuAction) { this.tableCaptionName = this.ViewReference.ContextValueForKey("tableCaption"); this.recordIdentification = this.ViewReference.ContextValueForKey("uid"); string imageMapFilterName = this.ViewReference.ContextValueForKey("imageMapFilter"); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (string.IsNullOrEmpty(this.recordIdentification)) { throw new Exception("RecordIdentification is null"); } if (!string.IsNullOrEmpty(this.tableCaptionName)) { this.tableCaption = configStore.TableCaptionByName(this.tableCaptionName); } if (this.tableCaption == null) { if (string.IsNullOrEmpty(this.tableCaptionName)) { throw new Exception("TableCaptionName is null"); } } if (!string.IsNullOrEmpty(imageMapFilterName)) { this.imageFilter = configStore.FilterByName(imageMapFilterName); this.imageFilter = this.imageFilter?.FilterByApplyingValueDictionaryDefaults(this.Parameters, true); if (this.imageFilter != null) { this.catalogAttributes = configStore.CatalogAttributesByFilter(this.imageFilter); if (this.catalogAttributes != null) { this.crmQuery?.AddCrmFields(new List <UPCRMField> { this.catalogAttributes.CrmField }); } } } }
/// <summary> /// Adds the page model controllers. /// </summary> public override void AddPageModelControllers() { this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); this.RecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(this.RecordIdentification); ViewReference viewReference = this.ViewReference; if (this.OfflineRequest != null) { if (this.RecordIdentification.Contains("new")) { UPCRMRecord rootRecord = ((UPOfflineRecordRequest)this.OfflineRequest).FirstRecordWithInfoAreaId(this.RecordIdentification.InfoAreaId()); if (rootRecord != null) { viewReference = new ViewReference(this.ViewReference, this.RecordIdentification, rootRecord.RecordIdentification, null); this.RecordIdentification = rootRecord.RecordIdentification; } } } UPMOrganizer editOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Edit")); this.TopLevelElement = editOrganizer; SerialEntryPageModelController tmpSerialEntryPageModelController = new SerialEntryPageModelController(viewReference, (UPOfflineSerialEntryRequest)this.OfflineRequest); //tmpSerialEntryPageModelController.AddObserverForKeyPathOptionsContext(this, "hasRunningChangeRequests", NSKeyValueObservingOptionNew, null); tmpSerialEntryPageModelController.Delegate = this; Page overviewPage = tmpSerialEntryPageModelController.Page; string organizerHeaderText; string organizerDetailText = null; if (this.ExpandConfig != null) { UPConfigHeader header = ConfigurationUnitStore.DefaultStore.HeaderByNameFromGroup("Edit", this.ExpandConfig.HeaderGroupName); if (header != null) { organizerDetailText = header.Label; tmpSerialEntryPageModelController.Page.LabelText = organizerDetailText; } } if (string.IsNullOrEmpty(organizerDetailText)) { if (!string.IsNullOrEmpty(this.InfoAreaId)) { organizerDetailText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(this.InfoAreaId).Label; } else { organizerDetailText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(this.RecordIdentification.InfoAreaId()).Label; } } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; string rootRecordIdentification = this.RecordIdentification; if (string.IsNullOrEmpty(rootRecordIdentification)) { rootRecordIdentification = this.LinkRecordIdentification; } UPConfigTableCaption tableCaption = configStore.TableCaptionByName(rootRecordIdentification.InfoAreaId()); string recordTableCaption = null; if (tableCaption != null) { recordTableCaption = tableCaption.TableCaptionForRecordIdentification(rootRecordIdentification); } if (string.IsNullOrEmpty(recordTableCaption)) { if (!string.IsNullOrEmpty(organizerDetailText)) { organizerHeaderText = organizerDetailText; organizerDetailText = null; } else { organizerHeaderText = rootRecordIdentification; } } else { organizerHeaderText = recordTableCaption; } this.Organizer.TitleText = organizerHeaderText; this.Organizer.SubtitleText = organizerDetailText; this.AddPageModelController(tmpSerialEntryPageModelController); this.Organizer.AddPage(overviewPage); this.AddRemainingPageModelController(); this.AddOrganizerActions(); editOrganizer.ExpandFound = true; }
/// <summary> /// Loads this instance. /// </summary> public override void Load() { string searchAndListName = this.ViewReference.ContextValueForKey("name"); string recordId = this.ViewReference.ContextValueForKey("link"); string filterName = this.ViewReference.ContextValueForKey("filter"); string linkIdString = this.ViewReference.ContextValueForKey("linkId"); string infoAreaId = this.ViewReference.ContextValueForKey("infoAreaId"); string tableCaptionName = this.ViewReference.ContextValueForKey("tableCaption"); this.crmQuery = null; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.titleText = string.Empty; if (!string.IsNullOrEmpty(searchAndListName)) { this.crmQuery = new UPContainerMetaInfo(searchAndListName, this.Parameters, new List <object> { "List" }); } if (this.crmQuery == null && !string.IsNullOrEmpty(tableCaptionName)) { UPConfigTableCaption tableCaption = configStore.TableCaptionByName(tableCaptionName); if (tableCaption != null) { this.crmQuery = new UPContainerMetaInfo(new List <UPCRMField>(), tableCaption.InfoAreaId); this.titleText = tableCaption.FormatString.Replace("{1}", string.Empty).Replace(Environment.NewLine, string.Empty); } } if (this.crmQuery == null && infoAreaId != null) { this.crmQuery = new UPContainerMetaInfo(new List <UPCRMField>(), infoAreaId); } if (filterName != null) { UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(filterName); filter = filter?.FilterByApplyingValueDictionaryDefaults(this.Parameters, true); if (filter != null) { if (this.crmQuery == null) { this.crmQuery = new UPContainerMetaInfo(new List <UPCRMField>(), filter.InfoAreaId); } this.crmQuery.ApplyFilter(filter); } } if (this.crmQuery == null) { this.Tiles.TileFinishedWithError(this, new Exception("No query")); } if (string.IsNullOrEmpty(this.titleText)) { this.titleText = this.MenuAction.DisplayName; } if (!string.IsNullOrEmpty(recordId)) { this.crmQuery?.SetLinkRecordIdentification(recordId, Convert.ToInt32(linkIdString)); } this.crmQuery?.Find(this.RequestOption, this); }
private List <ICalendarItem> CalendarItemsFromResult() { List <ICalendarItem> calendarItems = new List <ICalendarItem>(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.resultContexts = new List <UPCoreMappingResultContext>(); UPMAction goToAction = new UPMAction(StringIdentifier.IdentifierWithStringId("action")); goToAction.SetTargetAction(this, this.SwitchToDetail); goToAction.LabelText = LocalizedString.TextShowRecord; foreach (TimelineSearch timelineSearch in this.searches) { UPCRMResult result = timelineSearch.Result; int rowCount = result.RowCount; if (rowCount == 0) { continue; } UPConfigTableCaption tableCaption = configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.ConfigName) ?? configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.InfoAreaId); List <UPContainerFieldMetaInfo> tableCaptionResultFieldMap = tableCaption.ResultFieldMapFromMetaInfo(result.MetaInfo); if (tableCaptionResultFieldMap == null) { continue; } UPCRMResultCondition resultCondition = null; var functionNameFieldMapping = result.MetaInfo.SourceFieldControl.FunctionNames(); UPConfigFieldControlField fromField = functionNameFieldMapping["Date"]; if (fromField != null) { if (this.fromDate != null) { resultCondition = new UPCRMResultFieldCondition(fromField.Field, UPConditionOperator.GreaterEqual, this.fromDate.Value.CrmValueFromDate(), fromField.TabIndependentFieldIndex); } if (this.toDate != null) { UPConfigFieldControlField toField = (functionNameFieldMapping.ContainsKey("EndDate") ? functionNameFieldMapping["EndDate"] : null) ?? fromField; UPCRMResultCondition toCondition = new UPCRMResultFieldCondition(toField.Field, UPConditionOperator.LessEqual, this.toDate.Value.CrmValueFromDate(), toField.TabIndependentFieldIndex); resultCondition = resultCondition != null?resultCondition.ConditionByAppendingANDCondition(toCondition) : toCondition; } } UPCoreMappingResultContext resultContext = new UPCoreMappingResultContext(result, result.MetaInfo.SourceFieldControl, timelineSearch.PreparedSearch.ListFieldControl.NumberOfFields); resultContext.Context = timelineSearch; this.resultContexts.Add(resultContext); UPConfigExpand expand = configStore.ExpandByName(timelineSearch.TimelineInfoArea.ConfigName) ?? configStore.ExpandByName(timelineSearch.TimelineInfoArea.InfoAreaId); AureaColor defaultColor = null; if (!string.IsNullOrEmpty(timelineSearch.TimelineInfoArea.ColorString)) { defaultColor = AureaColor.ColorWithString(timelineSearch.TimelineInfoArea.ColorString); } if (defaultColor == null) { defaultColor = AureaColor.ColorWithString(expand.ColorKey); } for (int i = 0; i < rowCount; i++) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i); if (resultCondition != null && !resultCondition.Check(row)) { continue; } ConfigTimelineCriteria matchingCriteria = timelineSearch.MatchingCriteriaForRow(row); AureaColor color = null; if (matchingCriteria.Setting1 != null) { color = AureaColor.ColorWithString(matchingCriteria.Setting1); } if (color == null) { color = defaultColor; } ICalendarItem calendarItem = new ResultRowCalendarItem(row, resultContext, new RecordIdentifier(row.RootRecordIdentification), tableCaption, tableCaptionResultFieldMap, null, color); calendarItem.GoToAction = goToAction; calendarItems.Add(calendarItem); } } if (this.fromDate != null && this.toDate != null && this.CalendarPage.IncludeSystemCalendar) { #if PORTING ArrayList localCalendarItems = ResultRowCalendarItem.EventsFromLocalCalendarFromToSearchTextCalenderIdentifiers(this.fromDate, this.toDate, null, null); if (localCalendarItems.Count) { calendarItems.AddRange(localCalendarItems); } #endif } return(calendarItems); }