Exemplo n.º 1
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)
 {
     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;
 }
Exemplo n.º 2
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;
        }