/// <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; }
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> /// 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> /// Builds the page. /// </summary> protected override void BuildPage() { base.BuildPage(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; string rootTreeNodeName = this.ViewReference.ContextValueForKey("ConfigName"); if (!string.IsNullOrEmpty(rootTreeNodeName)) { this.rootTreeNode = configStore.TreeViewByName(rootTreeNodeName); } UPMCircleOfInfluencePage page = this.CreatePageInstance(); this.TopLevelElement = page; if (this.rootTreeNode == null) { SimpleIoc.Default.GetInstance <ILogger>().LogError($"No treeView found for configName: {rootTreeNodeName}"); return; } // Root FieldGroup string rootNodeExpandName = this.rootTreeNode.RootNode.ExpandName; this.ExpandSettings = configStore.ExpandByName(rootNodeExpandName) ?? configStore.ExpandByName(this.InfoAreaId); List <FieldControl> fieldControler = new List <FieldControl>(); FieldControl details = configStore.FieldControlByNameFromGroup("Details", this.ExpandSettings.FieldGroupName); if (details != null) { fieldControler.Add(details); } FieldControl miniDetails = configStore.FieldControlByNameFromGroup("MiniDetails", this.ExpandSettings.FieldGroupName); if (miniDetails != null) { fieldControler.Add(miniDetails); } if (fieldControler.Count > 0) { this.rootNodeFieldControl = new FieldControl(fieldControler); } this.ApplyViewConfigOnPage(page); page.Invalid = true; this.ApplyLoadingStatusOnPage(page); this.TopLevelElement = page; }
/// <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> /// 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 ContinueBuildDetailsOrganizerPage() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Details", this.ExpandConfig.FieldGroupName); this.TilesName = fieldControl.ValueForAttribute("tiles"); bool hasCopyFields = false; foreach (FieldControlTab tab in fieldControl.Tabs) { if (tab.Fields != null) { if (tab.Fields.Any(field => !string.IsNullOrEmpty(field.Function) && field.Function != "=")) { hasCopyFields = true; } } if (hasCopyFields) { break; } } if (!hasCopyFields) { this.ContinueWithCopyFieldsLoaded(null); } else { this.CopyFields = new UPCopyFields(fieldControl); this.CopyFields.CopyFieldValuesForRecordIdentification(this.RecordIdentification, false, this); } }
/// <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> /// 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); }
private bool CreateParentControllerFromLinkReader(UPCRMLinkReader linkReader) { int tabIndex; UPConfigFieldControlField field = this.LinkFields[linkReader.DestinationPosition]; string fieldGroupName = field.InfoAreaId; tabIndex = 0; string fieldStyle = field.Attributes.FieldStyle; if (!string.IsNullOrEmpty(fieldStyle)) { var parts = fieldStyle.Split('_'); if (parts.Length > 1) { tabIndex = Convert.ToInt32(parts[1]); fieldGroupName = parts[0]; } else { fieldGroupName = fieldStyle; } } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ParentFieldControl = configStore.FieldControlByNameFromGroup("Details", fieldGroupName); if (this.ParentFieldControl == null && fieldGroupName == field.InfoAreaId) { this.ParentFieldControl = configStore.FieldControlByNameFromGroup("Details", field.InfoAreaId); } if (this.ParentFieldControl == null) { return(false); } if (tabIndex >= this.ParentFieldControl.NumberOfTabs) { tabIndex = 0; } this.ParentController = UPGroupModelController.DetailsGroupModelController(this.ParentFieldControl, tabIndex, this); this.ParentController.ExplicitLabel = this.TabLabel; return(true); }
/// <summary> /// Initializes a new instance of the <see cref="EditChildrenGroupModelController"/> 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> /// <exception cref="Exception"> /// TabConfig is null /// or /// ChildFieldControl is null /// </exception> public EditChildrenGroupModelController(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate) : base(fieldControl, tabIndex, editPageContext, theDelegate) { FieldControlTab tabConfig = fieldControl.TabAtIndex(tabIndex); if (tabConfig == null) { throw new Exception("TabConfig is null"); } var typeParts = tabConfig.Type.Split('_'); if (typeParts.Length > 1) { string detailsConfigurationName = (string)typeParts[1]; var configNameParts = detailsConfigurationName.Split('#'); if (configNameParts.Length > 1) { this.LinkId = Convert.ToInt32(configNameParts[1]); detailsConfigurationName = configNameParts[0]; } IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ChildFieldControl = configStore.FieldControlByNameFromGroup("Edit", detailsConfigurationName); if (this.ChildFieldControl.NumberOfTabs > 1) { this.ChildFieldControl = this.ChildFieldControl.FieldControlWithSingleTab(0); } this.ChildInfoAreaId = this.ChildFieldControl.InfoAreaId; if (typeParts.Length > 2) { UPConfigFilter templateFilter = configStore.FilterByName((string)typeParts[2]); if (templateFilter != null) { templateFilter = templateFilter.FilterByApplyingReplacements(UPConditionValueReplacement.DefaultParameters); this.initialValues = templateFilter.FieldsWithConditions(false); } } } else if (tabConfig.NumberOfFields > 0) { UPConfigFieldControlField childField = tabConfig.FieldAtIndex(0); this.ChildInfoAreaId = childField.InfoAreaId; this.LinkId = childField.LinkId; this.ChildFieldControl = fieldControl.FieldControlWithSingleTabRootInfoAreaIdRootLinkId(tabIndex, this.ChildInfoAreaId, this.LinkId); } else { this.ChildFieldControl = null; } if (this.ChildFieldControl == null) { throw new Exception("ChildFieldControl is null"); } }
private void LoadItems() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.ItemSearchAndListControl != null) { this.ItemFieldControl = configStore.FieldControlByNameFromGroup("List", this.ItemSearchAndListControl.FieldGroupName); UPConfigFilter filter = null; UPConfigFilter groupFilter = null; if (!string.IsNullOrEmpty(this.GroupSearchAndListControl?.FilterName)) { groupFilter = configStore.FilterByName(this.GroupSearchAndListControl.FilterName); if (groupFilter != null && this.sourceFieldDictionary != null) { groupFilter = groupFilter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary)); } } if (!string.IsNullOrEmpty(this.ItemSearchAndListControl.FilterName)) { filter = configStore.FilterByName(this.ItemSearchAndListControl.FilterName); if (filter != null && this.sourceFieldDictionary != null) { filter = filter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary)); } } UPConfigFieldControlField groupField = this.ItemFieldControl.FieldWithFunction(Constants.FieldGroupString); UPConfigFieldControlField itemField = this.ItemFieldControl.FieldWithFunction(Constants.FieldItemString); if (this.ItemFieldControl != null && groupField != null && itemField != null) { this.crmQuery = new UPContainerMetaInfo(this.ItemFieldControl); if (groupFilter != null) { this.crmQuery.ApplyFilter(groupFilter); } if (filter != null) { this.crmQuery.ApplyFilter(filter); } this.currentQueryType = 1; this.crmQuery.Find(this.SourceRequestOption, this); } else { this.HandleGroupsWithAllItems(this.Groups); } } else { this.HandleGroupsWithAllItems(this.Groups); } }
/// <summary> /// Builds the page. /// </summary> public override void BuildPage() { this.ConfigName = this.ViewReference.ContextValueForKey("ConfigName"); this.ConfigTabNr = Convert.ToInt32(this.ViewReference.ContextValueForKey("ConfigTabNr")); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; Form form = configStore.FormByName(this.ConfigName); this.formtab = null; MDashboardPage _page = (MDashboardPage)this.InstantiatePage(); if (this.ConfigTabNr < form.NumberOfTabs) { if (this.ConfigTabNr < 0) { this.ConfigTabNr = 0; } this.formtab = form.TabAtIndex(this.ConfigTabNr); } else { this.Logger.LogError($"Configured ConfigTabNr {this.ConfigTabNr} is larger than the number of available tabs {form.NumberOfTabs}"); // DDLogError("Configured ConfigTabNr (%ld) is larger than the number of available tabs (%lu)", (long)this.ConfigTabNr, (unsigned long)form.NumberOfTabs()); return; } _page.LabelText = !string.IsNullOrWhiteSpace(this.formtab.Label) ? this.formtab.Label : "*** FormTab Label Missing ***"; _page.Invalid = true; this.TopLevelElement = _page; string copyRecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); string copyFieldGroupName = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName"); this.copyFields = null; if (copyRecordIdentification.IsRecordIdentification() && !string.IsNullOrWhiteSpace(copyFieldGroupName)) { FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", copyFieldGroupName); if (fieldControl != null) { this.copyFields = new UPCopyFields(fieldControl); } } if (this.copyFields != null) { this.copyFields.CopyFieldValuesForRecordIdentification(copyRecordIdentification, false, this); } else { this.ContinueWithCopyFields(null); } }
/// <summary> /// Initializes a new instance of the <see cref="UPSearchPageModelControllerPreparedSearch"/> class. /// </summary> /// <param name="infoAreaId"> /// The info area id. /// </param> /// <param name="quickSearchEntries"> /// The quick search entries. /// </param> public UPSearchPageModelControllerPreparedSearch(string infoAreaId, List <QuickSearchEntry> quickSearchEntries) { this.InfoAreaId = infoAreaId; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.DetailAction = configStore.MenuByName(@"SHOWRECORD"); this.ListFieldControl = configStore.FieldControlByNameFromGroup(@"List", this.InfoAreaId); this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(@"MiniDetails", this.InfoAreaId); this.CombinedControl = this.DropdownFieldControl == null ? this.ListFieldControl : new FieldControl( new List <FieldControl> { this.ListFieldControl, this.DropdownFieldControl }); this.QuickSearchEntries = quickSearchEntries; this.ExpandSettings = configStore.ExpandByName(this.InfoAreaId); this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters"); }
/// <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>(); }
private void LoadGroups() { this.Groups = new List <UPCharacteristicsGroup>(); this.groupDict = new Dictionary <string, UPCharacteristicsGroup>(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.GroupSearchAndListControl != null) { this.GroupFieldControl = configStore.FieldControlByNameFromGroup("List", this.GroupSearchAndListControl.FieldGroupName); UPConfigFilter filter = null; if (!string.IsNullOrEmpty(this.GroupSearchAndListControl.FilterName)) { filter = configStore.FilterByName(this.GroupSearchAndListControl.FilterName); if (filter != null && this.sourceFieldDictionary != null) { filter = filter.FilterByApplyingReplacements(new UPConditionValueReplacement(this.sourceFieldDictionary)); } } UPConfigFieldControlField groupField = this.GroupFieldControl.FieldWithFunction(Constants.FieldGroupString); if (this.GroupFieldControl != null && groupField != null) { this.crmQuery = new UPContainerMetaInfo(this.GroupFieldControl); if (filter != null) { this.crmQuery.ApplyFilter(filter); } this.currentQueryType = 0; this.crmQuery.Find(this.SourceRequestOption, this); } } else { bool showAdditionalFields = !configStore.ConfigValueIsSet("Characteristics.HideAdditionalFields"); bool showExpanded = !configStore.ConfigValueIsSet("Characteristics.CollapseGroups"); UPCatalog catalog = UPCRMDataStore.DefaultStore.CatalogForCrmField(this.DestinationGroupField.Field); foreach (string key in catalog.SortedValues) { UPCharacteristicsGroup group = new UPCharacteristicsGroup(catalog.TextValueForKey(key), key, false, this, showExpanded); if (showAdditionalFields) { group.ShowAdditionalFields = true; } this.groupDict[key] = group; this.Groups.Add(group); } this.LoadItems(); } }
private void SetupColumnDestinationFieldGroupName( Dictionary <string, object> dict, IConfigurationUnitStore configStore, int nextColumn, UPSERowConfiguration defaultConfiguration, List <UPSEColumn> columnArray) { var destinationColumnFieldGroupName = dict.ValueOrDefault("DestFG") as string; FieldControl destFieldControl = null; if (!string.IsNullOrWhiteSpace(destinationColumnFieldGroupName)) { destFieldControl = configStore.FieldControlByNameFromGroup("Edit", destinationColumnFieldGroupName); } if (destFieldControl != null) { var destColumnDictionary = new Dictionary <string, UPSEColumn>(); for (var i = nextColumn; i < defaultConfiguration.Columns.Count; i++) { var column = defaultConfiguration.Columns[i]; if (!(column is UPSEDestinationColumn)) { break; } destColumnDictionary[column.CrmField.FieldIdentification] = column; } var tab = destFieldControl.TabAtIndex(0); foreach (var field in tab.Fields) { if (destColumnDictionary.ValueOrDefault(field.Field.FieldIdentification) is UPSEDestinationColumn column) { columnArray.Add(new UPSEDestinationColumn(field, column)); } } } else { for (var i = nextColumn; i < defaultConfiguration.Columns.Count; i++) { var column = defaultConfiguration.Columns[i]; if (!(column is UPSEDestinationColumn)) { break; } columnArray.Add(column); } } }
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> /// Initializes a new instance of the <see cref="UPParentDetailsGroupModelController"/> class. /// </summary> /// <param name="fieldControl">The field control.</param> /// <param name="tabIndex">Index of the tab.</param> /// <param name="theDelegate">The delegate.</param> public UPParentDetailsGroupModelController(FieldControl fieldControl, int tabIndex, IGroupModelControllerDelegate theDelegate) : base(fieldControl, tabIndex, theDelegate) { var typeParts = this.TabConfig.Type.Split('_'); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (typeParts.Length > 1) { string fieldGroupName; var configParts = ((string)typeParts[1]).Split('#'); if (configParts.Length > 1) { fieldGroupName = configParts[0]; this.LinkId = Convert.ToInt32(configParts[1]); } else { fieldGroupName = (string)typeParts[1]; this.LinkId = -1; } int parentTabIndex; if (typeParts.Length > 2) { parentTabIndex = Convert.ToInt32(typeParts[2]); if (parentTabIndex >= 1) { parentTabIndex--; } } else { parentTabIndex = 0; } this.ParentFieldControl = configStore.FieldControlByNameFromGroup("Details", fieldGroupName); if (this.ParentFieldControl.NumberOfTabs <= parentTabIndex || parentTabIndex < 0) { parentTabIndex = 0; } this.ParentFieldControl = this.ParentFieldControl.FieldControlWithSingleTab(parentTabIndex); this.ParentController = DetailsGroupModelController(this.ParentFieldControl, 0, this); this.ParentController.RootTabIndex = this.RootTabIndex; this.ParentController.ExplicitLabel = this.TabLabel; } else { this.LinkFields = fieldControl.TabAtIndex(tabIndex).Fields; } }
/// <summary> /// Updates the element for calendar group. /// </summary> /// <param name="origDetailGroup">The original detail group.</param> /// <returns></returns> public override UPMCalendarPopoverGroup UpdateElementForCalendarGroup(UPMCalendarPopoverGroup origDetailGroup) { if (!(origDetailGroup.Context is ResultRowCalendarItem)) { return(base.UpdateElementForCalendarGroup(origDetailGroup)); } if (origDetailGroup.Invalid) { ResultRowCalendarItem calendarItem = (ResultRowCalendarItem)origDetailGroup.Context; UPCoreMappingResultContext resultContext = calendarItem.ResultContext; TimelineSearch timelineSearch = (TimelineSearch)resultContext.Context; string sourceCopyFieldGroupName = timelineSearch.FieldGroupName; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; FieldControl sourceFieldControl = configStore.FieldControlByNameFromGroup("Details", sourceCopyFieldGroupName) ?? configStore.FieldControlByNameFromGroup("MiniDetails", sourceCopyFieldGroupName); this.Loader = new UPCalendarPopoverLoader(this); this.Loader.LoadElementForCalendarGroupFieldControl(origDetailGroup, sourceFieldControl); } return(origDetailGroup); }
/// <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); }
/// <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> /// Loads the documents with maximum results. /// </summary> /// <param name="maxResults">The maximum results.</param> public void LoadDocumentsWithMaxResults(int maxResults) { if (this.Record != null) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.documentFieldControl = configStore.FieldControlByNameFromGroup("List", "D3DocData"); UPContainerMetaInfo containerMetaInfo = new UPContainerMetaInfo(this.documentFieldControl); containerMetaInfo.SetLinkRecordIdentification(this.Record.OriginalRecordIdentification, 127); if (maxResults > 0) { containerMetaInfo.MaxResults = maxResults; } Operation operation = containerMetaInfo.Find(this.Group.Objectives.RequestOption, this); if (operation == null) { //DDLogError("Could not create operation for loading documents.{}"); Logger.LogError($"Could not create operation for loading documents. {this.Group.Objectives.RequestOption.ToString()}"); } } }
/// <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> /// Initializes a new instance of the <see cref="UPInBoxPageModelController"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> public UPInBoxPageModelController(ViewReference viewReference) : base(viewReference) { UPMInBoxPage page = new UPMInBoxPage(StringIdentifier.IdentifierWithStringId("Inbox")) { Invalid = true, SkipUploadIfPossible = viewReference.ContextValueIsSet("SkipUploadPageIfPossible") }; this.removeUploadedFileFromInbox = viewReference.ContextValueIsSet("RemoveUploadedFile"); this.TopLevelElement = page; this.editFieldContexts = new Dictionary <StringIdentifier, UPEditFieldContext>(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; FieldControl editFieldControl = configStore.FieldControlByNameFromGroup("Edit", viewReference.ContextValueForKey("UploadFields")); UPMGroup uploadFieldGroup = new UPMGroup(StringIdentifier.IdentifierWithStringId("uploadFieldGroup")); if (editFieldControl != null) { int numberOfFields = editFieldControl.NumberOfFields; for (int index = 0; index < numberOfFields; index++) { UPConfigFieldControlField field = editFieldControl.FieldAtIndex(index); StringIdentifier fieldIdentifier = StringIdentifier.IdentifierWithStringId($"Field {field.FieldId} {field.InfoAreaId}"); UPEditFieldContext initialValueEditField = UPEditFieldContext.FieldContextFor(field, fieldIdentifier, null, (List <UPEditFieldContext>)null); this.editFieldContexts[fieldIdentifier] = initialValueEditField; if (field.Function == "Filename") { page.FileNameEditField = initialValueEditField.EditField; } uploadFieldGroup.AddField(initialValueEditField.EditField); } } this.recordIdentification = this.ViewReference.ContextValueForKey("RecordId"); page.UploadFieldGroup = uploadFieldGroup; // load directly this.UpdatedElement(page); }
/// <summary> /// Results for row row. /// </summary> /// <param name="_serialEntry">The serial entry.</param> /// <param name="row">The row.</param> /// <returns></returns> public UPCRMResult ResultForRowRow(UPSerialEntry _serialEntry, UPSERow row) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; FieldControl documentFieldControl = configStore.FieldControlByNameFromGroup("List", "D1DocData"); UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(documentFieldControl); UPConfigFilter filter = configStore.FilterByName(this.FilterName); if (filter != null) { Dictionary <string, object> valuesForFunction = new Dictionary <string, object>(); Dictionary <string, UPSEColumn> columnsForFunction = _serialEntry.DestColumnsForFunction; foreach (string functionName in columnsForFunction.Keys) { UPSEColumn column = columnsForFunction.ValueOrDefault(functionName) ?? columnsForFunction.ValueOrDefault($"$par{functionName}"); if (column != null) { string value = row.StringValueAtIndex(column.Index); if (!string.IsNullOrEmpty(value)) { valuesForFunction.SetObjectForKey(value, functionName); } } } UPConfigFilter replacedFilter = filter.FilterByApplyingValueDictionaryDefaults(valuesForFunction, true); crmQuery.ApplyFilter(replacedFilter); } else { crmQuery.MaxResults = 10; } UPCRMResult crmResult = crmQuery.Find(); return(crmResult); }
private void ProcessDetailsControl(IConfigurationUnitStore configStore) { this.detailsControl = configStore.FieldControlByNameFromGroup("Details", this.ExpandConfig?.FieldGroupName); if (this.ExpandConfig == null) { this.ExpandConfig = configStore.ExpandByName(this.configName); } int tabCount = this.detailsControl?.NumberOfTabs ?? 0; this.ClearGroupControllers(); for (int i = 0; i < tabCount; i++) { var groupModelController = UPGroupModelController.DetailsGroupModelController(this.detailsControl, i, this); if (groupModelController != null) { this.GroupModelControllerArray.Add(groupModelController); } } }
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); }