private void LoadConfigFieldControlForFieldGroup(string fieldGroup) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndListConfig = configStore.SearchAndListByName(fieldGroup); FieldControl configFieldControl; UPConfigFilter configFilter = null; if (searchAndListConfig != null) { configFieldControl = configStore.FieldControlByNameFromGroup("List", fieldGroup); if (!string.IsNullOrEmpty(searchAndListConfig.FilterName)) { configFilter = configStore.FilterByName(searchAndListConfig.FilterName); } } else { configFieldControl = configStore.FieldControlByNameFromGroup("List", fieldGroup); } if (configFieldControl != null) { this.fieldControl = configFieldControl; } if (configFilter != null) { this.filter = configFilter; } }
/// <summary> /// Loads this instance. /// </summary> /// <returns></returns> public bool Load() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.SearchAndListConfigName); UPConfigFilter filter = null; if (searchAndList != null) { filter = configStore.FilterByName(searchAndList.FilterName); } if (searchAndList == null) { return(false); } this.fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); if (this.fieldControl != null) { this.crmQuery = new UPContainerMetaInfo(this.fieldControl, filter, null); } if (this.crmQuery == null) { return(false); } var result = this.crmQuery.Find(); this.HandleResult(result); return(true); }
/// <summary> /// Builds the page. /// </summary> protected override void BuildPage() { base.BuildPage(); this.ConfigName = this.ViewReference.ContextValueForKey("RootNodeConfigName"); UPMCircleOfInfluencePage page = this.CreatePageInstance(); string rootNodeFieldGroup = null; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (!string.IsNullOrEmpty(this.ConfigName)) { SearchAndList searchAndList = configStore.SearchAndListByName(this.ConfigName); rootNodeFieldGroup = searchAndList.FieldGroupName; } if (string.IsNullOrEmpty(rootNodeFieldGroup)) { rootNodeFieldGroup = this.ViewReference.ContextValueForKey("RootNodeFieldGroup"); } FieldControl details = configStore.FieldControlByNameFromGroup("Details", rootNodeFieldGroup); FieldControl miniDetails = configStore.FieldControlByNameFromGroup("MiniDetails", rootNodeFieldGroup); this.rootNodeFieldControl = new FieldControl(new List <FieldControl> { details, miniDetails }); this.ApplyViewConfigOnPage(page); this.ApplyLoadingStatusOnPage(page); page.Invalid = true; this.TopLevelElement = page; }
/// <summary> /// Loads the specified request option. /// </summary> /// <param name="requestOption">The request option.</param> /// <param name="currencyDelegate">The currency delegate.</param> /// <returns></returns> public bool Load(UPRequestOption requestOption, ICurrencyConversionDelegate currencyDelegate) { if (this.CurrencyDelegate != null) { return(false); } this.CurrencyDelegate = currencyDelegate; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.SearchAndListConfigName); UPConfigFilter filter = null; if (searchAndList != null) { filter = configStore.FilterByName(searchAndList.FilterName); } this.fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); if (this.fieldControl != null) { this.crmQuery = new UPContainerMetaInfo(this.fieldControl, filter, null); } if (this.crmQuery == null) { this.CurrencyDelegate = null; this.crmQuery = null; currencyDelegate.CurrencyConversionDidFailWithError(this, new Exception($"invalid searchAndList configuration {this.SearchAndListConfigName}")); return(true); } this.crmQuery.Find(requestOption, this); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="ContactTimesEditPageModelController"/> class. /// </summary> /// <param name="viewReference">View reference</param> public ContactTimesEditPageModelController(ViewReference viewReference) : base(viewReference) { this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); this.searchAndListConfigurationName = this.ViewReference.ContextValueForKey("SearchList"); if (string.IsNullOrEmpty(this.searchAndListConfigurationName)) { this.searchAndListConfigurationName = "U001"; } var configStore = ConfigurationUnitStore.DefaultStore; this.searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName); if (this.searchAndList != null) { this.infoAreaid = this.searchAndList.InfoAreaId; this.FieldControl = configStore.FieldControlByNameFromGroup("Edit", this.searchAndList.FieldGroupName); } else { this.FieldControl = configStore.FieldControlByNameFromGroup("Edit", this.searchAndListConfigurationName); } for (int weekDay = 0; weekDay < 7; weekDay++) { var day = (int)DayOfWeek.Sunday + (weekDay + 1); this.weekDayArray[weekDay] = day > 7 ? (day % 7) : day; } this.BuildPage(); }
/// <summary> /// Initializes a new instance of the <see cref="ContactTimesGroupModelController"/> class. /// </summary> /// <param name="fieldControl">Field Control</param> /// <param name="tabIndex">Tab Index</param> /// <param name="controllerDelegate">Controller Delegate</param> public ContactTimesGroupModelController(FieldControl fieldControl, int tabIndex, IGroupModelControllerDelegate controllerDelegate) : base(fieldControl, tabIndex, controllerDelegate) { var typeParts = this.TabConfig.Type.Split('_'); this.linkId = -1; if (typeParts?.Length > 1) { this.searchAndListConfigurationName = typeParts[1]; } if (this.searchAndListConfigurationName.Length == 0) { this.searchAndListConfigurationName = "U001"; } var configStore = ConfigurationUnitStore.DefaultStore; this.searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName); if (this.searchAndList != null) { this.infoAreaid = this.searchAndList.InfoAreaId; this.fieldControl = configStore.FieldControlByNameFromGroup("List", this.searchAndList.FieldGroupName); } else { this.fieldControl = configStore.FieldControlByNameFromGroup("List", this.searchAndListConfigurationName); } }
/// <summary> /// The create field control for constructor. /// </summary> /// <param name="searchAndList"> /// The search and list. /// </param> /// <returns> /// The <see cref="Tuple"/>. /// </returns> private static Tuple <string, FieldControl> CreateFieldControlForConstructor(SearchAndList searchAndList) { var listFieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup( "List", searchAndList.FieldGroupName); return(Tuple.Create(listFieldControl.InfoAreaId, listFieldControl)); }
/// <summary> /// Filters for configuration filter. /// </summary> /// <param name="configFilter">The configuration filter.</param> /// <param name="searchAndListName">Name of the search and list.</param> /// <param name="filterParameters">The filter parameters.</param> /// <param name="singleSelect">if set to <c>true</c> [single select].</param> /// /// <returns>Filter</returns> public static UPMFilter FilterForConfigFilter(UPConfigFilter configFilter, string searchAndListName, Dictionary <string, object> filterParameters, bool singleSelect) { if (string.IsNullOrEmpty(searchAndListName)) { return(null); } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(searchAndListName); if (searchAndList != null) { return(null); } FieldControl listControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); if (listControl == null) { return(null); } UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(searchAndListName, filterParameters); UPCRMResult result = crmQuery.Find(); int count = result.RowCount; if (count == 0) { return(null); } UPCRMListFormatter listFormatter = new UPCRMListFormatter(listControl.TabAtIndex(0)); StringIdentifier identifier = StringIdentifier.IdentifierWithStringId("SelectFilter"); UPMSelectCatalogFilter filter = new UPMSelectCatalogFilter(identifier); Dictionary <string, string> dict = new Dictionary <string, string>(count); Dictionary <string, UPCRMResultRow> rowDict = new Dictionary <string, UPCRMResultRow>(count); for (int i = 0; i < count; i++) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i); string fieldValue = listFormatter.StringFromRowForPosition(row, 0); dict[row.RootRecordIdentification] = fieldValue; rowDict[row.RootRecordIdentification] = row; } filter.CrmResult = result; filter.FilterParameters = filterParameters; filter.ResultRowDictionary = rowDict; filter.ExplicitCatalogValues = dict; filter.ParameterName = "Select"; filter.Name = configFilter.UnitName; filter.DisplayName = !string.IsNullOrEmpty(configFilter.DisplayName) ? configFilter.DisplayName : configFilter.UnitName; filter.SingleSelect = singleSelect; return(filter); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentInfoAreaManager"/> class. /// </summary> /// <param name="searchAndList"> /// The search and list. /// </param> public DocumentInfoAreaManager(SearchAndList searchAndList) : this( CreateFieldControlForConstructor(searchAndList).Item1, CreateFieldControlForConstructor(searchAndList).Item2, 0, null) { this.SearchAndList = searchAndList; }
/// <summary> /// Initializes a new instance of the <see cref="TimelineSearch"/> class. /// </summary> /// <param name="crmQuery">The CRM query.</param> /// <param name="preparedSearch">The prepared search.</param> public TimelineSearch(UPContainerMetaInfo crmQuery, UPSearchPageModelControllerPreparedSearch preparedSearch) { this.CrmQuery = crmQuery; this.PreparedSearch = preparedSearch; this.TimelineInfoArea = this.PreparedSearch.TimelineConfiguration; string configName = !string.IsNullOrEmpty(this.TimelineInfoArea.ConfigName) ? this.TimelineInfoArea.ConfigName : this.TimelineInfoArea.InfoAreaId; SearchAndList searchAndList = ConfigurationUnitStore.DefaultStore.SearchAndListByName(configName); this.FieldGroupName = searchAndList != null ? searchAndList.FieldGroupName : configName; }
/// <summary> /// Initializes a new instance of the <see cref="UPCRMParticipants"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> /// <param name="rootInfoAreaId">The root information area identifier.</param> /// <param name="linkParticipantsInfoAreaId">The link participants information area identifier.</param> /// <param name="linkParticipantsLinkId">The link participants link identifier.</param> /// <param name="recordIdentification">The record identification.</param> /// <param name="theDelegate">The delegate.</param> public UPCRMParticipants(ViewReference viewReference, string rootInfoAreaId, string linkParticipantsInfoAreaId, int linkParticipantsLinkId, string recordIdentification, UPCRMParticipantsDelegate theDelegate) { this.RecordIdentification = recordIdentification; this.TheDelegate = theDelegate; this.RootInfoAreaId = rootInfoAreaId ?? recordIdentification.InfoAreaId(); if (string.IsNullOrEmpty(this.RootInfoAreaId)) { this.RootInfoAreaId = "MA"; } this.linkParticipantsInfoAreaId = linkParticipantsInfoAreaId; this.linkParticipantsLinkId = linkParticipantsLinkId; if (viewReference == null) { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName($"Configuration:{this.RootInfoAreaId}Participants"); this.ViewReference = menu?.ViewReference; } else { this.ViewReference = viewReference; } this.RepParticipantsRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference?.ContextValueForKey("RepAcceptanceRequestOption"), UPRequestOption.FastestAvailable); this.AcceptanceFieldId = -1; string configName = this.ViewReference?.ContextValueForKey("RepAcceptanceConfigName"); if (!string.IsNullOrEmpty(configName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(configName); if (!string.IsNullOrEmpty(searchAndList.FieldGroupName)) { configName = searchAndList.FieldGroupName; } FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Edit", configName) ?? configStore.FieldControlByNameFromGroup("List", configName); if (fieldControl != null) { UPConfigFieldControlField field = fieldControl.FieldWithFunction(Constants.UPRepAcceptanceFunctionName_Acceptance); if (field != null) { this.AcceptanceFieldId = field.FieldId; } this.RepAcceptanceInfoAreaId = fieldControl.InfoAreaId; } } }
/// <summary> /// Searches the operation did finish with result. /// </summary> /// <param name="operation">The operation.</param> /// <param name="result">The result.</param> public void SearchOperationDidFinishWithResult(Operation operation, UPCRMResult result) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName); this.detailActionViewReference = this.DefaultActionForSearchAndList(searchAndList).ViewReference; if (result.RowCount > 0) { this.detailActionRecordIdentifier = result.ResultRowAtIndex(0).RootRecordIdentification; } this.Delegate.GroupModelControllerFinished(this); }
/// <summary> /// Switches to detail. /// </summary> /// <param name="identifier">The identifier.</param> public override void SwitchToDetail(IIdentifier identifier) { bool switchToCoi = this.ViewReference.ContextValueForKey("SwitchToCoi") == "true"; if (identifier is RecordIdentifier) { string recordIdentification = ((RecordIdentifier)identifier).RecordIdentification; CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[recordIdentification]; string editAction = infoAreaConfig.Definition.ValueOrDefault("NodeDetailAction") as string; editAction = !string.IsNullOrEmpty(editAction) ? editAction : "SHOWRECORD"; this.SwitchToRecord(recordIdentification, editAction, true, false, switchToCoi ? new SwitchToFirstCoiIndex() : null); } else { // Switch to SearchAndList string searchAndListName = this.nodeIdConfigDict[identifier].SearchAndListName; if (!string.IsNullOrEmpty(searchAndListName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(searchAndListName); if (searchAndList != null) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary["ConfigName"] = searchAndListName; dictionary["InfoArea"] = searchAndList.InfoAreaId; UPMCoINode node = this.vistedNodes[identifier]; UPConfigTreeViewTable parentConfigTable = this.nodeIdConfigDict[node.Parent.Identifier]; if (!string.IsNullOrEmpty(node.Parent.RecordIdentification)) { dictionary["LinkRecord"] = node.Parent.RecordIdentification; } if (parentConfigTable.LinkId > 0) { dictionary["LinkId"] = $"{parentConfigTable.LinkId}"; } dictionary[Search.Constants.SwipeDetailRecordsConfigName] = "true"; string initialRquestOptionString = UPCRMDataStore.StringFromRequestOption(this.RequestOption); if (!string.IsNullOrEmpty(initialRquestOptionString)) { dictionary["InitialRequestOption"] = initialRquestOptionString; } UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(new ViewReference(dictionary, "RecordListView")); this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController); } } } }
/// <summary> /// Searches the operation did finish with count. /// </summary> /// <param name="operation">The operation.</param> /// <param name="count">The count.</param> public void SearchOperationDidFinishWithCount(Operation operation, int count) { this.ControllerState = GroupModelControllerState.Finished; UPMInsightBoardItem item = (UPMInsightBoardItem)this.Group.Children[0]; item.Countable = true; item.Count = count; item.SortIndex = this.SortIndex; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName); this.infoAreaid = searchAndList.InfoAreaId; InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.infoAreaid); if (!string.IsNullOrEmpty(infoAreaConfig.ColorKey)) { item.Color = AureaColor.ColorWithString(infoAreaConfig.ColorKey); } if (!string.IsNullOrEmpty(this.Menu.DisplayName)) { item.Title = this.Menu.DisplayName; } else { item.Title = item.Count > 1 ? infoAreaConfig.PluralName : infoAreaConfig.SingularName; } item.ImageName = this.Menu.ImageName ?? infoAreaConfig.ImageName; UPMAction action = new UPMAction(null); if (count == 1) { this.crmQuery.Find(this.requestOption, this); action.SetTargetAction(this, this.SwitchToDetailOrganizer); } else { action.SetTargetAction(this, this.SwitchToListOrganizer); } item.Action = action; if (count != 1) { this.Delegate.GroupModelControllerFinished(this); } }
/// <summary> /// Sets the name of the fields from search and list configuration. /// </summary> /// <param name="searchAndListConfigurationName">Name of the search and list configuration.</param> /// <returns></returns> public bool SetFieldsFromSearchAndListConfigurationName(string searchAndListConfigurationName) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(searchAndListConfigurationName); if (searchAndList != null) { FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); if (fieldControl != null) { this.SetFieldsFromFieldControl(fieldControl); return(true); } } return(false); }
private UPSESingleAdditionalItemInformation(UPSerialEntry _serialEntry, string _configName, string _keyColumnName, Dictionary <string, object> filterParameters, UPSESingleAdditionalItemInformationDelegate theDelegate) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndListConfiguration = configStore.SearchAndListByName(_configName); if (searchAndListConfiguration == null) { throw new Exception("Search & List Config is null"); } this.FieldControl = configStore.FieldControlByNameFromGroup("List", searchAndListConfiguration.FieldGroupName); if (this.FieldControl == null) { throw new Exception("FieldControl is null"); } if (searchAndListConfiguration.FilterName != null) { this.Filter = configStore.FilterByName(searchAndListConfiguration.FilterName); if (this.Filter != null && filterParameters != null) { this.Filter = this.Filter.FilterByApplyingReplacements(UPConditionValueReplacement.ReplacementsFromValueParameterDictionary(filterParameters)); } if (this.Filter == null) { throw new Exception("Filter is null"); } } UPConfigFieldControlField field = this.FieldControl.FieldWithFunction(_keyColumnName); if (field == null) { throw new Exception("Field is null"); } this.keyColumnIndex = field.TabIndependentFieldIndex; this.SerialEntry = _serialEntry; this.KeyColumnName = _keyColumnName; this.TheDelegate = theDelegate; }
/// <summary> /// Initializes a new instance of the <see cref="UPEditParticipantsGroupModelController"/> class. /// </summary> /// <param name="_fieldControl">The field control.</param> /// <param name="_tabIndex">Index of the tab.</param> /// <param name="_editPageContext">The edit page context.</param> /// <param name="_theDelegate">The delegate.</param> public UPEditParticipantsGroupModelController(FieldControl _fieldControl, int _tabIndex, UPEditPageContext _editPageContext, IGroupModelControllerDelegate _theDelegate) : base(_fieldControl, _tabIndex, _editPageContext, _theDelegate) { int fieldCount = this.TabConfig.NumberOfFields; for (int i = 0; i < fieldCount; i++) { UPConfigFieldControlField fieldConfig = this.TabConfig.FieldAtIndex(i); if (fieldConfig.Field.FieldInfo.IsParticipantsField) { this.ParticipantsField = fieldConfig; break; } } var tabTypeParts = this.TabConfig.Type.Split('_'); this.LinkParticipantsName = null; if (tabTypeParts.Length > 1) { this.LinkParticipantsName = tabTypeParts[1]; var configParts = this.LinkParticipantsName.Split('#'); if (configParts.Length > 1) { this.LinkParticipantsName = configParts[0]; this.LinkId = Convert.ToInt32(configParts[1]); } SearchAndList searchAndList = ConfigurationUnitStore.DefaultStore.SearchAndListByName(this.LinkParticipantsName); if (searchAndList != null) { this.ParticipantInfoAreaId = searchAndList.InfoAreaId; } else { FieldControl fieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", this.LinkParticipantsName); this.ParticipantInfoAreaId = fieldControl.InfoAreaId; } } this.RootInfoAreaId = _fieldControl.InfoAreaId; }
/// <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="UPDocumentGroupModelController"/> class. /// </summary> /// <param name="_fieldControl">The field control.</param> /// <param name="_tabIndex">Index of the tab.</param> /// <param name="_theDelegate">The delegate.</param> public UPDocumentGroupModelController(FieldControl _fieldControl, int _tabIndex, IGroupModelControllerDelegate _theDelegate) : base(_fieldControl, _tabIndex, _theDelegate) { var typeParts = this.TabConfig.Type.Split('_'); this.MaxResults = 100; if (typeParts.Length > 1) { bool docSearch = typeParts[0].StartsWith("DOCSEARCH"); if (docSearch) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (typeParts.Length > 1) { string searchAndListName = (string)typeParts[1]; this.searchAndList = configStore.SearchAndListByName(searchAndListName); } if (typeParts.Length > 2) { this.MaxResults = Convert.ToInt32(typeParts[2]); } } else { if (typeParts.Length > 1) { this.MaxResults = Convert.ToInt32(typeParts[1]); } } this.ControllerState = GroupModelControllerState.Pending; string sendEmailFieldgroup = _fieldControl.ValueForAttribute("documentClientEmailFieldgroup"); if (sendEmailFieldgroup != null) { this._sendEmailFieldgroup = sendEmailFieldgroup; } } }
/// <summary> /// Initializes a new instance of the <see cref="UPCharacteristics"/> class. /// </summary> /// <param name="rootRecordIdentification">The root record identification.</param> /// <param name="searchAndListConfigurationName">Name of the search and list configuration.</param> /// <param name="destinationRequestOption">The destination request option.</param> public UPCharacteristics(string rootRecordIdentification, string searchAndListConfigurationName, UPRequestOption destinationRequestOption) { this.RecordIdentification = rootRecordIdentification; this.EditMode = false; SearchAndList searchAndListConfiguration = ConfigurationUnitStore.DefaultStore.SearchAndListByName(searchAndListConfigurationName); if (searchAndListConfiguration != null) { this.DestinationFieldControlName = searchAndListConfiguration.FieldGroupName; this.DestinationFilterName = searchAndListConfiguration.FilterName; } else { this.DestinationFieldControlName = searchAndListConfigurationName; } this.DestinationRequestOption = destinationRequestOption; if (!this.SetControlsFromParameters()) { throw new InvalidOperationException("Failed: SetControlsFromParameters"); } }
/// <summary> /// Creates the query. /// </summary> /// <param name="recordIdentifier">The record identifier.</param> /// <returns></returns> protected override UPContainerMetaInfo CreateQuery(string recordIdentifier) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(this.configName); if (searchAndList == null) { return(null); } UPContainerMetaInfo query = this.CreateQueryLinkIdSearchAndList(recordIdentifier, -1, searchAndList); if (recordIdentifier.InfoAreaId() == "FI" && !string.IsNullOrEmpty(this.fiFilterName)) { query.ApplyFilter(configStore.FilterByName(this.fiFilterName)); } else if (recordIdentifier.InfoAreaId() == "KP" && !string.IsNullOrEmpty(this.kpFilterName)) { query.ApplyFilter(configStore.FilterByName(this.kpFilterName)); } return(query); }
private IIdentifier BuildIdentifier() { IIdentifier identifier; if (this.WebContentMetadata is UPWebContentMetadataClientReport) { UPWebContentMetadataClientReport clientReport = (UPWebContentMetadataClientReport)this.WebContentMetadata; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; List <string> usedInfoAreas = new List <string>(); foreach (UPWebContentClientReport contentClientReport in clientReport.ClientReports) { SearchAndList searchAndList = configStore.SearchAndListByName(contentClientReport.ConfigName); FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList == null ? contentClientReport.ConfigName : searchAndList.FieldGroupName); foreach (UPConfigFieldControlField field in fieldControl.Fields) { if (!usedInfoAreas.Contains(field.InfoAreaId)) { usedInfoAreas.Add(field.InfoAreaId); } } } List <IIdentifier> usedIdentifiers = new List <IIdentifier>(); usedIdentifiers.AddRange(usedInfoAreas.Select(infoArea => StringIdentifier.IdentifierWithStringId($"{infoArea}.*"))); identifier = usedIdentifiers.Count > 0 ? new MultipleIdentifier(usedIdentifiers) : this.BuildStandartIdentifier(); } else { identifier = this.BuildStandartIdentifier(); } return(identifier); }
/// <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> /// Creates the query link identifier search and list. /// </summary> /// <param name="recordIdentifier">The record identifier.</param> /// <param name="linkId">The link identifier.</param> /// <param name="searchAndList">The search and list.</param> /// <returns></returns> protected UPContainerMetaInfo CreateQueryLinkIdSearchAndList(string recordIdentifier, int linkId, SearchAndList searchAndList) { if (searchAndList == null) { return(null); } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.expandSettings == null) { this.expandSettings = configStore.ExpandByName(searchAndList.InfoAreaId); } FieldControl fieldControlList = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); FieldControl fieldControlMini = configStore.FieldControlByNameFromGroup("MiniDetails", searchAndList.FieldGroupName); FieldControl fieldControlCombi = new FieldControl(new List <FieldControl> { fieldControlList, fieldControlMini }); UPContainerMetaInfo query = new UPContainerMetaInfo(fieldControlCombi); query.SetLinkRecordIdentification(recordIdentifier, linkId); if (this.expandSettings != null) { Dictionary <string, UPCRMField> alternateExpandFields = this.expandSettings.FieldsForAlternateExpands(true); List <UPCRMField> additionalFields = alternateExpandFields.Values.Where(field => query.ContainsField(field) == null).ToList(); if (additionalFields.Count > 0) { query.AddCrmFields(additionalFields); } this.expandChecker = this.expandSettings.ExpandCheckerForCrmQuery(query); } return(query); }
private bool ComputeNextReport() { if (this.ClientReports.Count <= this.nextClientReport) { this.BuildXml(); this.blockStart = false; return(true); } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; UPWebContentClientReport report = this.ClientReports[this.nextClientReport]; SearchAndList searchAndList = configStore.SearchAndListByName(report.ConfigName); FieldControl tmpFieldControl = searchAndList == null ? configStore.FieldControlByNameFromGroup("List", report.ConfigName) : configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName); if (tmpFieldControl == null) { this.nextClientReport++; return(this.ComputeNextReport()); } this.crmQuery = new UPContainerMetaInfo(tmpFieldControl); if (!string.IsNullOrEmpty(this.recordIdentification)) { int _linkId = this.linkId; if (report.ExplicitLinkId) { _linkId = report.LinkId; } if (string.IsNullOrEmpty(report.ParentLinkConfig)) { this.crmQuery.SetLinkRecordIdentification(this.recordIdentification, _linkId); } else if (report.ParentLinkConfig != "nolink") { string linkRecordIdentification = this.parentLinkDictionary.ValueOrDefault(report.ParentLinkConfig); if (linkRecordIdentification == null) { this.linkReader = new UPCRMLinkReader(this.recordIdentification, report.ParentLinkConfig, this); this.linkReader.Start(); return(true); } if (!string.IsNullOrEmpty(linkRecordIdentification)) { this.crmQuery.SetLinkRecordIdentification(linkRecordIdentification, _linkId); } } } if (!string.IsNullOrEmpty(searchAndList?.FilterName)) { UPConfigFilter filter = configStore.FilterByName(searchAndList.FilterName); filter = filter?.FilterByApplyingValueDictionaryDefaults(this.filterParameters, true); if (filter != null) { this.crmQuery.ApplyFilter(filter); } } this.crmQuery.Find(this.RequestOption, this); return(true); }
/// <summary> /// Creates the page instance. /// </summary> /// <returns></returns> public override UPMSearchPage CreatePageInstance() { this.InfoAreaId = this.ViewReference.ContextValueForKey("InfoArea"); this.ConfigName = this.ViewReference.ContextValueForKey("Config1Name"); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; string searchTypeString = this.ViewReference.ContextValueForKey("InitialSearchType"); SearchPageSearchType searchType = Convert.ToInt32(searchTypeString) == 2 ? SearchPageSearchType.OnlineSearch : SearchPageSearchType.OfflineSearch; if (string.IsNullOrEmpty(this.InfoAreaId) && this.ViewReference.ContextValueForKey("Modus") == "MultiSearch") { if (string.IsNullOrEmpty(this.ConfigName)) { this.ConfigName = "default"; } } List <IIdentifier> identifiers = new List <IIdentifier>(); this.usedFilters = new Dictionary <string, UPMFilter>(); List <UPMFilter> filters = new List <UPMFilter>(); string geoFilter1 = this.ViewReference.ContextValueForKey("Config1Filter"); UPMFilter filter = UPMFilter.FilterForName(geoFilter1); SearchAndList searchConfiguration = configStore.SearchAndListByName(this.ConfigName); var infoAreaId = searchConfiguration != null ? searchConfiguration.InfoAreaId : this.ConfigName; if (filter != null) { filter.Active = true; this.usedFilters[this.ConfigName] = filter; filters.Add(filter); } identifiers.Add(new RecordIdentifier(infoAreaId, null)); for (int i = 2; i < 99; i++) { string configNameKey = $"Config{i}Name"; string configName2 = this.ViewReference.ContextValueForKey(configNameKey); if (!string.IsNullOrEmpty(configName2)) { string configFilterKey = $"Config{i}Filter"; string geoFilter2 = this.ViewReference.ContextValueForKey(configFilterKey); UPMFilter filter2 = UPMFilter.FilterForName(geoFilter2); SearchAndList searchConfiguration2 = configStore.SearchAndListByName(configName2); if (filter2 != null) { filter2.Active = true; this.usedFilters[configName2] = filter2; filters.Add(filter2); } infoAreaId = (searchConfiguration2 != null) ? searchConfiguration2.InfoAreaId : configName2; identifiers.Add(new RecordIdentifier(infoAreaId, null)); } else { break; } } MultipleIdentifier multipleIdentifier = new MultipleIdentifier(identifiers); UPMSearchPage page = new UPMSearchPage(multipleIdentifier) { SearchType = searchType, AvailableFilters = filters, Style = UPMTableStyle.UPMStandardTableStyle, AvailableOnlineSearch = !this.ViewReference.ContextValueIsSet("hideOnlineOfflineButton"), InitiallyOnline = searchType == SearchPageSearchType.OnlineSearch, HideSearchBar = true, ViewType = SearchPageViewType.List }; return(page); }
private UPContainerMetaInfo CreateQueryWithRecordIdentifier(string recordIdentifier) { string childSearchAndListName = this.childrenTreeConfig.SearchAndListName; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; SearchAndList searchAndList = configStore.SearchAndListByName(childSearchAndListName); UPContainerMetaInfo metainfo = this.CreateQueryLinkIdSearchAndList(recordIdentifier, this.childrenTreeConfig.LinkId, searchAndList); if (metainfo == null) { return(null); } if (this.childrenTreeConfig.RecordCount <= 0) { metainfo.MaxResults = 0; } else { metainfo.MaxResults = this.childrenTreeConfig.RecordCount - 1; } // Add additionalConfig for RecordNodeChilds foreach (UPConfigTreeViewTable childTree in this.childrenTreeConfig.ChildNodes) { if (this.IsRecordNode(childTree)) { string recordCustomControl = childTree.RecordCustomControl; Dictionary <string, object> customControlDict = recordCustomControl.JsonDictionaryFromString(); string nodeType = customControlDict["Type"] as string; if (nodeType.StartsWith("Tree:")) { CoITreeInfoAreaConfig infoAreaConfig = new CoITreeInfoAreaConfig { InfoAreaId = childTree.InfoAreaId, LinkId = childTree.LinkId }; string jumpTreeConfigName = nodeType.Substring(5); UPConfigTreeView treeConfig = configStore.TreeViewByName(jumpTreeConfigName); infoAreaConfig.Config = treeConfig.RootNode; infoAreaConfig.FunctionNameSuffix = childTree.RelationName; infoAreaConfig.Definition = customControlDict; this.infoAreaConfigs.Add(infoAreaConfig); } else if (nodeType.StartsWith("LinkNode")) { CoITreeInfoAreaConfig infoAreaConfig = new CoITreeInfoAreaConfig { InfoAreaId = childTree.InfoAreaId, LinkId = childTree.LinkId, Config = childTree, FunctionNameSuffix = childTree.RelationName, Definition = customControlDict }; this.infoAreaConfigs.Add(infoAreaConfig); } else { SimpleIoc.Default.GetInstance <ILogger>().LogWarn($"UPCoITree cant handle nodeType: {nodeType}"); } } } return(metainfo); }
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 UPMSearchPage UpdatePage(UPMSearchPage searchPage) { UPMSearchPage newPage = this.CreatePageInstance(); this.BuildPageDetails(newPage); if (searchPage.Invalid) { this.pendingRecords.Clear(); this.rows.Clear(); this.historyManager = HistoryManager.DefaultHistoryManager; this.configStore = ConfigurationUnitStore.DefaultStore; if (this.historyManager.HistoryEntries.Count == 0) { return(newPage); } foreach (HistoryEntry entry in this.historyManager.HistoryEntries) { string recordIdent = entry.RecordIdentification; SearchAndList searchConfiguration = this.configStore.SearchAndListByName(recordIdent.InfoAreaId()); FieldControl listFieldControl = this.configStore.FieldControlByNameFromGroup("List", searchConfiguration.FieldGroupName); UPContainerMetaInfo containerMetaInfo = new UPContainerMetaInfo(listFieldControl); if (entry.OnlineData) { if (ServerSession.CurrentSession.ConnectedToServer) { this.pendingRecords.Add(recordIdent); this.resCount++; containerMetaInfo.ReadRecord(recordIdent, UPRequestOption.Online, this); } else { UPMResultRow row = new UPMResultRow(new RecordIdentifier(recordIdent)); UPMStringField stringField = new UPMStringField(StringIdentifier.IdentifierWithStringId(recordIdent)); stringField.FieldValue = LocalizedString.TextOfflineNotAvailable; row.Fields = new List <UPMField> { stringField }; row.OnlineData = true; //row.StatusIndicatorIcon = UIImage.UpXXImageNamed("crmpad-List-Cloud"); // CRM-5007 InfoArea infoAreaConfig = this.configStore.InfoAreaConfigById(recordIdent.InfoAreaId()); string imageName = infoAreaConfig.ImageName; if (!string.IsNullOrEmpty(imageName)) { //row.Icon = UIImage.UpImageWithFileName(imageName); // CRM-5007 } this.rows.Add(row); } } else { this.resCount++; this.pendingRecords.Add(recordIdent); containerMetaInfo.ReadRecord(recordIdent, UPRequestOption.Offline, this); } } newPage.Invalid = false; this.TopLevelElement = newPage; this.ApplyLoadingStatusOnPage(newPage); return(newPage); } UPMResultSection section = (UPMResultSection)this.Page.Children[0]; this.ResortRowListAddToPage(section.Children, newPage); this.TopLevelElement = newPage; return(newPage); }
/// <summary> /// Search operation did finish with result /// </summary> /// <param name="operation">Operation</param> /// <param name="result">Result</param> public override void SearchOperationDidFinishWithResult(Operation operation, UPCRMResult result) { UPCRMResultRow resultRow = (UPCRMResultRow)result.ResultRowAtIndex(0); this.resCount--; if (resultRow != null) { string recordIdent = resultRow.RootRecordIdentification; RecordIdentifier recordIdentifier = new RecordIdentifier(recordIdent.InfoAreaId(), recordIdent.RecordId()); UPMResultRow row = new UPMResultRow(new RecordIdentifier(recordIdent)); SearchAndList searchConfiguration = this.configStore.SearchAndListByName(recordIdent.InfoAreaId()); FieldControl listFieldControl = this.configStore.FieldControlByNameFromGroup("List", searchConfiguration.FieldGroupName); InfoArea configInfoArea = this.configStore.InfoAreaConfigById(recordIdent.InfoAreaId()); row.RowColor = AureaColor.ColorWithString(configInfoArea.ColorKey); UPCRMListFormatter listFormatter = new UPCRMListFormatter(listFieldControl); int fieldCount = listFormatter.PositionCount; List <UPMField> listFields = new List <UPMField>(fieldCount); for (int i = 0; i < fieldCount; i++) { UPConfigFieldControlField configField = listFormatter.FirstFieldForPosition(i); if (configField == null) { continue; } FieldAttributes attributes = configField.Attributes; if (attributes.Hide) { continue; } UPMStringField stringField = new UPMStringField(StringIdentifier.IdentifierWithStringId($"{recordIdent}-{i}")); string stringValue = listFormatter.StringFromRowForPosition(resultRow, i); if (attributes.Image) { DocumentManager documentManager = new DocumentManager(); string documentKey = stringValue; DocumentData documentData = documentManager.DocumentForKey(documentKey); if (documentData != null) { row.RecordImageDocument = new UPMDocument(documentData); } else { //row.RecordImageDocument = new UPMDocument(recordIdentifier, ServerSession.DocumentRequestUrlForDocumentKey(documentKey)); } continue; } if (!string.IsNullOrEmpty(stringValue)) { if (attributes.NoLabel && !string.IsNullOrEmpty(configField.Label)) { stringValue = $"{configField.Label} {stringValue}"; } stringField.StringValue = stringValue; stringField.SetAttributes(attributes); } listFields.Add(stringField); } row.OnlineData = resultRow.IsServerResponse; if (row.OnlineData) { //row.StatusIndicatorIcon = UIImage.UpXXImageNamed("crmpad-List-Cloud"); // CRM-5007 } foreach (HistoryEntry entry in this.historyManager.HistoryEntries) { if (entry.RecordIdentification == recordIdent) { this.rows.Add(row); if (this.pendingRecords.Contains(recordIdent)) { this.pendingRecords.Remove(recordIdent); } break; } } row.Fields = listFields; } if (this.resCount == 0) { this.DisplayPage(this.rows); } }