/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingSet"/> class. /// </summary> /// <param name="configName">Name of the configuration.</param> /// <param name="scaleConfigName">Name of the scale configuration.</param> /// <param name="bundleConfigName">Name of the bundle configuration.</param> /// <param name="bundleScaleConfigName">Name of the bundle scale configuration.</param> /// <param name="pricing">The pricing.</param> /// <param name="theDelegate">The delegate.</param> public UPSEPricingSet(string configName, string scaleConfigName, string bundleConfigName, string bundleScaleConfigName, UPSEPricing pricing, UPSEPricingSetDelegate theDelegate) { this.fastRequest = ServerSession.CurrentSession.IsEnterprise; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ConfigSearchAndList = configStore.SearchAndListByName(configName); this.ConfigFieldControl = this.ConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.ConfigSearchAndList.FieldGroupName) : null; if (this.ConfigFieldControl == null) { throw new InvalidOperationException("ConfigFieldControl is null"); } this.TheDelegate = theDelegate; this.Pricing = pricing; if (!string.IsNullOrEmpty(scaleConfigName)) { this.ScaleConfigSearchAndList = configStore.SearchAndListByName(scaleConfigName); this.ScaleConfigFieldControl = this.ScaleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.ScaleConfigSearchAndList.FieldGroupName) : null; } if (!string.IsNullOrEmpty(bundleConfigName)) { this.BundleConfigSearchAndList = configStore.SearchAndListByName(bundleConfigName); this.BundleConfigFieldControl = this.BundleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.BundleConfigSearchAndList.FieldGroupName) : null; if (!string.IsNullOrEmpty(bundleScaleConfigName)) { this.BundleScaleConfigSearchAndList = configStore.SearchAndListByName(bundleScaleConfigName); this.BundleScaleConfigFieldControl = this.BundleScaleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.BundleScaleConfigSearchAndList.FieldGroupName) : null; } } }
/// <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); }
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> /// Creates the specified definition. /// </summary> /// <param name="definition">The definition.</param> /// <param name="serialEntry">The serial entry.</param> /// <returns></returns> public static UPSerialEntrySourceRowInfo Create(Dictionary <string, string> definition, UPSerialEntry serialEntry) { string name = definition.ValueOrDefault("name"); if (name == null) { return(null); } var newObj = new UPSerialEntrySourceRowInfo(name, serialEntry); newObj.VerticalRows = false; string configName = definition.ValueOrDefault("configName") ?? name; string parameters = definition.ValueOrDefault("maxResults"); newObj.MaxResults = !string.IsNullOrEmpty(parameters) ? Convert.ToInt32(parameters) : 10; newObj.IgnoreSourceRecord = Convert.ToInt32(definition.ValueOrDefault("NoLink")) != 0; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; newObj.SearchAndList = configStore.SearchAndListByName(configName); if (newObj.SearchAndList == null) { return(null); } newObj.FieldControl = configStore.FieldControlByNameFromGroup("List", newObj.SearchAndList.FieldGroupName); if (newObj.FieldControl == null) { return(null); } if (!string.IsNullOrEmpty(newObj.SearchAndList.FilterName)) { newObj.Filter = configStore.FilterByName(newObj.SearchAndList.FilterName); if (!string.IsNullOrEmpty(newObj.Filter?.DisplayName)) { newObj.Label = newObj.Filter.DisplayName; } } List <string> columnNameArray = new List <string>(); List <UPConfigFieldControlField> columnDefArray = new List <UPConfigFieldControlField>(); foreach (FieldControlTab tab in newObj.FieldControl.Tabs) { foreach (UPConfigFieldControlField field in tab.Fields) { columnDefArray.Add(field); columnNameArray.Add(field.Label); } } newObj.ColumnDefs = columnDefArray; newObj.ColumnNames = columnNameArray; return(newObj); }
/// <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="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> /// Initializes a new instance of the <see cref="UPSurvey"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> /// <param name="recordIdentification">The record identification.</param> /// <param name="theDelegate">The delegate.</param> public UPSurvey(ViewReference viewReference, string recordIdentification, ISurveyDelegate theDelegate) { this.ViewReference = viewReference; this.RecordIdentification = recordIdentification; this.TheDelegate = theDelegate; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.SurveySearchAndList = configStore.SearchAndListByName(this.ViewReference.ContextValueForKey("SurveySearchAndListName")); this.SurveyTemplateFilter = configStore.FilterByName(this.ViewReference.ContextValueForKey("SurveyTemplateFilter")); this.SurveyAnswerSearchAndList = configStore.SearchAndListByName(this.ViewReference.ContextValueForKey("SurveyAnswerSearchAndListName")); this.SurveyAnswerTemplateFilter = configStore.FilterByName(this.ViewReference.ContextValueForKey("SurveyAnswerTemplateFilter")); this.ParentLink = this.ViewReference.ContextValueForKey("ParentLink"); this.SourceCopyFieldGroup = configStore.FieldControlByNameFromGroup("List", this.ViewReference.ContextValueForKey("SourceCopyFieldGroupName")); FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Edit", this.SurveyAnswerSearchAndList.FieldGroupName) ?? configStore.FieldControlByNameFromGroup("List", this.SurveyAnswerSearchAndList.FieldGroupName); foreach (FieldControlTab tab in fieldControl.Tabs) { foreach (UPConfigFieldControlField field in tab.Fields) { if (field.Function == Constants.QuestionnaireAnswer) { this.AnswerAnswerTextField = field; } else if (field.Function == Constants.QuestionnaireAnswerNumber) { this.AnswerAnswerNumberField = field; } else if (field.Function == Constants.QuestionnaireQuestionNumber) { this.AnswerQuestionNumberField = field; } } } this.QuestionnaireLinkName = this.ViewReference.ContextValueForKey("QuestionnaireLinkName"); this.SourceRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("SourceRequestOption"), UPRequestOption.FastestAvailable); this.DestinationRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("DestinationRequestOption"), UPRequestOption.BestAvailable); this.surveyAnswers = new Dictionary <string, UPSurveyAnswer>(); }
/// <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); }
private void InitializeBaseConfigStore(IConfigurationUnitStore configStore) { var configName = this.Configuration.ContextValueForKey("ArticleConfigName"); this.ArticleConfigurationSearchAndList = configStore.SearchAndListByName(configName); if (this.ArticleConfigurationSearchAndList == null) { throw new Exception("ArticleConfigurationSearchAndList is null"); } configName = this.Configuration.ContextValueForKey("QuotaConfigName"); this.QuotaSearchAndList = configStore.SearchAndListByName(configName); if (this.QuotaSearchAndList == null) { throw new Exception("QuotaSearchAndList is null"); } this.QuotaEditFieldControl = configStore.FieldControlByNameFromGroup("Edit", this.QuotaSearchAndList.FieldGroupName) ?? configStore.FieldControlByNameFromGroup("List", this.QuotaSearchAndList.FieldGroupName); }
/// <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> /// Populates filters and Identifiers for filter != Config1Filter /// </summary> /// <param name="configStore"> /// IConfigurationUnitStore /// </param> /// <param name="filters"> /// List<UPMFilter> /// </param> /// <param name="identifiers"> /// List<IIdentifier> /// </param> /// <param name="defaultRadiusMeter"> /// defaultRadiusMeter /// </param> private void PopulatePageFiltersAndIdentifiersForNonConfig1Filter( IConfigurationUnitStore configStore, List <UPMFilter> filters, List <IIdentifier> identifiers, int defaultRadiusMeter) { var infoAreaId = string.Empty; for (int configNo = 2; configNo < 99; configNo++) { var configNameKey = $"Config{configNo}Name"; var configName = ViewReference.ContextValueForKey(configNameKey); if (!string.IsNullOrWhiteSpace(configName)) { var configFilterKey = $"Config{configNo}Filter"; var geoFilter = ViewReference.ContextValueForKey(configFilterKey); var filter = UPMFilter.FilterForName(geoFilter) as UPMDistanceFilter; if (filter == null) { continue; } var expand = configStore.ExpandByName(configName); var imageName = expand.ImageName; var searchConfiguration = configStore.SearchAndListByName(configName); var colorKey = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ColorKey; if (string.IsNullOrWhiteSpace(imageName)) { imageName = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ImageName; } filter.ImageName = imageName; filter.ColorKey = colorKey; filter.Radius = (int)defaultRadiusMeter; filter.Active = true; usedFilters.SetObjectForKey(filter, configName); infoAreaId = (searchConfiguration != null) ? searchConfiguration.InfoAreaId : configName; identifiers.Add(new RecordIdentifier(infoAreaId, null)); filters.Add(filter); } else { break; } } }
/// <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="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="UPSEPricingBulkVolumes"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> /// <param name="theDelegate">The delegate.</param> /// <exception cref="InvalidOperationException">FieldControl is null</exception> public UPSEPricingBulkVolumes(ViewReference viewReference, UPSEPricingBulkVolumesDelegate theDelegate) { this.TheDelegate = theDelegate; string configName = viewReference.ContextValueForKey("BulkVolumeConfigName"); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (!string.IsNullOrEmpty(configName)) { this.SearchAndListConfig = configStore.SearchAndListByName(configName); if (this.SearchAndListConfig != null) { this.FieldControl = configStore.FieldControlByNameFromGroup("List", this.SearchAndListConfig.FieldGroupName); } } if (this.FieldControl == null) { throw new InvalidOperationException("FieldControl is null"); } this.ItemNumberFunctionName = viewReference.ContextValueForKey("BulkVolumeItemNumber"); if (string.IsNullOrEmpty(this.ItemNumberFunctionName)) { this.ItemNumberFunctionName = "ItemNumber"; } configName = viewReference.ContextValueForKey("BulkVolumeMatchFunctionNames"); if (!string.IsNullOrEmpty(configName)) { var parts = configName.Split(';'); List <UPSEPricingBulkVolumeMatch> otherMatches = new List <UPSEPricingBulkVolumeMatch>(parts.Length); otherMatches.AddRange(parts.Select(part => new UPSEPricingBulkVolumeMatch(part)).Where(otherMatch => otherMatch != null)); if (otherMatches.Count > 0) { this.otherBulkVolumeMatches = otherMatches; } } }
/// <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> /// Populates filters and Identifiers for filter = Config1Filter /// </summary> /// <param name="configStore"> /// IConfigurationUnitStore /// </param> /// <param name="filters"> /// List<UPMFilter> /// </param> /// <param name="identifiers"> /// List<IIdentifier> /// </param> /// <param name="defaultRadiusMeter"> /// defaultRadiusMeter /// </param> private void PopulatePageFiltersAndIdentifiersForConfig1Filter( IConfigurationUnitStore configStore, List <UPMFilter> filters, List <IIdentifier> identifiers, int defaultRadiusMeter) { var infoAreaId = string.Empty; var geoFilter1 = ViewReference.ContextValueForKey("Config1Filter"); var filter = UPMFilter.FilterForName(geoFilter1) as UPMDistanceFilter; if (filter != null) { var expand = configStore.ExpandByName(ConfigName); var imageName = expand.ImageName; var searchConfiguration = configStore.SearchAndListByName(ConfigName); infoAreaId = searchConfiguration != null ? searchConfiguration.InfoAreaId : ConfigName; if (string.IsNullOrWhiteSpace(imageName)) { imageName = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ImageName; } var colorKey = expand.ColorKey; if (string.IsNullOrWhiteSpace(colorKey)) { colorKey = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ColorKey; } filter.ImageName = imageName; filter.ColorKey = colorKey; filter.Radius = defaultRadiusMeter; filter.Active = true; usedFilters.SetObjectForKey(filter, ConfigName); filters.Add(filter); identifiers.Add(new RecordIdentifier(infoAreaId, null)); } }
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); }
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> /// Initializes a new instance of the <see cref="UPSEListingController"/> class. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="parameters">The parameters.</param> /// <param name="serialEntry">The serial entry.</param> /// <param name="theDelegate">The delegate.</param> public UPSEListingController(string recordIdentification, Dictionary <string, object> parameters, UPSerialEntry serialEntry, UPSEListingControllerDelegate theDelegate) { this.fastRequest = ServerSession.CurrentSession.IsEnterprise; this.LinkRecordIdentification = recordIdentification; this.RootRecordIdentification = recordIdentification; this.SerialEntry = serialEntry; string listingControlName = parameters.ValueOrDefault("ListingControlName") as string; string listingOwnerFieldGroupName = parameters.ValueOrDefault("ListingOwnerFieldGroupName") as string; string relatedListingOwnersConfigName = parameters.ValueOrDefault("RelatedListingOwnersConfigName") as string; string distinctListingFunctionNamesString = parameters.ValueOrDefault("DistinctListingFunctionNames") as string; this.rowColumnsForFunctionNames = new Dictionary <string, UPSEColumn>(); if (!string.IsNullOrEmpty(distinctListingFunctionNamesString)) { this.DistinctListingFunctionNames = distinctListingFunctionNamesString.Split(',').ToList(); } string listingApplyHierarchyString = parameters.ValueOrDefault("ApplyHierarchy") as string; if (!string.IsNullOrEmpty(listingControlName)) { List <UPSEListingFieldMatch> hierarchyItemArray = new List <UPSEListingFieldMatch>(); var hierarchyItemStrings = listingApplyHierarchyString.Split(';'); int index = 0; foreach (string itemStrings in hierarchyItemStrings) { if (string.IsNullOrEmpty(itemStrings)) { continue; } hierarchyItemArray.Add(new UPSEListingFieldMatch(index++, itemStrings)); } this.ListingFieldMatchHierarchy = hierarchyItemArray; } string destinationFieldFunctionNameString = parameters.ValueOrDefault("DestinationFieldFunctionNames") as string; if (!string.IsNullOrEmpty(destinationFieldFunctionNameString)) { this.DestinationFieldFunctionNames = destinationFieldFunctionNameString.Split(',').ToList(); } this.RootFieldValues = parameters.ValueOrDefault("RecordFieldValues") as Dictionary <string, object>; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ListingOwnerFieldGroup = configStore.FieldControlByNameFromGroup("List", listingOwnerFieldGroupName); this.RootListingOwnerMapping = this.ListingOwnerFieldGroup.FunctionNames(); this.RelatedListingOwnersSearch = configStore.SearchAndListByName(relatedListingOwnersConfigName); FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", this.RelatedListingOwnersSearch.FieldGroupName); this.ListingOwnerMapping = fieldControl.FunctionNames(); this.ListingSearch = configStore.SearchAndListByName(listingControlName); fieldControl = configStore.FieldControlByNameFromGroup("List", this.ListingSearch.FieldGroupName); this.ListingMapping = fieldControl.FunctionNames(); if (this.ListingMapping.Count > 0) { Dictionary <string, string> listingKeyForFieldKey = new Dictionary <string, string>(this.ListingMapping.Count); foreach (string key in this.ListingMapping.Keys) { UPConfigFieldControlField field = this.ListingMapping[key]; listingKeyForFieldKey[$"{field.InfoAreaId}.{field.FieldId}"] = key; } this.ListingFieldToKey = listingKeyForFieldKey; } this.TheDelegate = theDelegate; }
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 bool SetControlsFromParameters() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.DestinationFieldControl == null && !string.IsNullOrEmpty(this.DestinationFieldControlName)) { this.DestinationFieldControl = configStore.FieldControlByNameFromGroup(this.EditMode ? "Edit" : "List", this.DestinationFieldControlName); } if (this.DestinationFieldControl == null) { return(false); } List <UPConfigFieldControlField> addFields = new List <UPConfigFieldControlField>(); foreach (FieldControlTab tab in this.DestinationFieldControl.Tabs) { foreach (UPConfigFieldControlField field in tab.Fields) { switch (field.Function) { case Constants.FieldGroupString: this.DestinationGroupField = field; break; case Constants.FieldItemString: this.DestinationItemField = field; break; default: addFields.Add(field); break; } } } if (this.DestinationGroupField == null || this.DestinationItemField == null) { return(false); } if (addFields.Count > 0) { this.AdditionalFields = addFields; } if (!string.IsNullOrEmpty(this.GroupSearchAndListControlName)) { string infoAreaSpecificGroupSearchAndListControl = $"{this.GroupSearchAndListControlName}:{this.RecordIdentification.InfoAreaId()}"; this.GroupSearchAndListControl = configStore.SearchAndListByName(infoAreaSpecificGroupSearchAndListControl) ?? configStore.SearchAndListByName(this.GroupSearchAndListControlName); } if (!string.IsNullOrEmpty(this.ItemSearchAndListControlName)) { string infoAreaSpecificItemSearchAndListControl = $"{this.ItemSearchAndListControlName}:{this.RecordIdentification.InfoAreaId()}"; this.ItemSearchAndListControl = configStore.SearchAndListByName(infoAreaSpecificItemSearchAndListControl) ?? configStore.SearchAndListByName(this.ItemSearchAndListControlName); } if (!string.IsNullOrEmpty(this.SourceFieldControlName)) { this.SourceFieldControl = configStore.FieldControlByNameFromGroup("List", this.SourceFieldControlName); } return(true); }
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); }
/// <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"); }
/// <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); }
/// <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); }