Example Title |
Copy Code
|
---|---|
/* How to call: BugFactory tempBugF = (BugFactory)tdConnection.BugFactory; Bug tempbug = (Bug)tempBugF[1]; BugReqLink(tempbug); */ public bool BugReqLink(Bug aBug) { try { TDFilter bugFilter, reqFilter; List reqL, bugL; BugFactory bugF = (BugFactory)tdConnection.BugFactory; ReqFactory reqF = (ReqFactory)tdConnection.ReqFactory; //Set up the cross filter that specifies only this bug bugFilter = bugF.Filter; bugFilter["BG_BUG_ID"] = aBug.ID.ToString(); bugL = bugFilter.NewList(); foreach (Bug thisBug in bugL) { String tempStr = String.Format("{0} {1}", thisBug.ID, thisBug.Summary); Debug.Print(tempStr); } reqFilter = reqF.Filter; // Add the cross filter. The filter now means // "Return all requirements associated // with the bugs specified by the cross filter" // In this case, a single Bug. reqFilter.SetXFilter("REQ-BUG", true, bugFilter.Text); reqL = reqF.NewList(reqFilter.Text); //Check the results if (reqL.Count > 0) { foreach (Req aReq in reqL) { Debug.Print(aReq.Name); } } else { String errmsg = "No bug links found"; return false; } return true; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); //Handle Error return false; } } |