Ejemplo n.º 1
0
        }//END AddItem Method

        //  =================================================================================
        /// <summary>
        ///   This method adds a new data change value to the list of data change objects.
        /// </summary>
        /// <param name="ItemId">String: The item identifier.</param>
        /// <param name="InitialValue">String: the intial item value.</param>
        /// <param name="NewValue">String: the new item value.</param>
        /// <returns>Integer: is the count of data change object in the list.</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initilize the data change item object
        ///
        /// 2. Add the item to the item object
        ///
        /// 3. Return a number of items on the item list object
        /// </remarks>
        //  ---------------------------------------------------------------------------------
        public int AddItem(String ItemId, Guid InitialValue, Guid NewValue)
        {
            //
            // if nothing has changed then exit.
            //
            if (InitialValue == NewValue)
            {
                return(this._Items.Count);
            }

            //
            // Initialise the new data change item
            //
            EvDataChangeItem item = new EvDataChangeItem(ItemId, InitialValue.ToString( ), NewValue.ToString( ));

            //
            // Append the item to the item list.
            //
            this._Items.Add(item);

            //
            // return the item index.
            //
            return(this._Items.Count);
        }//END AddItem Method
Ejemplo n.º 2
0
        }//END AddItem Method

        //  =================================================================================
        /// <summary>
        ///   This method adds a new data change value to the list of data change objects.
        /// </summary>
        /// <param name="ItemId">String: The item identifier.</param>
        /// <param name="enumInitialValue">Enumerated Object: the intial item value.</param>
        /// <param name="enumNewValue">Enumerated Object: the new item value.</param>
        /// <returns>Integer: is the count of data change object in the list.</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initilize the data change item object
        ///
        /// 2. Add the item to the item object
        ///
        /// 3. Return a number of items on the item list object
        /// </remarks>
        //  ---------------------------------------------------------------------------------
        public int AddItem(
            String ItemId,
            Object enumInitialValue,
            Object enumNewValue)
        {
            //
            // Convert the enumerated value to string.
            //
            String InitialValue = Enum.GetName(enumInitialValue.GetType( ), enumInitialValue);
            String NewValue     = Enum.GetName(enumNewValue.GetType( ), enumNewValue);

            //
            // if nothing has changed then exit.
            //
            if (InitialValue.Trim( ) == NewValue.Trim( ))
            {
                return(this._Items.Count);
            }

            //
            // Initialise the new data change item
            //
            EvDataChangeItem item = new EvDataChangeItem(ItemId, InitialValue, NewValue);

            //
            // Append the item to the item list.
            //
            this._Items.Add(item);

            //
            // return the item index.
            //
            return(this._Items.Count);
        }//END AddItem Metho
Ejemplo n.º 3
0
        }//END AddItem Method

        //  =================================================================================
        /// <summary>
        /// This method creates a Html fieldset containing the contents of the indexed data
        /// change object.
        /// </summary>
        /// <param name="ChangeNo">Int: the index to the data change object to be displayed.</param>
        /// <returns>Html as String</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize the stHtml string
        ///
        /// 2. Open the fieldset element and set its legend
        ///
        /// 3. Add a table row displaying the trail identifier if it exists
        ///
        /// 4. Add a table row displaying the subject identifier if it exists
        ///
        /// 5. Add a table row displaying the record identifier if it is exists
        ///
        /// 6. Output the data change item value in a table
        ///
        /// 7. Loop through the items in this change items as a table row.
        ///
        /// 8. Extract data, set view, set column, format xml, add user identifier and time stamp
        /// </remarks>
        //  ---------------------------------------------------------------------------------
        public string getAsHtml(int ChangeNo)
        {
            //
            // Initialise the stHtlm string
            //
            String stHtml = String.Empty;

            //
            // Open the fieldset element and set its legend
            //
            stHtml += "<fieldset class='Fields'> "
                      + "<legend>Change: " + (ChangeNo + 1) + "</legend>"
                      + "<table>";

            //
            // Add a table row displaying the trial identifier if it exists.
            //
            if (this._TrialId != String.Empty)
            {
                stHtml += "<tr>"
                          + "<td class='Prompt Width_20' >TrialId:</td>"
                          + "<td>" + this._TrialId + "</td>"
                          + "</tr>";
            }

            //
            // Add a table row displaying the subject identifier if it exists
            //
            if (this._SubjectId != String.Empty)
            {
                stHtml += "<tr>"
                          + "<td class='Prompt Width_20' >SubjectId:</td>"
                          + "<td>" + this._SubjectId + "</td>"
                          + "</tr>";
            }

            //
            // Add a table row displaying the record identifier if it is exists
            //
            if (this._RecordId != String.Empty)
            {
                stHtml += "<tr>"
                          + "<td class='Prompt Width_20' >RecordId:</td>"
                          + "<td>" + this._RecordId + "</td>"
                          + "</tr>";
            }
            stHtml += "</table>\r\n";

            //
            // Output the data change item value in a table
            //
            stHtml += "<table class='View' style='width:98%' cellspacing='0' border='1' style='border-collapse:collapse;' >"
                      + "<tr class='View_Header'>"
                      + "<th style='width:40px;' style='text-align:center;' >Item</th>"
                      + "<th style='text-align:center;' >ItemId</th>"
                      + "<th style='width:425px;'style='text-align:center;' >Initial Value</th>"
                      + "<th style='width:425px;'style='text-align:center;' >New Value</th>"
                      + "</tr>";

            //
            // Iterate through the items in this change items as a table row.
            //
            for (int index = 0; index < this._Items.Count; index++)
            {
                //
                // Extract data change item from the list of items.
                //
                EvDataChangeItem item = this._Items [index];

                //
                // Set the view to be "View_Item" for the event order and "View_Alt" for the odd order
                //
                if (index % 2 == 0)
                {
                    stHtml += "<tr class='View_Item' >"
                              + "<td style='text-align:center;'>"
                              + (index + 1)
                              + "</td>";
                }
                else
                {
                    stHtml += "<tr class='View_Alt'>"
                              + "<td style='text-align:center;'>"
                              + (index + 1)
                              + "</td>";
                }

                //
                // Set the column to be "Null Data" if item identifier does not exist
                // but if it exists, assign column with item identifier from the list of items
                //
                if (item.ItemId == String.Empty)
                {
                    stHtml += "<td>Null Data</td>";
                }
                else
                {
                    stHtml += "<td>" + EvHtmlCoding.Decode(item.ItemId) + "</td>";
                }

                //
                // Set the column to be "Null Data" if the initial value does not exist
                //
                if (item.InitialValue == String.Empty)
                {
                    stHtml += "<td>Null Data</td>";
                }
                else
                {
                    string value = EvHtmlCoding.Decode(item.InitialValue);

                    //
                    // Formating XML object for display
                    //
                    if (value.Contains("< ?xml version") == true)
                    {
                        value = value.Replace("> ", ">");
                        value = value.Replace("\n", String.Empty);
                        value = value.Replace("> ", "><br/>");
                    }

                    stHtml += "<td>" + value + "</td>";
                }

                //
                // Set the column to be "Null Data" if the new value does not exist
                //
                if (item.NewValue == String.Empty)
                {
                    stHtml += "<td>Null Data</td>";
                }
                else
                {
                    string value = EvHtmlCoding.Decode(item.NewValue);
                    //
                    // Formating XML object for display
                    //
                    if (value.Contains("< ?xml version") == true)
                    {
                        value = value.Replace("> ", ">");
                        value = value.Replace("\n", String.Empty);
                        value = value.Replace("> ", "> <br/>");
                    }

                    stHtml += "<td>" + value + "</td>";
                }
            }

            //
            // Add user identifier and date time stamp from the list of items to the new table row
            //
            stHtml += "<table>"
                      + "<tr>"
                      + "<td class='Prompt Width_20' >UserId:</td>"
                      + "<td>"
                      + this._UserId
                      + "</td>"
                      + "</tr>"
                      + "<tr>"
                      + "<td class='Prompt' >DateStamp:</td>"
                      + "<td>"
                      + this.stDateStamp
                      + "</td>"
                      + "</tr>"
                      + "</table>"
                      + "</fieldset>\t\n";

            //
            // Return the html markup as a string
            //
            return(stHtml);
        }//END getAsHtml method