Esempio n. 1
0
        /// <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>
        /// Computes EditRecordViewReference from <see cref="FieldControl"/>
        /// </summary>
        /// <param name="listFieldControl">
        /// <see cref="FieldControl"/> object
        /// </param>
        /// <param name="configStore">
        /// <see cref="IConfigurationUnitStore"/>
        /// </param>
        /// <returns>
        /// EditRecordViewReference value to be set
        /// </returns>
        private ViewReference GetEditRecordViewReference(FieldControl listFieldControl, IConfigurationUnitStore configStore)
        {
            var viewReference = (ViewReference)null;
            var editAction    = listFieldControl.ValueForAttribute(AttributeCalendarEditAction);

            if (editAction == ActionNone)
            {
                viewReference = null;
            }
            else if (!string.IsNullOrWhiteSpace(editAction))
            {
                if (editAction.StartsWith(ActionPrefixButton))
                {
                    viewReference = configStore.ButtonByName(editAction.Substring(ButtonNameStartingIndex)).ViewReference;
                }
                else if (editAction.StartsWith(ActionPrefixMenu))
                {
                    viewReference = configStore.MenuByName(editAction.Substring(MenuNameStartingIndex)).ViewReference;
                }
                else
                {
                    viewReference = configStore.ButtonByName(editAction).ViewReference;
                }
            }
            else
            {
                var expand = configStore.ExpandByName(InfoAreaId);
                var header = configStore.HeaderByNameFromGroup(HeaderExpand, expand.HeaderGroupName);

                if (header?.ButtonNames != null)
                {
                    foreach (var button in header.ButtonNames)
                    {
                        if (button.StartsWith(Edit))
                        {
                            viewReference = configStore.ButtonByName(button).ViewReference;
                            var isSwitchToEdit = false;
                            if (viewReference.ParameterDictionary().ContainsKey(Action))
                            {
                                isSwitchToEdit = ((string)viewReference.ParameterDictionary()[Action]).StartsWith(SwitchToEdit);
                            }

                            if (viewReference.ViewName == ViewOrganizerAction && isSwitchToEdit)
                            {
                                viewReference = configStore.MenuByName(MenuEditRecord).ViewReference;
                            }

                            if (viewReference != null)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            return(viewReference);
        }
Esempio n. 3
0
        /// <summary>
        /// Builds the page.
        /// </summary>
        protected virtual void BuildPage()
        {
            string recordId = this.ViewReference.ContextValueForKey("recordId");

            if (string.IsNullOrEmpty(recordId))
            {
                recordId = this.ViewReference.ContextValueForKey("RecordId");
            }

            this.RootRecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(recordId);
            this.InfoAreaId = this.RootRecordIdentification.InfoAreaId();
            string requestOptionString = this.ViewReference.ContextValueForKey("RequestOption");

            this.RequestOption = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline);
            this.MaxDepth      = Convert.ToInt32(this.ViewReference.ContextValueForKey("TreeMaxDepth"));
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.ExpandSettings = configStore.ExpandByName(this.ConfigName) ?? configStore.ExpandByName(this.InfoAreaId);
        }
Esempio n. 4
0
        /// <summary>
        /// Populates filters and Identifiers for filter != Config1Filter
        /// </summary>
        /// <param name="configStore">
        /// IConfigurationUnitStore
        /// </param>
        /// <param name="filters">
        /// List&lt;UPMFilter&gt;
        /// </param>
        /// <param name="identifiers">
        /// List&lt;IIdentifier&gt;
        /// </param>
        /// <param name="defaultRadiusMeter">
        /// defaultRadiusMeter
        /// </param>
        private void PopulatePageFiltersAndIdentifiersForNonConfig1Filter(
            IConfigurationUnitStore configStore,
            List <UPMFilter> filters,
            List <IIdentifier> identifiers,
            int defaultRadiusMeter)
        {
            var infoAreaId = string.Empty;

            for (int configNo = 2; configNo < 99; configNo++)
            {
                var configNameKey = $"Config{configNo}Name";
                var configName    = ViewReference.ContextValueForKey(configNameKey);
                if (!string.IsNullOrWhiteSpace(configName))
                {
                    var configFilterKey = $"Config{configNo}Filter";
                    var geoFilter       = ViewReference.ContextValueForKey(configFilterKey);
                    var filter          = UPMFilter.FilterForName(geoFilter) as UPMDistanceFilter;
                    if (filter == null)
                    {
                        continue;
                    }

                    var expand              = configStore.ExpandByName(configName);
                    var imageName           = expand.ImageName;
                    var searchConfiguration = configStore.SearchAndListByName(configName);
                    var colorKey            = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ColorKey;
                    if (string.IsNullOrWhiteSpace(imageName))
                    {
                        imageName = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ImageName;
                    }

                    filter.ImageName = imageName;
                    filter.ColorKey  = colorKey;
                    filter.Radius    = (int)defaultRadiusMeter;
                    filter.Active    = true;
                    usedFilters.SetObjectForKey(filter, configName);
                    infoAreaId = (searchConfiguration != null) ? searchConfiguration.InfoAreaId : configName;
                    identifiers.Add(new RecordIdentifier(infoAreaId, null));
                    filters.Add(filter);
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CoIBaseNodeLoader"/> class.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="maxDepth">The maximum depth.</param>
        /// <param name="vistedNodes">The visted nodes.</param>
        public CoIBaseNodeLoader(UPMCoINode node, ViewReference viewReference, int depth, int maxDepth, Dictionary <IIdentifier, UPMCoINode> vistedNodes)
        {
            this.RootNode      = node;
            this.viewReference = viewReference;
            string requestOptionString = this.viewReference.ContextValueForKey("RequestOption");

            this.requestOption      = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline);
            this.depth              = depth;
            this.maxDepth           = maxDepth;
            this.vistedNodes        = vistedNodes;
            this.subNodeLoader      = new List <CoIBaseNodeLoader>();
            this.ChangedIdentifiers = new List <IIdentifier>();
            this.pendingCount       = 0;
            this.configName         = this.viewReference.ContextValueForKey("ConfigName");
            this.ChangedIdentifiers.Add(this.RootNode.Identifier);
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.expandSettings = configStore.ExpandByName(this.configName);
        }
        /// <summary>
        /// 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");
        }
        // Add this node only with children
        // Also used by ModelControllers

        /// <summary>
        /// Initializes a new instance of the <see cref="CoITreeNodeLoader"/> class.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="_rootNodeTreeConfig">The root node tree configuration.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="vistedNodes">The visted nodes.</param>
        /// <param name="_nodeConfigMapping">The node configuration mapping.</param>
        /// <param name="_recordIdentifierInfoAreaConfigMapping">The record identifier information area configuration mapping.</param>
        public CoITreeNodeLoader(UPMCoINode node, UPConfigTreeViewTable _rootNodeTreeConfig, ViewReference viewReference, int depth,
                                 Dictionary <IIdentifier, UPMCoINode> vistedNodes, Dictionary <IIdentifier, UPConfigTreeViewTable> _nodeConfigMapping,
                                 Dictionary <string, CoITreeInfoAreaConfig> _recordIdentifierInfoAreaConfigMapping)
            : base(node, viewReference, depth, 1, vistedNodes)
        {
            this.childrenTreeConfig = _rootNodeTreeConfig;
            this.nodeConfigMapping  = _nodeConfigMapping;
            this.infoAreaConfigs    = new List <CoITreeInfoAreaConfig>();
            this.recordIdentifierInfoAreaConfigMapping = _recordIdentifierInfoAreaConfigMapping;

            if (!string.IsNullOrEmpty(this.childrenTreeConfig.SearchAndListName))
            {
                this.configName = this.childrenTreeConfig.SearchAndListName;
            }
            else if (this.childrenTreeConfig != null)
            {
                this.configName = this.childrenTreeConfig.ExpandName;
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.expandSettings = configStore.ExpandByName(this.configName);
        }
        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);
                }
            }
        }
Esempio n. 9
0
        /// <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);
        }
Esempio n. 10
0
        /// <summary>
        /// Populates filters and Identifiers for filter = Config1Filter
        /// </summary>
        /// <param name="configStore">
        /// IConfigurationUnitStore
        /// </param>
        /// <param name="filters">
        /// List&lt;UPMFilter&gt;
        /// </param>
        /// <param name="identifiers">
        /// List&lt;IIdentifier&gt;
        /// </param>
        /// <param name="defaultRadiusMeter">
        /// defaultRadiusMeter
        /// </param>
        private void PopulatePageFiltersAndIdentifiersForConfig1Filter(
            IConfigurationUnitStore configStore,
            List <UPMFilter> filters,
            List <IIdentifier> identifiers,
            int defaultRadiusMeter)
        {
            var infoAreaId = string.Empty;
            var geoFilter1 = ViewReference.ContextValueForKey("Config1Filter");
            var filter     = UPMFilter.FilterForName(geoFilter1) as UPMDistanceFilter;

            if (filter != null)
            {
                var expand              = configStore.ExpandByName(ConfigName);
                var imageName           = expand.ImageName;
                var searchConfiguration = configStore.SearchAndListByName(ConfigName);
                infoAreaId = searchConfiguration != null ? searchConfiguration.InfoAreaId : ConfigName;
                if (string.IsNullOrWhiteSpace(imageName))
                {
                    imageName = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ImageName;
                }

                var colorKey = expand.ColorKey;
                if (string.IsNullOrWhiteSpace(colorKey))
                {
                    colorKey = configStore.InfoAreaConfigById(searchConfiguration.InfoAreaId).ColorKey;
                }

                filter.ImageName = imageName;
                filter.ColorKey  = colorKey;
                filter.Radius    = defaultRadiusMeter;
                filter.Active    = true;
                usedFilters.SetObjectForKey(filter, ConfigName);
                filters.Add(filter);
                identifiers.Add(new RecordIdentifier(infoAreaId, null));
            }
        }
        private UPMGroup BuildGroup(UPMGroup group)
        {
            Dictionary <string, string> infoAreaImageFileNames = new Dictionary <string, string>();
            IConfigurationUnitStore     configStore            = ConfigurationUnitStore.DefaultStore;
            UPConfigExpand repExpand = configStore.ExpandByName("ID");

            this.linkParticipantsViewReference = null;

            if (!string.IsNullOrEmpty(this.linkParticipantsName))
            {
                SearchAndList searchAndList = configStore.SearchAndListByName(this.linkParticipantsName);
                Menu          menu          = searchAndList != null?configStore.MenuByName(searchAndList.DefaultAction) : null;

                this.linkParticipantsViewReference = menu?.ViewReference;
            }

            if (this.acceptanceCatalogAttributes == null && this.recordParticipants.AcceptanceField != null)
            {
                this.acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(this.recordParticipants.AcceptanceField.InfoAreaId, this.recordParticipants.AcceptanceField.FieldId);
            }

            foreach (UPCRMParticipant participant in this.recordParticipants.Participants)
            {
                bool           isRepParticipant = participant is UPCRMRepParticipant;
                IIdentifier    identifier       = StringIdentifier.IdentifierWithStringId(participant.Key);
                UPMListRow     listRow          = new UPMListRow(identifier);
                UPMStringField nameField        = new UPMStringField(StringIdentifier.IdentifierWithStringId("name"));
                nameField.StringValue = participant.Name;
                listRow.AddField(nameField);
                UPMStringField acceptanceField = new UPMStringField(StringIdentifier.IdentifierWithStringId("acceptance"));
                if (!isRepParticipant || this.recordParticipants.HasRepAcceptance)
                {
                    acceptanceField.StringValue = participant.AcceptanceDisplayText;
                    UPConfigCatalogValueAttributes configCatalogValueAttributes = this.acceptanceCatalogAttributes?.ValuesByCode[Convert.ToInt32(participant.AcceptanceText)];
                    string colorString = configCatalogValueAttributes?.ColorKey;
                    if (!string.IsNullOrEmpty(colorString))
                    {
                        listRow.RowColor = AureaColor.ColorWithString(colorString);
                    }
                }
                else
                {
                    acceptanceField.StringValue = string.Empty;
                }

                listRow.AddField(acceptanceField);
                UPMStringField requirementField = new UPMStringField(StringIdentifier.IdentifierWithStringId("requirement"));
                requirementField.StringValue = participant.RequirementDisplayText;
                listRow.AddField(requirementField);
                if (isRepParticipant)
                {
                    // listRow.Icon = UIImage.UpImageWithFileName(repExpand.ImageName);     // CRM-5007
                    listRow.RowAction = null;
                }
                else
                {
                    UPCRMLinkParticipant linkParticipant = (UPCRMLinkParticipant)participant;
                    string _infoAreaId = linkParticipant.LinkRecordIdentification.InfoAreaId();
                    string imageName   = infoAreaImageFileNames.ValueOrDefault(_infoAreaId);
                    if (imageName == null)
                    {
                        UPConfigExpand expand = configStore.ExpandByName(_infoAreaId);
                        imageName = expand.ImageName ?? string.Empty;

                        infoAreaImageFileNames.SetObjectForKey(imageName, _infoAreaId);
                    }

                    // listRow.Icon = UIImage.UpImageWithFileName(imageName);       // CRM-5007
                    listRow.OnlineData = !UPCRMDataStore.DefaultStore.RecordExistsOffline(linkParticipant.LinkRecordIdentification);

                    if (this.linkParticipantsViewReference != null)
                    {
                        UPMAction switchToOrganizerAction = new UPMAction(null);
                        switchToOrganizerAction.IconName = "arrow.png";
                        switchToOrganizerAction.SetTargetAction(this, this.SwitchToOrganizerForLinkParticipant);
                        listRow.RowAction = switchToOrganizerAction;
                    }
                }

                group.AddChild(listRow);
            }

            return(group);
        }
Esempio n. 12
0
        private void ContinueBuildDetailOrganizerPages0()
        {
            this.ConfigName = this.ViewReference.ContextValueForKey("ConfigName");
            bool configNameHasWildCards = !string.IsNullOrEmpty(this.ConfigName) && this.ConfigName.Contains("##");

            if (string.IsNullOrEmpty(this.ConfigName) || configNameHasWildCards)
            {
                this.VirtualInfoAreaId = UPCRMDataStore.DefaultStore.VirtualInfoAreaIdForRecordIdentification(this.RecordIdentification);
                if (!string.IsNullOrEmpty(this.VirtualInfoAreaId))
                {
                    if (!configNameHasWildCards)
                    {
                        this.ConfigName = this.VirtualInfoAreaId;
                        if (this.VirtualInfoAreaId != this.InfoAreaId)
                        {
                            this.AlternateConfigName = this.InfoAreaId;
                        }
                    }
                }
            }
            else
            {
                this.VirtualInfoAreaId = this.InfoAreaId;
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            if (configNameHasWildCards)
            {
                this.ExpandConfig = configStore.ExpandByName(this.ConfigName.Replace("##", this.VirtualInfoAreaId));
                if (this.ExpandConfig == null && this.VirtualInfoAreaId != this.InfoAreaId)
                {
                    this.ExpandConfig = configStore.ExpandByName(this.ConfigName.Replace("##", this.InfoAreaId));
                }

                if (this.ExpandConfig == null)
                {
                    this.ExpandConfig = configStore.ExpandByName(this.VirtualInfoAreaId);
                }

                if (this.ExpandConfig == null)
                {
                    this.ExpandConfig = configStore.ExpandByName(this.InfoAreaId);
                }
            }
            else
            {
                this.ExpandConfig = configStore.ExpandByName(this.ConfigName);
                if (this.ExpandConfig == null && !string.IsNullOrEmpty(this.AlternateConfigName))
                {
                    this.ExpandConfig = configStore.ExpandByName(this.AlternateConfigName);
                }
            }

            if (this.ExpandConfig == null)
            {
                SimpleIoc.Default.GetInstance <ILogger>()?.
                LogError($"Detail Organizer: Detail expand configuration is not present for the Info Area {this.InfoAreaId}");
                return;
            }

            this.Organizer.OrganizerColor = this.ColorForInfoAreaWithId(this.InfoAreaId);
            if (this.ExpandConfig.AlternateExpands != null)
            {
                this.AlternateExpandChecker = new UPCRMAlternateExpandChecker(this.RecordIdentification, this.ExpandConfig, this);
                this.AlternateExpandChecker.Start(UPRequestOption.FastestAvailable);
                this.ApplyLoadingStatusOnOrganizer(this.Organizer);
            }
            else
            {
                this.AlternateExpandChecker = null;
                this.ContinueBuildDetailsOrganizerPage();
                this.AddToHistory(this.RecordIdentification, this.ViewReference, this.ExpandConfig.ImageName);
            }
        }
Esempio n. 13
0
        private List <ICalendarItem> CalendarItemsFromResult()
        {
            List <ICalendarItem>    calendarItems = new List <ICalendarItem>();
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;

            this.resultContexts = new List <UPCoreMappingResultContext>();
            UPMAction goToAction = new UPMAction(StringIdentifier.IdentifierWithStringId("action"));

            goToAction.SetTargetAction(this, this.SwitchToDetail);
            goToAction.LabelText = LocalizedString.TextShowRecord;

            foreach (TimelineSearch timelineSearch in this.searches)
            {
                UPCRMResult result   = timelineSearch.Result;
                int         rowCount = result.RowCount;
                if (rowCount == 0)
                {
                    continue;
                }

                UPConfigTableCaption tableCaption = configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.ConfigName) ??
                                                    configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.InfoAreaId);

                List <UPContainerFieldMetaInfo> tableCaptionResultFieldMap = tableCaption.ResultFieldMapFromMetaInfo(result.MetaInfo);
                if (tableCaptionResultFieldMap == null)
                {
                    continue;
                }

                UPCRMResultCondition resultCondition = null;
                var functionNameFieldMapping         = result.MetaInfo.SourceFieldControl.FunctionNames();
                UPConfigFieldControlField fromField  = functionNameFieldMapping["Date"];
                if (fromField != null)
                {
                    if (this.fromDate != null)
                    {
                        resultCondition = new UPCRMResultFieldCondition(fromField.Field, UPConditionOperator.GreaterEqual,
                                                                        this.fromDate.Value.CrmValueFromDate(), fromField.TabIndependentFieldIndex);
                    }

                    if (this.toDate != null)
                    {
                        UPConfigFieldControlField toField = (functionNameFieldMapping.ContainsKey("EndDate")
                            ? functionNameFieldMapping["EndDate"]
                            : null) ?? fromField;

                        UPCRMResultCondition toCondition = new UPCRMResultFieldCondition(toField.Field, UPConditionOperator.LessEqual,
                                                                                         this.toDate.Value.CrmValueFromDate(), toField.TabIndependentFieldIndex);
                        resultCondition = resultCondition != null?resultCondition.ConditionByAppendingANDCondition(toCondition) : toCondition;
                    }
                }

                UPCoreMappingResultContext resultContext = new UPCoreMappingResultContext(result, result.MetaInfo.SourceFieldControl, timelineSearch.PreparedSearch.ListFieldControl.NumberOfFields);
                resultContext.Context = timelineSearch;
                this.resultContexts.Add(resultContext);

                UPConfigExpand expand = configStore.ExpandByName(timelineSearch.TimelineInfoArea.ConfigName) ??
                                        configStore.ExpandByName(timelineSearch.TimelineInfoArea.InfoAreaId);

                AureaColor defaultColor = null;
                if (!string.IsNullOrEmpty(timelineSearch.TimelineInfoArea.ColorString))
                {
                    defaultColor = AureaColor.ColorWithString(timelineSearch.TimelineInfoArea.ColorString);
                }

                if (defaultColor == null)
                {
                    defaultColor = AureaColor.ColorWithString(expand.ColorKey);
                }

                for (int i = 0; i < rowCount; i++)
                {
                    UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                    if (resultCondition != null && !resultCondition.Check(row))
                    {
                        continue;
                    }

                    ConfigTimelineCriteria matchingCriteria = timelineSearch.MatchingCriteriaForRow(row);
                    AureaColor             color            = null;
                    if (matchingCriteria.Setting1 != null)
                    {
                        color = AureaColor.ColorWithString(matchingCriteria.Setting1);
                    }

                    if (color == null)
                    {
                        color = defaultColor;
                    }

                    ICalendarItem calendarItem = new ResultRowCalendarItem(row, resultContext, new RecordIdentifier(row.RootRecordIdentification), tableCaption, tableCaptionResultFieldMap, null, color);
                    calendarItem.GoToAction = goToAction;
                    calendarItems.Add(calendarItem);
                }
            }

            if (this.fromDate != null && this.toDate != null && this.CalendarPage.IncludeSystemCalendar)
            {
#if PORTING
                ArrayList localCalendarItems = ResultRowCalendarItem.EventsFromLocalCalendarFromToSearchTextCalenderIdentifiers(this.fromDate, this.toDate, null, null);
                if (localCalendarItems.Count)
                {
                    calendarItems.AddRange(localCalendarItems);
                }
#endif
            }

            return(calendarItems);
        }
        private void Initialize(string infoAreaId, string configName, string filterName)
        {
            this.InfoAreaId = infoAreaId;
            this.ConfigName = configName;

            if (string.IsNullOrEmpty(this.ConfigName))
            {
                this.ConfigName = this.InfoAreaId;
            }

            this.FilterName = filterName;

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.SearchConfiguration = configStore.SearchAndListByName(this.ConfigName);

            if (this.SearchConfiguration == null)
            {
                FieldControl fieldControl = configStore.FieldControlByNameFromGroup(@"List", this.ConfigName);
                if (fieldControl != null)
                {
                    this.SearchConfiguration = new SearchAndList(fieldControl);
                }
            }

            if (this.InfoAreaId == null)
            {
                this.InfoAreaId = this.SearchConfiguration != null
                                      ? this.SearchConfiguration.InfoAreaId
                                      : this.ConfigName;
            }

            this.ExpandSettings = configStore.ExpandByName(this.ConfigName) ?? configStore.ExpandByName(this.InfoAreaId);

            if (!string.IsNullOrEmpty(this.SearchConfiguration?.DefaultAction))
            {
                this.DetailAction = configStore.MenuByName(this.SearchConfiguration.DefaultAction);
            }

            if (this.DetailAction == null)
            {
                InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId);

                if (!string.IsNullOrEmpty(infoAreaConfig?.DefaultAction))
                {
                    this.DetailAction = configStore.MenuByName(infoAreaConfig.DefaultAction);
                }
            }

            if (this.DetailAction == null)
            {
                this.DetailAction = configStore.MenuByName(@"SHOWRECORD");
            }

            if (this.SearchConfiguration != null)
            {
                this.ListFieldControl = configStore.FieldControlByNameFromGroup(
                    @"List",
                    this.SearchConfiguration.FieldGroupName);

                if (this.ListFieldControl != null)
                {
                    this.SearchFieldControl = configStore.FieldControlByNameFromGroup(
                        @"Search",
                        this.SearchConfiguration.FieldGroupName);
                    this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(
                        @"MiniDetails",
                        this.SearchConfiguration.FieldGroupName);

                    if (this.DropdownFieldControl == null)
                    {
                        this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(
                            @"Details",
                            this.SearchConfiguration.FieldGroupName);

                        this.DropdownFieldControl = this.DropdownFieldControl?.FieldControlWithSingleTab(0);
                    }

                    this.CombinedControl = this.DropdownFieldControl == null
                                               ? this.ListFieldControl
                                               : new FieldControl(
                        new List <FieldControl>
                    {
                        this.ListFieldControl,
                        this.DropdownFieldControl
                    });
                }
            }

            this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters");
        }