Exemple #1
0
        private void butAudit_Click(object sender, EventArgs e)
        {
            FormAuditOrtho FormAO = new FormAuditOrtho();

            SecurityLog[] orthoChartLogs = SecurityLogs.Refresh(_patCur.PatNum, new List <Permissions> {
                Permissions.OrthoChartEditFull
            }, null, checkIncludeArchived.Checked);
            SecurityLog[] patientFieldLogs = SecurityLogs.Refresh(new DateTime(1, 1, 1), DateTime.Today, Permissions.PatientFieldEdit, _patCur.PatNum, 0,
                                                                  DateTime.MinValue, DateTime.Today, checkIncludeArchived.Checked);
            SortedDictionary <DateTime, List <SecurityLog> > dictDatesOfServiceLogEntries = new SortedDictionary <DateTime, List <SecurityLog> >();

            //Add all dates from grid first, some may not have audit trail entries, but should be selectable from FormAO
            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                DateTime dtCur = GetOrthoDate(i);
                if (dictDatesOfServiceLogEntries.ContainsKey(dtCur))
                {
                    continue;
                }
                dictDatesOfServiceLogEntries.Add(dtCur, new List <SecurityLog>());
            }
            //Add Ortho Audit Trail Entries
            for (int i = 0; i < orthoChartLogs.Length; i++)
            {
                DateTime dtCur = OrthoCharts.GetOrthoDateFromLog(orthoChartLogs[i]);
                if (!dictDatesOfServiceLogEntries.ContainsKey(dtCur))
                {
                    dictDatesOfServiceLogEntries.Add(dtCur, new List <SecurityLog>());
                }
                dictDatesOfServiceLogEntries[dtCur].Add(orthoChartLogs[i]);                //add entry to existing list.
            }
            FormAO.DictDateOrthoLogs = dictDatesOfServiceLogEntries;
            FormAO.PatientFieldLogs.AddRange(patientFieldLogs);
            FormAO.ShowDialog();
        }