Пример #1
0
    public static string PasteRQMTs(int RQMTSetID, string options)
    {
        var result = WTSPage.CreateDefaultResult();

        string previousCopiedRQMTs = (string)HttpContext.Current.Session["copied.rqmts"]; // RQMTS, SYSIDS, RSRSIDS

        if (options == null)
        {
            options = "";
        }
        bool pasteAttributes   = options.IndexOf("attr") != -1;
        bool pasteDefects      = options.IndexOf("def") != -1;
        bool pasteDescriptions = options.IndexOf("desc") != -1;

        string pasteOptions = (pasteAttributes ? "attr," : "") + (pasteDefects ? "def," : "") + (pasteDescriptions ? "desc," : "");

        if (pasteOptions.Length > 0)
        {
            pasteOptions = pasteOptions.Substring(0, pasteOptions.Length - 1);
        }

        if (!string.IsNullOrWhiteSpace(previousCopiedRQMTs))
        {
            string[] arr         = previousCopiedRQMTs.Split(',');
            string[] prevRQMTIDs = arr[0].Split('|');
            string[] prevRQMTSet_RQMTSystemIDs = arr[2].Split('|');

            for (int i = 0; i < prevRQMTIDs.Length; i++)
            {
                int RQMTID = Int32.Parse(prevRQMTIDs[i]);
                int RQMTSet_RQMTSystemID = Int32.Parse(prevRQMTSet_RQMTSystemIDs[i]);

                RQMT.RQMTSet_AddRQMT(RQMTSetID, RQMTID, null, false, RQMTSet_RQMTSystemID, pasteOptions);
            }

            RQMT.RQMTSet_ReorderRQMTs(RQMTSetID, null); // this forces us to reclaim space from previously deleted rqmts

            result["success"] = "true";
        }
        else // we shouldn't get here; the UI should have disabled the paste button if there is nothing on the clipboard
        {
            result["success"] = "true";
        }

        return(WTSPage.SerializeResult(result));
    }
Пример #2
0
    public static string AddRQMTToRQMTSet(int RQMTSetID, int RQMTID, string RQMTText, bool addAsChild)
    {
        var result = WTSPage.CreateDefaultResult();

        try
        {
            RQMTID = RQMT.RQMTSet_AddRQMT(RQMTSetID, RQMTID, RQMTText, addAsChild, 0, null);

            result["success"] = "true";
            result["RQMTID"]  = RQMTID.ToString(); // only needed if we create a brand new RQMTID
        }
        catch (Exception e)
        {
            result["error"] = e.Message;
        }

        return(WTSPage.SerializeResult(result));
    }