Exemple #1
0
        private void FormBugSubmission_Load(object sender, EventArgs e)
        {
            try {
                RegistrationKey key = RegistrationKeys.GetByKey(_subCur.RegKey);
                _patCur = Patients.GetPat(key.PatNum);
            }
            catch (Exception ex) {
                ex.DoNothing();
                _patCur = new Patient();              //Just in case, needed mostly for debug.
            }
            labelName.Text     = _patCur?.GetNameLF() ?? "";
            labelDateTime.Text = POut.DateT(_subCur.SubmissionDateTime);
            labelVersion.Text  = _subCur.TryGetPrefValue(PrefName.ProgramVersion, "0.0.0.0");
            labelHashNum.Text  = POut.Long(_subCur.BugSubmissionHashNum);
            if (_subCur.BugId != 0)           //Already associated to a bug
            {
                _bug = Bugs.GetOne(_subCur.BugId);
                butAddViewBug.Text = "View Bug";
            }
            if (_bug != null)
            {
                _listLinks = JobLinks.GetForType(JobLinkType.Bug, _bug.BugId);
                if (_listLinks.Count == 1)
                {
                    butAddViewJob.Text = "View Job";
                }
            }
            Dictionary <string, Patient> dictPats = new Dictionary <string, Patient>();

            dictPats.Add(_subCur.RegKey, _patCur);
            bugSubmissionControl.RefreshData(dictPats, -1, null);          //New selelction, refresh control data.
            bugSubmissionControl.RefreshView(_subCur);
        }
        private void gridSubs_CellClick(object sender, UI.ODGridClickEventArgs e)
        {
            butAddJob.Text = "Add Job";          //Always reset
            if (e.Row == -1 || gridSubs.SelectedIndices.Length != 1)
            {
                bugSubmissionControl.ClearCustomerInfo();
                _subCur            = null;
                labelDateTime.Text = "";
                labelHashNum.Text  = "";
                bugSubmissionControl.SetTextDevNoteEnabled(false);
                return;
            }
            bugSubmissionControl.SetTextDevNoteEnabled(true);
            _subCur = ((List <BugSubmission>)gridSubs.ListGridRows[e.Row].Tag)[0];
            if (_dictPatients.ContainsKey(_subCur.RegKey))
            {
                _patCur = _dictPatients[_subCur.RegKey];
            }
            else
            {
                try {
                    RegistrationKey key = RegistrationKeys.GetByKey(_subCur.RegKey);
                    _patCur = Patients.GetPat(key.PatNum);
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    _patCur = new Patient();                  //Just in case, needed mostly for debug.
                }
                _dictPatients.Add(_subCur.RegKey, _patCur);
            }
            List <BugSubmission> listSubs = _listAllSubs;

            if (comboGrouping.SelectedIndex.In(1, 2, 3, 4, 5))
            {
                listSubs = ((List <BugSubmission>)gridSubs.ListGridRows[gridSubs.GetSelectedIndex()].Tag);
            }
            butAddJob.Tag = null;
            bugSubmissionControl.RefreshData(_dictPatients, comboGrouping.SelectedIndex, listSubs);          //New selelction, refresh control data.
            bugSubmissionControl.RefreshView(_subCur);
            labelDateTime.Text = POut.DateT(_subCur.SubmissionDateTime);
            labelHashNum.Text  = POut.Long(_subCur.BugSubmissionHashNum);
            if (_subCur.BugId != 0)
            {
                List <JobLink> listJobLink = _listJobLinks.Where(x => x.FKey == _subCur.BugId).ToList();
                if (listJobLink.Count == 1)
                {
                    butAddJob.Text = "View Job";
                    butAddJob.Tag  = listJobLink.First();
                }
            }
            if (_viewMode.In(FormBugSubmissionMode.SelectionMode, FormBugSubmissionMode.ValidationMode))
            {
                butAddJob.Text = "OK";
            }
        }
 ///<summary>When sub is set, fills customer group box with various information.
 ///When null, clears all fields.</summary>
 private void SetCustomerInfo(BugSubmission sub = null)
 {
     if (sub == null)
     {
         textStack.Text          = "";     //Also clear any submission specific fields.
         labelCustomerNum.Text   = "";
         labelCustomerName.Text  = "";
         labelCustomerState.Text = "";
         labelCustomerPhone.Text = "";
         labelSubNum.Text        = "";
         labelLastCall.Text      = "";
         FillOfficeInfoGrid(null);
         butGoToAccount.Enabled = false;
         butBugTask.Enabled     = false;
         return;
     }
     try {
         if (_patCur == null)
         {
             RegistrationKey key = RegistrationKeys.GetByKey(sub.RegKey);
             _patCur = Patients.GetPat(key.PatNum);
             if (_patCur == null)
             {
                 return;                        //Should not happen.
             }
         }
         labelCustomerNum.Text   = _patCur.PatNum.ToString();
         labelCustomerName.Text  = _patCur.GetNameLF();
         labelCustomerState.Text = _patCur.State;
         labelCustomerPhone.Text = _patCur.WkPhone;
         labelSubNum.Text        = POut.Long(sub.BugSubmissionNum);
         labelLastCall.Text      = Commlogs.GetDateTimeOfLastEntryForPat(_patCur.PatNum).ToString();
     }
     catch (Exception ex) {
         ex.DoNothing();
     }
     butGoToAccount.Enabled = true;
     butBugTask.Enabled     = true;
 }
Exemple #4
0
        ///<summary>When sub is set, fills customer group box with various information.
        ///When null, clears all fields.</summary>
        private void SetCustomerInfo(BugSubmission sub = null, bool refreshGrid = true)
        {
            if (sub == null)
            {
                textStack.Text          = "";     //Also clear any submission specific fields.
                labelCustomerNum.Text   = "";
                labelCustomerName.Text  = "";
                labelCustomerState.Text = "";
                labelCustomerPhone.Text = "";
                labelSubNum.Text        = "";
                labelLastCall.Text      = "";
                FillOfficeInfoGrid(null);
                gridCustomerSubs.BeginUpdate();
                gridCustomerSubs.Rows.Clear();
                gridCustomerSubs.EndUpdate();
                butGoToAccount.Enabled = false;
                butBugTask.Enabled     = false;
                return;
            }
            try {
                if (_dictPatients.ContainsKey(sub.RegKey))
                {
                    _patCur = _dictPatients[sub.RegKey];
                }
                else
                {
                    RegistrationKey key = RegistrationKeys.GetByKey(sub.RegKey);
                    _patCur = Patients.GetPat(key.PatNum);
                    if (_patCur == null)
                    {
                        return;                        //Should not happen.
                    }
                    _dictPatients.Add(sub.RegKey, _patCur);
                }
                labelCustomerNum.Text   = _patCur.PatNum.ToString();
                labelCustomerName.Text  = _patCur.GetNameLF();
                labelCustomerState.Text = _patCur.State;
                labelCustomerPhone.Text = _patCur.WkPhone;
                labelSubNum.Text        = POut.Long(sub.BugSubmissionNum);
                labelLastCall.Text      = Commlogs.GetDateTimeOfLastEntryForPat(_patCur.PatNum).ToString();
            }
            catch (Exception ex) {
                ex.DoNothing();
            }
            if (!refreshGrid)
            {
                return;
            }
            switch (comboGrouping.SelectedIndex)
            {
            case 0:
                #region None
                gridCustomerSubs.Title = "Customer Submissions";
                gridCustomerSubs.BeginUpdate();
                gridCustomerSubs.Columns.Clear();
                gridCustomerSubs.Columns.Add(new ODGridColumn("Version", 100, HorizontalAlignment.Center));
                gridCustomerSubs.Columns.Add(new ODGridColumn("Count", 50, HorizontalAlignment.Center));
                gridCustomerSubs.Rows.Clear();
                Dictionary <string, List <BugSubmission> > dictCustomerSubVersions = _listAllSubs
                                                                                     .Where(x => x.RegKey == sub.RegKey)
                                                                                     .GroupBy(x => x.Info.DictPrefValues[PrefName.ProgramVersion])
                                                                                     .ToDictionary(x => x.Key, x => x.DistinctBy(y => y.ExceptionStackTrace).ToList());
                foreach (KeyValuePair <string, List <BugSubmission> > pair in dictCustomerSubVersions)
                {
                    gridCustomerSubs.Rows.Add(new ODGridRow(pair.Key, pair.Value.Count.ToString()));
                }
                gridCustomerSubs.EndUpdate();
                #endregion
                break;

            case 1:
            case 2:
            case 3:
                #region Customer, Stacktrace, 95%
                List <BugSubmission> listSubGroup = ((List <BugSubmission>)gridSubs.Rows[gridSubs.GetSelectedIndex()].Tag);
                gridCustomerSubs.Title = "Grouped Submissions";
                gridCustomerSubs.BeginUpdate();
                gridCustomerSubs.Columns.Clear();
                gridCustomerSubs.Columns.Add(new ODGridColumn("Vers.", 55, HorizontalAlignment.Center));
                gridCustomerSubs.Columns.Add(new ODGridColumn("RegKey", 140, HorizontalAlignment.Center));
                gridCustomerSubs.Rows.Clear();
                listSubGroup.ForEach(x => {
                    ODGridRow row = new ODGridRow(x.Info.DictPrefValues[PrefName.ProgramVersion], x.RegKey);
                    row.Tag       = x;
                    gridCustomerSubs.Rows.Add(row);
                });
                gridCustomerSubs.EndUpdate();
                #endregion
                break;
            }
            butGoToAccount.Enabled = true;
            butBugTask.Enabled     = true;
        }