Exemplo n.º 1
0
        public UCBugStatus(List<string> resolutionList, MyZilla.BusinessEntities.Bug bugToUpdate, List<string >  assignedToList , UCEditBug ucEditBug   )
        {
            InitializeComponent();

            _catResolution = resolutionList.GetRange(0, resolutionList.Count);

            _bugToUpd = bugToUpdate;

            this.Size = ucSize;

            this.assignedTo = assignedToList;

            _ucEditBug = ucEditBug;
        }
Exemplo n.º 2
0
        public string AddBug( MyZilla.BusinessEntities.Bug newBug)
        {
            string result = string.Empty  ;

            int versionINT = -1;

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

            // get version for connection
            MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance();

            string version =  _appSettings.GetConnectionById(_connectionId).Version;

            try
            {
                versionINT = int.Parse(version.Substring(0, version.IndexOf(".")));
            }
            catch (FormatException ex)
            {
                result = ex.Message;

                return result;
            }

            switch (versionINT)
            {
                case 2:
                    result = this.AddBugForVersion_2_0(newBug, connection.URL, connection.Charset);
                    break;
                case 3:
                    result = this.AddBugForVersion_3_0(newBug, connection.URL, connection.Charset);
                    break;
            }

            return result;
        }
Exemplo n.º 3
0
        private void DisplayBugDetails( MyZilla.BusinessEntities.Bug bugDetail)
        {
            try
            {
                #region Simple properties

                txtSummary.Text = bugDetail.FullSummary ;

                txtOpenedOn.Text = bugDetail.Created.ToString();

                txtLastModified.Text = bugDetail.Changed.ToString();

                txtBugNo.Text = bugDetail.Id.ToString();

                txtReporter.Text = bugDetail.Reporter;

                txtAssignedTo.Text  = bugDetail.AssignedTo;

                cmbProduct.SelectedValue = bugDetail.Product;

                cmbComponent.SelectedValue = bugDetail.Component;

                cmbVersion.SelectedValue = bugDetail.Version;

                cmbMilestone.SelectedValue = bugDetail.Milestone;

                cmbPriority.SelectedValue = bugDetail.Priority;

                txtStatus.Text = bugDetail.Status;

                cmbOS.SelectedValue = bugDetail.OS;

                cmbSeverity.SelectedValue = bugDetail.Severity;

                cmbHardware.SelectedValue = bugDetail.Hardware;

                txtDependsOn.Text = bugDetail.DependsOn;

                txtBlock.Text = bugDetail.Blocks;

                txtURL.Text = bugDetail.Url;

                txtStWhiteboard.Text = bugDetail.StatusWhiteboard;

                txtResolution.Text = bugDetail.Resolution;

                _bugKnob = bugDetail.Knob;

                _bugReassignTo = bugDetail.ReassignTo;

                _bugDuplicateBug = bugDetail.DuplicateBug;

                _bugResolution = bugDetail.Resolution;

                #endregion

                #region CC

                if (this.ccCatalogListCompleted && !this.ccCompleted)
                {
                    this.ccCompleted = true;
                    //complete cc list with ccBugList

                    this.CompleteCcList(bugDetail);

                    this.ccCatalogListCompleted = false;
                }

                #endregion

                #region Description & Comments

                //load Comments
                ucComments1.LoadComments(bugDetail.Comment);

                //load description
                if (bugDetail.Comment != null && bugDetail.Comment.Count > 0)
                {

                    // who, bug_when, thetext

                    StringBuilder sb = new StringBuilder();

                    string strComment = bugDetail.Comment[0].Replace("\n", Environment.NewLine  );

                    string[] elements = strComment.Split(',');

                    if (elements.GetLength(0) >= 3)
                    {
                        string Date = elements[1].ToString();

                        sb.Append(strComment.Substring(strComment.IndexOf(Date) + Date.Length + 2));
                    }

                    txtDescriptionValue.Text = sb.ToString();
                }

                #endregion

                if (txtResolution.Text  == "DUPLICATE")
                {

                    // search in comment text the bug to duplicate
                    Regex  duplicateBug = new Regex (@"This bug has been marked as a duplicate of (?<bug_number>[(0-9)]+)", RegexOptions.IgnoreCase  );

                    foreach (string strComment in bugDetail.Comment)
                    {
                        Match match = duplicateBug.Match(strComment.ToString());

                        if (match.Success == true)
                        {
                            string bugNo = match.Groups["bug_number"].ToString();

                            txtResolution.Text = "DUPLICATE of bug " + bugNo;

                            break;
                        }

                    }

                }

                #region Attachments

                this.PopulateAttachmentList();

                #endregion

            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "DisplayBugDetails", LoggingCategory.Exception);

                throw ;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bugDetail"></param>
        private void CompleteCcList(MyZilla.BusinessEntities.Bug bug)
        {
            if (allowAddingPersonsToCcList && !txtCC.Visible)
            {
                lstCC.Top += txtCC.Height + 5;
                lstCC.Height -= (txtCC.Height + 5);
                txtCC.Visible = true;
                btnAddCC.Visible = true;
            }

            if (bug.CC != null && bug.CC.Count > 0)
            {
                if (lstCC.Items.Count > 1)
                {
                    // check the proper items in chklistbox
                    for (int i = 0; i < lstCC.Items.Count; i++)
                    {
                        string item = lstCC.Items[i] as string; // name <email>

                        if (CcListContainsItem(item))
                        {
                            lstCC.SetItemChecked(i, true);
                        }
                    }
                }
                else
                {
                    //cc catalog contains only default value
                    if (lstCC.Items.Count == 1)
                    {
                        lstCC.Items.Clear();
                    }

                    int prevCount = lstCC.Items.Count;

                    for (int i = 0; i < bug.CC.Count; i++)
                    {
                        lstCC.Items.Add(bug.CC[i]);
                        lstCC.SetItemChecked(i + prevCount, true);
                    }
                }

            }
        }
Exemplo n.º 5
0
        public string PostHttpRequest_UpdateBug(MyZilla.BusinessEntities.Bug bug, string bugzillaVersion)
        {
            StringBuilder sb = new StringBuilder();

            //Encoding bugzillaEncoding = Encoding.GetEncoding("utf-8");
            Encoding bugzillaEncoding = Encoding.GetEncoding(this._charset);

            #region Build data to be posted

            if (bugzillaVersion.StartsWith("2.18"))
                sb.AppendFormat("&delta_ts={0}", bug.Changed.ToString("yyyyMMddHHmmss"));
            else
                sb.AppendFormat("&delta_ts={0}", HttpUtility.UrlEncode(bug.Changed.ToString("yyyy-MM-dd HH:mm:ss"), bugzillaEncoding));

            sb.AppendFormat("&longdesclength={0}", 1); // mmi
            sb.AppendFormat("&id={0}", bug.Id);
            sb.AppendFormat("&token={0}", bug.Token);
            sb.AppendFormat("&alias={0}", "");
            sb.AppendFormat("&short_desc={0}", HttpUtility.UrlEncode(bug.Summary, bugzillaEncoding));
            sb.AppendFormat("&product={0}", HttpUtility.UrlEncode(bug.Product, bugzillaEncoding));
            sb.AppendFormat("&component={0}", HttpUtility.UrlEncode(bug.Component, bugzillaEncoding));
            sb.AppendFormat("&rep_platform={0}", HttpUtility.UrlEncode(bug.Hardware, bugzillaEncoding));
            sb.AppendFormat("&op_sys={0}", HttpUtility.UrlEncode(bug.OS, bugzillaEncoding));
            sb.AppendFormat("&version={0}", HttpUtility.UrlEncode(bug.Version, bugzillaEncoding));
            sb.AppendFormat("&priority={0}", HttpUtility.UrlEncode(bug.Priority, bugzillaEncoding));
            sb.AppendFormat("&bug_severity={0}", HttpUtility.UrlEncode(bug.Severity, bugzillaEncoding));
            sb.AppendFormat("&assigned_to={0}", HttpUtility.UrlEncode(bug.AssignedTo, bugzillaEncoding));
            sb.AppendFormat("&qa_contact={0}", HttpUtility.UrlEncode("", bugzillaEncoding));
            sb.AppendFormat("&target_milestone={0}", HttpUtility.UrlEncode(bug.Milestone, bugzillaEncoding));
            sb.AppendFormat("&bug_file_loc={0}", HttpUtility.UrlEncode(bug.Url, bugzillaEncoding));
            sb.AppendFormat("&status_whiteboard={0}", HttpUtility.UrlEncode(bug.StatusWhiteboard, bugzillaEncoding));
            sb.AppendFormat("&keywords={0}", HttpUtility.UrlEncode("", bugzillaEncoding));
            sb.AppendFormat("&dependson={0}", bug.DependsOn );
            sb.AppendFormat("&blocked={0}", bug.Blocks );
            sb.AppendFormat("&newcc={0}", HttpUtility.UrlEncode("", bugzillaEncoding));
            sb.AppendFormat("&cf_custom_field={0}", HttpUtility.UrlEncode("", bugzillaEncoding));
            sb.AppendFormat("&defined_cf_colo={0}", HttpUtility.UrlEncode("", bugzillaEncoding));
            sb.AppendFormat("&cf_color={0}", HttpUtility.UrlEncode("---", bugzillaEncoding));
            sb.AppendFormat("&cf_datetime={0}", HttpUtility.UrlEncode("", bugzillaEncoding));

            sb.AppendFormat("&flag_type-8={0}", HttpUtility.UrlEncode("X", bugzillaEncoding));
            sb.AppendFormat("&flag_type-9={0}", HttpUtility.UrlEncode("X", bugzillaEncoding));
            sb.AppendFormat("&flag_type-11={0}", HttpUtility.UrlEncode("X", bugzillaEncoding));
            sb.AppendFormat("&flag_type-10={0}", HttpUtility.UrlEncode("X", bugzillaEncoding));
            sb.AppendFormat("&flag_type-6={0}", HttpUtility.UrlEncode("X", bugzillaEncoding));

            sb.AppendFormat("&estimated_time={0}", HttpUtility.UrlEncode("0.0", bugzillaEncoding));
            sb.AppendFormat("&work_time={0}", HttpUtility.UrlEncode("0", bugzillaEncoding));
            sb.AppendFormat("&remaining_time={0}", HttpUtility.UrlEncode("0.0", bugzillaEncoding));

            sb.AppendFormat("&deadline={0}", HttpUtility.UrlEncode("", bugzillaEncoding));

            sb.AppendFormat("&comment={0}", HttpUtility.UrlEncode(bug.Comment[bug.Comment.Count - 1], bugzillaEncoding));

            sb.AppendFormat("&knob={0}", bug.Knob ); // mmi
            sb.AppendFormat("&resolution={0}", HttpUtility.UrlEncode(bug.Resolution, bugzillaEncoding));

            sb.AppendFormat("&bug_status={0}", HttpUtility.UrlEncode(bug.Status, bugzillaEncoding));

            sb.AppendFormat("&addtonewgroup={0}", "yesifinold");

            //&estimated_time=0.0
            //&work_time=0
            //&remaining_time=0.0
            //&deadline=
            //&comment=ddd
            //&bug_status=NEW

            //&dup_id=
            //&defined_isprivate_13662=1
            //&defined_isprivate_13724=1

            if (bug.DuplicateBug != null)
            {
                sb.AppendFormat("&dup_id={0}", bug.DuplicateBug);
            }

            #region CC
            if (bug.CC != null &&  bug.CC.Count > 0)
            {
                for (int i = 0; i < bug.CC.Count; i++ )
                {
                    string itemCC = bug.CC[i];

                    string[] elements = itemCC.Split(',');

                    if (elements.Length == 2)
                    {
                        switch (elements[1])
                        {
                            case "removecc":
                                // cc=mzavoi%40tremend.ro&removecc=on
                                sb.AppendFormat("&cc={0}&removecc=on", HttpUtility.UrlEncode(elements[0], bugzillaEncoding));
                                break;
                            case "newcc":
                                sb.AppendFormat("&newcc={0}", HttpUtility.UrlEncode(elements[0], bugzillaEncoding));
                                break;

                        }
                    }
                    else
                    {
                        // no code here.
                    }
                }
            }
            #endregion

            #endregion

            // spaces have to be replaced bu "+"
            string dataToPost = sb.Replace(" ", "+").ToString();

            return dataToPost ;
        }
Exemplo n.º 6
0
        public string PostHttpRequest_AddBug(MyZilla.BusinessEntities.Bug bug)
        {
            StringBuilder sb = new StringBuilder();

            //Encoding bugzillaEncoding = Encoding.GetEncoding("utf-8");
            Encoding bugzillaEncoding = Encoding.GetEncoding(this._charset);

            #region Build data to be posted

            sb.AppendFormat("product={0}", HttpUtility.UrlEncode(bug.Product, bugzillaEncoding));
            sb.AppendFormat("&version={0}", HttpUtility.UrlEncode(bug.Version, bugzillaEncoding));
            sb.AppendFormat("&component={0}", HttpUtility.UrlEncode(bug.Component, bugzillaEncoding));
            sb.AppendFormat("&rep_platform={0}", HttpUtility.UrlEncode(bug.Hardware, bugzillaEncoding));
            sb.AppendFormat("&op_sys={0}", HttpUtility.UrlEncode(bug.OS, bugzillaEncoding));
            sb.AppendFormat("&priority={0}", HttpUtility.UrlEncode(bug.Priority, bugzillaEncoding));
            sb.AppendFormat("&bug_severity={0}", HttpUtility.UrlEncode(bug.Severity, bugzillaEncoding));
            if (String.IsNullOrEmpty(bug.Milestone))
            {
                sb.AppendFormat("&target_milestone={0}", "---");
            }
            else
            {
                sb.AppendFormat("&target_milestone={0}", HttpUtility.UrlEncode(bug.Milestone, bugzillaEncoding));
            }
            sb.AppendFormat("&bug_status={0}", HttpUtility.UrlEncode(bug.Status, bugzillaEncoding));
            sb.AppendFormat("&assigned_to={0}", HttpUtility.UrlEncode(bug.AssignedTo, bugzillaEncoding));
            if (bug.CC != null &&  bug.CC.Count != 0 )
            {
                foreach (string cc in bug.CC  )
                {
                    sb.AppendFormat ("&cc={0}", HttpUtility.UrlEncode(cc, bugzillaEncoding));
                }
            }
            sb.AppendFormat("&bug_file_loc={0}", HttpUtility.UrlEncode(bug.Url, bugzillaEncoding));
            sb.AppendFormat("&short_desc={0}", HttpUtility.UrlEncode(bug.Summary, bugzillaEncoding));
            if ( bug.Comment != null && bug.Comment.Count  > 0)
            {
                sb.AppendFormat ("&comment={0}", HttpUtility.UrlEncode(bug.Comment[0], bugzillaEncoding) );
            }

            sb.AppendFormat("&dependson={0}", bug.DependsOn);
            sb.AppendFormat("&blocked={0}", bug.Blocks);

            #endregion

            // blanks have to be replaced with "+"
            return sb.Replace(' ', '+').ToString(); ;
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
        private string AddBugForVersion_3_0(MyZilla.BusinessEntities.Bug bug, string myZillaUrl, string charset)
        {
            string result = string.Empty;

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

            string htmlContent =  httpDialog.PostMultipartWhenAddingBug(bug, myZillaUrl );

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

            result = ValidateAddBug(htmlContent);

            return result;
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
0
        private void ShowBugDetails(MyZilla.BusinessEntities.Bug currentBug)
        {
            try
            {
                if (currentBug != null)
                {
                    if (!string.IsNullOrEmpty(currentBug.ErrorMessage))
                    {
                        lblMessageError.Visible = true;

                        lblMessageError.Text = currentBug.ErrorMessage;

                    }
                    else
                    {
                        lblMessageError.Visible = false;
                    }

                    lblBugId.Text = currentBug.Id.ToString();

                    lblSummary.Text = String.Format("{0}  {1}", currentBug.Id, currentBug.Summary);

                    lblProductValue.Text = currentBug.Product;

                    lblVersionValue.Text = currentBug.Version;

                    lblComponentValue.Text = currentBug.Component;

                    lblCreatedOnValue.Text = currentBug.Created.ToString("dd/MM/yyyy HH:mm");

                    lblLastModifiedValue.Text = currentBug.Changed.ToString("dd/MM/yyyy HH:mm");

                    lblStatusValue.Text = currentBug.Status;

                    lblPriorityValue.Text = currentBug.Priority;

                    lblSeverityValue.Text = currentBug.Severity;

                    lblReporterValue.Text = currentBug.Reporter;

                    lblAssignedToValue.Text = currentBug.AssignedTo;

                    lblHardwareValue.Text = currentBug.Hardware;

                    lblOSValue.Text = currentBug.OS;

                    lblURLValue.Text = currentBug.Url;

                    lblDescr.Text = String.Empty;

                    lblAttachment.Text = String.Format("Attachments:    {0}", currentBug.Attachments.Count);

                    if (currentBug.Attachments.Count > 0)
                    {
                        dgvAttachments.AutoGenerateColumns = false;
                        dgvAttachments.DataSource = currentBug.Attachments;
                        dgvAttachments.Height = currentBug.Attachments.Count * dgvAttachments.Rows[0].Height;
                        dgvAttachments.Visible = true;
                        //btnAtach.Visible = true;
                    }
                    else {
                        dgvAttachments.Visible = false;
                        //btnAtach.Visible = false;
                    }

                    if (currentBug.Comment != null)
                    {
                        if (currentBug.Comment.Count > 0)
                        {
                            string[] res = currentBug.Comment[0].Split(',');
                            if (res.GetLength(0) >= 3)
                            {
                                string Date = res[1];
                                //avoid problems of spliting by comma (comment might contain comma)
                                lblDescr.Text = Utils.ReplaceNewLines(currentBug.Comment[0].Substring(currentBug.Comment[0].IndexOf(Date) + Date.Length + 1));
                            }

                            ucComments1.LoadComments(currentBug.Comment);

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "ShowBugDetails", LoggingCategory.Exception);

                throw;

            }
        }
Exemplo n.º 11
0
 public CustomException(MyZilla.BusinessEntities.SavingData data, string message,
     Exception innerException)
     : base(message, innerException)
 {
     _customData = data;
 }
Exemplo n.º 12
0
 public CustomException(MyZilla.BusinessEntities.SavingData data)
     : base()
 {
     _customData = data;
 }