/// <summary> /// Computes EditRecordViewReference from <see cref="FieldControl"/> /// </summary> /// <param name="listFieldControl"> /// <see cref="FieldControl"/> object /// </param> /// <param name="configStore"> /// <see cref="IConfigurationUnitStore"/> /// </param> /// <returns> /// EditRecordViewReference value to be set /// </returns> private ViewReference GetEditRecordViewReference(FieldControl listFieldControl, IConfigurationUnitStore configStore) { var viewReference = (ViewReference)null; var editAction = listFieldControl.ValueForAttribute(AttributeCalendarEditAction); if (editAction == ActionNone) { viewReference = null; } else if (!string.IsNullOrWhiteSpace(editAction)) { if (editAction.StartsWith(ActionPrefixButton)) { viewReference = configStore.ButtonByName(editAction.Substring(ButtonNameStartingIndex)).ViewReference; } else if (editAction.StartsWith(ActionPrefixMenu)) { viewReference = configStore.MenuByName(editAction.Substring(MenuNameStartingIndex)).ViewReference; } else { viewReference = configStore.ButtonByName(editAction).ViewReference; } } else { var expand = configStore.ExpandByName(InfoAreaId); var header = configStore.HeaderByNameFromGroup(HeaderExpand, expand.HeaderGroupName); if (header?.ButtonNames != null) { foreach (var button in header.ButtonNames) { if (button.StartsWith(Edit)) { viewReference = configStore.ButtonByName(button).ViewReference; var isSwitchToEdit = false; if (viewReference.ParameterDictionary().ContainsKey(Action)) { isSwitchToEdit = ((string)viewReference.ParameterDictionary()[Action]).StartsWith(SwitchToEdit); } if (viewReference.ViewName == ViewOrganizerAction && isSwitchToEdit) { viewReference = configStore.MenuByName(MenuEditRecord).ViewReference; } if (viewReference != null) { break; } } } } } return(viewReference); }
/// <summary> /// Applies the link record identification. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <returns></returns> public UPMGroup ApplyLinkRecordIdentification(string recordIdentification) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; string menuName = this.TabConfig.Type.Substring(5); this.Menu = configStore.MenuByName(menuName); if (this.Menu == null || this.Menu.Items.Count == 0) { this.ControllerState = GroupModelControllerState.Error; base.Error = new Exception("ConfigurationError"); return(null); } UPMMenuGroup menuGroup = null; uint menuItemNr = 0; this.viewReferenceDictionary = new Dictionary <string, ViewReference>(); foreach (string menuItemName in this.Menu.Items) { Menu menuItem = configStore.MenuByName(menuItemName); if (menuItem.ViewReference == null) { continue; } if (menuGroup == null) { menuGroup = new UPMMenuGroup(this.TabIdentifierForRecordIdentification(recordIdentification)); menuGroup.LabelText = this.TabLabel; } string identifierString = $"menu_{menuItemNr++}_{ menuItem.UnitName}"; IIdentifier identifier = StringIdentifier.IdentifierWithStringId(identifierString); UPMAction menuAction = new UPMAction(identifier); ViewReference linkRecordViewReference = menuItem.ViewReference.ViewReferenceWith(recordIdentification); this.viewReferenceDictionary[identifierString] = linkRecordViewReference; menuAction.SetTargetAction(this, this.PerformMenuAction); if (menuItem.ImageName != null) { menuAction.IconName = menuItem.ImageName; } UPMLinkRecordField field = new UPMLinkRecordField(identifier, menuAction); field.LabelText = menuItem.UnitName; field.StringValue = menuItem.DisplayName; menuGroup.AddField(field); } this.ControllerState = menuGroup != null ? GroupModelControllerState.Finished : GroupModelControllerState.Empty; this.Group = menuGroup; return(menuGroup); }
/// <summary> /// Initializes a new instance of the <see cref="UPWebContentPageModelController"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> public UPWebContentPageModelController(ViewReference viewReference) : base(viewReference) { this.SendByEmailActions = new List <Menu>(); this.SendByEmailButtonIsShown = viewReference.ContextValueIsSet("SendByEmail"); var actionStr = viewReference.ContextValueForKey("SendByEmailAction"); var actions = !string.IsNullOrEmpty(viewReference.ContextValueForKey("SendByEmailAction")) ? actionStr.Split(',') : new string[0]; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; foreach (string action in actions) { Menu menu = configStore.MenuByName(action); if (menu != null) { this.SendByEmailActions.Add(menu); } } this.WebContentMetadata = UPWebContentMetadata.WebContentMetaDataFromReportType(viewReference.ContextValueForKey("ReportType"), this); this.WebContentMetadata.UpdateMetadataWithViewReference(this.ViewReference); this.AllowsXMLExport = this.WebContentMetadata.AllowsXMLExport; this.AllowsFullScreen = this.WebContentMetadata.AllowsFullScreen; this.RecordIdentification = viewReference.ContextValueForKey("RecordId"); IIdentifier identifier = this.BuildIdentifier(); UPMWebContentPage page = new UPMWebContentPage(identifier) { Invalid = true, PrintEnabled = this.ViewReference.ContextValueForKey("ButtonPrint") == "true" }; this.TopLevelElement = page; this.WebContentPage.ReportType = this.WebContentMetadata.ReportType; this.ApplyLoadingStatusOnPage(page); }
/// <summary> /// The buttons for result row. /// </summary> /// <param name="row"> /// The row. /// </param> /// <returns> /// The <see cref="IList"/>. /// </returns> public List <UPConfigButton> ButtonsForResultRow(UPCRMResultRow row) { UPConfigQueryTable matchingTable = this.QueryTableForResultRow(row); if (matchingTable != null) { List <UPConfigButton> matchingButtons = new List <UPConfigButton>(); UPConfigQueryCondition propertyCondition = matchingTable.PropertyConditions[@"Action"]; if (propertyCondition != null) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; foreach (string menuName in propertyCondition.FieldValues) { Menu menu = configStore.MenuByName(menuName); if (menu != null) { UPConfigButton button = new UPConfigButton( menu.DisplayName, menu.ImageName, menu.ViewReference); matchingButtons.Add(button); } else if (menuName.StartsWith(@"Button:")) { UPConfigButton button = configStore.ButtonByName(menuName.Substring(7)); if (button != null) { matchingButtons.Add(button); } } } } propertyCondition = matchingTable.PropertyConditions.ValueOrDefault("ButtonAction"); if (propertyCondition != null) { foreach (string buttonName in propertyCondition.FieldValues) { UPConfigButton button = ConfigurationUnitStore.DefaultStore.ButtonByName(buttonName); if (button != null) { matchingButtons.Add(button); } } } return(matchingButtons.Count > 0 ? matchingButtons : null); } return(null); }
/// <summary> /// Defaults the action for search and list. /// </summary> /// <param name="searchAndList">The search and list.</param> /// <returns></returns> public Menu DefaultActionForSearchAndList(SearchAndList searchAndList) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; Menu tmpDetailAction = null; string infoAreaId = searchAndList.InfoAreaId; if (!string.IsNullOrEmpty(searchAndList.DefaultAction)) { tmpDetailAction = configStore.MenuByName(searchAndList.DefaultAction); } if (tmpDetailAction == null) { InfoArea infoAreaConfig = configStore.InfoAreaConfigById(infoAreaId); if (!string.IsNullOrEmpty(infoAreaConfig.DefaultAction)) { tmpDetailAction = configStore.MenuByName(infoAreaConfig.DefaultAction); } } return(tmpDetailAction ?? configStore.MenuByName("SHOWRECORD")); }
/// <summary> /// Initializes a new instance of the <see cref="UPSearchPageModelControllerPreparedSearch"/> class. /// </summary> /// <param name="infoAreaId"> /// The info area id. /// </param> /// <param name="quickSearchEntries"> /// The quick search entries. /// </param> public UPSearchPageModelControllerPreparedSearch(string infoAreaId, List <QuickSearchEntry> quickSearchEntries) { this.InfoAreaId = infoAreaId; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.DetailAction = configStore.MenuByName(@"SHOWRECORD"); this.ListFieldControl = configStore.FieldControlByNameFromGroup(@"List", this.InfoAreaId); this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(@"MiniDetails", this.InfoAreaId); this.CombinedControl = this.DropdownFieldControl == null ? this.ListFieldControl : new FieldControl( new List <FieldControl> { this.ListFieldControl, this.DropdownFieldControl }); this.QuickSearchEntries = quickSearchEntries; this.ExpandSettings = configStore.ExpandByName(this.InfoAreaId); this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters"); }
private void ConfigInsightBoard(string contextMenuName, string recordIdentification) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; Menu configMenu = configStore.MenuByName(contextMenuName); var skipMenusList = this.FormItem?.Options.ValueOrDefault("SkipMenus"); List <string> skipMenus = skipMenusList as List <string> ?? (skipMenusList as List <object>)?.Cast <string>().ToList(); int count = 0; bool useAllKindOfItems = Convert.ToInt32(this.FormItem?.Options.ValueOrDefault("useAllKindOfItems")) != 0; for (int i = 0; i < configMenu?.NumberOfSubMenus; i++) { Menu submenu = configMenu.SubMenuAtIndex(i); if (submenu == null || skipMenus?.Contains(submenu.UnitName) == true || submenu?.ViewReference?.ViewName == "DebugView") { continue; } if (submenu.ViewReference?.ViewName == "InsightBoardItem") { this.itemControllerArray.Add(new UPInsightBoardItemGroupModelController(submenu, this, count++, this.testViewReference, recordIdentification)); } else { if (useAllKindOfItems) { this.itemControllerArray.Add(new UPInsightBoardItemGroupModelController(submenu, this, count++, this.testViewReference, null)); } else { SimpleIoc.Default.GetInstance <ILogger>().LogWarn($"ViewName '{submenu.ViewReference?.ViewName}' not as insightBoard submenu supported"); } } } this.pending = this.itemControllerArray.Count; }
private HistoryManager() { this.HistoryEntries = new List <HistoryEntry>(); this.MaxEntries = 10; this.filterSet = null; this.Active = false; IConfigurationUnitStore store = ConfigurationUnitStore.DefaultStore; WebConfigValue configValue = store.WebConfigValueByName(Constants.ConfigParamMenuName); string menuName = Constants.DefaultHistoryMenuName; if (configValue != null) { menuName = configValue.Value; } Menu menu = store.MenuByName(menuName); if (menu != null) { this.ConfigureWithViewReference(menu.ViewReference); } }
/// <summary> /// Sets ShowRecordViewReferece /// </summary> /// <param name="listFieldControl"> /// <see cref="FieldControl"/> /// </param> /// <param name="configStore"> /// <see cref="IConfigurationUnitStore"/> /// </param> private void SetShowRecordViewReference(FieldControl listFieldControl, IConfigurationUnitStore configStore) { var showAction = listFieldControl.ValueForAttribute(AttributeCalendarShowAction); if (showAction == ActionNone) { ShowRecordViewReference = null; } else if (!string.IsNullOrWhiteSpace(showAction)) { if (showAction.StartsWith(ActionPrefixButton)) { ShowRecordViewReference = configStore.ButtonByName(showAction.Substring(7)).ViewReference; } else if (showAction.StartsWith(ActionPrefixMenu)) { ShowRecordViewReference = configStore.MenuByName(showAction.Substring(5)).ViewReference; } else { ShowRecordViewReference = configStore.ButtonByName(showAction).ViewReference; } } }
private UPMGroup BuildGroup(UPMGroup group) { Dictionary <string, string> infoAreaImageFileNames = new Dictionary <string, string>(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; UPConfigExpand repExpand = configStore.ExpandByName("ID"); this.linkParticipantsViewReference = null; if (!string.IsNullOrEmpty(this.linkParticipantsName)) { SearchAndList searchAndList = configStore.SearchAndListByName(this.linkParticipantsName); Menu menu = searchAndList != null?configStore.MenuByName(searchAndList.DefaultAction) : null; this.linkParticipantsViewReference = menu?.ViewReference; } if (this.acceptanceCatalogAttributes == null && this.recordParticipants.AcceptanceField != null) { this.acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(this.recordParticipants.AcceptanceField.InfoAreaId, this.recordParticipants.AcceptanceField.FieldId); } foreach (UPCRMParticipant participant in this.recordParticipants.Participants) { bool isRepParticipant = participant is UPCRMRepParticipant; IIdentifier identifier = StringIdentifier.IdentifierWithStringId(participant.Key); UPMListRow listRow = new UPMListRow(identifier); UPMStringField nameField = new UPMStringField(StringIdentifier.IdentifierWithStringId("name")); nameField.StringValue = participant.Name; listRow.AddField(nameField); UPMStringField acceptanceField = new UPMStringField(StringIdentifier.IdentifierWithStringId("acceptance")); if (!isRepParticipant || this.recordParticipants.HasRepAcceptance) { acceptanceField.StringValue = participant.AcceptanceDisplayText; UPConfigCatalogValueAttributes configCatalogValueAttributes = this.acceptanceCatalogAttributes?.ValuesByCode[Convert.ToInt32(participant.AcceptanceText)]; string colorString = configCatalogValueAttributes?.ColorKey; if (!string.IsNullOrEmpty(colorString)) { listRow.RowColor = AureaColor.ColorWithString(colorString); } } else { acceptanceField.StringValue = string.Empty; } listRow.AddField(acceptanceField); UPMStringField requirementField = new UPMStringField(StringIdentifier.IdentifierWithStringId("requirement")); requirementField.StringValue = participant.RequirementDisplayText; listRow.AddField(requirementField); if (isRepParticipant) { // listRow.Icon = UIImage.UpImageWithFileName(repExpand.ImageName); // CRM-5007 listRow.RowAction = null; } else { UPCRMLinkParticipant linkParticipant = (UPCRMLinkParticipant)participant; string _infoAreaId = linkParticipant.LinkRecordIdentification.InfoAreaId(); string imageName = infoAreaImageFileNames.ValueOrDefault(_infoAreaId); if (imageName == null) { UPConfigExpand expand = configStore.ExpandByName(_infoAreaId); imageName = expand.ImageName ?? string.Empty; infoAreaImageFileNames.SetObjectForKey(imageName, _infoAreaId); } // listRow.Icon = UIImage.UpImageWithFileName(imageName); // CRM-5007 listRow.OnlineData = !UPCRMDataStore.DefaultStore.RecordExistsOffline(linkParticipant.LinkRecordIdentification); if (this.linkParticipantsViewReference != null) { UPMAction switchToOrganizerAction = new UPMAction(null); switchToOrganizerAction.IconName = "arrow.png"; switchToOrganizerAction.SetTargetAction(this, this.SwitchToOrganizerForLinkParticipant); listRow.RowAction = switchToOrganizerAction; } } group.AddChild(listRow); } return(group); }
private void HandleSaved() { this.disappearingOrganizer = true; var savedActionName = !string.IsNullOrEmpty(this.finishActionName) ? this.finishActionName : this.ViewReference.ContextValueForKey("SavedAction"); if (!string.IsNullOrEmpty(savedActionName)) { if (this.ConflictHandlingMode) { savedActionName = string.Empty; } else { foreach (UPPageModelController pageModelController in this.PageModelControllers) { if (pageModelController is SerialEntryPageModelController && ((SerialEntryPageModelController)pageModelController).RightsFilterRevocation) { savedActionName = string.Empty; } } } } if (!string.IsNullOrEmpty(savedActionName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (savedActionName.StartsWith("Button:")) { UPConfigButton button = configStore.ButtonByName(savedActionName.Substring(7)); this.SaveViewReference = button.ViewReference; } else if (savedActionName.StartsWith("Menu:")) { Menu menu = configStore.MenuByName(savedActionName.Substring(5)); this.SaveViewReference = menu.ViewReference; } else if (savedActionName == "Return") { this.PopToPrevious = true; } else { Menu menu = configStore.MenuByName(savedActionName); this.SaveViewReference = menu.ViewReference; } this.ExecuteSavedActionWithRecordIdentification((string)this.PageModelControllerContextValueForKey(null, "RootRecordIdentification"), false); } else { if (this.PopToRootOnSave) { this.ModelControllerDelegate.PopToRootContentViewController(); } else { this.PopToPreviousContentViewController(); } } }
/// <summary> /// Initializes a new instance of the <see cref="UPSearchPageModelControllerPreparedSearch"/> class. /// </summary> /// <param name="timelineInfoAreaConfiguration"> /// The timeline info area configuration. /// </param> public UPSearchPageModelControllerPreparedSearch(ConfigTimelineInfoArea timelineInfoAreaConfiguration) { this.InfoAreaId = timelineInfoAreaConfiguration.InfoAreaId; this.ConfigName = timelineInfoAreaConfiguration.ConfigName; this.TimelineConfiguration = timelineInfoAreaConfiguration; if (string.IsNullOrEmpty(this.ConfigName)) { this.ConfigName = this.InfoAreaId; } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.SearchConfiguration = configStore.SearchAndListByName(this.ConfigName); string fieldGroupName; if (this.SearchConfiguration != null) { if (this.SearchConfiguration.DefaultAction != null) { this.DetailAction = configStore.MenuByName(this.SearchConfiguration.DefaultAction); } if (this.DetailAction == null) { InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId); if (!string.IsNullOrEmpty(infoAreaConfig.DefaultAction)) { this.DetailAction = configStore.MenuByName(infoAreaConfig.DefaultAction); } } fieldGroupName = this.SearchConfiguration.FieldGroupName; } else { fieldGroupName = this.ConfigName; } this.FilterName = timelineInfoAreaConfiguration.FilterName; this.ListFieldControl = configStore.FieldControlByNameFromGroup(@"List", fieldGroupName); if (this.ListFieldControl != null) { this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(@"MiniDetails", fieldGroupName); if (this.DropdownFieldControl == null) { this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(@"Details", fieldGroupName); if (this.DropdownFieldControl != null) { this.DropdownFieldControl = this.DropdownFieldControl.FieldControlWithSingleTab(0); } } this.CombinedControl = this.DropdownFieldControl == null ? this.ListFieldControl : new FieldControl( new List <FieldControl> { this.ListFieldControl, this.DropdownFieldControl }); } if (this.TimelineConfiguration.ColorCriteria.Count > 0) { Dictionary <string, UPCRMField> additionalFieldDictionary = null; foreach (ConfigTimelineCriteria criteria in this.TimelineConfiguration.ColorCriteria) { if (criteria.FieldId < 0) { continue; } UPCRMField field = new UPCRMField(criteria.FieldId, this.TimelineConfiguration.InfoAreaId); string key = field.FieldId.ToString(); if (additionalFieldDictionary == null) { additionalFieldDictionary = new Dictionary <string, UPCRMField>(); } if (!additionalFieldDictionary.ContainsKey(key)) { additionalFieldDictionary.Add(key, field); } } this.AdditionalOutputFields = additionalFieldDictionary.Values.Select(x => x).ToList(); } if (this.DetailAction == null) { this.DetailAction = configStore.MenuByName(@"SHOWRECORD"); } this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters"); }
private void Initialize(string infoAreaId, string configName, string filterName) { this.InfoAreaId = infoAreaId; this.ConfigName = configName; if (string.IsNullOrEmpty(this.ConfigName)) { this.ConfigName = this.InfoAreaId; } this.FilterName = filterName; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.SearchConfiguration = configStore.SearchAndListByName(this.ConfigName); if (this.SearchConfiguration == null) { FieldControl fieldControl = configStore.FieldControlByNameFromGroup(@"List", this.ConfigName); if (fieldControl != null) { this.SearchConfiguration = new SearchAndList(fieldControl); } } if (this.InfoAreaId == null) { this.InfoAreaId = this.SearchConfiguration != null ? this.SearchConfiguration.InfoAreaId : this.ConfigName; } this.ExpandSettings = configStore.ExpandByName(this.ConfigName) ?? configStore.ExpandByName(this.InfoAreaId); if (!string.IsNullOrEmpty(this.SearchConfiguration?.DefaultAction)) { this.DetailAction = configStore.MenuByName(this.SearchConfiguration.DefaultAction); } if (this.DetailAction == null) { InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId); if (!string.IsNullOrEmpty(infoAreaConfig?.DefaultAction)) { this.DetailAction = configStore.MenuByName(infoAreaConfig.DefaultAction); } } if (this.DetailAction == null) { this.DetailAction = configStore.MenuByName(@"SHOWRECORD"); } if (this.SearchConfiguration != null) { this.ListFieldControl = configStore.FieldControlByNameFromGroup( @"List", this.SearchConfiguration.FieldGroupName); if (this.ListFieldControl != null) { this.SearchFieldControl = configStore.FieldControlByNameFromGroup( @"Search", this.SearchConfiguration.FieldGroupName); this.DropdownFieldControl = configStore.FieldControlByNameFromGroup( @"MiniDetails", this.SearchConfiguration.FieldGroupName); if (this.DropdownFieldControl == null) { this.DropdownFieldControl = configStore.FieldControlByNameFromGroup( @"Details", this.SearchConfiguration.FieldGroupName); this.DropdownFieldControl = this.DropdownFieldControl?.FieldControlWithSingleTab(0); } this.CombinedControl = this.DropdownFieldControl == null ? this.ListFieldControl : new FieldControl( new List <FieldControl> { this.ListFieldControl, this.DropdownFieldControl }); } } this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters"); }
/// <summary> /// Applies the link record identification. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="context">The context.</param> /// <param name="_viewReference">The view reference.</param> /// <returns></returns> public UPMGroup ApplyLinkRecordIdentification(string recordIdentification, Dictionary <string, object> context, ViewReference _viewReference) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.formItem != null) { string reportType = this.formItem.ViewReference.ContextValueForKey("ReportType"); if (reportType == "ClientReport") { Menu configMenu = configStore.MenuByName(this.formItem.ViewReference.ContextValueForKey("ConfigName")); this.viewReference = this.formItem.ViewReference.ViewReferenceWith(context); if (configMenu != null) { this.viewReference = configMenu.ViewReference.ViewReferenceWith(this.viewReference.ContextValueForKey("RecordId")); } } else { this.viewReference = this.formItem.ViewReference; } } else { if (_viewReference == null) { Menu configMenu = configStore.MenuByName(this.TabConfig.Type.Substring("WEBCONTENT_".Length)); this.viewReference = configMenu.ViewReference.ViewReferenceWith(recordIdentification); } else { this.viewReference = _viewReference; } } this.webContentMetadata = UPWebContentMetadata.WebContentMetaDataFromViewReference(this.viewReference, this); this.RecordIdentification = this.viewReference.ContextValueForKey("RecordId"); if (this.ExplicitTabIdentifier == null) { this.ExplicitTabIdentifier = this.TabIdentifierForRecordIdentification( !string.IsNullOrEmpty(this.RecordIdentification) ? this.RecordIdentification : recordIdentification); } this.tmpGroup = new UPMWebContentGroup(this.ExplicitTabIdentifier); string linkIdStr = this.viewReference.ContextValueForKey("LinkId"); if (!string.IsNullOrEmpty(linkIdStr)) { this.LinkId = Convert.ToInt32(linkIdStr); } else { this.LinkId = -1; } string parentLink = this.viewReference.ContextValueForKey("ParentLink"); if (!string.IsNullOrEmpty(parentLink)) { this.linkReader = new UPCRMLinkReader(this.RecordIdentification, parentLink, UPRequestOption.FastestAvailable, this); this.linkReader.Start(); this.ControllerState = GroupModelControllerState.Pending; return(null); } this.ContinueBuildGroup(); return(this.Group); }
/// <summary> /// Initializes a new instance of the <see cref="UPInsightBoardItemGroupModelController"/> class. /// </summary> /// <param name="menu">The menu.</param> /// <param name="theDelegate">The delegate.</param> /// <param name="sortIndex">Index of the sort.</param> /// <param name="insightBoardItemViewReference">The insight board item view reference.</param> /// <param name="recordIdentification">The record identification.</param> public UPInsightBoardItemGroupModelController(Menu menu, IGroupModelControllerDelegate theDelegate, int sortIndex, ViewReference insightBoardItemViewReference, string recordIdentification) : base(theDelegate) { this.Menu = menu; this.SortIndex = sortIndex; this.InsightBoardItemViewReference = insightBoardItemViewReference; this.recordIdentification = recordIdentification; bool showImage = false; UPMInsightBoardItemType insightBoardType; if (menu?.ViewReference?.ViewName == "InsightBoardItem") { string contextMenuName = this.Menu.ViewReference.ContextValueForKey("ContextMenu"); this.isAlternativeContextMenu = false; if (!string.IsNullOrEmpty(contextMenuName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; Menu configMenu = configStore.MenuByName(contextMenuName); if (configMenu != null) { this.relevantViewReference = configMenu.ViewReference; this.countable = this.relevantViewReference.ViewName == "RecordListView"; if (this.relevantViewReference.ContextValueForKey("Modus") == "GeoSearch") { this.countable = false; } if (menu.ViewReference.ContextValueIsSet("ForceActionStyle")) { this.forcedRecordListView = this.countable; this.countable = false; } else { this.forcedRecordListView = false; } this.isAlternativeContextMenu = true; if (this.countable) { this.searchAndListConfigurationName = this.relevantViewReference.ContextValueForKey("ConfigName"); this.infoAreaid = this.relevantViewReference.ContextValueForKey("InfoArea"); if (string.IsNullOrEmpty(this.searchAndListConfigurationName)) { this.searchAndListConfigurationName = this.infoAreaid; } } } } if (!this.isAlternativeContextMenu) { this.relevantViewReference = this.Menu.ViewReference; this.countable = true; if (menu.ViewReference.ContextValueIsSet("ForceActionStyle")) { this.forcedRecordListView = true; this.countable = false; } this.searchAndListConfigurationName = this.relevantViewReference.ContextValueForKey("ConfigName"); if (this.forcedRecordListView) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName); this.infoAreaid = searchAndList.InfoAreaId; } } string requestOptionString = this.Menu.ViewReference.ContextValueForKey("RequestOption"); this.relevantViewReference = new ViewReference(this.relevantViewReference, requestOptionString, "InitialRequestOption", null); this.requestOption = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline); insightBoardType = this.countable ? UPMInsightBoardItemType.Count : UPMInsightBoardItemType.Action; } else { this.relevantViewReference = this.Menu.ViewReference; showImage = true; insightBoardType = UPMInsightBoardItemType.ExMenu; } UPMInsightBoardGroup insightBoardGroup = new UPMInsightBoardGroup(StringIdentifier.IdentifierWithStringId("temp")); insightBoardGroup.LabelText = "InsightBoard"; this.Group = insightBoardGroup; this.ControllerState = GroupModelControllerState.Pending; IIdentifier identifier; if (!string.IsNullOrEmpty(this.infoAreaid)) { identifier = new RecordIdentifier(this.infoAreaid, null); } else { identifier = StringIdentifier.IdentifierWithStringId("InsightBoardItem"); } UPMInsightBoardItem item = new UPMInsightBoardItem(identifier) { ShowImage = showImage, Type = insightBoardType }; this.Group.AddChild(item); }
/// <summary> /// Populate Sub menus /// </summary> /// <param name="organizer"> /// <see cref="UPMAdvancedSearchOrganizer"/> object /// </param> /// <param name="store"> /// <see cref="IConfigurationUnitStore"/> config store /// </param> /// <param name="startMenuName"> /// starting menu /// </param> private void PopulateSubMenus(UPMAdvancedSearchOrganizer organizer, IConfigurationUnitStore store, string startMenuName) { var searchTypes = new List <UPMDetailSearch>(); var menu = Menu.MainMenu(); for (var index = 0; index < menu.NumberOfSubMenus; index++) { var menuItem = menu.SubMenuAtIndex(index); if (menuItem?.ViewReference != null) { if (startMenu == null) { startMenu = menuItem; } if (!string.IsNullOrWhiteSpace(startMenuName)) { var startMenuItem = store.MenuByName(startMenuName); if (startMenuItem != null && startMenuItem == menuItem) { startMenu = menuItem; } } if (menuItem.ViewReference.ViewName == ViewHistoryListView) { var modelController = PageForViewReference(menuItem.ViewReference); AddPageModelController(modelController); organizer.AddPage(modelController.Page); QuickHistorySearchModelController = (UPHistorySearchPageModelController)modelController; } else if (menuItem.ViewReference.ViewName == ViewRecordListView || menuItem.ViewReference.ViewName == ViewCalendarView || menuItem.ViewReference.ViewName == ViewDocumentView) { if (menuItem.ViewReference.ContextValueForKey(KeyModus) == KeyGlobalSearch) { var modelController = PageForViewReference(menuItem.ViewReference); AddPageModelController(modelController); organizer.AddPage(modelController.Page); QuickGlobalSearchModelController = (GlobalSearchPageModelController)modelController; } else if (menuItem.ViewReference.ContextValueForKey(KeyModus) == KeyMultiSearch) { var modelController = PageForViewReference(menuItem.ViewReference); AddPageModelController(modelController); organizer.AddPage(modelController.Page); QuickFavoriteSearchModelController = (UPMultiSearchPageModelController)modelController; } else { var itemViewReference = menuItem.ViewReference; var infoArea = itemViewReference.ContextValueForKey(KeyInfoArea); if (menuItem.ViewReference.ViewName == ViewDocumentView && infoArea == null) { infoArea = InfoAreaD1; } var detailSearchType = new UPMDetailSearch(StringIdentifier.IdentifierWithStringId(menu.UnitName)) { TileField = new UPMStringField(StringIdentifier.IdentifierWithStringId($"{menuItem.UnitName}{IdentifierSuffixTitle}")) { StringValue = menuItem.DisplayName }, Color = ColorForInfoAreaWithId(infoArea) }; searchTypes.Add(detailSearchType); var action = new UPMAction(StringIdentifier.IdentifierWithStringId($"{IdentifierPrefixDetailAction} {menuItem.UnitName}")); action.SetTargetAction(this, PerformDetailAction); detailSearchType.SwitchToDetailSearchAction = action; viewReferenceDict[action.Identifier] = itemViewReference; } } } } organizer.DetailSearches = searchTypes; }