/// <summary> /// Update a bug. /// </summary> /// <param name="bug"></param> public string UpdateBug( MyZilla.BusinessEntities.Bug bug, out string errorMessage) { errorMessage = string.Empty; // get version for connection MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance(); TDSettings.ConnectionRow connection = _appSettings.GetConnectionById(_connectionId); string myZillaUrl = connection.URL; string bugzillaVersion = _appSettings.GetConnectionById(_connectionId).Version; string strResult = string.Empty; string url = String.Concat(myZillaUrl, UPDATE_BUG_PAGE); MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset); string dataToPost = httpDialog.PostHttpRequest_UpdateBug(bug, bugzillaVersion); string htmlContent = httpDialog.PostToUrl(url, dataToPost, false); // verify if confirmation string exits in response int pos = htmlContent.IndexOf("Changes submitted"); if (pos >= 0) { strResult = string.Format(Resource.MsgUpdBugSuccessfully, bug.Id); } else { int pos1 = htmlContent.IndexOf("<title>"); int pos2 = htmlContent.IndexOf("</title>"); string strTitle = errorMessage = htmlContent.Substring(pos1 + "<title>".Length, pos2 - (pos1 - 1 + "</title>".Length)); strResult = string.Format(Resource.MsgUpdBugFailed, bug.Id) + Environment.NewLine + strTitle; if (strTitle.Contains("collision")) strResult += Environment.NewLine + "Bug details will be reloaded!"; } #if DEBUG MyZilla.BL.Interfaces.Utils.htmlContents = htmlContent; #endif if (strResult.IndexOf("failed") >= 0) { // search in htmlContent the error // check if assignee was properly assigned //bool errIdentified = false; if (htmlContent.ToLower().IndexOf("assignee") >= 0) { errorMessage = string.Format ( Resource.ErrAssigneeNotMatch, bug.AssignedTo ); //errIdentified = true; } if (htmlContent.ToLower().IndexOf("invalid bug id") >= 0) { errorMessage = Resource.ErrInvalidBugID; // errIdentified = true; } //if (!errIdentified) //{ // errorMessage = Resource.ErrNotIdentifiedFail; //} } return strResult; }