示例#1
0
    private void FillRQMTHistory()
    {
        DataTable dthst = Auditing.AuditHistory_Get((int)AuditLogTypeEnum.RQMT, ItemID, 0, asOfDateExclusive);

        DataSet dsRQMT = RQMT.RQMTEditData_Get(ItemID);

        DataTable dtRQMT                     = dsRQMT.Tables["RQMT"];
        DataTable dtAllSets                  = dsRQMT.Tables["ALLSETS"];
        DataTable dtAssociations             = dsRQMT.Tables["ASSOCIATIONS"];
        DataTable dtAttributes               = dsRQMT.Tables["ATTRIBUTES"];
        DataTable dtUsage                    = dsRQMT.Tables["USAGE"];
        DataTable dtAvailableFunctionalities = dsRQMT.Tables["AVAILABLEFUNCTIONALITIES"];
        DataTable dtFunctionality            = dsRQMT.Tables["FUNCTIONALITY"];
        DataTable dtDescriptions             = dsRQMT.Tables["DESCRIPTIONS"];
        DataTable dtDescriptionTypes         = dsRQMT.Tables["DESCTYPES"];
        DataTable dtDefects                  = dsRQMT.Tables["DEFECTS"];

        string detailsSection = CreatePropertySections("details",
                                                       new string[] { "RQMT Name" },
                                                       new string[] { dtRQMT.Rows[0]["RQMT"].ToString() },
                                                       new string[] { GetPreviousValues(dthst, "RQMT", asOfDateExclusive) });

        phAuditHistory.Controls.Add(CreateSection("Details", detailsSection));

        string associationsHistory = CreateTableSection("associations", "RQMTID", "SET", dthst,
                                                        new string[] { "ACTION", "UPDATED", "UPDATED BY" },
                                                        new string[] { "NewValue", "UpdatedDate", "UpdatedBy" },
                                                        30, 250);

        string currentAssocations = "<div style=\"padding-bottom:10px;padding-left:15px;position:relative;\">";

        if (string.IsNullOrWhiteSpace(associationsHistory))
        {
            currentAssocations += "<img src=\"images/icons/expand.gif\" width=\"9\" height=\"9\" style=\"position:absolute;left:2px;top:2px;opacity:.3\" alt=\"No history found\" title=\"No history found\">";
        }
        else
        {
            currentAssocations += "<img src=\"images/icons/expand.gif\" width=\"9\" height=\"9\" style=\"position:absolute;left:2px;top:2px;cursor:pointer;\" onclick=\"$('#div_associations_history').toggle(); $(this).attr('src', $('#div_associations_history').is(':visible') ? 'images/icons/collapse.gif' : 'images/icons/expand.gif')\">";

            associationsHistory = associationsHistory.Replace("RQMT ADDED TO SET", "<img src=\"images/icons/check.png\" width=\"12\" height=\"12\" alt=\"Added to set\" title=\"Added to set\">&nbsp;");
            associationsHistory = associationsHistory.Replace("RQMT DELETED FROM SET", "<img src=\"images/icons/cross.png\" width=\"12\" height=\"12\" alt=\"Deleted from set\" title=\"Deleted from set\">&nbsp;");
        }

        bool rowAdded = false;

        foreach (DataRow row in dtAssociations.Rows)
        {
            if (rowAdded)
            {
                currentAssocations += "<br />";
            }

            string rsid = row["RQMTSet_ID"].ToString();
            string sys  = row["WTS_SYSTEM"].ToString();
            string wa   = row["WorkArea"].ToString();
            string rt   = row["RQMTType"].ToString();

            currentAssocations += "<b>" + sys + "/" + wa + "/" + rt + " (" + rsid + ")</b>";

            rowAdded = true;
        }
        currentAssocations += "</div>";
        currentAssocations += "<div id=\"div_associations_history\" style=\"display:none;\">";
        currentAssocations += associationsHistory;
        currentAssocations += "</div>";

        phAuditHistory.Controls.Add(CreateSection("Associations", currentAssocations));
    }
示例#2
0
    private void LoadData()
    {
        // get the full attribute list
        dtRQMTAttribute = RQMT.RQMTAttribute_Get();

        if (!this.NewRQMT)
        {
            DataSet dsRQMT = RQMT.RQMTEditData_Get(RQMTID);

            dtRQMT = dsRQMT.Tables["RQMT"];

            if (dtRQMT.Rows.Count == 0)
            {
                pageIsInvalid = true;
                return;
            }

            dtAllSets                  = dsRQMT.Tables["ALLSETS"];
            dtAssociations             = dsRQMT.Tables["ASSOCIATIONS"];
            dtAttributes               = dsRQMT.Tables["ATTRIBUTES"];
            dtUsage                    = dsRQMT.Tables["USAGE"];
            dtAvailableFunctionalities = dsRQMT.Tables["AVAILABLEFUNCTIONALITIES"];
            dtFunctionality            = dsRQMT.Tables["FUNCTIONALITY"];
            dtDescriptions             = dsRQMT.Tables["DESCRIPTIONS"];
            dtDescriptionTypes         = dsRQMT.Tables["DESCTYPES"];
            dtDefects                  = dsRQMT.Tables["DEFECTS"];
            dtDescriptionAttachments   = dsRQMT.Tables["DESCATT"];

            SetAssociationsCount    = dtAssociations.Rows.Count;
            SystemAssociationsCount = dtAttributes.Rows.Count;

            sectionCounts = "associations=" + SetAssociationsCount + ",attributes=" + SystemAssociationsCount + ",usage=" + SetAssociationsCount + ",functionalities=0,descriptions=0,defects=0";

            CanDeleteRQMT = true;
            if (SetAssociationsCount > 0 ||
                (dtDefects.Rows.Count > 0 && dtDefects.Rows[0]["RQMTSystemDefect_ID"] != DBNull.Value) ||
                (dtFunctionality.Rows.Count > 0 && dtFunctionality.Rows[0]["Functionality_ID"] != DBNull.Value) ||
                (dtDescriptions.Rows.Count > 0 && dtDescriptions.Rows[0]["RQMTSystemRQMTDescription_ID"] != DBNull.Value))
            {
                CanDeleteRQMT = false;
            }

            descTypeOptions = CreateOptionStringFromDataTable(dtDescriptionTypes, "RQMTDescriptionType_ID", "RQMTDescriptionType", null, null, true);

            if (dtRQMT != null && dtRQMT.Rows.Count > 0)
            {
                spnRQMT.InnerText = dtRQMT.Rows[0]["RQMTID"].ToString();

                string   createdDateDisplay = string.Empty, updatedDateDisplay = string.Empty;
                DateTime nCreatedDate = new DateTime(), nUpdatedDate = new DateTime();

                if (DateTime.TryParse(dtRQMT.Rows[0]["CreatedDate"].ToString(), out nCreatedDate))
                {
                    createdDateDisplay = String.Format("{0:M/d/yyyy h:mm tt}", nCreatedDate);
                }
                if (DateTime.TryParse(dtRQMT.Rows[0]["UpdatedDate"].ToString(), out nUpdatedDate))
                {
                    updatedDateDisplay = String.Format("{0:M/d/yyyy h:mm tt}", nUpdatedDate);
                }

                spnCreated.InnerText = "Created: " + dtRQMT.Rows[0]["CreatedBy"].ToString() + " - " + createdDateDisplay;
                spnUpdated.InnerText = "Updated: " + dtRQMT.Rows[0]["UpdatedBy"].ToString() + " - " + updatedDateDisplay;
                txtRQMT.Text         = dtRQMT.Rows[0]["RQMT"].ToString();
                txtRQMT.Attributes.Add("original_value", dtRQMT.Rows[0]["RQMT"].ToString());
            }

            if (dtAllSets != null && dtAllSets.Rows.Count > 0)
            {
                dtAllSets.Columns.Add("X", typeof(string));
                dtAllSets.Columns["X"].SetOrdinal(0);
                dtAllSets.Columns.Add("Z", typeof(string));

                grdAssociations.GridHeaderRowDataBound += grdAssociations_GridHeaderRowDataBound;
                grdAssociations.GridRowDataBound       += grdAssociations_GridRowDataBound;
                grdAssociations.DataSource              = dtAllSets;
                grdAssociations.DataBind();
            }

            if (dtAttributes != null && dtAttributes.Rows.Count > 0)
            {
                dtAttributes.Columns.Add("Z", typeof(string));

                grdAttributes.GridHeaderRowDataBound += grdAttributes_GridHeaderRowDataBound;
                grdAttributes.GridRowDataBound       += grdAttributes_GridRowDataBound;
                grdAttributes.DataSource              = dtAttributes;
                grdAttributes.DataBind();
            }

            if (dtUsage != null && dtUsage.Rows.Count > 0)
            {
                dtUsage.Columns.Add("Toggle", typeof(string));
                dtUsage.Columns.Add("Z", typeof(string));

                grdUsage.GridHeaderRowDataBound += grdUsage_GridHeaderRowDataBound;
                grdUsage.GridRowDataBound       += grdUsage_GridRowDataBound;
                grdUsage.DataSource              = dtUsage;
                grdUsage.DataBind();
            }

            if (dtFunctionality != null && dtFunctionality.Rows.Count > 0)
            {
                // produce a unique table with one row per rsrs
                dtFunctionalityDistinct = dtFunctionality.Copy();
                dtFunctionalityDistinct.Columns.Remove("Functionality");
                dtFunctionalityDistinct.Columns.Remove("Functionality_ID");
                dtFunctionalityDistinct.AcceptChanges();
                dtFunctionalityDistinct = dtFunctionalityDistinct.DefaultView.ToTable(true);
                dtFunctionalityDistinct.Columns.Add("Functionality", typeof(string));

                grdFunctionalities.GridHeaderRowDataBound += grdFunctionalities_GridHeaderRowDataBound;
                grdFunctionalities.GridRowDataBound       += grdFunctionalities_GridRowDataBound;
                grdFunctionalities.DataSource              = dtFunctionalityDistinct;
                grdFunctionalities.DataBind();

                int cnt = 0;
                for (int i = 0; i < dtFunctionality.Rows.Count; i++)
                {
                    if (dtFunctionality.Rows[i]["Functionality_ID"] != DBNull.Value)
                    {
                        cnt++;
                    }
                }

                sectionCounts = sectionCounts.Replace("functionalities=0", "functionalities=" + cnt);
            }

            if (dtDescriptions != null && dtDescriptions.Rows.Count > 0)
            {
                // produce a unique table with one row per rs
                dtDescriptionsDistinct = dtDescriptions.Copy();
                dtDescriptionsDistinct.Columns.Remove("RQMTSystemRQMTDescription_ID");
                dtDescriptionsDistinct.Columns.Remove("RQMTDescription_ID");
                dtDescriptionsDistinct.Columns.Remove("RQMTDescription");
                dtDescriptionsDistinct.Columns.Remove("RQMTDescriptionType_ID");
                dtDescriptionsDistinct.Columns.Remove("RQMTDescriptionType");
                dtDescriptionsDistinct.AcceptChanges();
                dtDescriptionsDistinct = dtDescriptionsDistinct.DefaultView.ToTable(true);
                dtDescriptionsDistinct.Columns.Add("Descriptions", typeof(string));

                grdDescriptions.GridHeaderRowDataBound += grdDescriptions_GridHeaderRowDataBound;
                grdDescriptions.GridRowDataBound       += grdDescriptions_GridRowDataBound;
                grdDescriptions.DataSource              = dtDescriptionsDistinct;
                grdDescriptions.DataBind();

                int cnt = 0;
                for (int i = 0; i < dtDescriptions.Rows.Count; i++)
                {
                    int RQMTSystemRQMTDescription_ID = dtDescriptions.Rows[i]["RQMTSystemRQMTDescription_ID"] != DBNull.Value ? (int)dtDescriptions.Rows[i]["RQMTSystemRQMTDescription_ID"] : 0;

                    if (RQMTSystemRQMTDescription_ID != 0 && (DisplayItemID == 0 || RQMTSystemRQMTDescription_ID == DisplayItemID))
                    {
                        cnt++;
                    }
                }

                sectionCounts           = sectionCounts.Replace("descriptions=0", "descriptions=" + cnt);
                SystemDescriptionsCount = cnt;
            }

            if (dtDefects != null && dtDefects.Rows.Count > 0)
            {
                dtDefectsDistinct = dtDefects.Copy();
                dtDefectsDistinct.Columns.Remove("RQMTSystemDefect_ID");
                dtDefectsDistinct.Columns.Remove("Description");
                dtDefectsDistinct.Columns.Remove("Impact");
                dtDefectsDistinct.Columns.Remove("RQMTStage");
                dtDefectsDistinct.Columns.Remove("SortOrder_ID");
                dtDefectsDistinct.AcceptChanges();
                dtDefectsDistinct = dtDefectsDistinct.DefaultView.ToTable(true);
                dtDefectsDistinct.Columns.Add("Defects", typeof(string));

                grdDefects.GridHeaderRowDataBound += grdDefects_GridHeaderRowDataBound;
                grdDefects.GridRowDataBound       += grdDefects_GridRowDataBound;
                grdDefects.DataSource              = dtDefectsDistinct;
                grdDefects.DataBind();

                int cnt = 0;
                for (int i = 0; i < dtDefects.Rows.Count; i++)
                {
                    if (dtDefects.Rows[i]["RQMTSystemDefect_ID"] != DBNull.Value)
                    {
                        cnt++;
                    }
                }

                sectionCounts = sectionCounts.Replace("defects=0", "defects=" + cnt);
            }
        }
    }