Exemplo n.º 1
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));
    }
Exemplo n.º 2
0
    public static string CreateNewComponent(string compType, string txt)
    {
        var result = WTSPage.CreateDefaultResult();

        try
        {
            if (compType == "rqmt")
            {
                txt = txt.Replace("|", "!");
                txt = txt.Replace("\r", "");
                txt = txt.Replace("\n", "|"); // we will be adding one rqmt for each |
                string[] txtarr = txt.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                txt = string.Join("|", txtarr);

                // rqmtsNeedingParents stores the indexes of the rqmts that had a > in front of them
                // after the saving is done, we make ajax calls to add the new rqmts to the sets displayed on the page, and will preserve parent-child relationships based on > characters
                string rqmtsNeedingParents = "";
                for (int i = 0; i < txtarr.Length; i++)
                {
                    if (i > 0)
                    {
                        rqmtsNeedingParents += ",";
                    }

                    rqmtsNeedingParents += txtarr[i].Trim().StartsWith(">") ? "1" : "0";
                }

                var saveResult = RQMT.RQMT_Save(true, 0, txt);

                result["success"]             = saveResult["saved"].ToLower();
                result["rqmtid"]              = saveResult["newID"];
                result["rqmtids"]             = saveResult["newIDs"];
                result["exists"]              = saveResult["exists"];
                result["rqmtsneedingparents"] = rqmtsNeedingParents;
            }
        }
        catch (Exception e)
        {
            result["error"] = e.Message;
        }

        return(WTSPage.SerializeResult(result));
    }
Exemplo n.º 3
0
    public static string FilterRQMTSets(int RQMTSetID, string RQMTSetName, int WTS_SYSTEMID, int WorkAreaID, int RQMTTypeID)
    {
        var result = WTSPage.CreateDefaultResult();

        if (RQMTSetID < 0)
        {
            RQMTSetID = 0;
        }

        // when results from back from the server, they come back as a data set containing the following tables:
        // [0] = RQMT
        // [1] = DESC
        // [2] = FUNC
        // [3] = DEFECT
        // [4] = TASK
        DataSet ds = RQMT.RQMTBuilder_Data_Get(RQMTSetID, !string.IsNullOrWhiteSpace(RQMTSetName) ? RQMTSetName : null, WTS_SYSTEMID, WorkAreaID, RQMTTypeID, 0);

        return(WTSPage.SerializeResult(ds));
    }
Exemplo n.º 4
0
    public static string Save(int RQMTID, string RQMTName, string addToSets, string deleteFromSets, string attrChanges, string usageChanges, string funcChanges, string descChanges, int ParentRQMTID)
    {
        var result = WTSPage.CreateDefaultResult();

        RQMTName = RQMTName.Replace("|", "!");
        RQMTName = RQMTName.Replace("\r", "");
        RQMTName = RQMTName.Replace("\n", "");

        // new ID will be 0 if fail, RQMTID if updating, or a new RQMTID if new
        int savedID = RQMT.RQMTEditData_Save(RQMTID, RQMTName, addToSets, deleteFromSets, attrChanges, usageChanges, funcChanges, StringUtil.UndoStrongEscape(descChanges), RQMTID == 0 ? ParentRQMTID : 0);

        if (savedID > 0)
        {
            result["success"] = "true";

            if (RQMTID == 0)
            {
                result["newid"] = savedID.ToString();
            }
        }

        return(WTSPage.SerializeResult(result));
    }
Exemplo n.º 5
0
    public static string CopyRQMTs(string RQMTIDs, string SystemIDs, string RQMTSet_RQMTSystemIDs)
    {
        var result = WTSPage.CreateDefaultResult();

        if (string.IsNullOrWhiteSpace(RQMTIDs) || string.IsNullOrWhiteSpace(RQMTSet_RQMTSystemIDs))
        {
            HttpContext.Current.Session["copied.rqmts"] = "";

            result["rqmtids"]              = "";
            result["rqmtidsstr"]           = "";
            result["systemids"]            = "";
            result["rqmtsetrqmtsystmeids"] = "";
        }
        else
        {
            string previousCopiedRQMTs = (string)HttpContext.Current.Session["copied.rqmts"];

            if (string.IsNullOrWhiteSpace(previousCopiedRQMTs))
            {
                HttpContext.Current.Session["copied.rqmts"] = RQMTIDs + "," + SystemIDs + "," + RQMTSet_RQMTSystemIDs;
            }
            else
            {
                string[] arr                       = previousCopiedRQMTs.Split(',');
                string   prevRQMTIDs               = arr[0];
                string   prevSystemIDs             = arr[1];
                string   prevRQMTSet_RQMTSystemIDs = arr[2];

                string[] newRQMTIdArr             = RQMTIDs.Split('|');
                string[] newSystemIdArr           = SystemIDs.Split('|');
                string[] newRQMTSet_RQMTSystemArr = RQMTSet_RQMTSystemIDs.Split('|');

                string newRQMTIDs               = prevRQMTIDs;
                string newSystemIDs             = prevSystemIDs;
                string newRQMTSet_RQMTSystemIDs = prevRQMTSet_RQMTSystemIDs;

                for (int i = 0; i < newRQMTSet_RQMTSystemArr.Length; i++)
                {
                    if (!("|" + prevRQMTIDs + "|").Contains("|" + newRQMTIdArr[i] + "|"))
                    {
                        newRQMTSet_RQMTSystemIDs += "|" + newRQMTSet_RQMTSystemArr[i];
                        newSystemIDs             += "|" + newSystemIdArr[i];

                        if (("|" + prevRQMTIDs.Replace("*", "") + "|").Contains("|" + newRQMTIdArr[i] + "|"))
                        {
                            newRQMTIDs += "|" + newRQMTIdArr[i] + "*";
                        }
                        else
                        {
                            newRQMTIDs += "|" + newRQMTIdArr[i];
                        }
                    }
                }

                RQMTIDs               = newRQMTIDs;
                SystemIDs             = newSystemIDs;
                RQMTSet_RQMTSystemIDs = newRQMTSet_RQMTSystemIDs;

                HttpContext.Current.Session["copied.rqmts"] = newRQMTIDs + "," + newSystemIDs + "," + newRQMTSet_RQMTSystemIDs;
            }

            result["rqmtids"]              = RQMTIDs;
            result["rqmtidsstr"]           = RQMTIDs.Replace("|", ", ");
            result["systemids"]            = SystemIDs;
            result["rqmtsetrqmtsystmeids"] = RQMTSet_RQMTSystemIDs;
        }

        result["success"] = "true";

        return(WTSPage.SerializeResult(result));
    }
Exemplo n.º 6
0
 public static string LoadAllRQMTSetsForRQMT(int RQMTID)
 {
     return(WTSPage.SerializeResult(RQMT.RQMT_AssociatedSets_Get(RQMTID)));
 }
Exemplo n.º 7
0
 public static string LoadAllRQMTSets()
 {
     return(WTSPage.SerializeResult(RQMT.RQMTSetList_Get()));
 }
Exemplo n.º 8
0
 public static string GetRQMTSetNames()
 {
     return(WTSPage.SerializeResult(RQMT.RQMTSetName_Get()));
 }
Exemplo n.º 9
0
    public static string ExecuteComponentSearch(string compType, string txt)
    {
        DataTable dt = new DataTable();

        bool returnAll = txt == "[ALL]";

        if (txt != null && txt.Length > 2000)
        {
            txt = txt.Substring(0, 2000);
        }

        switch (compType)
        {
        case "rqmt":
            if (string.IsNullOrWhiteSpace(txt))
            {
                txt = "[NONE]";     // we don't allow blank searches for rqmts
            }

            txt = txt.Trim();
            txt = txt.Replace("\r", "");
            txt = txt.Replace("\n", "[CR]");

            // do another check for empty string
            if (string.IsNullOrWhiteSpace(txt))
            {
                txt = "[NONE]";
            }

            dt = RQMT.RQMTList_Get(0, txt, true);

            break;

        case "type":
            dt = RQMT.RQMTTypeList_Get(returnAll || string.IsNullOrWhiteSpace(txt) ? null : txt);     // the type list is short so we default to showing all
            break;

        case "workarea":
            dt = MasterData.WorkAreaList_Get();
            if (!string.IsNullOrWhiteSpace(txt))
            {
                txt = txt.ToUpper();
                foreach (DataRow row in dt.Rows)
                {
                    if (row["WorkArea"].ToString().ToUpper().IndexOf(txt) == -1)
                    {
                        row.Delete();
                    }
                }
            }
            break;

        case "sys":
            dt = MasterData.SystemList_Get();
            DataColumn col = dt.Columns["WTS_SystemID"];
            col.ColumnName = "WTS_SYSTEMID";

            if (!string.IsNullOrWhiteSpace(txt))
            {
                txt = txt.ToUpper();
                foreach (DataRow row in dt.Rows)
                {
                    if (row["WTS_SYSTEM"].ToString().ToUpper().IndexOf(txt) == -1)
                    {
                        row.Delete();
                    }
                }
            }
            break;

        case "desc":
            if (string.IsNullOrWhiteSpace(txt))
            {
                txt = "__NONE__";     // we don't allow blank searches for descriptions
            }
            dt = RQMT.RQMTBuilderDescriptionList_Get(0, txt, false);
            break;
        }

        // some of the source queries are returning invalid xml/json column names, so we fix the common errors
        foreach (DataColumn x in dt.Columns)
        {
            x.ColumnName = x.ColumnName.Replace(" ", "_").Replace("#", "NUM");
        }
        dt.AcceptChanges();

        string str = WTSPage.SerializeResult(dt);

        return(WTSPage.SerializeResult(dt));
    }
Exemplo n.º 10
0
    public static string GetRequirementTypes()
    {
        DataTable dtTypes = RQMT.RQMTTypeList_Get();

        return(WTSPage.SerializeResult(dtTypes));
    }
Exemplo n.º 11
0
    public static string DescriptionAttachmentsUpdated(int RQMTDescription_ID)
    {
        DataTable dt = RQMT.RQMTDescriptionAttachment_Get(0, RQMTDescription_ID, 0, false, 0);

        return(WTSPage.SerializeResult(dt));
    }