コード例 #1
0
        public void RefreshAuditLog()
        {
            try
            {
                List <AuditLogEntry> entries = new List <AuditLogEntry>();

                List <KeyValuePair <long, string> > _contracts = AuditLog.GetContractsInRange(StartDate, EndDate);
                //AuditLogEntries = new ObservableCollection<AuditLogEntry>(_contracts);

                //            IEnumerable<AuditLogEntry> obsCollection = (IEnumerable<AuditLogEntry>)AuditLogEntries;
                //            var list = new List<AuditLogEntry>(obsCollection);

                AuditLogViewer.LocalReport.DataSources.Clear();
                AuditLogViewer.BorderStyle                        = System.Windows.Forms.BorderStyle.None;
                AuditLogViewer.LocalReport.ReportPath             = ApplicationInfo.ApplicationPath + "\\AuditLogRpt.rdlc";
                AuditLogViewer.ProcessingMode                     = ProcessingMode.Local;
                AuditLogViewer.LocalReport.ReportEmbeddedResource = "Spheris.BillingAdmin.AuditLogRpt.rdlc";
                if (this.EnableContractList)
                {
                    entries = AuditLog.GetEntries(StartDate, EndDate, SelectedContract.Key);
                }
                else if (EnableChangedByList && String.IsNullOrEmpty(ChangedBy) == false)
                {
                    entries = AuditLog.GetEntries(StartDate, EndDate, ChangedBy);
                }
                else
                {
                    entries = AuditLog.GetEntries(StartDate, EndDate);
                }
                AuditLogViewer.LocalReport.DataSources.Add(new ReportDataSource("Spheris_Billing_AuditLogEntry", entries));
                //AuditLogViewer.da
                //ApplicationInfo.ApplicationPath
                AuditLogViewer.Name = "Spheris_Billing_AuditLogEntry";
                ReportParameter[] parameters = new ReportParameter[2];
                parameters[0] = new ReportParameter("BeginDate", StartDate.ToShortDateString());
                parameters[1] = new ReportParameter("EndDate", EndDate.ToShortDateString());
                AuditLogViewer.LocalReport.SetParameters(parameters);
                AuditLogViewer.RefreshReport();
            }
            catch (Exception x)
            {
                View.ShowMsg(x.ToString());
            }
            //View.SetAuditLog( list );
        }
コード例 #2
0
        private void RefreshReport()
        {
            List <AuditLogEntry> entries;

            if (filterByContract.Checked)
            {
                // Make sure that a contract has been specified.
                if (Contracts.SelectedValue == null)
                {
                    throw new ArgumentNullException("A contract has not been selected.");
                }

                entries = AuditLog.GetEntries(StartDate.Value, EndDate.Value, long.Parse(Contracts.SelectedValue.ToString()));
            }
            else if (filterByChangedBy.Checked)
            {
                // Make sure that a user name has been specified.
                if (string.IsNullOrEmpty(ChangedBy.Text.Trim()))
                {
                    throw new ArgumentNullException("A user name has not been specified.");
                }

                entries = AuditLog.GetEntries(StartDate.Value, EndDate.Value, ChangedBy.Text);
            }
            else
            {
                entries = AuditLog.GetEntries(StartDate.Value, EndDate.Value);
            }
            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Spheris_Billing_AuditLogEntry", entries));
            ReportParameter[] parameters = new ReportParameter[2];
            parameters[0] = new ReportParameter("BeginDate", StartDate.Value.ToShortDateString());
            parameters[1] = new ReportParameter("EndDate", EndDate.Value.ToShortDateString());
            this.reportViewer1.LocalReport.SetParameters(parameters);
            this.reportViewer1.RefreshReport();
        }