예제 #1
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
            }
        }
        /// <summary>
        /// Creates the node from result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="currentDepth">The current depth.</param>
        /// <param name="expandChecker">The expand checker.</param>
        /// <param name="infoAreaConfigs">The information area configs.</param>
        /// <param name="infoAreaMapping">The information area mapping.</param>
        /// <returns></returns>
        public static UPMCoINode CreateNodeFromResultRow(UPCRMResultRow row, int currentDepth,
                                                         UPConfigExpand expandChecker, List <CoITreeInfoAreaConfig> infoAreaConfigs, Dictionary <string, CoITreeInfoAreaConfig> infoAreaMapping)
        {
            string trgtNodeFieldSuffix  = string.Empty;
            string recordIdentification = row.RootRecordIdentification;
            string rootInfoAreaId       = recordIdentification.InfoAreaId();

            if (infoAreaConfigs != null)
            {
                foreach (CoITreeInfoAreaConfig infoAreaConfig in infoAreaConfigs)
                {
                    string linkRecordIdentifictaion = row.RecordIdentificationForLinkInfoAreaIdLinkId(infoAreaConfig.InfoAreaId, infoAreaConfig.LinkId);
                    if (!string.IsNullOrEmpty(linkRecordIdentifictaion.RecordId()))
                    {
                        trgtNodeFieldSuffix  = infoAreaConfig.FunctionNameSuffix;
                        recordIdentification = linkRecordIdentifictaion;
                        infoAreaMapping[recordIdentification] = infoAreaConfig;
                        break;
                    }
                }
            }

            string     virtualInfoAreaId = row.RootVirtualInfoAreaId == rootInfoAreaId ? null : row.RootVirtualInfoAreaId;
            UPMCoINode node = CreateNodeFromResultRow(row, virtualInfoAreaId, recordIdentification, currentDepth, infoAreaConfigs == null,
                                                      expandChecker, trgtNodeFieldSuffix, recordIdentification.InfoAreaId());

            return(node);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SerialEntryOrganizerWithoutRootModelController"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="buildPageModelControllers">if set to <c>true</c> [build page model controllers].</param>
        public SerialEntryOrganizerWithoutRootModelController(ViewReference viewReference, bool buildPageModelControllers = true)
            : base(viewReference)
        {
            this.ShouldShowTabsForSingleTab = false;
            string         configName   = viewReference.ContextValueForKey("DestinationConfigName");
            UPConfigExpand expandConfig = ConfigurationUnitStore.DefaultStore.ExpandByName(configName);

            if (expandConfig != null)
            {
                this.ExpandConfig = expandConfig;
            }

            if (buildPageModelControllers)
            {
                this.AddPageModelControllers();
            }
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
        /// <summary>
        /// Adds row actions
        /// </summary>
        /// <param name="expand">Expand</param>
        /// <param name="resultRow">Result row</param>
        /// <param name="recordId">Record id</param>
        public override void AddRowActions(UPConfigExpand expand, UPMResultRow resultRow, string recordId)
        {
            base.AddRowActions(expand, resultRow, recordId);

            if (this.PreparedSearch.FilterBasedDecision != null)
            {
                var rowContext    = this.ResultContext.RowDictionary[resultRow.Key];
                var actionButtons = this.PreparedSearch.FilterBasedDecision.ButtonsForResultRow(rowContext.Row);

                if (actionButtons.Count > 0)
                {
                    foreach (UPConfigButton buttonDef in actionButtons)
                    {
                        string iconName   = string.Empty;
                        string buttonName = buttonDef.UnitName;

                        if (buttonDef.ViewReference != null)
                        {
                            var action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId($"action.{buttonName}"));

                            var viewReference = buttonDef.ViewReference.ViewReferenceWith(recordId);
                            viewReference = viewReference.ViewReferenceWith(new Dictionary <string, object> {
                                { ".fromPopup", 1 }
                            });
                            action.ViewReference = viewReference;

                            if (!string.IsNullOrEmpty(iconName))
                            {
                                action.IconName = iconName;
                            }

                            action.LabelText = buttonDef.Label;
                            resultRow.AddDetailAction(action);
                        }
                    }
                }
            }
        }
예제 #7
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);
        }
        /// <summary>
        /// Updates the page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns></returns>
        protected override UPMCircleOfInfluencePage UpdatePage(UPMCircleOfInfluencePage page)
        {
            if (this.rootNodeFieldControl == null)
            {
                this.InformAboutDidFailTopLevelElement(page);
                return(page);
            }

            // Load Root Node
            if (page.Invalid || page.RootNode.Invalid)
            {
                UPContainerMetaInfo query = new UPContainerMetaInfo(this.rootNodeFieldControl);
                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);
                }

                Operation operation = query.ReadRecord(this.RootRecordIdentification, this.RequestOption, this);
                if (operation == null && this.RequestOption == UPRequestOption.Online)
                {
                    // Offline
                    UPMWatermarkStatus offlineStatus = UPMWatermarkStatus.WatermarkStatus();
                    page.Status = offlineStatus;
                    this.InformAboutDidChangeTopLevelElement(page, page, null, null);
                }
            }

            return(page);
        }
        private void UpdatePageFromQueryResult(UPCRMResult result)
        {
            this.QueryResult = result;
            UPMGridPage      searchPage = (UPMGridPage)this.CreatePageInstance();
            Page             oldPage = this.Page;
            int              i, j;
            int              columnCount         = result.ColumnCount;
            StringIdentifier identifier          = StringIdentifier.IdentifierWithStringId("columnHeader");
            UPMResultSection section             = new UPMResultSection(identifier);
            UPMResultRow     columnHeaderListRow = new UPMResultRow(identifier);
            var              fieldArray          = new List <UPMField>();

            searchPage.FixedFirstColumn = false;
            searchPage.ShowMenu         = true;
            searchPage.SumRowAtEnd      = false;
            for (i = 0; i < columnCount; i++)
            {
                UPContainerFieldMetaInfo fieldMetaInfo = result.ColumnFieldMetaInfoAtIndex(i);
                string fieldType = fieldMetaInfo.CrmFieldInfo.FieldType;
                if (fieldType == "F" || fieldType == "L" || fieldType == "S")
                {
                    searchPage.SetColumnInfoAtIndexDataTypeSpecialSort(i, UPMColumnDataType.Numeric, false);
                }
                else if (fieldType == "D")
                {
                    searchPage.SetColumnInfoAtIndexDataTypeSpecialSort(i, UPMColumnDataType.Date, true);
                }

                UPMGridColumnHeaderStringField field = new UPMGridColumnHeaderStringField(StringIdentifier.IdentifierWithStringId($"col {i}"))
                {
                    StringValue = result.ColumnNameAtIndex(i)
                };
                fieldArray.Add(field);
            }

            columnHeaderListRow.Fields = fieldArray;
            section.AddResultRow(columnHeaderListRow);
            searchPage.AddResultSection(section);
            int           numberOfResultTables = result.NumberOfResultTables;
            List <object> contextMenuOptions   = new List <object>(numberOfResultTables);
            var           configStore          = ConfigurationUnitStore.DefaultStore;

            for (j = 0; j < numberOfResultTables; j++)
            {
                string infoAreaId    = result.ResultTableAtIndex(j).InfoAreaId;
                string infoAreaLabel = string.Empty;
                if (infoAreaId?.Length > 0)
                {
                    InfoArea       configInfoArea = configStore.InfoAreaConfigById(infoAreaId);
                    UPConfigExpand expand         = configStore.ExpandByName(infoAreaId);
                    FieldControl   fieldControl   = configStore.FieldControlByNameFromGroup("Details", expand.FieldGroupName);
                    if (configInfoArea != null && expand != null && fieldControl != null)
                    {
                        infoAreaLabel = LocalizedString.TextAnalysesShowParam.Replace("%@", configInfoArea.SingularName);
                    }
                }

                contextMenuOptions.Add(infoAreaLabel);
            }

            for (i = 0; i < result.RowCount; i++)
            {
                identifier = StringIdentifier.IdentifierWithStringId($"row {i}");
                var listRow = new UPMResultRow(identifier);
                var crmRow  = result.ResultRowAtIndex(i) as UPCRMResultRow;
                fieldArray = new List <UPMField>();
                var v = crmRow.Values();
                for (j = 0; j < v.Count; j++)
                {
                    UPMStringField field2 = new UPMStringField(StringIdentifier.IdentifierWithStringId($"cell{i}_{j}"))
                    {
                        StringValue    = v[j],
                        RawStringValue = crmRow.RawValueAtIndex(j)
                    };
                    fieldArray.Add(field2);
                }

                listRow.Fields = fieldArray;
                section.AddResultRow(listRow);
                for (j = 0; j < numberOfResultTables; j++)
                {
                    var label = contextMenuOptions[j] as string;
                    if (label.Length == 0)
                    {
                        continue;
                    }

                    string recordIdentification = crmRow.RecordIdentificationAtIndex(j);
                    if (recordIdentification?.Length > 0)
                    {
                        UPMOrganizerAnalysisShowRecordAction showRecordAction = new UPMOrganizerAnalysisShowRecordAction(StringIdentifier.IdentifierWithStringId($"action.row {i} record {j}"))
                        {
                            RecordIdentification = recordIdentification
                        };
                        showRecordAction.SetTargetAction(this, this.PerformShowRecordAction);
                        showRecordAction.LabelText = label;
                        listRow.AddDetailAction(showRecordAction);
                    }
                }
            }

            this.TopLevelElement = searchPage;
            this.InformAboutDidChangeTopLevelElement(oldPage, searchPage, null, null);
        }
        /// <summary>
        /// Creates the root node from result row. Called from PageModeController
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="currentDepth">The current depth.</param>
        /// <param name="expandChecker">The expand checker.</param>
        /// <returns></returns>
        public static UPMCoINode CreateRootNodeFromResultRow(UPCRMResultRow row, string recordIdentification, int currentDepth, UPConfigExpand expandChecker)
        {
            string virtualInfoArea = row.RootVirtualInfoAreaId;
            string infoAreaId      = row.RootRecordIdentification.InfoAreaId();

            virtualInfoArea = infoAreaId == virtualInfoArea ? null : infoAreaId;
            return(CreateNodeFromResultRow(row, virtualInfoArea, recordIdentification, 0, true, expandChecker, null, infoAreaId));
        }
예제 #11
0
        /// <summary>
        /// Creates the node from result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="virtualInfoArea">The virtual information area.</param>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="currentDepth">The current depth.</param>
        /// <param name="rootNode">if set to <c>true</c> [root node].</param>
        /// <param name="expandChecker">The expand checker.</param>
        /// <param name="infoAreaSuffix">The information area suffix.</param>
        /// <param name="infoAreaConfigId">The information area configuration identifier.</param>
        /// <returns></returns>
        protected static UPMCoINode CreateNodeFromResultRow(UPCRMResultRow row, string virtualInfoArea, string recordIdentification, int currentDepth, bool rootNode, UPConfigExpand expandChecker, string infoAreaSuffix, string infoAreaConfigId)
        {
            string     nodeInfoAreaSuffix    = infoAreaSuffix ?? string.Empty;
            string     functionName          = $"trgtNodeField{nodeInfoAreaSuffix}";
            string     mainFieldFunctionName = rootNode ? "mainField" : $"mainField{nodeInfoAreaSuffix}";
            string     subFieldFunctionName  = rootNode ? "subField" : $"subField{nodeInfoAreaSuffix}";
            string     initial1FunctionName  = rootNode ? "initial1" : $"initial1{nodeInfoAreaSuffix}";
            string     initial2FunctionName  = rootNode ? "initial2" : $"initial2{nodeInfoAreaSuffix}";
            string     initialFunctionName   = rootNode ? "initialField" : $"initialField{nodeInfoAreaSuffix}";
            UPMCoINode node = new UPMCoINode(new RecordIdentifier(recordIdentification));

            AddImageToNode(node, infoAreaConfigId, virtualInfoArea, expandChecker, row);

            // Add Fields
            node.Fields = FieldsForResultRow(row, rootNode ? null : functionName, 0, !rootNode);
            List <UPMStringField> mainFields    = FieldsForResultRow(row, mainFieldFunctionName, 1, true);
            List <UPMStringField> subFields     = FieldsForResultRow(row, subFieldFunctionName, 1, true);
            List <UPMStringField> intial1Fields = FieldsForResultRow(row, initial1FunctionName, 0, true);
            UPMStringField        initial1Field = null;

            if (intial1Fields.Count > 0)
            {
                initial1Field = intial1Fields[0];
            }

            List <UPMStringField> intial2Fields = FieldsForResultRow(row, initial2FunctionName, 0, true);
            UPMStringField        initial2Field = null;

            if (intial2Fields.Count > 0)
            {
                initial2Field = intial2Fields[0];
            }

            List <UPMStringField> intialFields = FieldsForResultRow(row, initialFunctionName, 0, true);
            UPMStringField        initialField = null;

            if (intialFields.Count > 0)
            {
                initialField = intialFields[0];
            }

            if (initialField != null)
            {
                node.InitialField = initialField;
            }
            else if (initial1Field != null && initial2Field != null)
            {
                string string1 = initial1Field.StringValue?.Length > 0 ? initial1Field.StringValue.Substring(0, 1) : string.Empty;
                string string2 = initial2Field.StringValue?.Length > 0 ? initial2Field.StringValue.Substring(0, 1) : string.Empty;
                initial1Field.StringValue = $"{string1}{string2}".ToUpper();
                node.InitialField         = initial1Field;
            }
            else if (initial2Field != null)
            {
                initial2Field.StringValue = initial2Field.StringValue?.Length > 0 ? initial2Field.StringValue.Substring(0, 1) : string.Empty;
                node.InitialField         = initial2Field;
            }
            else if (initial1Field != null)
            {
                initial1Field.StringValue = initial1Field.StringValue?.Length > 0 ? initial1Field.StringValue.Substring(0, 1) : string.Empty;
                node.InitialField         = initial1Field;
            }

            List <UPMStringField> fields = new List <UPMStringField>(mainFields);

            fields.AddRange(subFields);
            if (fields.Count > 0)
            {
                node.InfoFields = fields;
            }

            return(node);
        }
        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);
        }
예제 #13
0
        /// <summary>
        /// The alternate expand checker did finish with result.
        /// </summary>
        /// <param name="expandChecker">The expand checker.</param>
        /// <param name="expand">The expand.</param>
        public void AlternateExpandCheckerDidFinishWithResult(UPCRMAlternateExpandChecker expandChecker, UPConfigExpand expand)
        {
            if (expand != null)
            {
                this.ExpandConfig = expand;
            }

            this.ContinueBuildDetailsOrganizerPage();
            this.InformAboutDidChangeTopLevelElement(this.Organizer, this.Organizer, null, UPChangeHints.ChangeHintsWithHint("AlternateExpandFound"));
            this.AddToHistory(this.RecordIdentification, this.ViewReference, this.ExpandConfig.ImageName);
        }
예제 #14
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);
        }
예제 #15
0
        /// <summary>
        /// Adds the dropdown groups for result row.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <param name="rowContext">The row context.</param>
        /// <param name="expand">The expand.</param>
        public override void AddDropdownGroupsForResultRow(UPMResultRow resultRow, UPCoreMappingResultRowContext rowContext, UPConfigExpand expand)
        {
            UPCoreMappingResultContext resultContext = rowContext.Context;

            if (resultContext.DropdownFields.Any())
            {
                int detailFieldCount = resultContext.DropdownFields.Count;
                if (detailFieldCount > 0)
                {
                    UPCRMResultRow row             = rowContext.Row;
                    string         recordId        = row.RecordIdentificationAtIndex(0);
                    var            detailGroupCol1 =
                        new UPMTimelineDetailsGroup(FieldIdentifier.IdentifierWithInfoAreaIdRecordIdFieldId(this.InfoAreaId, recordId, "DetailField_Left"))
                    {
                        Invalid       = true,
                        ResultContext = resultContext
                    };
                    resultRow.AddDetailGroup(detailGroupCol1);
                }
            }
        }
 /// <summary>
 /// The alternate expand checker did finish with result.
 /// </summary>
 /// <param name="expandChecker">The expand checker.</param>
 /// <param name="expand">The expand.</param>
 public void AlternateExpandCheckerDidFinishWithResult(UPCRMAlternateExpandChecker expandChecker,
                                                       UPConfigExpand expand)
 {
     this.ExpandConfig = expand;
     this.ContinueWithExpandConfig();
 }