private void ContinueBuildPagesFromViewReference() { UPCharacteristicsEditPageModelController pageModelController = new UPCharacteristicsEditPageModelController(this.ViewReference, this.RecordIdentification, (UPOfflineCharacteristicsRequest)this.conflictEditOfflineRequest); UPMOrganizer organizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("EditCharacteristics")); string infoAreaId = this.RecordIdentification.InfoAreaId(); organizer.TitleText = LocalizedString.TextEditCharacteristics; UPConfigTableCaption tableCaption = ConfigurationUnitStore.DefaultStore.TableCaptionByName(this.RecordIdentification.InfoAreaId()); organizer.TitleText = tableCaption?.TableCaptionForRecordIdentification(this.RecordIdentification); InfoArea infoAreaConfig = ConfigurationUnitStore.DefaultStore.InfoAreaConfigById(infoAreaId); organizer.SubtitleText = infoAreaConfig?.SingularName; if (string.IsNullOrEmpty(organizer.SubtitleText)) { organizer.SubtitleText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(infoAreaId).Label; } Page page = pageModelController.Page; page.LabelText = "Error"; this.AddPageModelController(pageModelController); organizer.AddPage(page); this.TopLevelElement = organizer; organizer.ExpandFound = true; this.AddOrganizerActions(); }
/// <summary> /// Tables the caption for information area identifier result row. /// </summary> /// <param name="infoAreaId">The information area identifier.</param> /// <param name="resultRow">The result row.</param> /// <returns></returns> public static string TableCaptionForInfoAreaIdResultRow(string infoAreaId, UPCRMResultRow resultRow) { var store = ConfigurationUnitStore.DefaultStore; UPConfigTableCaption tableCaption = store.TableCaptionByName($"{infoAreaId}Part") ?? store.TableCaptionByName(infoAreaId); return(tableCaption != null?tableCaption.TableCaptionForResultRow(resultRow) : string.Empty); }
/// <summary> /// Adds the link participant with record identification. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="options">The options.</param> /// <returns></returns> public UPCRMLinkParticipant AddLinkParticipantWithRecordIdentification(string recordIdentification, Dictionary <string, object> options) { string name = UPConfigTableCaption.TableCaptionForRecordIdentification(recordIdentification, "Default"); UPCRMLinkParticipant linkParticipant = new UPCRMLinkParticipant(this.LinkParticipantsInfoAreaId, recordIdentification, name); linkParticipant.Options = options; this.AddLinkParticipant(linkParticipant); return(linkParticipant); }
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")); }
private void BuildEditOrganizerPage() { UPMOrganizer organizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("EditQuestionnaire")); this.TopLevelElement = organizer; this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); this.InfoAreaId = this.RecordIdentification.InfoAreaId(); UPConfigTableCaption tableCaption = ConfigurationUnitStore.DefaultStore.TableCaptionByName(this.RecordIdentification.InfoAreaId()); organizer.TitleText = this.SurveyText; organizer.SubtitleText = tableCaption.TableCaptionForRecordIdentification(this.RecordIdentification); QuestionnaireEditPageModelController pageModelController = new QuestionnaireEditPageModelController(this.ViewReference); this.AddPageModelController(pageModelController); organizer.AddPage(pageModelController.Page); this.AddOrganizerActions(); organizer.ExpandFound = true; }
/// <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> /// Builds the pages from view reference. /// </summary> public override void BuildPagesFromViewReference() { ObjectivesEditPageModelController pageModelController = new ObjectivesEditPageModelController(this.ViewReference); UPMOrganizer organizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("EditObjectives")); this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); string infoAreaId = this.RecordIdentification.InfoAreaId(); UPConfigTableCaption tableCaption = ConfigurationUnitStore.DefaultStore.TableCaptionByName(this.RecordIdentification.InfoAreaId()); organizer.TitleText = tableCaption.TableCaptionForRecordIdentification(this.RecordIdentification); organizer.SubtitleText = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(infoAreaId).Label; Page page = pageModelController.Page; page.LabelText = "Error"; this.AddPageModelController(pageModelController); organizer.AddPage(page); this.TopLevelElement = organizer; organizer.ExpandFound = true; this.AddOrganizerActions(); }
/// <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); }
/// <summary> /// The table caption did finish with result. /// </summary> /// <param name="tableCaption">The table caption.</param> /// <param name="tableCaptionString">The table caption string.</param> public void TableCaptionDidFinishWithResult(UPConfigTableCaption tableCaption, string tableCaptionString) { this.Organizer.TitleText = tableCaptionString; this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("RecordDataChanged")); }
/// <summary> /// The table caption did fail with error. /// </summary> /// <param name="tableCaption">The table caption.</param> /// <param name="error">The error.</param> public void TableCaptionDidFailWithError(UPConfigTableCaption tableCaption, Exception error) { this.Organizer.TitleText = LocalizedString.Localize(LocalizationKeys.TextGroupErrors, LocalizationKeys.KeyErrorsCouldNotLoadTableCaption); this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("RecordDataChanged")); }
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); }
/// <summary> /// Initializes a new instance of the <see cref="ResultRowCalendarItem" /> class. /// </summary> /// <param name="row">The row.</param> /// <param name="resultContext">The result context.</param> /// <param name="identifier">The identifier.</param> /// <param name="tableCaption">The table caption.</param> /// <param name="tableCaptionResultFieldMap">The table caption result field map.</param> /// <param name="attributes">The attributes.</param> /// <param name="color">The color.</param> /// <exception cref="Exception">StartDate is null</exception> public ResultRowCalendarItem(UPCRMResultRow row, UPCoreMappingResultContext resultContext, IIdentifier identifier, UPConfigTableCaption tableCaption, List <UPContainerFieldMetaInfo> tableCaptionResultFieldMap, UPConfigCatalogAttributes attributes, AureaColor color) : base(identifier) { this.ResultContext = resultContext; var fieldMapping = this.ResultContext.FieldControl.FunctionNames(); var dict = this.ResultContext.FieldControl.FunctionNames(row); string startDateString = dict.ValueOrDefault("Date") as string; string startTimeString = dict.ValueOrDefault("Time") as string; string endDateString = dict.ValueOrDefault("EndDate") as string; string endTimeString = dict.ValueOrDefault("EndTime") as string; UPConfigFieldControlField personLabelControlField = fieldMapping.ValueOrDefault("PersonLabel"); if (personLabelControlField != null) { this.PersonLabelField = UPMStringField.StringFieldWithIdentifierValue( new FieldIdentifier(row.RootRecordIdentification, personLabelControlField.Field.FieldIdentification), row.FormattedFieldValueAtIndex(personLabelControlField.TabIndependentFieldIndex, null, this.ResultContext.FieldControl)); } UPConfigFieldControlField companyLabelControlField = fieldMapping.ValueOrDefault("CompanyLabel"); if (companyLabelControlField != null) { this.CompanyLabelField = UPMStringField.StringFieldWithIdentifierValue( new FieldIdentifier(row.RootRecordIdentification, companyLabelControlField.Field.FieldIdentification), row.FormattedFieldValueAtIndex(companyLabelControlField.TabIndependentFieldIndex, null, this.ResultContext.FieldControl)); } UPConfigFieldControlField field = fieldMapping.ValueOrDefault("Status"); string status = dict.ValueOrDefault("Status") as string; if (field != null) { this.StatusLabelField = UPMStringField.StringFieldWithIdentifierValue( new FieldIdentifier(row.RootRecordIdentification, field.Field.FieldIdentification), field.Field.ValueForRawValueOptions(status, 0)); } string repLabel = dict.ValueOrDefault("RepLabel") as string; if (string.IsNullOrEmpty(repLabel)) { string repId = dict.ValueOrDefault("RepId") as string; if (!string.IsNullOrEmpty(repId)) { repLabel = UPCRMDataStore.DefaultStore.Reps.RepWithId(repId).RepName; } } this.RepLabelField = UPMStringField.StringFieldWithIdentifierValue(StringIdentifier.IdentifierWithStringId("rep"), repLabel); int iType = Convert.ToInt32(dict.ValueOrDefault("Type")); this.Type = (UPCalendarItemType)iType; this.StartDate = StringExtensions.DateFromStrings(startDateString, startTimeString); this.EndDate = StringExtensions.DateFromStrings(endDateString, endTimeString); this.Identification = identifier.IdentifierAsString; this.Color = color; this.RowColor = this.Color; this.CrmResultRow = row; this.IPadCalendarItem = null; this.HasTime = !string.IsNullOrEmpty(startTimeString); this.HasEndTime = !string.IsNullOrEmpty(endTimeString); UPConfigCatalogValueAttributes temp = attributes?.ValuesByCode[iType]; if (temp != null) { if (this.Color == null) { string colorString = temp.ColorKey; if (string.IsNullOrEmpty(colorString)) { this.Color = AureaColor.ColorWithString(colorString); } } this.ImageName = temp.ImageName; } if (tableCaption != null) { this.Subject = tableCaption.TableCaptionForResultRow(row, tableCaptionResultFieldMap); } else { this.Subject = dict.ValueOrDefault("Subject") as string; } if (this.StartDate == DateTime.MinValue) { throw new Exception("StartDate is null"); } if (this.EndDate == DateTime.MinValue) { this.EndDate = this.StartDate; } if (this.Type < UPCalendarItemType.Color0 || this.Type >= UPCalendarItemType.ColorCount) { this.Type = UPCalendarItemType.Color0; } //this.AllDay = this.DetermineIsAllDay(); }
/// <summary> /// The table caption did finish with result. /// </summary> /// <param name="tableCaption">The table caption.</param> /// <param name="tableCaptionString">The table caption string.</param> public void TableCaptionDidFinishWithResult(UPConfigTableCaption tableCaption, string tableCaptionString) { Messenger.Default.Send(HeaderBarMessage.HeaderBarTitleUpdate(tableCaptionString)); }
/// <summary> /// The table caption did fail with error. /// </summary> /// <param name="tableCaption">The table caption.</param> /// <param name="error">The error.</param> public void TableCaptionDidFailWithError(UPConfigTableCaption tableCaption, Exception error) { Messenger.Default.Send(HeaderBarMessage.HeaderBarTitleUpdate(string.Empty)); }