Пример #1
0
        /// <summary>
        /// This is the method to write and issue into the report. This takes the parameters in the issue node
        /// </summary>
        /// <param name="id">Issue Id</param>
        /// <param name="type">Issue Type</param>
        /// <param name="details">Actual Isssue Message</param>
        /// <param name="itemName">Issue Item</param>
        /// <param name="location">Issue Location</param>
        /// <param name="group">Issue Group/Category</param>
        /// <param name="additionalInfos">Other Additional Info</param>
        virtual public void WriteIssue(string id,
                                       string details,
                                       string itemName,
                                       string location,
                                       string group,
                                       ReportIssueType type,
                                       params string[] additionalInfoList
                                       )
        {
            //What will happen if id/message/type is null?
            ReportIssue issue = new ReportIssue();

            issue.IssueID = id;
            issue.Type    = type;
            issue.Message = details;
            issue.Group   = group;
            if (additionalInfoList != null && additionalInfoList.Length > 0)
            {
                issue.AdditionalInfos = additionalInfoList;
            }

            issue.Item     = itemName;
            issue.Location = location;
            // Increment the corresponding counter
            switch (type)
            {
            // If this issue is an critical error, set the flag
            // as there can be only one Critical Error
            case ReportIssueType.Critical:
                // debug check to see that this should'nt occur more than once
                Debug.Assert(statisticsField.HasCriticalError == false, "Trying to add more than one critical error");
                statisticsField.HasCriticalError = true;
                m_criticalError = issue.Message;
                break;

            // If this issue is an error, increment the numberoferrors
            case ReportIssueType.Error:
                statisticsField.NumberOfErrors++;
                break;

            // if this issue is a warning, increment the numberofwarnings
            case ReportIssueType.Warning:
                statisticsField.NumberOfWarnings++;
                break;
            }

            AddIssue(issue);
        }
Пример #2
0
 /// <summary>
 ///  Public methods called during the migration process for logging messages into the report and finally writing it to file
 /// </summary>
 /// Add an issue to the report.
 public void AddIssue(ReportIssue rep)
 {
     issuesField.Add(rep);
 }