/// <summary>
        /// Returns collection of filter
        /// </summary>
        /// <param name="configStore">
        /// <see cref="IConfigurationUnitStore"/>
        /// </param>
        /// <returns>
        /// List of <see cref="UPConfigFilter"/>
        /// </returns>
        private List <UPConfigFilter> GetFilterArray(IConfigurationUnitStore configStore)
        {
            var filterArray = new List <UPConfigFilter>();

            for (var number = 1; number <= FilterKeyCount; number++)
            {
                var filterName = ViewReference.ContextValueForKey($"Filter{number}");

                if (!string.IsNullOrWhiteSpace(filterName))
                {
                    var filter = configStore.FilterByName(filterName);
                    filterArray.Add(filter);
                }
                else
                {
                    filterArray.Add(null);
                }
            }

            var addFilters = ViewReference.ContextValueForKey(KeyAdditionalFilter);

            if (!string.IsNullOrWhiteSpace(addFilters))
            {
                var filterParts = addFilters.Split(';');
                foreach (var filterPart in filterParts)
                {
                    var filter = !string.IsNullOrWhiteSpace(filterPart) ? configStore.FilterByName(filterPart) : null;
                    filterArray.Add(filter);
                }
            }

            return(filterArray);
        }
Esempio n. 2
0
        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>
        /// Initializes a new instance of the <see cref="UPCRMOfflineDocumentRecordCreator"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="noD3Link">The no d3 link.</param>
        public UPCRMOfflineDocumentRecordCreator(ViewReference viewReference, string noD3Link)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string val = viewReference.ContextValueForKey("DocumentTemplateFilter");

            if (!string.IsNullOrEmpty(val))
            {
                this.TemplateFilter = configStore.FilterByName(val);
                if (this.TemplateFilter != null)
                {
                    this.TemplateFilter = this.TemplateFilter.FilterByApplyingDefaultReplacements();
                }
            }

            val = viewReference.ContextValueForKey("DocumentLinkTemplateFilter");
            if (!string.IsNullOrEmpty(val))
            {
                this.LinkTemplateFilter = configStore.FilterByName(val);
                if (this.LinkTemplateFilter != null)
                {
                    this.LinkTemplateFilter = this.LinkTemplateFilter.FilterByApplyingDefaultReplacements();
                }
            }

            val = viewReference.ContextValueForKey("RecordLinkId");
            this.RecordLinkId = !string.IsNullOrEmpty(val) ? Convert.ToInt32(val) : 126;

            val = viewReference.ContextValueForKey("DocumentLinkLinkId");
            if (!string.IsNullOrEmpty(val))
            {
                this.DocumentLinkLinkId = Convert.ToInt32(val);
            }
            else
            {
                this.DocumentLinkLinkId = -1;
            }

            if (string.IsNullOrEmpty(noD3Link))
            {
                this.DocumentLinkInfoAreaId = viewReference.ContextValueForKey("DocumentLinkInfoAreaId");
                if (!string.IsNullOrEmpty(this.DocumentLinkInfoAreaId))
                {
                    if (this.DocumentLinkInfoAreaId == "nolink")
                    {
                        this.DocumentLinkInfoAreaId = null;
                    }
                }
                else
                {
                    this.DocumentLinkInfoAreaId = "D3";
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCalendarSearch"/> class.
        /// </summary>
        /// <param name="preparedSearch">
        /// The prepared search.
        /// </param>
        public UPCalendarSearch(UPSearchPageModelControllerPreparedSearch preparedSearch)
        {
            this.PreparedSearch = preparedSearch;
            ViewReference viewRef = preparedSearch.CalendarPageInfoArea.ViewReference;

            if (viewRef != null)
            {
                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                string repFilterName = viewRef.ContextValueForKey("RepFilter");
                this.RepFilter = configStore.FilterByName(repFilterName);
                var filterIndexMapping = new Dictionary <string, UPConfigFilter>();

                for (int i = 1; i < 6; i++)
                {
                    string filterName = viewRef.ContextValueForKey($"Filter{i}");
                    if (!string.IsNullOrEmpty(filterName))
                    {
                        UPConfigFilter filter = configStore.FilterByName(filterName);
                        if (filter != null)
                        {
                            filterIndexMapping[i.ToString()] = filter;
                        }
                    }
                }

                string addIndex = viewRef.ContextValueForKey("AdditionalFilter");
                if (!string.IsNullOrEmpty(addIndex))
                {
                    int filterIndex = 6;
                    var parts       = addIndex.Split(';');

                    foreach (string part in parts)
                    {
                        if (part.Length > 0)
                        {
                            UPConfigFilter filter = configStore.FilterByName(part);
                            if (filter != null)
                            {
                                filterIndexMapping[filterIndex.ToString()] = filter;
                            }
                        }

                        ++filterIndex;
                    }
                }

                this.FilterIndexMapping = filterIndexMapping;
            }
        }
Esempio n. 5
0
        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>
        /// Loads the specified request option.
        /// </summary>
        /// <param name="requestOption">The request option.</param>
        /// <param name="currencyDelegate">The currency delegate.</param>
        /// <returns></returns>
        public bool Load(UPRequestOption requestOption, ICurrencyConversionDelegate currencyDelegate)
        {
            if (this.CurrencyDelegate != null)
            {
                return(false);
            }

            this.CurrencyDelegate = currencyDelegate;
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(this.SearchAndListConfigName);
            UPConfigFilter          filter        = null;

            if (searchAndList != null)
            {
                filter = configStore.FilterByName(searchAndList.FilterName);
            }

            this.fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName);
            if (this.fieldControl != null)
            {
                this.crmQuery = new UPContainerMetaInfo(this.fieldControl, filter, null);
            }

            if (this.crmQuery == null)
            {
                this.CurrencyDelegate = null;
                this.crmQuery         = null;
                currencyDelegate.CurrencyConversionDidFailWithError(this, new Exception($"invalid searchAndList configuration {this.SearchAndListConfigName}"));
                return(true);
            }

            this.crmQuery.Find(requestOption, this);
            return(true);
        }
        /// <summary>
        /// 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>
        /// 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");
            }
        }
Esempio n. 10
0
        /// <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>();
        }
Esempio n. 11
0
        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();
            }
        }
        /// <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);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSerialEntryDocuments"/> class.
        /// </summary>
        /// <param name="_name">The name.</param>
        /// <param name="_filterName">Name of the filter.</param>
        /// <param name="_style">The style.</param>
        /// <param name="_addPhotoDirectButtonName">Name of the add photo direct button.</param>
        /// <param name="_hasDocumentsColumnFunctionName">Name of the has documents column function.</param>
        /// <param name="_hasDocumentsColumnValue">The has documents column value.</param>
        /// <param name="_serialEntry">The serial entry.</param>
        UPSerialEntryDocuments(string _name, string _filterName, string _style, string _addPhotoDirectButtonName,
                               string _hasDocumentsColumnFunctionName, string _hasDocumentsColumnValue, UPSerialEntry _serialEntry)
        {
            this.Name        = _name;
            this.SerialEntry = _serialEntry;
            this.FilterName  = _filterName;
            this.Style       = _style;
            this.AddPhotoDirectButtonName       = _addPhotoDirectButtonName;
            this.HasDocumentsColumnFunctionName = _hasDocumentsColumnFunctionName;
            this.HasDocumentsColumnValue        = _hasDocumentsColumnValue;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPConfigFilter          filter      = configStore.FilterByName(this.FilterName);

            if (!string.IsNullOrEmpty(filter?.DisplayName))
            {
                this.Label = filter.DisplayName;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMRecordTile"/> class.
        /// </summary>
        /// <param name="tiles">The tiles.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="menuAction">The menu action.</param>
        /// <exception cref="Exception">
        /// RecordIdentification is null
        /// or
        /// TableCaptionName is null
        /// </exception>
        public UPCRMRecordTile(UPCRMTiles tiles, ViewReference viewReference, Dictionary <string, object> parameters, Menu menuAction)
            : base(tiles, viewReference, parameters, menuAction)
        {
            this.tableCaptionName     = this.ViewReference.ContextValueForKey("tableCaption");
            this.recordIdentification = this.ViewReference.ContextValueForKey("uid");
            string imageMapFilterName           = this.ViewReference.ContextValueForKey("imageMapFilter");
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            if (string.IsNullOrEmpty(this.recordIdentification))
            {
                throw new Exception("RecordIdentification is null");
            }

            if (!string.IsNullOrEmpty(this.tableCaptionName))
            {
                this.tableCaption = configStore.TableCaptionByName(this.tableCaptionName);
            }

            if (this.tableCaption == null)
            {
                if (string.IsNullOrEmpty(this.tableCaptionName))
                {
                    throw new Exception("TableCaptionName is null");
                }
            }

            if (!string.IsNullOrEmpty(imageMapFilterName))
            {
                this.imageFilter = configStore.FilterByName(imageMapFilterName);
                this.imageFilter = this.imageFilter?.FilterByApplyingValueDictionaryDefaults(this.Parameters, true);

                if (this.imageFilter != null)
                {
                    this.catalogAttributes = configStore.CatalogAttributesByFilter(this.imageFilter);
                    if (this.catalogAttributes != null)
                    {
                        this.crmQuery?.AddCrmFields(new List <UPCRMField> {
                            this.catalogAttributes.CrmField
                        });
                    }
                }
            }
        }
Esempio n. 15
0
        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>
        /// 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);
        }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuestionnaireEditPageModelController"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        public QuestionnaireEditPageModelController(ViewReference viewReference)
            : base(viewReference)
        {
            this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId");
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string configValue = this.ViewReference.ContextValueForKey("ConfirmButtonName");

            if (!string.IsNullOrEmpty(configValue))
            {
                this.ConfirmationButton = configStore.ButtonByName(configValue);
            }

            configValue = this.ViewReference.ContextValueForKey("ConfirmedFilterName");
            if (!string.IsNullOrEmpty(configValue))
            {
                this.ConfirmedFilter = configStore.FilterByName(configValue);
            }

            this.Readonly      = this.ViewReference.ContextValueIsSet("ReadOnly") || this.ViewReference.ContextValueIsSet("QuestionnaireReadOnly");
            this.Survey        = new UPSurvey(this.ViewReference, this.RecordIdentification, this);
            this.PortfolioMode = this.ViewReference.ContextValueIsSet("Portfolio");
            this.BuildPage();
        }
        private bool SetControlsFromParametersEditMode(Dictionary <string, object> parameters, bool editMode)
        {
            IConfigurationUnitStore configStore       = ConfigurationUnitStore.DefaultStore;
            string destinationFieldgroupParameterName = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterDestinationFieldGroupConfigurationName, this.SectionName);
            string configName = this.ContextValueForViewReferenceKeyParameters(this.ViewReference, destinationFieldgroupParameterName, parameters);

            if (!string.IsNullOrEmpty(configName))
            {
                if (editMode)
                {
                    FieldControl listFieldControl = configStore.FieldControlByNameFromGroup(Constants.ListConfigurationName, configName);
                    this.DestinationFieldControl = configStore.FieldControlByNameFromGroup(Constants.EditConfigurationName, configName);
                    if (listFieldControl?.CrmSortFields != null)
                    {
                        this.DestinationFieldControl = new FieldControl(this.DestinationFieldControl, listFieldControl);
                    }
                }
                else
                {
                    this.DestinationFieldControl = configStore.FieldControlByNameFromGroup(Constants.ListConfigurationName, configName);
                }
            }

            if (this.DestinationFieldControl == null)
            {
                return(false);
            }

            List <UPConfigFieldControlField> addFields = new List <UPConfigFieldControlField>();
            Dictionary <string, UPConfigFieldControlField> tempFieldDictionary = new Dictionary <string, UPConfigFieldControlField>();

            this.FieldsWithFunction = new Dictionary <string, UPConfigFieldControlField>();
            foreach (FieldControlTab tab in this.DestinationFieldControl.Tabs)
            {
                foreach (UPConfigFieldControlField field in tab.Fields)
                {
                    FieldAttributes fieldAttributes = field.Attributes;
                    if (!fieldAttributes.Hide)
                    {
                        addFields.Add(field);
                    }

                    if (!string.IsNullOrEmpty(field.Function))
                    {
                        tempFieldDictionary[field.Function] = field;
                    }
                }

                this.FieldsWithFunction = new Dictionary <string, UPConfigFieldControlField>(tempFieldDictionary);
                this.AdditionalFields   = new List <UPConfigFieldControlField>(addFields);
            }

            configName = this.ContextValueForViewReferenceKeyParameters(this.ViewReference, CombineConfigurationNameWithSection(Constants.ParameterSourceFieldControlConfigurationName, this.SectionName), parameters);
            if (!string.IsNullOrEmpty(configName))
            {
                this.SourceFieldControl = configStore.FieldControlByNameFromGroup(Constants.ListConfigurationName, configName);
            }

            string destinationFilterParameterName = CombineConfigurationNameWithSection(Constants.ParameterDestinationFilterConfigurationName, this.SectionName);

            this.DestinationFilterName = this.ContextValueForViewReferenceKeyParameters(this.ViewReference, destinationFilterParameterName, parameters);
            UPConfigFilter filter = configStore.FilterByName(this.DestinationFilterName);

            if (filter != null)
            {
                this.SectionHeaderLabel = filter.DisplayName;
            }

            configName = this.ViewReference?.ContextValueForKey("ExecuteActionFilterName");
            if (!string.IsNullOrEmpty(configName))
            {
                this.ExecuteActionFilter = configStore.FilterByName(configName);
            }

            return(true);
        }
Esempio n. 19
0
        private void ContinueLoadWithFieldValueDictionary(Dictionary <string, object> fieldValueDictionary)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            if (fieldValueDictionary != null)
            {
                if (this.copyFieldsDictionary == null)
                {
                    this.copyFieldsDictionary = new Dictionary <string, Dictionary <string, object> >();
                }

                this.copyFieldsDictionary.SetObjectForKey(fieldValueDictionary, this.currentSectionConfiguration.SourceFieldControl.UnitName);
            }

            this.currentCopyFields = null;
            FieldControl   destinationFieldControl = this.currentSectionConfiguration.DestinationFieldControl;
            string         destinationFilterName   = this.currentSectionConfiguration.DestinationFilterName;
            UPConfigFilter companyRelatedFilter    = null;

            if (this.companyRelated)
            {
                string companyFilterName = $"{destinationFieldControl.InfoAreaId}.CompanyRelated";
                companyRelatedFilter = configStore.FilterByName(companyFilterName);
            }

            UPContainerMetaInfo container = new UPContainerMetaInfo(destinationFieldControl);

            container.SetLinkRecordIdentification(this.rootRecordIdentification);
            List <UPConfigFilter> appliedFilters = new List <UPConfigFilter>();
            UPConfigFilter        filter         = configStore.FilterByName(destinationFilterName);

            if (filter != null)
            {
                filter = filter.FilterByApplyingReplacements(UPConditionValueReplacement.ReplacementsFromValueParameterDictionary(fieldValueDictionary));
                container.ApplyFilter(filter);
                appliedFilters.Add(filter);
            }

            if (companyRelatedFilter != null && this.currentSectionConfiguration.SourceFieldControl != null)
            {
                companyRelatedFilter = companyRelatedFilter.FilterByApplyingReplacements(new UPConditionValueReplacement(fieldValueDictionary));
                container.ApplyFilter(companyRelatedFilter);
                appliedFilters.Add(companyRelatedFilter);
            }

            this.objectivesForRecordOperation = null;
            this.rightFilterOperation         = null;
            this.filterLoaded = true;
            if (this.RightsFilter != null && this.filterItemsResult == null)
            {
                this.filterLoaded = false;
            }

            if (this.currentSectionConfiguration.ExecuteActionFilter != null)
            {
                this.currentSectionConfiguration.ExecuteActionFilter = this.currentSectionConfiguration.ExecuteActionFilter.FilterByApplyingValueDictionaryDefaults(fieldValueDictionary, true);
                if (this.currentSectionConfiguration.ExecuteActionFilter != null)
                {
                    this.currentSectionConfiguration.FilterBasedDecision = new UPCRMFilterBasedDecision(this.currentSectionConfiguration.ExecuteActionFilter);
                    List <UPCRMField> fields = this.currentSectionConfiguration.FilterBasedDecision.FieldDictionary.Values.ToList();
                    if (fields.Count > 0)
                    {
                        container.AddCrmFields(fields);
                    }

                    this.currentSectionConfiguration.FilterBasedDecision.UseCrmQuery(container);
                }
            }

            this.objectivesForRecordOperation = container.Find(this.RequestOption, this);
            if (this.objectivesForRecordOperation == null)
            {
                SimpleIoc.Default.GetInstance <ILogger>().LogError("Could not create operation for loading objectives.");
                this.FailWithError(new Exception("ConnectionOfflineError"));
            }

            if (this.RightsFilter != null && this.filterItemsResult == null)
            {
                UPContainerMetaInfo clonedContainer = new UPContainerMetaInfo(new List <UPCRMField>(), destinationFieldControl.InfoAreaId);
                clonedContainer.SetLinkRecordIdentification(this.rootRecordIdentification);
                clonedContainer.ApplyFilter(this.RightsFilter);
                foreach (UPConfigFilter filter1 in appliedFilters)
                {
                    clonedContainer.ApplyFilter(filter1);
                }

                this.rightFilterOperation = clonedContainer.Find(this.RequestOption, this);
                if (this.rightFilterOperation == null)
                {
                    SimpleIoc.Default.GetInstance <ILogger>().LogError("Could not create operation for filtering objectives.");
                    this.FailWithError(new Exception("ConnectionOfflineError"));
                }
            }
        }
Esempio n. 20
0
        private bool SetControlsFromParameters()
        {
            ViewReference viewReference = null;

            if (this.Parameters.ContainsKey("viewReference"))
            {
                viewReference = (ViewReference)this.Parameters["viewReference"];
            }

            // create rightsfilter
            string rightsFilterName = viewReference?.ContextValueForKey(Constants.RightsFilterConfigurationName);

            if (!string.IsNullOrEmpty(rightsFilterName))
            {
                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                this.RightsFilter = configStore.FilterByName(rightsFilterName);
            }

            if (this.RightsFilter != null)
            {
#if PORTING
                NSDictionary filterParameters = (NSDictionary)viewReference.ContextValueForKey(Constants.RightsFilterCopyFieldConfigurationName);
                if (filterParameters != null)
                {
                    UPConditionValueReplacement replacement = new UPConditionValueReplacement(filterParameters);
                    this.RightsFilter = this.RightsFilter.FilterByApplyingReplacements(replacement);
                }
                else
#endif
                {
                    this.RightsFilter = this.RightsFilter.FilterByApplyingDefaultReplacements();
                }
            }

            this.RequestOption       = UPCRMDataStore.RequestOptionFromString(viewReference?.ContextValueForKey(Constants.RequestOptionConfigurationName), UPRequestOption.Offline);
            this.groupConfigurations = new List <UPObjectivesConfiguration>();
            UPObjectivesConfiguration individualConfiguration = UPObjectivesConfiguration.Create(viewReference, Constants.IndividualSectionPostFix, this.Parameters, this.EditMode);
            if (individualConfiguration != null)
            {
                this.groupConfigurations.Add(individualConfiguration);
            }

            UPObjectivesConfiguration salesConfiguration = UPObjectivesConfiguration.Create(viewReference, Constants.SalesSectionPostFix, this.Parameters, this.EditMode);
            if (salesConfiguration != null)
            {
                this.groupConfigurations.Add(salesConfiguration);
            }

            List <string> additionalFieldGroups = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalFieldgroupsConfigurationName));

            // load additional sections
            if (additionalFieldGroups?.Count > 0)
            {
                List <string> additionalDestinationFilter  = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalFilterConfigurationName));
                List <string> additionalSourceFieldControl = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalSourceFieldControlConfigurationName));
                if ((additionalDestinationFilter != null && additionalSourceFieldControl != null) && (additionalFieldGroups.Count == additionalDestinationFilter.Count) && (additionalDestinationFilter.Count == additionalSourceFieldControl.Count))
                {
                    Dictionary <string, object> additionalParameterDictionary = new Dictionary <string, object>(this.Parameters);
                    for (int additionalSectionIndex = 0; additionalSectionIndex < additionalDestinationFilter.Count; additionalSectionIndex++)
                    {
                        string sectionName = $"AdditionalSection_{additionalSectionIndex}";
                        string destinationFieldGroupName = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterDestinationFieldGroupConfigurationName, sectionName);
                        string destinationFilterName     = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterDestinationFilterConfigurationName, sectionName);
                        string sourceFieldControlName    = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterSourceFieldControlConfigurationName, sectionName);
                        additionalParameterDictionary[destinationFieldGroupName] = additionalFieldGroups[additionalSectionIndex];
                        additionalParameterDictionary[destinationFilterName]     = additionalDestinationFilter[additionalSectionIndex];
                        additionalParameterDictionary.SetObjectForKey(additionalSourceFieldControl[additionalSectionIndex], sourceFieldControlName);
                        UPObjectivesConfiguration additionalConfiguration = UPObjectivesConfiguration.Create(viewReference, sectionName, additionalParameterDictionary, this.EditMode);
                        if (additionalConfiguration != null)
                        {
                            this.groupConfigurations.Add(additionalConfiguration);
                        }
                    }
                }
            }

            this.record     = new UPCRMRecord(this.RecordIdentification);
            this.ParentLink = viewReference?.ContextValueForKey("ParentLink");
            return(true);
        }
        private bool ComputeNextReport()
        {
            if (this.ClientReports.Count <= this.nextClientReport)
            {
                this.BuildXml();
                this.blockStart = false;
                return(true);
            }

            IConfigurationUnitStore  configStore     = ConfigurationUnitStore.DefaultStore;
            UPWebContentClientReport report          = this.ClientReports[this.nextClientReport];
            SearchAndList            searchAndList   = configStore.SearchAndListByName(report.ConfigName);
            FieldControl             tmpFieldControl = searchAndList == null
                ? configStore.FieldControlByNameFromGroup("List", report.ConfigName)
                : configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName);

            if (tmpFieldControl == null)
            {
                this.nextClientReport++;
                return(this.ComputeNextReport());
            }

            this.crmQuery = new UPContainerMetaInfo(tmpFieldControl);
            if (!string.IsNullOrEmpty(this.recordIdentification))
            {
                int _linkId = this.linkId;
                if (report.ExplicitLinkId)
                {
                    _linkId = report.LinkId;
                }

                if (string.IsNullOrEmpty(report.ParentLinkConfig))
                {
                    this.crmQuery.SetLinkRecordIdentification(this.recordIdentification, _linkId);
                }
                else if (report.ParentLinkConfig != "nolink")
                {
                    string linkRecordIdentification = this.parentLinkDictionary.ValueOrDefault(report.ParentLinkConfig);
                    if (linkRecordIdentification == null)
                    {
                        this.linkReader = new UPCRMLinkReader(this.recordIdentification, report.ParentLinkConfig, this);
                        this.linkReader.Start();
                        return(true);
                    }

                    if (!string.IsNullOrEmpty(linkRecordIdentification))
                    {
                        this.crmQuery.SetLinkRecordIdentification(linkRecordIdentification, _linkId);
                    }
                }
            }

            if (!string.IsNullOrEmpty(searchAndList?.FilterName))
            {
                UPConfigFilter filter = configStore.FilterByName(searchAndList.FilterName);
                filter = filter?.FilterByApplyingValueDictionaryDefaults(this.filterParameters, true);
                if (filter != null)
                {
                    this.crmQuery.ApplyFilter(filter);
                }
            }

            this.crmQuery.Find(this.RequestOption, this);
            return(true);
        }
        /// <summary>
        /// Continues the with record identification.
        /// </summary>
        /// <param name="_linkRecordIdentification">The link record identification.</param>
        private void ContinueWithRecordIdentification(string _linkRecordIdentification)
        {
            this.linkRecordIdentification = _linkRecordIdentification;
            if (this.countable)
            {
                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                this.crmQuery = !string.IsNullOrEmpty(this.searchAndListConfigurationName)
                    ? new UPContainerMetaInfo(this.searchAndListConfigurationName, this.parameters)
                    : new UPContainerMetaInfo(configStore.FieldControlByNameFromGroup("List", this.infoAreaid));

                if (!string.IsNullOrEmpty(this.linkRecordIdentification))
                {
                    this.crmQuery.SetLinkRecordIdentification(this.linkRecordIdentification);
                }

                if (!string.IsNullOrEmpty(this.filterName))
                {
                    if (this.crmQuery != null)
                    {
                        UPConfigFilter filter = configStore.FilterByName(this.filterName);
                        if (filter != null)
                        {
                            if (this.parameters?.Count > 0)
                            {
                                filter = filter.FilterByApplyingValueDictionaryDefaults(this.parameters, true);
                            }

                            this.crmQuery.ApplyFilter(filter);
                        }
                    }
                }

                Operation operation = this.crmQuery.CountTheDelegate(this.requestOption, this);
                if (operation == null)
                {
                    this.SearchOperationDidFinishWithCount(null, 0);
                }
            }
            else
            {
                UPMInsightBoardItem item = (UPMInsightBoardItem)this.Group.Children[0];
                item.Countable = false;
                item.Count     = 1;
                item.Title     = !string.IsNullOrEmpty(this.Menu.DisplayName) ? this.Menu.DisplayName : string.Empty;
                item.ImageName = this.Menu.ImageName;
                item.SortIndex = this.SortIndex;

                this.detailActionViewReference    = this.relevantViewReference;
                this.detailActionRecordIdentifier = this.linkRecordIdentification;

                UPMAction action = new UPMAction(null);
                if (this.forcedRecordListView)
                {
                    action.SetTargetAction(this, this.SwitchToListOrganizer);
                }
                else
                {
                    action.SetTargetAction(this, this.SwitchToDetailOrganizer);
                }

                item.Action          = action;
                this.ControllerState = GroupModelControllerState.Finished;
                this.Delegate.GroupModelControllerFinished(this);
            }
        }
        /// <summary>
        /// The crm query for value.
        /// </summary>
        /// <param name="searchValue">
        /// The search value.
        /// </param>
        /// <param name="filters">
        /// The filters.
        /// </param>
        /// <param name="fullTextSearch">
        /// The full text search.
        /// </param>
        /// <returns>
        /// The <see cref="UPContainerMetaInfo"/>.
        /// </returns>
        public UPContainerMetaInfo CrmQueryForValue(
            string searchValue,
            List <UPConfigFilter> filters,
            bool fullTextSearch)
        {
            if (this.CombinedControl == null)
            {
                return(null);
            }

            if (this.SearchCRMFields == null && this.MultiSearchCRMFields == null &&
                this.SearchFieldControl?.Tabs?.Count > 0)
            {
                int tabCount = this.SearchFieldControl.Tabs.Count;

                List <UPCRMField> fieldArray      = null;
                List <UPCRMField> multiFieldArray = null;

                for (int i = 0; i < tabCount; i++)
                {
                    FieldControlTab tab = this.SearchFieldControl.TabAtIndex(i);
                    if (tab.Fields == null || tab.Fields.Count == 0)
                    {
                        continue;
                    }

                    if (string.Compare(tab.Type, @"MULTI", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        UPCRMField multiField = tab.FieldAtIndex(0).Field;

                        if (multiFieldArray == null)
                        {
                            multiFieldArray = new List <UPCRMField>();
                        }

                        multiFieldArray.Add(multiField);
                    }
                    else
                    {
                        if (fieldArray == null)
                        {
                            fieldArray = new List <UPCRMField>();
                        }

                        fieldArray.AddRange(tab.AllCRMFields());
                    }
                }

                this.SearchCRMFields      = fieldArray;
                this.MultiSearchCRMFields = multiFieldArray;
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPContainerMetaInfo     container   = new UPContainerMetaInfo(this.CombinedControl);

            if (!string.IsNullOrEmpty(this.DetailActionSwitchFilterName))
            {
                this.DetailActionSwitchFilter = ConfigurationUnitStore.DefaultStore.FilterByName(this.DetailActionSwitchFilterName);

                if (this.DetailActionSwitchFilter != null)
                {
                    this.DetailActionSwitchFilter =
                        this.DetailActionSwitchFilter.FilterByApplyingValueDictionaryDefaults(
                            this.FilterParameter,
                            true);
                }

                if (this.DetailActionSwitchFilter != null)
                {
                    this.FilterBasedDecision = new UPCRMFilterBasedDecision(this.DetailActionSwitchFilter);
                }
            }

            container.ReplaceCaseSensitiveCharacters = this.ReplaceCaseSensitiveCharacters;

            List <UPCRMField> additionalFields = null;

            if (this.ExpandSettings != null)
            {
                Dictionary <string, UPCRMField> alternateExpandFields =
                    this.ExpandSettings.FieldsForAlternateExpands(true);
                List <UPCRMField> _additionalFields = this.AdditionalOutputFields != null
                                                         ? new List <UPCRMField>(this.AdditionalOutputFields)
                                                         : new List <UPCRMField>();

                if (alternateExpandFields != null)
                {
                    _additionalFields.AddRange(alternateExpandFields.Values.Where(field => container.ContainsField(field) == null));
                }

                additionalFields = _additionalFields;
            }
            else if (this.AdditionalOutputFields?.Count > 0)
            {
                additionalFields = this.AdditionalOutputFields;
            }

            if (additionalFields != null && additionalFields.Count > 0)
            {
                container.AddCrmFields(additionalFields);
            }

            var checkFilterFields = this.FilterBasedDecision?.FieldDictionary.Values.Select(x => x).ToList();

            if (checkFilterFields?.Count > 0)
            {
                container.AddCrmFields(checkFilterFields);
                this.FilterBasedDecision.UseCrmQuery(container);
            }

            if (this.ExpandSettings != null)
            {
                this.ExpandChecker = this.ExpandSettings.ExpandCheckerForCrmQuery(container);
            }

            if (!string.IsNullOrEmpty(this.LinkRecordIdentification))
            {
                container.SetLinkRecordIdentification(this.LinkRecordIdentification);
            }

            if (this.SearchFieldControl != null)
            {
                container.SetSearchConditionsFor(
                    searchValue,
                    this.SearchCRMFields,
                    this.MultiSearchCRMFields,
                    fullTextSearch);
            }
            else if (this.QuickSearchEntries != null)
            {
                if (!string.IsNullOrEmpty(searchValue))
                {
                    List <UPCRMField> crmFields = this.QuickSearchEntries.Select(entry => entry.CrmField).ToList();

                    container.SetSearchConditionsFor(searchValue, crmFields, fullTextSearch);
                }
            }

            if (!string.IsNullOrEmpty(this.SearchConfiguration?.FilterName))
            {
                UPConfigFilter filter = configStore.FilterByName(this.SearchConfiguration.FilterName);

                if (filter != null)
                {
                    filter = filter.FilterByApplyingDefaultReplacements();
                    filter = filter.FilterByApplyingValueDictionary(this.FilterParameter);
                    container.ApplyFilter(filter);
                }
            }

            if (this.FilterObject != null)
            {
                container.ApplyFilter(this.FilterObject);
            }
            else if (!string.IsNullOrEmpty(this.FilterName))
            {
                UPConfigFilter filter = configStore.FilterByName(this.FilterName);
                if (filter != null)
                {
                    filter = filter.FilterByApplyingDefaultReplacements();
                    filter = filter.FilterByApplyingValueDictionary(this.FilterParameter);
                    container.ApplyFilter(filter);
                }
            }

            if (filters != null)
            {
                foreach (UPConfigFilter filter in filters)
                {
                    if (this.FilterParameter != null)
                    {
                        container.ApplyFilterWithReplacementDictionary(filter, this.FilterParameter);
                    }
                    else
                    {
                        container.ApplyFilter(filter);
                    }
                }
            }

            return(container);
        }