/// <summary> /// Adds a new fixfor and populates the ID field /// </summary> /// <param name="fixFor"></param> /// <returns></returns> public FogBugzFixFor AddFixFor(FogBugzFixFor fixFor) { //Make sure we have a token if (this.token == "") { throw new FogBugzApiException("You need to logon to the API before calling this method"); } //Now construct the various parameters Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("token", this.token); parameters.Add("ixProject", fixFor.Project); parameters.Add("sFixFor", fixFor.Name); parameters.Add("dtRelease", fixFor.ReleaseDate); parameters.Add("fAssignable", fixFor.Assignable); //Finally call the method and get the id back XmlElement response = CallMethod("newFixFor", parameters); //Extract the fix-for id and populate XmlElement xmlNewCase = (XmlElement)response.SelectSingleNode("fixFor"); fixFor.Id = Int32.Parse(xmlNewCase.Attributes["ixFixFor"].Value); return(fixFor); }
/// <summary> /// Gets an existing fixFor in the system /// </summary> /// <param name="id">The id of the fixFor to retrieve</param> /// <returns>The fixFor object</returns> public FogBugzFixFor GetFixFor(int id) { //First create an empty instance to populate FogBugzFixFor fogBugzFixFor = new FogBugzFixFor(); //Make sure we have a token if (this.token == "") { throw new FogBugzApiException("You need to logon to the API before calling this method"); } //Now construct the various parameters Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("token", this.token); parameters.Add("ixFixFor", id); //Finally call the method and get the response xml XmlElement response = CallMethod("viewFixFor", parameters); //Extract the fixFor and populate if (response.ChildNodes.Count > 0) { XmlElement xmlFixFor = (XmlElement)response["fixfor"]; if (xmlFixFor == null) { return(null); } else { fogBugzFixFor.Id = GetIntValue(xmlFixFor, "ixFixFor"); fogBugzFixFor.Project = GetIntValue(xmlFixFor, "ixProject"); fogBugzFixFor.Name = xmlFixFor.SelectSingleNode("sFixFor").InnerText; if (GetDateTimeValue(xmlFixFor, "dt").HasValue) { fogBugzFixFor.ReleaseDate = GetDateTimeValue(xmlFixFor, "dt").Value; } //Return the fixFor return(fogBugzFixFor); } } else { //No matching FixFors return(null); } }