Example #1
0
        /// <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;
        }
Example #2
0
        public string UpdateBugs(SortedList bugsIdList, Bug bugPropetriesToBeChanged, out string errorMessage)
        {
            errorMessage = string.Empty;

            TDSettings.ConnectionRow connection = MyZillaSettingsDataSet.GetInstance().GetConnectionById(_connectionId);

            string strResult = string.Empty;

            string url = String.Concat(connection.URL, UPDATE_BUG_PAGE);

            MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, connection.Charset);

            string dataToPost = httpDialog.PostHttpRequest_UpdateBugsBulk ( bugsIdList, bugPropetriesToBeChanged  );

            string htmlContent = httpDialog.PostToUrl(url, dataToPost, false);

            errorMessage = HttpEngine.GetStringBetween(htmlContent, "<title>", "</title>", 0, false);

            if (errorMessage.Contains("processed")) {
                //message is not from an error
                errorMessage = String.Empty;

                string updBugs = String.Empty;

                foreach (object key in bugsIdList.Keys)
                {
                    if (String.IsNullOrEmpty(updBugs))
                    {
                        updBugs = key.ToString();
                    }
                    else
                    {
                        updBugs += "," + key.ToString();
                    }
                }

                if (updBugs.Length > 0)
                {
                    strResult = string.Format(Resource.MsgUpdBunchBugsSuccessfully, updBugs);
                }

            }
            #if DEBUG
            MyZilla.BL.Interfaces.Utils.htmlContents = htmlContent;
            #endif

            return strResult;
        }
Example #3
0
        private string AddBugForVersion_2_0( MyZilla.BusinessEntities.Bug bug, string myZillaUrl, string charset)
        {
            string result = string.Empty;

            string url = myZillaUrl + UPDATE_BUG_2_0_PAGE;

            MyZilla.BL.Utils.HttpHelper httpDialog = new HttpHelper(_connectionId, charset);

            string dataToPost = httpDialog.PostHttpRequest_AddBug(bug);

            string htmlContent = httpDialog.PostToUrl(url, dataToPost, false);

            #if DEBUG
            MyZilla.BL.Interfaces.Utils.htmlContents = htmlContent;
            #endif

            result = ValidateAddBug(htmlContent);

            return result;
        }