/// <summary>
        /// Initializes a new instance of the <see cref="UPSerialEntryParentInfoPanelCell"/> class.
        /// </summary>
        /// <param name="fieldControlTab">The field control tab.</param>
        /// <param name="resultRow">The result row.</param>
        public UPSerialEntryParentInfoPanelCell(FieldControlTab fieldControlTab, UPCRMResultRow resultRow)
        {
            int           numberOfFields = fieldControlTab.NumberOfFields;
            List <string> fields         = new List <string>();

            if (!string.IsNullOrEmpty(fieldControlTab.Label))
            {
                fields.Add(fieldControlTab.Label);
            }

            for (int index = 0; index < numberOfFields; index++)
            {
                UPConfigFieldControlField field = fieldControlTab.FieldAtIndex(index);
                if (index == 0)
                {
                    IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                    this.ImageName = configStore.InfoAreaConfigById(field.InfoAreaId).ImageName;
                }

                int    offset = 0;
                string value  = resultRow.FormattedFieldValueAtIndex(index, offset, fieldControlTab);
                index += offset;
                if (!string.IsNullOrEmpty(value))
                {
                    fields.Add(value);
                }
            }

            this.FieldValues = fields;
        }
Esempio n. 2
0
        private static void AddImageToNode(UPMCoINode node, string infoArea, string virtualInfoArea, UPConfigExpand expandChecker, UPCRMResultRow row)
        {
            // Add Image
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPConfigExpand          expand      = null;
            string imageName = null;

            if (!string.IsNullOrEmpty(virtualInfoArea))
            {
                expand = ConfigurationUnitStore.DefaultStore.ExpandByName(virtualInfoArea);
            }

            if (expand == null && expandChecker != null)
            {
                expand = expandChecker.ExpandForResultRow(row);
            }

            if (expand != null)
            {
                imageName = expand.ImageName;
            }

            if (string.IsNullOrEmpty(imageName))
            {
                InfoArea infoAreaConfig = configStore.InfoAreaConfigById(infoArea);
                imageName = infoAreaConfig.ImageName;
            }

            if (!string.IsNullOrEmpty(imageName))
            {
                //node.Icon = UIImage.UpImageWithFileName(imageName);   // CRM-5007
            }
        }
Esempio n. 3
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;
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCoreMappingResultContext"/> class.
        /// </summary>
        /// <param name="result">
        /// The result.
        /// </param>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <param name="numberOfListFields">
        /// The number of list fields.
        /// </param>
        public UPCoreMappingResultContext(UPCRMResult result, FieldControl control, int numberOfListFields)
        {
            this.Result        = result;
            this.RowDictionary = new Dictionary <string, UPCoreMappingResultRowContext>();
            this.FieldControl  = control;

            this.NumberOfListFields = numberOfListFields;
            int controlFieldCount = control.NumberOfFields;

            if (numberOfListFields > controlFieldCount)
            {
                this.NumberOfListFields = controlFieldCount;
            }

            this.ListFormatter = new UPCRMListFormatter(control.TabAtIndex(0), this.NumberOfListFields);

            int dropdownLineFieldCount = controlFieldCount - numberOfListFields;

            if (dropdownLineFieldCount > 0)
            {
                List <UPConfigFieldControlField> fields = new List <UPConfigFieldControlField>(dropdownLineFieldCount);
                for (int i = numberOfListFields; i < numberOfListFields + dropdownLineFieldCount; i++)
                {
                    fields.Add(control.FieldAtIndex(i));
                }

                this.DropdownFields = fields;
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.InfoAreaConfig = configStore.InfoAreaConfigById(control.InfoAreaId);

            this.SectionFieldComplete = false;

            foreach (FieldControlTab tab in control.Tabs)
            {
                if (tab.Fields != null)
                {
                    foreach (UPConfigFieldControlField field in tab.Fields)
                    {
                        if (field.Attributes.ExtendedOptionIsSet(@"SectionField"))
                        {
                            this.SectionField = field;
                            break;
                        }
                    }
                }
            }

            this.SectionFieldComplete = this.SectionField != null && this.SectionField.Field.FieldType != @"C";
        }
Esempio n. 5
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));
            }
        }
        /// <summary>
        /// Searches the operation did finish with count.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="count">The count.</param>
        public void SearchOperationDidFinishWithCount(Operation operation, int count)
        {
            this.ControllerState = GroupModelControllerState.Finished;
            UPMInsightBoardItem item = (UPMInsightBoardItem)this.Group.Children[0];

            item.Countable = true;
            item.Count     = count;
            item.SortIndex = this.SortIndex;
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName);

            this.infoAreaid = searchAndList.InfoAreaId;
            InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.infoAreaid);

            if (!string.IsNullOrEmpty(infoAreaConfig.ColorKey))
            {
                item.Color = AureaColor.ColorWithString(infoAreaConfig.ColorKey);
            }

            if (!string.IsNullOrEmpty(this.Menu.DisplayName))
            {
                item.Title = this.Menu.DisplayName;
            }
            else
            {
                item.Title = item.Count > 1 ? infoAreaConfig.PluralName : infoAreaConfig.SingularName;
            }

            item.ImageName = this.Menu.ImageName ?? infoAreaConfig.ImageName;
            UPMAction action = new UPMAction(null);

            if (count == 1)
            {
                this.crmQuery.Find(this.requestOption, this);
                action.SetTargetAction(this, this.SwitchToDetailOrganizer);
            }
            else
            {
                action.SetTargetAction(this, this.SwitchToListOrganizer);
            }

            item.Action = action;
            if (count != 1)
            {
                this.Delegate.GroupModelControllerFinished(this);
            }
        }
Esempio n. 7
0
        private void RefreshTableCaption()
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            var    crmStore         = UPCRMDataStore.DefaultStore;
            string tableCaptionName = this.ExpandConfig.TableCaptionName;

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

            UPConfigTableCaption tableCaption = configStore.TableCaptionByName(tableCaptionName);
            string recordTableCaption         = tableCaption?.TableCaptionForRecordIdentification(this.RecordIdentification);

            if (string.IsNullOrEmpty(recordTableCaption) && !crmStore.RecordExistsOffline(this.RecordIdentification))
            {
                this.Organizer.TitleText = configStore.BasicTextByIndex(4);
                tableCaption?.RequestTableCaptionForRecordIdentification(this.RecordIdentification, this);
            }
            else
            {
                this.Organizer.TitleText = recordTableCaption;
            }

            string subTitleText = null;

            if (!string.IsNullOrEmpty(this.ExpandConfig.HeaderGroupName))
            {
                UPConfigHeader header = configStore.HeaderByNameFromGroup("Expand", this.ExpandConfig.HeaderGroupName);
                subTitleText = header?.Label;
            }

            if (string.IsNullOrEmpty(subTitleText))
            {
                InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.InfoAreaId);
                subTitleText = infoAreaConfig.SingularName;
                if (string.IsNullOrEmpty(subTitleText))
                {
                    subTitleText = crmStore.TableInfoForInfoArea(this.InfoAreaId).Label;
                }
            }

            this.Organizer.SubtitleText = subTitleText;
            this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("TableCaptionChanged"));
        }
Esempio n. 8
0
        /// <summary>
        /// Updates the title text.
        /// </summary>
        private void UpdateTitleText()
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.Organizer.SubtitleText = configStore.InfoAreaConfigById(this.RecordIdentification.InfoAreaId()).SingularName;
            UPConfigTableCaption tableCaption = configStore.TableCaptionByName(this.RecordIdentification.InfoAreaId());

            if (tableCaption != null)
            {
                string recordTableCaption = tableCaption.TableCaptionForRecordIdentification(this.RecordIdentification);

                this.Organizer.TitleText = recordTableCaption;
            }
            else
            {
                this.Organizer.TitleText = this.RecordIdentification;
            }
        }
        /// <summary>
        /// Defaults the action for search and list.
        /// </summary>
        /// <param name="searchAndList">The search and list.</param>
        /// <returns></returns>
        public Menu DefaultActionForSearchAndList(SearchAndList searchAndList)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            Menu   tmpDetailAction = null;
            string infoAreaId      = searchAndList.InfoAreaId;

            if (!string.IsNullOrEmpty(searchAndList.DefaultAction))
            {
                tmpDetailAction = configStore.MenuByName(searchAndList.DefaultAction);
            }

            if (tmpDetailAction == null)
            {
                InfoArea infoAreaConfig = configStore.InfoAreaConfigById(infoAreaId);
                if (!string.IsNullOrEmpty(infoAreaConfig.DefaultAction))
                {
                    tmpDetailAction = configStore.MenuByName(infoAreaConfig.DefaultAction);
                }
            }

            return(tmpDetailAction ?? configStore.MenuByName("SHOWRECORD"));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSearchPageModelControllerPreparedSearch"/> class.
        /// </summary>
        /// <param name="timelineInfoAreaConfiguration">
        /// The timeline info area configuration.
        /// </param>
        public UPSearchPageModelControllerPreparedSearch(ConfigTimelineInfoArea timelineInfoAreaConfiguration)
        {
            this.InfoAreaId            = timelineInfoAreaConfiguration.InfoAreaId;
            this.ConfigName            = timelineInfoAreaConfiguration.ConfigName;
            this.TimelineConfiguration = timelineInfoAreaConfiguration;

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

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

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

            string fieldGroupName;

            if (this.SearchConfiguration != null)
            {
                if (this.SearchConfiguration.DefaultAction != null)
                {
                    this.DetailAction = configStore.MenuByName(this.SearchConfiguration.DefaultAction);
                }

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

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

                fieldGroupName = this.SearchConfiguration.FieldGroupName;
            }
            else
            {
                fieldGroupName = this.ConfigName;
            }

            this.FilterName = timelineInfoAreaConfiguration.FilterName;

            this.ListFieldControl = configStore.FieldControlByNameFromGroup(@"List", fieldGroupName);

            if (this.ListFieldControl != null)
            {
                this.DropdownFieldControl = configStore.FieldControlByNameFromGroup(@"MiniDetails", fieldGroupName);

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

                    if (this.DropdownFieldControl != null)
                    {
                        this.DropdownFieldControl = this.DropdownFieldControl.FieldControlWithSingleTab(0);
                    }
                }

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

            if (this.TimelineConfiguration.ColorCriteria.Count > 0)
            {
                Dictionary <string, UPCRMField> additionalFieldDictionary = null;

                foreach (ConfigTimelineCriteria criteria in this.TimelineConfiguration.ColorCriteria)
                {
                    if (criteria.FieldId < 0)
                    {
                        continue;
                    }

                    UPCRMField field = new UPCRMField(criteria.FieldId, this.TimelineConfiguration.InfoAreaId);

                    string key = field.FieldId.ToString();

                    if (additionalFieldDictionary == null)
                    {
                        additionalFieldDictionary = new Dictionary <string, UPCRMField>();
                    }

                    if (!additionalFieldDictionary.ContainsKey(key))
                    {
                        additionalFieldDictionary.Add(key, field);
                    }
                }

                this.AdditionalOutputFields = additionalFieldDictionary.Values.Select(x => x).ToList();
            }

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

            this.ReplaceCaseSensitiveCharacters = configStore.ConfigValueIsSet(@"Search.ReplaceCaseSensitiveCharacters");
        }
        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");
        }