Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            TicketAnomaliesReport rpt = new TicketAnomaliesReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        public void ShowTicketAnomaliesReport(DateTime StartDate, DateTime EndDate)
        {
            string sVersion = string.Empty;
            string sSiteName = string.Empty;

            try
            {
                LogManager.WriteLog("Inside ShowTicketAnomaliesReport method", LogManager.enumLogLevel.Info);
                GetVersion_SiteName(out  sVersion, out  sSiteName);

                CrystalDecisions.CrystalReports.Engine.Database crDatabase;
                CrystalDecisions.CrystalReports.Engine.Tables crTables;

                TableLogOnInfo tableLogonInfo = new TableLogOnInfo();
                TicketAnomaliesReport TicketAnomaliesReport = new TicketAnomaliesReport();
                LogManager.WriteLog("Setting Report Datasource...", LogManager.enumLogLevel.Info);
                LogManager.WriteLog("Report DataSource set successfully", LogManager.enumLogLevel.Info);
                LogManager.WriteLog("Setting Report Parameters...", LogManager.enumLogLevel.Info);

                TicketAnomaliesReport.SetParameterValue("@StartDate", StartDate);
                TicketAnomaliesReport.SetParameterValue("@EndDate", EndDate);
                TicketAnomaliesReport.SetParameterValue("@Version", sVersion);
                TicketAnomaliesReport.SetParameterValue("@SiteCode", Settings.SiteCode);
                TicketAnomaliesReport.SetParameterValue("@SiteName", Settings.SiteName);
                TicketAnomaliesReport.SetParameterValue("@CurrencySymbol", ExtensionMethods.CurrentSiteCulture.GetCurrencySymbol());
                TicketAnomaliesReport.SetParameterValue("DateCulture", ExtensionMethods.CurrentDateCulture);

               IReports objReports = String.IsNullOrEmpty(_ExchangeConnectionString) ? ReportsBusinessObject.CreateInstance() : ReportsBusinessObject.CreateInstance(_ExchangeConnectionString, _TicketingConnectionString);
               List<ServerDetails> DbConnectionInfo = String.IsNullOrEmpty(_TicketingConnectionString) ? objReports.GetDataBaseConnectionString() : objReports.GetDataBaseConnectionString(_TicketingConnectionString);
                ConnectionInfo myConnectionInfo = new ConnectionInfo();

                myConnectionInfo.ServerName = DbConnectionInfo[0].ServerName;  // read this information from config file.
                myConnectionInfo.DatabaseName = "Ticketing"; // read this information from config file.
                myConnectionInfo.UserID = DbConnectionInfo[0].Username;  // read this information from config file.
                myConnectionInfo.Password = DbConnectionInfo[0].Password;  // read this information from config file.


                crDatabase = TicketAnomaliesReport.Database;
                crTables = crDatabase.Tables;

                foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                {
                    tableLogonInfo = crTable.LogOnInfo;
                    tableLogonInfo.ConnectionInfo = myConnectionInfo;
                    crTable.ApplyLogOnInfo(tableLogonInfo);
                }


                LogManager.WriteLog("Report Parameters set successfully", LogManager.enumLogLevel.Info);


                LogManager.WriteLog("Setting Report Source...", LogManager.enumLogLevel.Info);

                crystalReportViewer.ReportSource = TicketAnomaliesReport;


                LogManager.WriteLog("Report Source set successfully", LogManager.enumLogLevel.Info);

               // AuditReports();

                strReportName = "Ticket Anomalies Report";

            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     TicketAnomaliesReport rpt = new TicketAnomaliesReport();
     rpt.Site = this.Site;
     return rpt;
 }