/// <summary> /// Loads the specified the delegate. /// </summary> /// <param name="theDelegate">The delegate.</param> /// <returns></returns> public bool Load(IQuestionnaireDelegate theDelegate) { if (this.LoadDelegate != null) { return(false); } this.LoadDelegate = theDelegate; this.currentQuery = new UPContainerMetaInfo(this.Manager.QuestionnaireList); if (!string.IsNullOrEmpty(this.RecordIdentification)) { this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification); } else { UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(this.Manager.QuestionnaireSearchAndList.FilterName); filter = filter.FilterByApplyingValueDictionary( new Dictionary <string, object> { { Constants.QuestionnaireQuestionnaireID, this.CatalogCode.ToString() } }); if (filter != null) { this.currentQuery.ApplyFilter(filter); } } this.requestOption = this.Manager.QuestionnaireRequestOption; this.loadStep = 0; this.currentQuery.Find(this.requestOption, this); return(true); }
/// <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> /// Executes this instance. /// </summary> public override void Execute() { UPRequestOption requestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("RequestOption"), UPRequestOption.FastestAvailable); this.DecisionHandler?.UseCrmQuery(this.CrmQuery); this.CrmQuery.Find(requestOption, this); }
/// <summary> /// Loads the with request option. /// </summary> /// <param name="requestOption">The request option.</param> /// <returns></returns> public bool LoadWithRequestOption(UPRequestOption requestOption) { this.crmQuery = new UPContainerMetaInfo(this.FieldControl); if (this.Filter != null) { this.crmQuery.ApplyFilter(this.Filter); } this.crmQuery.Find(requestOption, this); return(true); }
/// <summary> /// Loads the with request option. /// </summary> /// <param name="requestOption">The request option.</param> /// <returns></returns> public bool LoadWithRequestOption(UPRequestOption requestOption) { if (this.loadStarted) { return(false); } this.loadStarted = true; this.currentLoadIndex = 0; this.requestOption = requestOption; this.LoadNext(); return(true); }
/// <summary> /// The start. /// </summary> /// <param name="requestOption"> /// The request option. /// </param> public void Start(UPRequestOption requestOption) { Dictionary <string, UPCRMField> fields = this.rootExpand?.FieldsForAlternateExpands(true); if (fields == null || fields?.Count == 0) { this.SearchOperationDidFinishWithResult(null, null); return; } var fieldValues = fields.Values.Select(x => x).ToList(); var crmQuery = new UPContainerMetaInfo(fieldValues, this.rootExpand.InfoAreaId); crmQuery.SetLinkRecordIdentification(this.recordIdentification); crmQuery.Find(requestOption, this); }
private void ContinueTemplateFilterGeoChecked() { bool checkExisting = this.ViewReference.ContextValueIsSet("CheckExisting") || this.ViewReference.ContextValueIsSet("ExistsAction"); if (!checkExisting) { this.ContinueRecordDoesNotExist(); return; } string requestModeString = this.ViewReference.ContextValueForKey("RequestMode"); UPRequestOption requestOption = UPCRMDataStore.RequestOptionFromString(requestModeString, UPRequestOption.Online); string filterName = this.ViewReference.ContextValueForKey("TemplateFilter"); string infoAreaId = this.ViewReference.ContextValueForKey("InfoAreaId"); string linkIdString = this.ViewReference.ContextValueForKey("LinkId"); if (string.IsNullOrEmpty(infoAreaId)) { this.ModelController.HandleOrganizerActionError(LocalizedString.TextErrorConfiguration, string.Format(LocalizedString.TextErrorParameterEmpty, "InfoAreaId"), true); return; } UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(filterName); filter = filter.FilterByApplyingValueDictionaryDefaults(this.sourceCopyFields, true); this.CrmQuery = new UPContainerMetaInfo(null, infoAreaId); if (this.CrmQuery == null) { this.ModelController.HandleOrganizerActionError(LocalizedString.TextErrorConfiguration, string.Format(LocalizedString.TextErrorParameterEmpty, "crmQuery"), true); return; } this.CrmQuery.ApplyFilter(filter); if (!string.IsNullOrEmpty(this.LinkRecordIdentification)) { int linkId = -1; if (!string.IsNullOrEmpty(linkIdString)) { linkId = Convert.ToInt32(linkIdString); } this.CrmQuery.SetLinkRecordIdentification(this.LinkRecordIdentification, linkId); } this.CrmQuery.Find(requestOption, this); }
/// <summary> /// Initializes a new instance of the <see cref="CoIBaseNodeLoader"/> class. /// </summary> /// <param name="node">The node.</param> /// <param name="viewReference">The view reference.</param> /// <param name="depth">The depth.</param> /// <param name="maxDepth">The maximum depth.</param> /// <param name="vistedNodes">The visted nodes.</param> public CoIBaseNodeLoader(UPMCoINode node, ViewReference viewReference, int depth, int maxDepth, Dictionary <IIdentifier, UPMCoINode> vistedNodes) { this.RootNode = node; this.viewReference = viewReference; string requestOptionString = this.viewReference.ContextValueForKey("RequestOption"); this.requestOption = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline); this.depth = depth; this.maxDepth = maxDepth; this.vistedNodes = vistedNodes; this.subNodeLoader = new List <CoIBaseNodeLoader>(); this.ChangedIdentifiers = new List <IIdentifier>(); this.pendingCount = 0; this.configName = this.viewReference.ContextValueForKey("ConfigName"); this.ChangedIdentifiers.Add(this.RootNode.Identifier); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.expandSettings = configStore.ExpandByName(this.configName); }
/// <summary> /// Builds the page. /// </summary> protected virtual void BuildPage() { string recordId = this.ViewReference.ContextValueForKey("recordId"); if (string.IsNullOrEmpty(recordId)) { recordId = this.ViewReference.ContextValueForKey("RecordId"); } this.RootRecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(recordId); this.InfoAreaId = this.RootRecordIdentification.InfoAreaId(); string requestOptionString = this.ViewReference.ContextValueForKey("RequestOption"); this.RequestOption = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline); this.MaxDepth = Convert.ToInt32(this.ViewReference.ContextValueForKey("TreeMaxDepth")); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ExpandSettings = configStore.ExpandByName(this.ConfigName) ?? configStore.ExpandByName(this.InfoAreaId); }
/// <summary> /// Strings from request option. /// </summary> /// <param name="requestOption"> /// The request option. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public static string StringFromRequestOption(UPRequestOption requestOption) { switch (requestOption) { case UPRequestOption.Offline: return("Offline"); case UPRequestOption.Online: return("Online"); case UPRequestOption.BestAvailable: return("Best"); case UPRequestOption.FastestAvailable: return("Fastest"); default: return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="UPCRMLinkReader"/> class. /// </summary> /// <param name="recordIdentification"> /// The record identification. /// </param> /// <param name="parentLinkString"> /// The parent link string. /// </param> /// <param name="requestOption"> /// The request option. /// </param> /// <param name="theDelegate"> /// The the delegate. /// </param> public UPCRMLinkReader( string recordIdentification, string parentLinkString, UPRequestOption requestOption, UPCRMLinkReaderDelegate theDelegate) { if (recordIdentification == null) { return; } this.SourceRecordIdentification = recordIdentification; this.InfoAreaId = this.SourceRecordIdentification.InfoAreaId(); this.ParentLinkString = parentLinkString; if (this.ParentLinkString == "KPFI") { this.ParentLinkString = "KP;FI"; } this.RequestOption = requestOption; this.TheDelegate = theDelegate; }
private void QuestionnaireFromResult(UPCRMResult result) { if (result.RowCount == 0) { this.SignalError(new Exception("questionnaire not found")); return; } UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(0); this.RecordIdentification = row.RootRecordIdentification; this.DataDictionary = row.ValuesWithFunctions(); this.Label = this.DataDictionary.ValueOrDefault(Constants.QuestionnaireLabel) as string; int catCode = 0; int.TryParse(this.DataDictionary.ValueOrDefault(Constants.QuestionnaireQuestionnaireID) as string, out catCode); this.CatalogCode = catCode; if (string.IsNullOrEmpty(this.Label) && this.CatalogCode > 0) { UPConfigFieldControlField field = this.Manager.QuestionnaireList.FieldWithFunction(Constants.QuestionnaireQuestionnaireID); if (field != null) { this.Label = field.Field.ValueForRawValueOptions(this.DataDictionary[Constants.QuestionnaireQuestionnaireID] as string, 0); } } this.currentQuery = new UPContainerMetaInfo(this.Manager.QuestionSearchAndList, this.filterParameters); this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification); this.loadStep = 1; if (this.requestOption == UPRequestOption.BestAvailable || this.requestOption == UPRequestOption.FastestAvailable) { this.requestOption = row.IsServerResponse ? UPRequestOption.Online : UPRequestOption.Offline; } this.currentQuery.Find(this.requestOption, this); }
/// <summary> /// Compute result settings request option /// </summary> /// <param name="settings">LogSettings</param> /// <param name="requestOption">Request option</param> /// <param name="theDelegate">Delegate</param> public void ComputeResultWithSettingsRequestOption(AnalysisExecutionSettings settings, UPRequestOption requestOption, IAnalysisDelegate theDelegate) { AnalysisExecutionContext currentContext = this.ExecutionContext.ExecutionContext(); AnalysisDataSourceCacheItem cacheItem = this.dataSourceCache?.CacheItemForExecutionContext(currentContext); if (cacheItem != null) { this.TheDelegate = theDelegate; this.currentSettings = settings; this.currentContext = currentContext; this.ContinueWithQueryResult(cacheItem.DataSource); return; } this.TheDelegate = theDelegate; this.currentSettings = settings; this.currentContext = currentContext; this.currentContext.QueryResultWithRequestOptionDelegate(requestOption, this); }
/// <summary> /// Fills the page with result row request option. /// </summary> /// <param name="page">The page.</param> /// <param name="resultRow">The result row.</param> /// <param name="requestOption">The request option.</param> public virtual void FillPageWithResultRow(Page page, UPCRMResultRow resultRow, UPRequestOption requestOption) { // use localArray because the array could be changed from outside var localArray = new List <UPGroupModelController>(this.GroupModelControllerArray); var changeIdentifier = new List <IIdentifier>(); try { foreach (var groupModelController in localArray) { if (requestOption != UPRequestOption.Default) { if (requestOption != UPRequestOption.Offline || !groupModelController.OnlineOnly) { groupModelController.RequestOption = requestOption; } } if (groupModelController.DelegateCleared) { continue; } groupModelController.ApplyResultRow(resultRow); if (groupModelController.ControllerState != GroupModelControllerState.Finished || groupModelController.Group == null) { continue; } changeIdentifier.Add(groupModelController.Group.Identifier); groupModelController.Group.ConfiguredPostionOfGroup = groupModelController.RootTabIndex; } } catch (Exception error) { SimpleIoc.Default.GetInstance <ILogger>().LogError(error); } if (this.DrawablePageModelController(true)) { this.DrawWholePage(page); if (changeIdentifier.Count > 0) { this.InformAboutDidChangeTopLevelElement(page, page, changeIdentifier, UPChangeHints.ChangeHintsWithHint(Constants.GroupAddedToPageHint)); } } }
/// <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> /// 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> /// Initializes a new instance of the <see cref="UPCharacteristics"/> class. /// </summary> /// <param name="rootRecordIdentification">The root record identification.</param> /// <param name="fieldControl">The field control.</param> /// <param name="destinationRequestOption">The destination request option.</param> public UPCharacteristics(string rootRecordIdentification, FieldControl fieldControl, UPRequestOption destinationRequestOption) { this.RecordIdentification = rootRecordIdentification; this.DestinationFieldControl = fieldControl; this.DestinationRequestOption = destinationRequestOption; if (!this.SetControlsFromParameters()) { throw new InvalidOperationException("Failed: SetControlsFromParameters"); } }
/// <summary> /// Query result with request option and delegate /// </summary> /// <param name="requestOption">Request option</param> /// <param name="contextDelegate">Context delegate</param> public virtual void QueryResultWithRequestOptionDelegate(UPRequestOption requestOption, IAnalysisExecutionContextDelegate contextDelegate) { contextDelegate.ExecutionContextDidFailWithError(this, new Exception("cannot request result for UPAnalysisExecutionContext base class", null)); }
/// <inheritdoc /> public override void QueryResultWithRequestOptionDelegate(UPRequestOption requestOption, IAnalysisExecutionContextDelegate contextDelegate) { this.currentQuery = this.Query(); this.ContextDelegate = contextDelegate; this.currentQuery.Find(requestOption, this); }
/// <summary> /// Loads the specified data dictionary. /// </summary> /// <param name="dataDictionary">The data dictionary.</param> /// <param name="requestOption">The request option.</param> public void Load(Dictionary <string, object> dataDictionary, UPRequestOption requestOption) { this.crmQuery = new UPContainerMetaInfo(this.SearchAndListConfig, dataDictionary); this.crmQuery.Find(requestOption, this); }
/// <summary> /// Requests the option from string the default. /// </summary> /// <param name="requestOptionString"> /// The request option string. /// </param> /// <param name="theDefaultRequestOption"> /// The default request option. /// </param> /// <returns> /// The <see cref="UPRequestOption"/>. /// </returns> public static UPRequestOption RequestOptionFromString(string requestOptionString, UPRequestOption theDefaultRequestOption) { switch (requestOptionString) { case "Offline": return(UPRequestOption.Offline); case "Online": return(UPRequestOption.Online); case "Best": return(UPRequestOption.BestAvailable); case "Fastest": return(UPRequestOption.FastestAvailable); default: return(theDefaultRequestOption); } }
/// <summary> /// Sets the request option. /// </summary> /// <param name="requestOption">The request option.</param> public void SetRequestOption(UPRequestOption requestOption) { this.RequestOption = requestOption; this.ChildController.RequestOption = requestOption; }
/// <summary> /// Fills the page with result row. /// </summary> /// <param name="page"> /// The page. /// </param> /// <param name="resultRow"> /// The result row. /// </param> /// <param name="requestOption"> /// The request option. /// </param> public override void FillPageWithResultRow(Page page, UPCRMResultRow resultRow, UPRequestOption requestOption) { this.Page.Status = null; base.FillPageWithResultRow(page, resultRow, requestOption); }