예제 #1
0
 private void FormBugEdit_Load(object sender, EventArgs e)
 {
     if (BugCur == null)
     {
         MsgBox.Show(this, "An invalid bug was attempted to be loaded.");
         DialogResult = DialogResult.Abort;
         Close();
         return;
     }
     textBugId.Text         = BugCur.BugId.ToString();
     textCreationDate.Text  = BugCur.CreationDate.ToString();
     comboStatus.Text       = BugCur.Status_.ToString();
     comboPriority.Text     = BugCur.PriorityLevel.ToString();
     textVersionsFound.Text = BugCur.VersionsFound;
     textVersionsFixed.Text = BugCur.VersionsFixed;
     textDescription.Text   = BugCur.Description;
     textLongDesc.Text      = BugCur.LongDesc;
     textPrivateDesc.Text   = BugCur.PrivateDesc;
     textDiscussion.Text    = BugCur.Discussion;
     textSubmitter.Text     = Bugs.GetSubmitterName(BugCur.Submitter);
     if (!IsNew)
     {
         _listBugSubs.AddRange(BugSubmissions.GetForBugId(BugCur.BugId));
     }
     FillGrid();
 }
예제 #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (BugCur.Submitter == 0)
     {
         MessageBox.Show("A valid submitter wasn't picked.  Make sure the computer being used is associated to a buguser.");
         return;
     }
     if (!Bugs.VersionsAreValid(textVersionsFixed.Text))
     {
         MsgBox.Show("Please fix your version format. Must be like '18.4.8.0;19.1.22.0;19.2.3.0'");
         return;
     }
     if (textVersionsFixed.Text != "")
     {
         BugCur.Status_ = BugStatus.Fixed;
     }
     else if (comboStatus.SelectedIndex == 0)           //none
     {
         BugCur.Status_ = BugStatus.Accepted;
     }
     else
     {
         BugCur.Status_ = (BugStatus)Enum.Parse(typeof(BugStatus), comboStatus.Text);
     }
     SaveToDb();
     BugSubmissions.UpdateBugIds(BugCur.BugId, _listBugSubs);
     DialogResult = DialogResult.OK;
     Close();
 }
예제 #3
0
 ///<summary>Reloads all data for form.</summary>
 private void RefreshData()
 {
     _listHashes           = BugSubmissionHashes.GetMany(datePicker.GetDateTimeFrom(), datePicker.GetDateTimeTo());
     _dictBugSubsByHashNum = BugSubmissions.GetForHashNums(_listHashes.Select(x => x.BugSubmissionHashNum).ToList());
     _dictBugs             = Bugs.GetMany(_listHashes.Select(x => x.BugId).Where(x => x != 0).ToList()).ToDictionary(key => key.BugId);
     _dictPatients         = RegistrationKeys.GetPatientsByKeys(_dictBugSubsByHashNum.Values.SelectMany(x => x.Select(y => y.RegKey)).ToList());
 }
예제 #4
0
        public static long CreateTask(Patient pat, BugSubmission sub)
        {
            //Button is only enabled if _patCur is not null (user has 1 row selected).
            //Mimics FormOpenDental.OnTask_Click()
            FormTaskListSelect FormT = new FormTaskListSelect(TaskObjectType.Patient);

            //FormT.Location=new Point(50,50);
            FormT.Text = Lan.g(FormT, "Add Task") + " - " + FormT.Text;
            FormT.ShowDialog();
            if (FormT.DialogResult != DialogResult.OK)
            {
                return(0);
            }
            Task task = new Task();

            task.TaskListNum = -1;          //don't show it in any list yet.
            Tasks.Insert(task);
            Task taskOld = task.Copy();

            task.KeyNum      = pat.PatNum;
            task.ObjectType  = TaskObjectType.Patient;
            task.TaskListNum = FormT.ListSelectedLists[0];
            task.UserNum     = Security.CurUser.UserNum;
            //Mimics the ?bug quick note at HQ.
            task.Descript = BugSubmissions.GetSubmissionDescription(pat, sub);
            FormTaskEdit FormTE = new FormTaskEdit(task, taskOld);

            FormTE.IsNew = true;
            FormTE.ShowDialog();
            return(task.TaskNum);
        }
예제 #5
0
 private void textDevNote_Leave(object sender, EventArgs e)
 {
     if (_subCur.DevNote == textDevNote.Text)
     {
         return;
     }
     _subCur.DevNote = textDevNote.Text;
     BugSubmissions.Update(_subCur);
     TextDevNoteLeave?.Invoke(sender, e);
 }
예제 #6
0
        ///<summary></summary>
        private void gridSubs_RightClickHelper(object sender, EventArgs e)
        {
            int index = gridSubs.GetSelectedIndex();

            if (index == -1)           //Should not happen, menu item is only enabled when exactly 1 row is selected.
            {
                return;
            }
            List <BugSubmission> listSubs;

            switch (((MenuItem)sender).Index)
            {
            case 0:                    //Open Submission
                listSubs = (List <BugSubmission>)gridSubs.ListGridRows[index].Tag;
                FormBugSubmission formBugSub = new FormBugSubmission(listSubs[0], _jobCur);
                formBugSub.Show();
                break;

            case 1:                    //Open Bug
                listSubs = (List <BugSubmission>)gridSubs.ListGridRows[index].Tag;
                OpenBug(listSubs[0]);
                break;

            case 2:                                           //Hide or Unhide submission
                listSubs = gridSubs.SelectedTags <List <BugSubmission> >().SelectMany(x => x.ToList()).ToList();
                bool isHidden = (!listSubs.First().IsHidden); //Flip all grouped submissions based on what the user selected/sees in the grid.
                listSubs.ForEach(x => x.IsHidden = isHidden);
                BugSubmissions.UpdateMany(listSubs, "IsHidden");
                FillSubGrid(true);
                break;

            case 3:                              //Link or Unlink bug
                listSubs = gridSubs.SelectedTags <List <BugSubmission> >().SelectMany(x => x.ToList()).ToList();
                if (listSubs.First().BugId == 0) //Not linked to existing bug, so link
                {
                    FormBugSearch formBS = new FormBugSearch(new Job());
                    if (formBS.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    listSubs.ForEach(x => x.BugId = formBS.BugCur.BugId);
                    BugSubmissionHashes.UpdateBugIds(listSubs, formBS.BugCur.BugId);
                }
                else                          //Unlink
                {
                    listSubs.ForEach(x => x.BugId = 0);
                    BugSubmissionHashes.UpdateBugIds(listSubs, 0);
                }
                BugSubmissions.UpdateMany(listSubs, "BugId");
                FillSubGrid(true);
                break;
            }
        }
예제 #7
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     Bugs.Delete(BugCur.BugId);
     BugSubmissions.UpdateBugIds(0, _listBugSubs.Select(x => x.BugSubmissionNum).ToList());
     BugCur       = null;
     DialogResult = DialogResult.OK;
 }
예제 #8
0
        public static bool HideMatchedBugSubmissions()
        {
            List <BugSubmission> listAllSubs        = BugSubmissions.GetAll();
            List <BugSubmission> listToBeHiddenSubs = listAllSubs.Where(x => !x.IsHidden &&
                                                                        listAllSubs.Any(y => y != x && y.ExceptionStackTrace == x.ExceptionStackTrace && y.IsHidden)
                                                                        ).ToList();

            if (listToBeHiddenSubs.Count == 0)
            {
                return(false);
            }
            listToBeHiddenSubs.ForEach(x => x.IsHidden = true);
            BugSubmissions.UpdateMany(listToBeHiddenSubs, "IsHidden");
            return(true);
        }
예제 #9
0
        private void butAddCategory_Click(object sender, EventArgs e)
        {
            InputBox input = new InputBox("Please enter a category tag");

            if (input.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            BugSubmission subOld      = _subCur.Copy();
            List <string> listCats    = subOld.ListCategoryTags;
            string        categoryNew = input.ListTextEntered[0];

            listCats.Add(categoryNew);
            _subCur.CategoryTags = string.Join(",", listCats);
            BugSubmissions.Update(_subCur, subOld);
            RefreshViews();
        }
예제 #10
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         Close();
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "This will also delete all attachments to jobs and bug submissions for this bug. Do you wish to continue?"))
     {
         return;
     }
     Bugs.Delete(BugCur.BugId);
     BugSubmissions.UpdateBugIds(0, _listBugSubs);
     BugCur       = null;
     DialogResult = DialogResult.OK;
     Close();
 }
예제 #11
0
        public static double CalculateSimilarity(string source, string target)
        {
            if ((source == null) || (target == null))
            {
                return(0);
            }
            string src = BugSubmissions.SimplifyStackTrace(source);
            string tar = BugSubmissions.SimplifyStackTrace(target);

            src = src.Replace("\r", "").Replace("\n", "");
            tar = tar.Replace("\r", "").Replace("\n", "");
            if (src.Equals(tar))
            {
                return(100);
            }
            int stepsToSame = ComputeLevenshteinDistance(src, tar);

            return((1.0 - ((double)stepsToSame / Math.Max(src.Length, tar.Length))) * 100);
        }
예제 #12
0
 private void FormBugEdit_Load(object sender, EventArgs e)
 {
     textBugId.Text         = BugCur.BugId.ToString();
     textCreationDate.Text  = BugCur.CreationDate.ToString();
     comboStatus.Text       = BugCur.Status_.ToString();
     comboPriority.Text     = BugCur.PriorityLevel.ToString();
     textVersionsFound.Text = BugCur.VersionsFound;
     textVersionsFixed.Text = BugCur.VersionsFixed;
     textDescription.Text   = BugCur.Description;
     textLongDesc.Text      = BugCur.LongDesc;
     textPrivateDesc.Text   = BugCur.PrivateDesc;
     textDiscussion.Text    = BugCur.Discussion;
     textSubmitter.Text     = Bugs.GetSubmitterName(BugCur.Submitter);
     if (!IsNew)
     {
         _listBugSubs.AddRange(BugSubmissions.GetForBugId(BugCur.BugId));
     }
     FillGrid();
 }
예제 #13
0
        private void gridSubs_CellClick(object sender, ODGridClickEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            gridSubs.ContextMenu = new ContextMenu();
            ContextMenu   menu = gridSubs.ContextMenu;
            BugSubmission sub  = (BugSubmission)gridSubs.Rows[e.Row].Tag;

            menu.MenuItems.Add("Unlink Submission", (o, arg) => {
                _listBugSubs.Remove(sub);
                BugSubmissions.UpdateBugIds(0, new List <long>()
                {
                    sub.BugSubmissionNum
                });
                FillGrid();
            });
            menu.Show(gridSubs, gridSubs.PointToClient(Cursor.Position));
        }
예제 #14
0
        private void butDeleteCategory_Click(object sender, EventArgs e)
        {
            int index = listBoxCategories.SelectedIndex;

            if (index == -1)
            {
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "You are about to delete this category, continue?"))
            {
                return;
            }
            BugSubmission subOld   = _subCur.Copy();
            List <string> listCats = subOld.ListCategoryTags;

            listCats.RemoveAt(index);
            _subCur.CategoryTags = string.Join(",", listCats);
            BugSubmissions.Update(_subCur, subOld);
            RefreshViews();
        }
예제 #15
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (BugCur.Submitter == 0)
     {
         MessageBox.Show("A valid submitter wasn't picked.  Make sure the computer being used is associated to a buguser.");
         return;
     }
     if (textVersionsFixed.Text != "")
     {
         BugCur.Status_ = BugStatus.Fixed;
     }
     else if (comboStatus.SelectedIndex == 0)           //none
     {
         BugCur.Status_ = BugStatus.Accepted;
     }
     else
     {
         BugCur.Status_ = (BugStatus)Enum.Parse(typeof(BugStatus), comboStatus.Text);
     }
     SaveToDb();
     BugSubmissions.UpdateBugIds(BugCur.BugId, _listBugSubs.Select(x => x.BugSubmissionNum).ToList());
     DialogResult = DialogResult.OK;
 }
예제 #16
0
        ///<summary>Attempts to add a bug for the given sub and job.
        ///Job can be null, only used for pre appending "(Enhancement)" to bug description.
        ///Returns null if user canceled.</summary>
        public static Bug AddBug(BugSubmission sub, Job job = null)
        {
            FormBugEdit formBE;

            formBE = new FormBugEdit(new List <BugSubmission>()
            {
                sub
            });
            formBE.IsNew  = true;
            formBE.BugCur = Bugs.GetNewBugForUser();
            if (job != null && job.Category == JobCategory.Enhancement)
            {
                formBE.BugCur.Description = "(Enhancement)";
            }
            if (formBE.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            BugSubmissions.UpdateBugIds(formBE.BugCur.BugId, new List <long> {
                sub.BugSubmissionNum
            });
            return(formBE.BugCur);
        }
예제 #17
0
        ///<summary></summary>
        public static bool TryAssociateSimilarBugSubmissions(List <BugSubmission> listAllSubs, Point pointFormLocaiton)
        {
            List <BugSubmission> listUnattachedSubs = listAllSubs.Where(x => x.BugId == 0).ToList();

            if (listUnattachedSubs.Count == 0)
            {
                MsgBox.Show("FormBugSubmissions", "All submissions are associated to bugs already.");
                return(false);
            }
            //Dictionary where key is a BugId and the value is list of submissions associated to that BugID.
            //StackTraces are unique and if there are duplicate stack trace entries we select the one with the newest version.
            Dictionary <long, List <BugSubmission> > dictAttachedSubs = listAllSubs.Where(x => x.BugId != 0)
                                                                        .GroupBy(x => x.BugId)
                                                                        .ToDictionary(x => x.Key, x =>
                                                                                      x.GroupBy(y => y.ExceptionStackTrace)
                                                                                      //Sub dictionary of unique ExceptionStackStraces as the key and the value is the submission from the highest version.
                                                                                      .ToDictionary(y => y.Key, y => y.OrderByDescending(z => new Version(z.Info.DictPrefValues[PrefName.ProgramVersion])).First())
                                                                                      .Values.ToList()
                                                                                      );
            Dictionary <long, List <BugSubmission> > dictSimilarBugSubs = new Dictionary <long, List <BugSubmission> >();
            List <long> listOrderedKeys = dictAttachedSubs.Keys.OrderByDescending(x => x).ToList();

            foreach (long key in listOrderedKeys)             //Loop through submissions that are already attached to bugs
            {
                dictSimilarBugSubs[key] = new List <BugSubmission>();
                foreach (BugSubmission sub in dictAttachedSubs[key])                 //Loop through the unique exception text from the submission with thie highest reported version.
                {
                    List <BugSubmission> listSimilarBugSubs = listUnattachedSubs.Where(x =>
                                                                                       x.ExceptionStackTrace == sub.ExceptionStackTrace//Find submissions that are not attached to bugs with identical ExceptionStackTrace
                                                                                       ).ToList();
                    if (listSimilarBugSubs.Count == 0)
                    {
                        continue;                        //All submissions with this stack trace are attached to a bug.
                    }
                    listUnattachedSubs.RemoveAll(x => listSimilarBugSubs.Contains(x));
                    dictSimilarBugSubs[key].AddRange(listSimilarBugSubs);
                }
            }
            if (dictSimilarBugSubs.All(x => x.Value.Count == 0))
            {
                MsgBox.Show("FormBugSubmissions", "All similar submissions are already attached to bugs.  No action needed.");
                return(false);
            }
            dictSimilarBugSubs = dictSimilarBugSubs.Where(x => x.Value.Count != 0).ToDictionary(x => x.Key, x => x.Value);
            bool isAutoAssign = (MsgBox.Show("FormBugSubmissions", MsgBoxButtons.YesNo, "Click Yes to auto attach duplicate submissions to bugs with identical stack traces?"
                                             + "\r\nClick No to manually validate all groupings found."));
            List <long>    listBugIds = listAllSubs.Where(x => x.BugId != 0).Select(x => x.BugId).ToList();
            List <JobLink> listLinks  = JobLinks.GetManyForType(JobLinkType.Bug, listBugIds);
            List <Bug>     listBugs   = Bugs.GetMany(listBugIds);

            foreach (KeyValuePair <long, List <BugSubmission> > pair in dictSimilarBugSubs)
            {
                Bug bugFixed = listBugs.FirstOrDefault(x => x.BugId == pair.Key && !string.IsNullOrEmpty(x.VersionsFixed));
                if (bugFixed != null)
                {
                    List <BugSubmission> listIssueSubs = pair.Value.Where(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]) >= new Version(bugFixed.VersionsFixed.Split(';').Last())).ToList();
                    if (listIssueSubs.Count > 0)
                    {
                        MsgBox.Show("FormBugSubmissions", "There appears to be a submission on a version that is newer than the previous fixed bug version (BugId: " + POut.Long(bugFixed.BugId) + ").  "
                                    + "These will be excluded.");
                        //TODO: Allow user to view these excluded submissions somehow.
                        pair.Value.RemoveAll(x => listIssueSubs.Contains(x));
                        if (pair.Value.Count == 0)
                        {
                            continue;
                        }
                    }
                }
                if (!isAutoAssign)
                {
                    FormBugSubmissions formGroupBugSubs = new FormBugSubmissions(viewMode: FormBugSubmissionMode.ValidationMode);
                    formGroupBugSubs.ListViewedSubs = pair.Value;                         //Add unnattached submissions to grid
                    formGroupBugSubs.ListViewedSubs.AddRange(dictAttachedSubs[pair.Key]); //Add already attached submissions to grid
                    formGroupBugSubs.StartPosition = FormStartPosition.Manual;
                    Point newLoc = pointFormLocaiton;
                    newLoc.X += 10;                  //Offset
                    newLoc.Y += 10;
                    formGroupBugSubs.Location = newLoc;
                    if (formGroupBugSubs.ShowDialog() != DialogResult.OK)
                    {
                        continue;
                    }
                }
                BugSubmissions.UpdateBugIds(pair.Key, pair.Value.Select(x => x.BugSubmissionNum).ToList());
            }
            MsgBox.Show("FormBugSubmissions", "Done.");
            return(true);
        }
예제 #18
0
 private void FillGrids(bool isRefreshNeeded = true)
 {
     if (_patCur == null || gridBugsFixed == null)         //Just in case.
     {
         return;
     }
     gridBugsInProgress.BeginUpdate();
     gridBugsFixed.BeginUpdate();
     gridBugSubmissions.BeginUpdate();
     #region Init Columns
     if (gridBugsFixed.ListGridColumns.Count == 0)
     {
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Expert", 55, HorizontalAlignment.Center));
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Vers.", 55, HorizontalAlignment.Center));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Vers.", 55, HorizontalAlignment.Center));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
     }
     #endregion
     if (isRefreshNeeded)
     {
         List <string> listKeys = RegistrationKeys.GetForPatient(_patCur.PatNum).Select(x => x.RegKey).ToList();
         try {
             _listBugSubs = BugSubmissions.GetBugSubsForRegKeys(listKeys, datePickerHqBugSub.GetDateTimeFrom(), datePickerHqBugSub.GetDateTimeTo());
         }
         catch (Exception ex) {               //Should only occur if running in debug at HQ and no bugs database on local machine.
             ex.DoNothing();
             label1.Text = "NO BUGS DB";      //Inform dev of issue.
         }
         _listJobLinks = JobLinks.GetManyForType(JobLinkType.Bug, _listBugSubs.Select(x => x.BugId).ToList());
         List <long> listNewBugUserIds = _listBugSubs.Where(x => x.BugObj != null && !_dictHqBugSubNames.ContainsKey(x.BugObj.Submitter))
                                         .Select(x => x.BugObj.Submitter).ToList();
         if (listNewBugUserIds.Count > 0)
         {
             Bugs.GetDictSubmitterNames(listNewBugUserIds).ToList()
             .ForEach(x => _dictHqBugSubNames[x.Key] = x.Value);
         }
     }
     gridBugsInProgress.ListGridRows.Clear();
     gridBugsFixed.ListGridRows.Clear();
     gridBugSubmissions.ListGridRows.Clear();
     List <long> listBugNums = new List <long>();        //Keep track of BubIds so that we do not show duplicates.
     foreach (BugSubmission sub in _listBugSubs)
     {
         bool   hasJob     = (_listJobLinks.Any(x => x.FKey == sub.BugObj?.BugId));
         string expertName = (sub.BugObj == null ? "" : _dictHqBugSubNames[sub.BugObj.Submitter].ToUpperFirstOnly());
         if (sub.BugObj != null && !listBugNums.Contains(sub.BugObj.BugId))          //BugSubmission has an associated bug and it is not a duplicate.
         {
             if (string.IsNullOrEmpty(sub.BugObj.VersionsFixed))                     //Bug is not fixed
             {
                 #region In Progress grid
                 listBugNums.Add(sub.BugObj.BugId);
                 GridRow rowBug = new GridRow(sub.BugObj.Description,
                                              expertName,
                                              (hasJob?"X":"")
                                              );
                 rowBug.Tag = sub.BugObj;
                 gridBugsInProgress.ListGridRows.Add(rowBug);
                 #endregion
             }
             else                      //Bug is fixed
             {
                 #region Fixed grid
                 listBugNums.Add(sub.BugObj.BugId);
                 GridRow rowBug = new GridRow(sub.BugObj.Description + "\r\nEXPERT: " + expertName,
                                              sub.BugObj.VersionsFixed.Replace(';', '\n'),
                                              (hasJob?"X":"")
                                              );
                 rowBug.Tag = sub.BugObj;
                 gridBugsFixed.ListGridRows.Add(rowBug);
                 #endregion
             }
         }
         #region All grid
         GridRow rowSub = new GridRow(sub.ExceptionMessageText + "\r\n"
                                      + sub.SubmissionDateTime.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture)
                                      + "\r\nEXPERT: " + expertName,
                                      sub.TryGetPrefValue(PrefName.ProgramVersion, "0.0.0.0"),
                                      (hasJob?"X":"")
                                      );
         rowSub.Tag = sub;
         gridBugSubmissions.ListGridRows.Add(rowSub);
         #endregion
     }
     gridBugsInProgress.EndUpdate();
     gridBugsFixed.EndUpdate();
     gridBugSubmissions.EndUpdate();
 }
예제 #19
0
        public static Bug AddBugAndJob(ODForm form, List <BugSubmission> listSelectedSubs, Patient pat)
        {
            if (!JobPermissions.IsAuthorized(JobPerm.Concept, true) &&
                !JobPermissions.IsAuthorized(JobPerm.NotifyCustomer, true) &&
                !JobPermissions.IsAuthorized(JobPerm.FeatureManager, true) &&
                !JobPermissions.IsAuthorized(JobPerm.Documentation, true))
            {
                return(null);
            }
            if (listSelectedSubs.Count == 0)
            {
                MsgBox.Show(form, "You must select a bug submission to create a job for.");
                return(null);
            }
            Job jobNew = new Job();

            jobNew.Category = JobCategory.Bug;
            InputBox titleBox = new InputBox("Provide a brief title for the job.");

            if (titleBox.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(titleBox.textResult.Text))
            {
                MsgBox.Show(form, "You must type a title to create a job.");
                return(null);
            }
            List <Def> listJobPriorities = Defs.GetDefsForCategory(DefCat.JobPriorities, true);

            if (listJobPriorities.Count == 0)
            {
                MsgBox.Show(form, "You have no priorities setup in definitions.");
                return(null);
            }
            jobNew.Title = titleBox.textResult.Text;
            long priorityNum = 0;

            priorityNum           = listJobPriorities.FirstOrDefault(x => x.ItemValue.Contains("BugDefault")).DefNum;
            jobNew.Priority       = priorityNum == 0?listJobPriorities.First().DefNum:priorityNum;
            jobNew.PhaseCur       = JobPhase.Concept;
            jobNew.UserNumConcept = Security.CurUser.UserNum;
            Bug bugNew = new Bug();

            bugNew = Bugs.GetNewBugForUser();
            InputBox bugDescription = new InputBox("Provide a brief description for the bug. This will appear in the bug tracker.", jobNew.Title);

            if (bugDescription.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(bugDescription.textResult.Text))
            {
                MsgBox.Show(form, "You must type a description to create a bug.");
                return(null);
            }
            FormVersionPrompt FormVP = new FormVersionPrompt("Enter versions found");

            FormVP.ShowDialog();
            if (FormVP.DialogResult != DialogResult.OK || string.IsNullOrEmpty(FormVP.VersionText))
            {
                MsgBox.Show(form, "You must enter a version to create a bug.");
                return(null);
            }
            bugNew.Status_       = BugStatus.Accepted;
            bugNew.VersionsFound = FormVP.VersionText;
            bugNew.Description   = bugDescription.textResult.Text;
            BugSubmission sub = listSelectedSubs.First();

            jobNew.Requirements = BugSubmissions.GetSubmissionDescription(pat, sub);
            Jobs.Insert(jobNew);
            JobLink jobLinkNew = new JobLink();

            jobLinkNew.LinkType = JobLinkType.Bug;
            jobLinkNew.JobNum   = jobNew.JobNum;
            jobLinkNew.FKey     = Bugs.Insert(bugNew);
            JobLinks.Insert(jobLinkNew);
            BugSubmissions.UpdateBugIds(bugNew.BugId, listSelectedSubs.Select(x => x.BugSubmissionNum).ToList());
            if (MsgBox.Show(form, MsgBoxButtons.YesNo, "Would you like to create a task too?"))
            {
                long taskNum = CreateTask(pat, sub);
                if (taskNum != 0)
                {
                    jobLinkNew          = new JobLink();
                    jobLinkNew.LinkType = JobLinkType.Task;
                    jobLinkNew.JobNum   = jobNew.JobNum;
                    jobLinkNew.FKey     = taskNum;
                    JobLinks.Insert(jobLinkNew);
                }
            }
            Signalods.SetInvalid(InvalidType.Jobs, KeyType.Job, jobNew.JobNum);
            FormOpenDental.S_GoToJob(jobNew.JobNum);
            return(bugNew);
        }
예제 #20
0
        private void FillSubGrid(bool isRefreshNeeded = false)
        {
            SetCustomerInfo();
            if (isRefreshNeeded)
            {
                if (_viewMode.In(FormBugSubmissionMode.ViewOnly, FormBugSubmissionMode.ValidationMode))
                {
                    _listAllSubs = ListViewedSubs;
                }
                else
                {
                    _listAllSubs = BugSubmissions.GetAllInRange(dateRangePicker.GetDateTimeFrom(), dateRangePicker.GetDateTimeTo());
                }
                try {
                    _dictPatients = RegistrationKeys.GetPatientsByKeys(_listAllSubs.Select(x => x.RegKey).ToList());
                }
                catch (Exception e) {
                    e.DoNothing();
                    _dictPatients = new Dictionary <string, Patient>();
                }
            }
            gridSubs.BeginUpdate();
            gridSubs.Columns.Clear();
            gridSubs.Columns.Add(new ODGridColumn("Reg Key", 140));
            gridSubs.Columns.Add(new ODGridColumn("Vers.", 55, GridSortingStrategy.VersionNumber));
            if (comboGrouping.SelectedIndex == 0)           //None
            {
                gridSubs.Columns.Add(new ODGridColumn("DateTime", 75, GridSortingStrategy.DateParse));
            }
            else
            {
                gridSubs.Columns.Add(new ODGridColumn("Count", 75, GridSortingStrategy.AmountParse));
            }
            gridSubs.Columns.Add(new ODGridColumn("HasBug", 50, HorizontalAlignment.Center));
            gridSubs.Columns.Add(new ODGridColumn("Msg Text", 300));
            gridSubs.AllowSortingByColumn = true;
            List <string> listSelectedVersions = comboVersions.ListSelectedItems.Select(x => (string)x).ToList();

            if (listSelectedVersions.Contains("All"))
            {
                listSelectedVersions.Clear();
            }
            List <string> listSelectedRegKeys = comboRegKeys.ListSelectedItems.Select(x => (string)x).ToList();

            if (listSelectedRegKeys.Contains("All"))
            {
                listSelectedRegKeys.Clear();
            }
            List <string> listStackFilters = textStackFilter.Text.Split(',')
                                             .Where(x => !string.IsNullOrWhiteSpace(x))
                                             .Select(x => x.ToLower()).ToList();
            List <string> listPatNumFilters = textPatNums.Text.Split(',')
                                              .Where(x => !string.IsNullOrWhiteSpace(x))
                                              .Select(x => x.ToLower()).ToList();

            gridSubs.Rows.Clear();
            _listAllSubs.ForEach(x => x.TagOD = null);
            List <BugSubmission> listFilteredSubs = _listAllSubs.Where(x =>
                                                                       PassesFilterValidation(x, listSelectedRegKeys, listStackFilters, listPatNumFilters, listSelectedVersions)
                                                                       ).ToList();

            foreach (BugSubmission sub in listFilteredSubs)
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(sub.RegKey);
                row.Cells.Add(sub.Info.DictPrefValues[PrefName.ProgramVersion]);
                List <BugSubmission> listPreviousRows;
                List <BugSubmission> listGroupedSubs;
                List <string>        listProgVersions;
                switch (comboGrouping.SelectedIndex)
                {
                case 0:
                    #region None
                    row.Cells.Add(sub.SubmissionDateTime.ToString().Replace('\r', ' '));
                    row.Tag = new List <BugSubmission>()
                    {
                        sub
                    };                                                                    //Tag is a specific bugSubmission
                    #endregion
                    break;

                case 1:
                    #region Customer
                    //Take previously proccessed rows and see if we have already handled the grouping.
                    listPreviousRows = listFilteredSubs.Take(listFilteredSubs.IndexOf(sub)).ToList();
                    if (listPreviousRows.Any(x => x.RegKey == sub.RegKey &&
                                             x.Info.DictPrefValues[PrefName.ProgramVersion] == sub.Info.DictPrefValues[PrefName.ProgramVersion] &&
                                             x.ExceptionStackTrace == sub.ExceptionStackTrace &&
                                             x.BugId == sub.BugId))
                    {
                        //Skip adding rows that have already been added when grouping
                        continue;
                    }
                    listGroupedSubs = listFilteredSubs.FindAll(x => x.RegKey == sub.RegKey &&
                                                               x.Info.DictPrefValues[PrefName.ProgramVersion] == sub.Info.DictPrefValues[PrefName.ProgramVersion] &&
                                                               x.ExceptionStackTrace == sub.ExceptionStackTrace &&
                                                               x.BugId == sub.BugId);
                    row.Cells.Add(listGroupedSubs.Count.ToString());
                    //row.Cells[1].Text=string.Join(",",listGroupedSubs.Select(x => x.Info.DictPrefValues[PrefName.ProgramVersion]).ToList());
                    listProgVersions = listGroupedSubs.Select(x => x.Info.DictPrefValues[PrefName.ProgramVersion]).Distinct().ToList();
                    if (listProgVersions.Count > 1)
                    {
                        row.Cells[1].Text = listProgVersions.Select(x => new Version(x)).Max().ToString();
                    }
                    else
                    {
                        row.Cells[1].Text = listProgVersions.First();
                    }
                    row.Tag = listGroupedSubs;                          //Tag is a list of bugSubmissions
                    #endregion
                    break;

                case 2:
                    #region StackTrace
                    //Take previously proccessed rows and see if we have already handled the grouping.
                    listPreviousRows = listFilteredSubs.Take(listFilteredSubs.IndexOf(sub)).ToList();
                    if (listPreviousRows.Any(x => x.ExceptionStackTrace == sub.ExceptionStackTrace &&
                                             x.BugId == sub.BugId))
                    {
                        //Skip adding rows that have already been added when grouping
                        continue;
                    }
                    listGroupedSubs = listFilteredSubs.FindAll(x => x.ExceptionStackTrace == sub.ExceptionStackTrace &&
                                                               x.BugId == sub.BugId);
                    row.Cells.Add(listGroupedSubs.Count.ToString());
                    listProgVersions = listGroupedSubs.Select(x => x.Info.DictPrefValues[PrefName.ProgramVersion]).Distinct().ToList();
                    if (listProgVersions.Count > 1)
                    {
                        row.Cells[1].Text = listProgVersions.Select(x => new Version(x)).Max().ToString();
                    }
                    else
                    {
                        row.Cells[1].Text = listProgVersions.First();
                    }
                    row.Tag = listGroupedSubs;                          //Tag is a list of bugSubmissions
                    #endregion
                    break;

                case 3:
                    #region 95%
                    //if(sub.TagOD!=null) {
                    //	continue;
                    //}
                    //listGroupedSubs=listFilteredSubs.FindAll(x => x.BugId==sub.BugId
                    //	&&x.TagOD==null
                    //	&&CalculateSimilarity(x.ExceptionMessageText,sub.ExceptionMessageText)>95
                    //	&&(x==sub||CalculateSimilarity(x.ExceptionStackTrace,sub.ExceptionStackTrace)>95));
                    //listGroupedSubs.ForEach(x => x.TagOD=true);
                    //row.Cells.Add(listGroupedSubs.Count.ToString());
                    //listProgVersions=listGroupedSubs.Select(x => x.Info.DictPrefValues[PrefName.ProgramVersion]).Distinct().ToList();
                    //if(listProgVersions.Count>1) {
                    //	row.Cells[1].Text=listProgVersions.Select(x => new Version(x)).Max().ToString();
                    //}
                    //else {
                    //	row.Cells[1].Text=listProgVersions.First();
                    //}
                    //row.Tag=listGroupedSubs;//Tag is a list of bugSubmissions
                    #endregion
                    break;
                }
                row.Cells.Add(sub.BugId == 0 ? "" : "X");
                row.Cells.Add(sub.ExceptionMessageText);
                gridSubs.Rows.Add(row);
            }
            gridSubs.EndUpdate();
            gridSubs.SortForced(1, false);           //Sort by Version column
            if (isRefreshNeeded)
            {
                FillVersionsFilter();
                FillRegKeyFilter();
            }
        }
예제 #21
0
        private void FillSubGrid(bool isRefreshNeeded = false, string grouping95 = "")
        {
            List <string> listSelectedVersions = listVersionsFilter.SelectedItems.OfType <string>().ToList();

            if (listSelectedVersions.Contains("All"))
            {
                listSelectedVersions.Clear();
            }
            if (isRefreshNeeded && listSelectedVersions.IsNullOrEmpty())
            {
                if (!MsgBox.Show(MsgBoxButtons.YesNo, "All bug submissions are going to be downloaded...\r\nAre you sure about this?"))
                {
                    return;
                }
            }
            Action loadingProgress = null;

            Cursor = Cursors.WaitCursor;
            #region gridSubs columns
            gridSubs.BeginUpdate();
            gridSubs.ListGridColumns.Clear();
            gridSubs.ListGridColumns.Add(new GridColumn("Submitter", 140));
            gridSubs.ListGridColumns.Add(new GridColumn("Vers.", 55, GridSortingStrategy.VersionNumber));
            if (comboGrouping.SelectedIndex == 0)           //Group by 'None'
            {
                gridSubs.ListGridColumns.Add(new GridColumn("DateTime", 75, GridSortingStrategy.DateParse));
            }
            else
            {
                gridSubs.ListGridColumns.Add(new GridColumn("#", 30, HorizontalAlignment.Right, GridSortingStrategy.AmountParse));
            }
            gridSubs.ListGridColumns.Add(new GridColumn("Flag", 50, HorizontalAlignment.Center));
            gridSubs.ListGridColumns.Add(new GridColumn("Msg Text", 0));
            gridSubs.AllowSortingByColumn = true;
            gridSubs.ListGridRows.Clear();
            #endregion
            bugSubmissionControl.ClearCustomerInfo();
            bugSubmissionControl.SetTextDevNoteEnabled(false);
            if (isRefreshNeeded)
            {
                loadingProgress = ODProgress.Show(ODEventType.BugSubmission, typeof(BugSubmissionEvent), Lan.g(this, "Refreshing Data") + "...");
                #region Refresh Logic
                if (_viewMode.In(FormBugSubmissionMode.ViewOnly, FormBugSubmissionMode.ValidationMode))
                {
                    _listAllSubs = ListViewedSubs;
                }
                else
                {
                    BugSubmissionEvent.Fire(ODEventType.BugSubmission, Lan.g(this, "Refreshing Data: Bugs"));
                    _listAllSubs = BugSubmissions.GetAllInRange(dateRangePicker.GetDateTimeFrom(), dateRangePicker.GetDateTimeTo(), listSelectedVersions);
                }
                try {
                    BugSubmissionEvent.Fire(ODEventType.BugSubmission, Lan.g(this, "Refreshing Data: Patients"));
                    _dictPatients = RegistrationKeys.GetPatientsByKeys(_listAllSubs.Select(x => x.RegKey).ToList());
                }
                catch (Exception e) {
                    e.DoNothing();
                    _dictPatients = new Dictionary <string, Patient>();
                }
                BugSubmissionEvent.Fire(ODEventType.BugSubmission, Lan.g(this, "Refreshing Data: JobLinks"));
                _listJobLinks = JobLinks.GetManyForType(JobLinkType.Bug, _listAllSubs.Select(x => x.BugId).Where(x => x != 0).Distinct().ToList());
                #endregion
            }
            #region Filter Logic
            BugSubmissionEvent.Fire(ODEventType.BugSubmission, "Filtering Data");
            List <BugSubmission> listFilteredSubs    = null;
            List <string>        listSelectedRegKeys = comboRegKeys.ListSelectedItems.Select(x => (string)x).ToList();
            if (listSelectedRegKeys.Contains("All"))
            {
                listSelectedRegKeys.Clear();
            }
            List <string> listStackFilters = textStackFilter.Text.Split(',')
                                             .Where(x => !string.IsNullOrWhiteSpace(x))
                                             .Select(x => x.ToLower()).ToList();
            List <string> listPatNumFilters = textPatNums.Text.Split(',')
                                              .Where(x => !string.IsNullOrWhiteSpace(x))
                                              .Select(x => x.ToLower()).ToList();
            _listAllSubs.ForEach(x => x.TagCustom = null);
            List <string> listCategoryFilters = textCategoryFilters.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            string        msgText             = textMsgText.Text;
            string        devNoteFilter       = textDevNoteFilter.Text;
            DateTime      dateTimeFrom        = dateRangePicker.GetDateTimeFrom();
            DateTime      dateTimeTo          = dateRangePicker.GetDateTimeTo();
            //Filter the list of all bug submissions and then order it by program version and submission date time so that the grouping is predictable.
            listFilteredSubs = _listAllSubs.Where(x =>
                                                  PassesFilterValidation(x, listCategoryFilters, listSelectedRegKeys, listStackFilters, listPatNumFilters, listSelectedVersions, grouping95,
                                                                         msgText, devNoteFilter, dateTimeFrom, dateTimeTo)
                                                  )
                               .OrderByDescending(x => new Version(x.ProgramVersion))
                               .ThenByDescending(x => x.SubmissionDateTime)
                               .ToList();
            if (isRefreshNeeded)
            {
                FillPatNameFilter(_listAllSubs);
            }
            #endregion
            #region Grouping Logic
            List <BugSubmission> listGridSubmissions = new List <BugSubmission>();
            BugSubmissionEvent.Fire(ODEventType.BugSubmission, "Grouping Data");
            switch (comboGrouping.SelectedIndex)
            {
            case 0:
                #region None
                foreach (BugSubmission bugSubmission in listFilteredSubs)
                {
                    AddGroupedSubsToGridSubs(listGridSubmissions, new List <BugSubmission>()
                    {
                        bugSubmission
                    });
                }
                listShowHideOptions.SetSelected(3, false);                       //Deselect 'None'
                _minGroupingCount = -1;
                butAddJob.Enabled = true;
                #endregion
                break;

            case 1:
                #region RegKey/Ver/Stack
                listFilteredSubs.GroupBy(x => new {
                    x.BugId,
                    x.RegKey,
                    x.ProgramVersion,
                    x.ExceptionMessageText,
                    x.ExceptionStackTrace
                })
                .ToDictionary(x => x.Key, x => x.ToList())
                .ForEach(x => AddGroupedSubsToGridSubs(listGridSubmissions, x.Value));
                butAddJob.Enabled = true;
                #endregion
                break;

            case 2:
                #region StackTrace
                listFilteredSubs.GroupBy(x => new {
                    x.BugId,
                    x.ExceptionMessageText,
                    x.ExceptionStackTrace
                })
                .ToDictionary(x => x.Key, x => x.ToList())
                .ForEach(x => AddGroupedSubsToGridSubs(listGridSubmissions, x.Value));
                butAddJob.Enabled = true;
                #endregion
                break;

            case 3:
                #region 95%
                //At this point all bugSubmissions in listFilteredSubs is at least a 95% match. Group them all together in a single row.
                AddGroupedSubsToGridSubs(listGridSubmissions, listFilteredSubs);
                butAddJob.Enabled = true;
                #endregion
                break;

            case 4:
                #region StackSig
                listFilteredSubs.GroupBy(x => new {
                    x.BugId,
                    x.ExceptionMessageText,
                    x.OdStackSignature
                })
                .ToDictionary(x => x.Key, x => x.ToList())
                .ForEach(x => AddGroupedSubsToGridSubs(listGridSubmissions, x.Value));
                butAddJob.Enabled = false;                      //Can not add jobs in this mode.
                #endregion
                break;

            case 5:
                #region StackSimple
                listFilteredSubs.GroupBy(x => new {
                    x.BugId,
                    x.ExceptionMessageText,
                    x.SimplifiedStackTrace
                })
                .ToDictionary(x => x.Key, x => x.ToList())
                .ForEach(x => AddGroupedSubsToGridSubs(listGridSubmissions, x.Value));
                butAddJob.Enabled = false;                      //Can not add jobs in this mode.
                #endregion
                break;

            case 6:
                #region Hash
                listFilteredSubs.GroupBy(x => new {
                    x.BugId,
                    x.BugSubmissionHashNum
                })
                .ToDictionary(x => x.Key, x => x.ToList())
                .ForEach(x => AddGroupedSubsToGridSubs(listGridSubmissions, x.Value));
                butAddJob.Enabled = false;                      //Can not add jobs in this mode.
                #endregion
                break;
            }
            if (_minGroupingCount > 0)
            {
                listGridSubmissions.RemoveAll(x => (x.TagCustom as List <BugSubmission>).Count < _minGroupingCount);
            }
            #endregion
            #region Sorting Logic
            BugSubmissionEvent.Fire(ODEventType.BugSubmission, "Sorting Data");
            switch (comboSortBy.SelectedIndex)
            {
            case 0:
                listGridSubmissions = listGridSubmissions.OrderByDescending(x => new Version(x.ProgramVersion))
                                      .ThenByDescending(x => GetGroupCount(x))
                                      .ThenByDescending(x => x.SubmissionDateTime).ToList();
                break;
            }
            #endregion
            #region Fill gridSubs
            BugSubmissionEvent.Fire(ODEventType.BugSubmission, "Filling Grid");
            foreach (BugSubmission sub in listGridSubmissions)
            {
                gridSubs.ListGridRows.Add(GetODGridRowForSub(sub));
            }
            gridSubs.EndUpdate();
            #endregion
            loadingProgress?.Invoke();
            Cursor = Cursors.Default;
        }
예제 #22
0
        public static bool TryAssociateSimilarBugSubmissions(Point pointFormLocaiton)
        {
            List <BugSubmission> listAllSubs        = BugSubmissions.GetAll();
            List <BugSubmission> listUnattachedSubs = listAllSubs.Where(x => x.BugId == 0).ToList();

            if (listUnattachedSubs.Count == 0)
            {
                MsgBox.Show("FormBugSubmissions", "All submissions are associated to bugs already.");
                return(false);
            }
            //Dictionary where key is a BugId and the value is list of submissions associated to that BugID.
            //StackTraces are unique and if there are duplicate stack trace entries we select the one with the newest version.
            Dictionary <long, List <BugSubmission> > dictAttachedSubs = listAllSubs.Where(x => x.BugId != 0)
                                                                        .GroupBy(x => x.BugId)
                                                                        .ToDictionary(x => x.Key, x =>
                                                                                      x.GroupBy(y => y.ExceptionStackTrace)
                                                                                      //Sub dictionary of unique ExceptionStackStraces as the key and the value is the submission from the highest version.
                                                                                      .ToDictionary(y => y.Key, y => y.OrderByDescending(z => new Version(z.Info.DictPrefValues[PrefName.ProgramVersion])).First())
                                                                                      .Values.ToList()
                                                                                      );
            Dictionary <long, List <BugSubmission> > dictSimilarBugSubs = new Dictionary <long, List <BugSubmission> >();
            List <long> listOrderedKeys = dictAttachedSubs.Keys.OrderByDescending(x => x).ToList();

            foreach (long key in listOrderedKeys)             //Loop through submissions that are already attached to bugs
            {
                dictSimilarBugSubs[key] = new List <BugSubmission>();
                foreach (BugSubmission sub in dictAttachedSubs[key])                 //Loop through the unique exception text from the submission with thie highest reported version.
                {
                    List <BugSubmission> listSimilarBugSubs = listUnattachedSubs.Where(x =>
                                                                                       x.ExceptionStackTrace == sub.ExceptionStackTrace//Find submissions that are not attached to bugs with identical ExceptionStackTrace
                                                                                       ).ToList();
                    if (listSimilarBugSubs.Count == 0)
                    {
                        continue;                        //All submissions with this stack trace are attached to a bug.
                    }
                    listUnattachedSubs.RemoveAll(x => listSimilarBugSubs.Contains(x));
                    dictSimilarBugSubs[key].AddRange(listSimilarBugSubs);
                }
            }
            if (dictSimilarBugSubs.All(x => x.Value.Count == 0))
            {
                MsgBox.Show("FormBugSubmissions", "All similar submissions are already attached to bugs.  No action needed.");
                return(false);
            }
            dictSimilarBugSubs = dictSimilarBugSubs.Where(x => x.Value.Count != 0).ToDictionary(x => x.Key, x => x.Value);
            bool isAutoAssign = (MsgBox.Show("FormBugSubmissions", MsgBoxButtons.YesNo, "Click Yes to auto attach duplicate submissions to bugs with identical stack traces?"
                                             + "\r\nClick No to manually validate all groupings found."));
            List <long>    listBugIds            = listAllSubs.Where(x => x.BugId != 0).Select(x => x.BugId).ToList();
            List <JobLink> listLinks             = JobLinks.GetManyForType(JobLinkType.Bug, listBugIds);
            List <Bug>     listBugs              = Bugs.GetMany(listBugIds);
            StringBuilder  issueSubmissionPrompt = new StringBuilder();

            foreach (KeyValuePair <long, List <BugSubmission> > pair in dictSimilarBugSubs)
            {
                Bug bugFixed = listBugs.FirstOrDefault(x => x.BugId == pair.Key && !string.IsNullOrEmpty(x.VersionsFixed));
                if (bugFixed != null)
                {
                    List <BugSubmission> listIssueSubs = pair.Value.Where(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]) >= new Version(bugFixed.VersionsFixed.Split(';').Last())).ToList();
                    if (listIssueSubs.Count > 0)
                    {
                        List <JobLink> listBugJobLinks = listLinks.FindAll(x => x.FKey == bugFixed.BugId);
                        List <Job>     listBugJobs     = Jobs.GetMany(listBugJobLinks.Select(x => x.JobNum).ToList());
                        if (issueSubmissionPrompt.Length == 0)
                        {
                            issueSubmissionPrompt.AppendLine("The following completed jobs have submissions from newer versions then the jobs reported fixed version: ");
                        }
                        listBugJobs.ForEach(x => issueSubmissionPrompt.AppendLine("- " + " (" + x.Category.ToString().Substring(0, 1) + x.JobNum + ")" + x.Title));
                        pair.Value.RemoveAll(x => listIssueSubs.Contains(x));
                        if (pair.Value.Count == 0)
                        {
                            continue;
                        }
                    }
                }
                if (!isAutoAssign)
                {
                    FormBugSubmissions formGroupBugSubs = new FormBugSubmissions(viewMode: FormBugSubmissionMode.ValidationMode);
                    formGroupBugSubs.ListViewedSubs = pair.Value;                         //Add unnattached submissions to grid
                    formGroupBugSubs.ListViewedSubs.AddRange(dictAttachedSubs[pair.Key]); //Add already attached submissions to grid
                    formGroupBugSubs.StartPosition = FormStartPosition.Manual;
                    Point newLoc = pointFormLocaiton;
                    newLoc.X += 10;                  //Offset
                    newLoc.Y += 10;
                    formGroupBugSubs.Location = newLoc;
                    if (formGroupBugSubs.ShowDialog() != DialogResult.OK)
                    {
                        continue;
                    }
                }
                BugSubmissions.UpdateBugIds(pair.Key, pair.Value.Select(x => x.BugSubmissionNum).ToList());
            }
            string msg = "";

            dictSimilarBugSubs.Keys.ToList().FindAll(x => dictSimilarBugSubs[x].Count > 0)
            .ForEach(x => msg += "Bug: " + x + " Found submissions: " + dictSimilarBugSubs[x].Count + "\r\n");
            msg += issueSubmissionPrompt.ToString();
            new MsgBoxCopyPaste(msg)
            {
                Text = "Done"
            }.ShowDialog();
            return(true);
        }
예제 #23
0
        static void Main(string[] args)
        {
            //Application.EnableVisualStyles() uses version 6 of comctl32.dll instead of version 5. See https://support.microsoft.com/en-us/kb/2892345
            //See also http://stackoverflow.com/questions/8335983/accessviolationexception-on-tooltip-that-faults-comctl32-dll-net-4-0
            Application.EnableVisualStyles();            //This line fixes rare AccessViolationExceptions for ToolTips on our ValidDate boxes, ValidDouble boxes, etc...
            //Register an EventHandler which handles unhandled exceptions.
            //AppDomain.CurrentDomain.UnhandledException+=new UnhandledExceptionEventHandler(OnUnhandeledExceptionPolicy);
            bool isSecondInstance = false;           //or more.

            Process[] processes = Process.GetProcesses();
            for (int i = 0; i < processes.Length; i++)
            {
                if (processes[i].Id == Process.GetCurrentProcess().Id)
                {
                    continue;
                }
                //we have to do it this way because during debugging, the name has vshost tacked onto the end.
                if (processes[i].ProcessName.StartsWith("OpenDental"))
                {
                    isSecondInstance = true;
                    break;
                }
            }

            /*
             * if(args.Length>0) {//if any command line args, then we will attempt to reuse an existing OD window.
             *      if(isSecondInstance){
             *              FormCommandLinePassOff formCommandLine=new FormCommandLinePassOff();
             *              formCommandLine.CommandLineArgs=new string[args.Length];
             *              args.CopyTo(formCommandLine.CommandLineArgs,0);
             *              Application.Run(formCommandLine);
             *              return;
             *      }
             * }*/
            Application.SetCompatibleTextRenderingDefault(false); //designer uses new text rendering.  This makes the exe use matching text rendering.  Before this was added, it was common for labels to be longer in the running program than they were in the designer.
            Application.EnableVisualStyles();                     //changes appearance to XP
            Application.DoEvents();
            string[] cla = new string[args.Length];
            args.CopyTo(cla, 0);
            FormOpenDental             formOD      = new FormOpenDental(cla);
            Action <Exception, string> onUnhandled = new Action <Exception, string>((e, threadName) => {
                //Try to automatically submit a bug report to HQ.  Default to "None" just in case the submission fails.
                BugSubmissionResult subResult = BugSubmissionResult.None;
                try {
                    subResult = BugSubmissions.SubmitException(e, threadName, FormOpenDental.CurPatNum, formOD.GetSelectedModuleName());
                }
                catch (Exception ex) {
                    ex.DoNothing();
                }
                FriendlyException.Show("Critical Error: " + e.Message, e, "Quit");
                formOD.ProcessKillCommand();
            });

            CodeBase.ODThread.RegisterForUnhandledExceptions(formOD, onUnhandled);
            formOD.IsSecondInstance = isSecondInstance;
            Application.AddMessageFilter(new ODGlobalUserActiveHandler());
            Application.ThreadException += new ThreadExceptionEventHandler((object s, ThreadExceptionEventArgs e) => {
                onUnhandled(e.Exception, "ProgramEntry");
            });
            Application.Run(formOD);
        }
예제 #24
0
        private void FillSubGrid(bool isRefreshNeeded = false, string grouping95 = "")
        {
            Action loadingProgress = null;

            Cursor = Cursors.WaitCursor;
            bugSubmissionControl.ClearCustomerInfo();
            bugSubmissionControl.SetTextDevNoteEnabled(false);
            if (isRefreshNeeded)
            {
                loadingProgress = ODProgressOld.ShowProgressStatus("FormBugSubmissions", this, Lan.g(this, "Refreshing Data") + "...", false);
                #region Refresh Logic
                if (_viewMode.In(FormBugSubmissionMode.ViewOnly, FormBugSubmissionMode.ValidationMode))
                {
                    _listAllSubs = ListViewedSubs;
                }
                else
                {
                    _listAllSubs = BugSubmissions.GetAllInRange(dateRangePicker.GetDateTimeFrom(), dateRangePicker.GetDateTimeTo());
                }
                try {
                    _dictPatients = RegistrationKeys.GetPatientsByKeys(_listAllSubs.Select(x => x.RegKey).ToList());
                }
                catch (Exception e) {
                    e.DoNothing();
                    _dictPatients = new Dictionary <string, Patient>();
                }
                #endregion
            }
            gridSubs.BeginUpdate();
            #region gridSubs columns
            gridSubs.Columns.Clear();
            gridSubs.Columns.Add(new ODGridColumn("Submitter", 140));
            gridSubs.Columns.Add(new ODGridColumn("Vers.", 55, GridSortingStrategy.VersionNumber));
            if (comboGrouping.SelectedIndex == 0)           //Group by 'None'
            {
                gridSubs.Columns.Add(new ODGridColumn("DateTime", 75, GridSortingStrategy.DateParse));
            }
            else
            {
                gridSubs.Columns.Add(new ODGridColumn("Count", 75, GridSortingStrategy.AmountParse));
            }
            gridSubs.Columns.Add(new ODGridColumn("HasBug", 50, HorizontalAlignment.Center));
            gridSubs.Columns.Add(new ODGridColumn("Msg Text", 300));
            gridSubs.AllowSortingByColumn = true;
            #endregion
            #region Filter Logic
            ODEvent.Fire(new ODEventArgs("FormBugSubmissions", "Filtering Data"));
            List <string> listSelectedVersions = comboVersions.ListSelectedItems.Select(x => (string)x).ToList();
            if (listSelectedVersions.Contains("All"))
            {
                listSelectedVersions.Clear();
            }
            List <string> listSelectedRegKeys = comboRegKeys.ListSelectedItems.Select(x => (string)x).ToList();
            if (listSelectedRegKeys.Contains("All"))
            {
                listSelectedRegKeys.Clear();
            }
            List <string> listStackFilters = textStackFilter.Text.Split(',')
                                             .Where(x => !string.IsNullOrWhiteSpace(x))
                                             .Select(x => x.ToLower()).ToList();
            List <string> listPatNumFilters = textPatNums.Text.Split(',')
                                              .Where(x => !string.IsNullOrWhiteSpace(x))
                                              .Select(x => x.ToLower()).ToList();
            _listAllSubs.ForEach(x => x.TagOD = null);
            List <BugSubmission> listFilteredSubs = _listAllSubs.Where(x =>
                                                                       PassesFilterValidation(x, listSelectedRegKeys, listStackFilters, listPatNumFilters, listSelectedVersions, grouping95)
                                                                       ).ToList();
            if (isRefreshNeeded)
            {
                FillVersionsFilter(listFilteredSubs);
                FillRegKeyFilter(listFilteredSubs);
            }
            #endregion
            #region Grouping Logic
            List <BugSubmission> listGroupedSubs;
            int index = 0;
            List <BugSubmission> listGridSubmissions = new List <BugSubmission>();
            foreach (BugSubmission sub in listFilteredSubs)
            {
                ODEvent.Fire(new ODEventArgs("FormBugSubmissions", "Grouping Data: " + POut.Double(((double)index++ / (double)listFilteredSubs.Count) * 100) + "%"));
                if (sub.TagOD != null)
                {
                    continue;
                }
                switch (comboGrouping.SelectedIndex)
                {
                case 0:
                    #region None
                    sub.TagOD = new List <BugSubmission>()
                    {
                        sub
                    };                                                                      //Tag is a specific bugSubmission
                    listGridSubmissions.Add(sub.Copy());
                    #endregion
                    break;

                case 1:
                    #region RegKey/Ver/Stack
                    listGroupedSubs = listFilteredSubs.FindAll(x => x.TagOD == null && x.RegKey == sub.RegKey &&
                                                               x.Info.DictPrefValues[PrefName.ProgramVersion] == sub.Info.DictPrefValues[PrefName.ProgramVersion] &&
                                                               x.ExceptionStackTrace == sub.ExceptionStackTrace &&
                                                               x.BugId == sub.BugId);
                    if (listGroupedSubs.Count == 0)
                    {
                        continue;
                    }
                    listGroupedSubs = listGroupedSubs.OrderByDescending(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]))
                                      .ThenByDescending(x => x.SubmissionDateTime).ToList();
                    listGroupedSubs.ForEach(x => x.TagOD = true);                          //So we don't considered previously handled submissions.
                    listGroupedSubs.First().TagOD = listGroupedSubs;                       //First element is what is shown in grid, still wont be considered again.
                    listGridSubmissions.Add(listGroupedSubs.First().Copy());
                    #endregion
                    break;

                case 2:
                    #region StackTrace
                    listGroupedSubs = listFilteredSubs.FindAll(x => x.TagOD == null && x.ExceptionStackTrace == sub.ExceptionStackTrace && x.BugId == sub.BugId);
                    if (listGroupedSubs.Count == 0)
                    {
                        continue;
                    }
                    listGroupedSubs = listGroupedSubs.OrderByDescending(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]))
                                      .ThenByDescending(x => x.SubmissionDateTime).ToList();
                    listGroupedSubs.ForEach(x => x.TagOD = true);                          //So we don't considered previously handled submissions.
                    listGroupedSubs.First().TagOD = listGroupedSubs;                       //First element is what is shown in grid, still wont be considered again.
                    listGridSubmissions.Add(listGroupedSubs.First().Copy());
                    #endregion
                    break;

                case 3:
                    #region 95%
                    //At this point all bugSubmissions in listFilteredSubs is at least a 95% match. Group them all together in a single row.
                    listGroupedSubs = listFilteredSubs;
                    listGroupedSubs = listGroupedSubs.OrderByDescending(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]))
                                      .ThenByDescending(x => x.SubmissionDateTime).ToList();
                    listGroupedSubs.ForEach(x => x.TagOD = true);                          //So we don't considered previously handled submissions.
                    listGroupedSubs.First().TagOD = listGroupedSubs;                       //First element is what is shown in grid, still wont be considered again.
                    listGridSubmissions.Add(listGroupedSubs.First().Copy());
                    #endregion
                    break;
                }
            }
            #endregion
            #region Sorting Logic
            ODEvent.Fire(new ODEventArgs("FormBugSubmissions", "Sorting Data"));
            switch (comboSortBy.SelectedIndex)
            {
            case 0:
                listGridSubmissions = listGridSubmissions.OrderByDescending(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]))
                                      .ThenByDescending(x => GetGroupCount(x))
                                      .ThenByDescending(x => x.SubmissionDateTime).ToList();
                break;
            }
            #endregion
            #region Fill gridSubs
            gridSubs.Rows.Clear();
            index = 0;
            foreach (BugSubmission sub in listGridSubmissions)
            {
                ODEvent.Fire(new ODEventArgs("FormBugSubmissions", "Filling Grid: " + POut.Double(((double)index++ / (double)listFilteredSubs.Count) * 100) + "%"));
                gridSubs.Rows.Add(GetODGridRowForSub(sub));
            }
            gridSubs.EndUpdate();
            #endregion
            try {
                loadingProgress?.Invoke();                //When this function executes quickly this can fail rarely, fail silently because of WaitCursor.
            }
            catch (Exception ex) {
                ex.DoNothing();
            }
            Cursor = Cursors.Default;
        }