internal int MessageCountByStatus(ValidationMessageStatus validationMessageStatus)
        {
            int returnCount = 0;

            foreach (TreeGridNode topLevelNode in this.Nodes)
            {
                foreach (TreeGridNode typeNode in topLevelNode.Nodes)
                {
                    foreach (TreeGridNode messageNode in typeNode.Nodes)
                    {
                        if (((ValidationMessageStatus)messageNode.Tag) == validationMessageStatus)
                        {
                            returnCount += 1;
                        }
                    }
                }
            }
            return(returnCount);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes ValidationMessageEventArgs with necessary data for Comparison.ValidationMessage event.
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="validationMessageType">Type of object that a validation message relates to. For example, Table, Measure, MeasureCalculationDependency, etc.</param>
 /// <param name="validationMessageStatus">Status for a validation message, such as Informational and Warning.</param>
 public ValidationMessageEventArgs(string message, ValidationMessageType validationMessageType, ValidationMessageStatus validationMessageStatus)
 {
     Message = message;
     ValidationMessageType   = validationMessageType;
     ValidationMessageStatus = validationMessageStatus;
 }
Exemplo n.º 3
0
        public void ShowStatusMessage(int windowHandle, string windowName, string message, ValidationMessageType validationMessageType, ValidationMessageStatus validationMessageStatus)
        {
            validationOutputButtons.Visible      = true;
            treeGridViewValidationOutput.Visible = true;

            treeGridViewValidationOutput.ShowStatusMessage(windowHandle, windowName, message, validationMessageType, validationMessageStatus);

            if (validationMessageStatus == ValidationMessageStatus.Informational)
            {
                validationOutputButtons.InformationalMessageCount += 1;
            }
            else
            {
                validationOutputButtons.WarningCount += 1;
            }

            this.Refresh();
        }
        public void ShowStatusMessage(int windowHandle, string windowName, string message, ValidationMessageType validationMessageType, ValidationMessageStatus validationMessageStatus)
        {
            // There are 3 types of nodes:
            //  1) Top Level (for a comparion window)
            //  2) Type Node (for grouping of messages by type, e.g. DataSources, tables, etc.)
            //  3) Message node (that contains the actual message), which can be either a warning or informational

            //This method will add at least 1 message node and its parent nodes only if necessary.
            //The nodes are differentiated and identified based on their level and the .Tag property


            TreeGridNode messageNode;  //node that will contain the actual message when we are done

            TreeGridNode topLevelNodeForHandle = null;

            foreach (TreeGridNode topLevelNode in this.Nodes)
            {
                if (topLevelNode.Tag != null && Convert.ToInt32(topLevelNode.Tag) == windowHandle)
                {
                    topLevelNodeForHandle = topLevelNode;
                    break;
                }
            }
            if (topLevelNodeForHandle == null)
            {
                //Didn't find match, so need to create new node
                topLevelNodeForHandle                     = this.Nodes.Add();
                topLevelNodeForHandle.Tag                 = windowHandle;
                topLevelNodeForHandle.Cells[1].Value      = windowName;
                topLevelNodeForHandle.Cells[1].Style.Font = new Font(Font.SystemFontName, 8, FontStyle.Bold);
                topLevelNodeForHandle.ImageIndex          = 17;
                //topLevelNodeForHandle.Visible = false;
            }

            TreeGridNode particularTypeNode = null;

            switch (validationMessageType)
            {
            case ValidationMessageType.Model:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Model");
                particularTypeNode.ImageIndex = 25;
                break;

            case ValidationMessageType.DataSource:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Data Sources");
                particularTypeNode.ImageIndex = 0;
                break;

            case ValidationMessageType.Table:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Tables");
                particularTypeNode.ImageIndex = 1;
                break;

            case ValidationMessageType.Relationship:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Relationships");
                particularTypeNode.ImageIndex = 2;
                break;

            case ValidationMessageType.Measure:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Measures");
                particularTypeNode.ImageIndex = 3;
                break;

            case ValidationMessageType.Kpi:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "KPIs");
                particularTypeNode.ImageIndex = 4;
                break;

            case ValidationMessageType.CalculationItem:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Calculation Items");
                particularTypeNode.ImageIndex = 24;
                break;

            case ValidationMessageType.CalculationGroup:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Calculation Groups");
                particularTypeNode.ImageIndex = 23;
                break;

            case ValidationMessageType.Expression:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Expression");
                particularTypeNode.ImageIndex = 22;
                break;

            case ValidationMessageType.Perspective:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Perspectives");
                particularTypeNode.ImageIndex = 15;
                break;

            case ValidationMessageType.Culture:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Culture");
                particularTypeNode.ImageIndex = 21;
                break;

            case ValidationMessageType.Role:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Roles");
                particularTypeNode.ImageIndex = 14;
                break;

            case ValidationMessageType.Action:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Actions");
                particularTypeNode.ImageIndex = 16;
                break;

            //case ValidationMessageType.RefreshPolicy:
            //    particularTypeNode = FindOrCreateTypeNode(topLevelNodeForHandle, "Refresh Policy");
            //    particularTypeNode.ImageIndex = 26;
            //    break;
            case ValidationMessageType.MeasureCalculationDependency:
                particularTypeNode            = FindOrCreateTypeNode(topLevelNodeForHandle, "Measure Calculation Dependencies");
                particularTypeNode.ImageIndex = 3;
                break;

            default:
                //Something is wrong, better get out of here.
                return;
            }
            messageNode = particularTypeNode.Nodes.Add();
            topLevelNodeForHandle.Expand();
            particularTypeNode.Expand();


            messageNode.Visible = false;
            if (validationMessageStatus == ValidationMessageStatus.Informational)
            {
                messageNode.ImageIndex = 11;
                if (_informationalMessagesVisible)
                {
                    messageNode.Visible        = true;
                    messageNode.Parent.Visible = true;
                }
            }
            else
            {
                messageNode.ImageIndex = 12;
                if (_warningsVisible)
                {
                    messageNode.Visible        = true;
                    messageNode.Parent.Visible = true;
                }
            }
            messageNode.Tag            = validationMessageStatus;
            messageNode.Cells[1].Value = message;

            if (messageNode.Visible && this.Height > 0)
            {
                // autoscroll
                this.FirstDisplayedCell = this.Rows[this.Rows.Count - 1].Cells[0];
                this.Refresh();
            }
        }