private void btnListReports_Click(object sender, EventArgs e)
{
CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
CrystalDecisions.Enterprise.EnterpriseService enterpriseService;
CrystalDecisions.Enterprise.EnterpriseSession enterpriseSession;
CrystalDecisions.Enterprise.InfoObjects infoObjects;
CrystalDecisions.Enterprise.InfoStore infoStore;
btnReportObjects.Text += "\nConnected to BOE Server - ";
btnReportObjects.AppendText(btrDataFile.Text + "- getting list of Reports ****** PLEASE WAIT ******\n");
btnReportObjects.Update();
try
{
if (ChkLocalHost.Checked)
btrDataFile.Text = System.Environment.MachineName + ":6400";
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
//return;
}
try
{
if (ChkLocalHost.Checked)
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
infoObjects = infoStore.Query("SELECT SI_NAME, SI_ID, SI_GUID FROM CI_INFOOBJECTS WHERE SI_KIND='CrystalReport'");
//ceinfoObjects = infoObjects;
int BItboxManagedRptCount = 0;
foreach (CrystalDecisions.Enterprise.InfoObject IObj in infoObjects)
{
ManagedReportsListBox.Items.Add(IObj.ID + " : " + IObj.Title.ToString());
++BItboxManagedRptCount;
tboxManagedRptCount.Text = BItboxManagedRptCount.ToString();
}
// this line should return the number of concurrent reports being executed
//int xxx = CrystalDecisions.CrystalReports.Engine.ReportDocument.GetConcurrentUsage();
infoObjects = infoStore.Query("Select * From CI_SYSTEMOBJECTS Where SI_PROGID='CrystalEnterprise.Server' and SI_DESCRIPTION='Crystal Reports 2016 Report Application Server'");
CrystalDecisions.Enterprise.Desktop.Server currentServer = (CrystalDecisions.Enterprise.Desktop.Server)infoObjects[1];
CrystalDecisions.Enterprise.Desktop.Server svr = (CrystalDecisions.Enterprise.Desktop.Server)currentServer;
CrystalDecisions.Enterprise.Admin.ReportAppServerAdmin rptAppAdmin = (CrystalDecisions.Enterprise.Admin.ReportAppServerAdmin)svr.ServerAdmin;
btnReportObjects.Text += "\nDoc Count: " + rptAppAdmin.CurrentDocumentCount;
btnReportObjects.Text += "\nMax Num Records: " + rptAppAdmin.MaxNumOfRecords;
btnReportObjects.Text += "\nMax Report Jobs: " + rptAppAdmin.MaxReportJobs;
btnReportObjects.Text += "\nN um of Browsing REcords: " + rptAppAdmin.NumOfBrowsingRecords;
//serverMetrics.CurrentDocumentCount.ToString();
//btnReportObjects.Text += "\nOpen Connections: " + serverMetrics.CurrentDocumentCount.ToString() + "\n";
// now that the report ID's are listed close this session - opens a new session when report is opened
enterpriseSession.Dispose();
}
private void btnGetUniverses_Click(object sender, EventArgs e)
{
ManagedReportsListBox.Items.Clear();
CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
CrystalDecisions.Enterprise.EnterpriseService enterpriseService;
CrystalDecisions.Enterprise.EnterpriseSession enterpriseSession;
CrystalDecisions.Enterprise.InfoObjects infoObjects;
CrystalDecisions.Enterprise.InfoStore infoStore;
btnReportObjects.Text += "Connected to BOE Server - ";
btnReportObjects.AppendText(btrDataFile.Text + "- getting list of Universes ****** PLEASE WAIT ******\n");
btnReportObjects.Update();
try
{
if (ChkLocalHost.Checked)
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
//infoObjects = infoStore.Query("SELECT SI_NAME, SI_KIND, SI_ID, SI_GUID, SI_PARENTID FROM CI_SYSTEMOBJECTS, CI_APPOBJECTS WHERE SI_KIND='Universe'");
infoObjects = infoStore.Query("SELECT * FROM CI_SYSTEMOBJECTS, CI_APPOBJECTS WHERE SI_KIND='Universe'");
//ceinfoObjects = infoObjects;
int BItboxManagedRptCount = 0;
foreach (CrystalDecisions.Enterprise.InfoObject IObj in infoObjects)
{
btnReportObjects.Text += "\nFolder CUID: " + IObj.CUID + " - SI_ID: " + IObj.ID + " : " + IObj.Title.ToString();
ManagedReportsListBox.Items.Add(IObj.ID + " : " + IObj.Title.ToString());
++BItboxManagedRptCount;
tboxManagedRptCount.Text = BItboxManagedRptCount.ToString();
}
// now that the report ID's are listed close this session - opens a new session when report is opened
enterpriseSession.Dispose();
}
private void btnUniverse_Click(object sender, EventArgs e)
{
CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
CrystalDecisions.Enterprise.EnterpriseService enterpriseService;
CrystalDecisions.Enterprise.EnterpriseSession enterpriseSession;
CrystalDecisions.Enterprise.InfoObjects infoObjects;
CrystalDecisions.Enterprise.InfoStore infoStore;
try
{
if (ChkLocalHost.Checked)
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
//ReportAppFactory Raf = (ReportAppFactory)enterpriseSession.GetService("RASReportFactory").Interface;
DateTime dtStart;
TimeSpan difference;
try
{
dtStart = DateTime.Now;
if (ManagedReportsListBox.SelectedItem != null)
{
try
{
if (ChkLocalHost.Checked)
MyUNIApp.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
MyUNIApp.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
MyUNIApp.Interactive = false;
string MySTRTemp = ManagedReportsListBox.SelectedItem.ToString();
int MySI_ID = MySTRTemp.LastIndexOf(@":");
// remove the ID, only wants the name of universe
string MyUNIName = ManagedReportsListBox.Text.Remove(0, MySI_ID+2);
int MMySTRTemp = Convert.ToInt32(ManagedReportsListBox.Text.Substring(0, MySI_ID));
// starting point for default Universes
IUniverseFolder myfolder = MyUNIApp.UniverseRootFolder;
//// get the Universe if it's in the root folder
//if (myfolder.Path == @"/")
//{
// try
// {
// IUniverse MYUNIV = MyUNIApp.Universes.OpenFromEnterprise(@"/", MyUNIName.ToString());
// //MessageBox.Show((dynamic) MYUNIV.Parent.ToString());
// btnReportObjects.Text += "\n" + "Table Count: " + MYUNIV.Tables.Count.ToString();
// }
// catch (Exception ex)
// {
// btnReportObjects.Text += "ERROR: " + ex.Message;
// //return;
// }
//}
// get the universe under a folder
{
if (MyUNIApp.UniverseRootFolder.Folders.Count >= 1)
{
// get the GUID from BOE and compare it to Designer GUID to verify it is the one selected.
infoObjects = infoStore.Query("SELECT * FROM CI_SYSTEMOBJECTS, CI_APPOBJECTS WHERE SI_ID='" + MMySTRTemp + "'");
string MyCUID = infoObjects[1].ParentCUID.ToString();
foreach (Designer.UniverseFolder myUnvFolder in MyUNIApp.UniverseRootFolder.Folders)
{
if (MyCUID == myUnvFolder.CUID) // || myUnvFolder.Name == MyUNIName.ToString())
{
string MyUNIFolder = myUnvFolder.Path.ToString();
Designer.Universe myUnv = MyUNIApp.Universes.OpenFromEnterprise(MyUNIFolder, MyUNIName.ToString());
btnReportObjects.Text += "\n" + "Table Count: " + myUnv.Tables.Count.ToString();
}
}
}
}
btnReportName.Text = "CUID - " + MySTRTemp;
difference = DateTime.Now.Subtract(dtStart);
btnReportObjects.Text += "\n\nReport Document Load: " + difference.Minutes.ToString() + ":" + difference.Seconds.ToString() + "\r\n";
btnCloserpt.Enabled = false;
dtStart = DateTime.Now;
ViewReport.Enabled = true;
btnCloserpt.Enabled = true;
cbLastSaveHistory.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
// do not modify this works
ViewReport.Enabled = true;
btnCloserpt.Enabled = true;
}
private void btnGetWebi_Click(object sender, EventArgs e)
{
ManagedReportsListBox.Items.Clear();
CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
CrystalDecisions.Enterprise.EnterpriseService enterpriseService;
CrystalDecisions.Enterprise.EnterpriseSession enterpriseSession;
CrystalDecisions.Enterprise.InfoObjects infoObjects;
CrystalDecisions.Enterprise.InfoStore infoStore;
btnReportObjects.Text += "\nConnected to BOE Server - ";
btnReportObjects.AppendText(btrDataFile.Text + "- getting list of Reports ****** PLEASE WAIT ******\n");
btnReportObjects.Update();
try
{
if (ChkLocalHost.Checked)
btrDataFile.Text = System.Environment.MachineName + ":6400";
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
//return;
}
try
{
if (ChkLocalHost.Checked)
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
infoObjects = infoStore.Query("SELECT SI_NAME, SI_ID, SI_GUID FROM CI_INFOOBJECTS WHERE SI_KIND='webi'");
//ceinfoObjects = infoObjects;
int BItboxManagedRptCount = 0;
foreach (CrystalDecisions.Enterprise.InfoObject IObj in infoObjects)
{
ManagedReportsListBox.Items.Add(IObj.ID + " : " + IObj.Title.ToString());
++BItboxManagedRptCount;
tboxManagedRptCount.Text = BItboxManagedRptCount.ToString();
}
// this line should return the number of concurrent reports being executed
//int xxx = CrystalDecisions.CrystalReports.Engine.ReportDocument.GetConcurrentUsage();
infoObjects = infoStore.Query("Select * From CI_SYSTEMOBJECTS Where SI_PROGID='CrystalEnterprise.Server' and SI_DESCRIPTION='Crystal Reports 2016 Report Application Server'");
CrystalDecisions.Enterprise.Desktop.Server currentServer = (CrystalDecisions.Enterprise.Desktop.Server)infoObjects[1];
CrystalDecisions.Enterprise.Desktop.Server svr = (CrystalDecisions.Enterprise.Desktop.Server)currentServer;
CrystalDecisions.Enterprise.Admin.ReportAppServerAdmin rptAppAdmin = (CrystalDecisions.Enterprise.Admin.ReportAppServerAdmin)svr.ServerAdmin;
btnReportObjects.Text += "\nDoc Count: " + rptAppAdmin.CurrentDocumentCount;
btnReportObjects.Text += "\nMax Num Records: " + rptAppAdmin.MaxNumOfRecords;
btnReportObjects.Text += "\nMax Report Jobs: " + rptAppAdmin.MaxReportJobs;
btnReportObjects.Text += "\nNumber of Browsing Records: " + rptAppAdmin.NumOfBrowsingRecords;
//serverMetrics.CurrentDocumentCount.ToString();
//btnReportObjects.Text += "\nOpen Connections: " + serverMetrics.CurrentDocumentCount.ToString() + "\n";
// now that the report ID's are listed close this session - opens a new session when report is opened
enterpriseSession.Dispose();
}
private void btnURLWebiRun_Click(object sender, EventArgs e)
{
CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
CrystalDecisions.Enterprise.EnterpriseService enterpriseService;
CrystalDecisions.Enterprise.EnterpriseSession enterpriseSession;
CrystalDecisions.Enterprise.InfoObjects infoObjects;
CrystalDecisions.Enterprise.InfoStore infoStore;
string mySession = "";
try
{
if (ChkLocalHost.Checked)
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
enterpriseSession = sessionMgr.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
// get serilized session
mySession = enterpriseSession.SerializedSession;
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new CrystalDecisions.Enterprise.InfoStore(enterpriseService);
//ReportAppFactory Raf = (ReportAppFactory)enterpriseSession.GetService("RASReportFactory").Interface;
DateTime dtStart;
TimeSpan difference;
if (LstBrowser.SelectedItem == null)
MessageBox.Show("Please select a Browser to render the report in");
else
{
string MyObjectType = LstBrowser.SelectedItem.ToString();
try
{
dtStart = DateTime.Now;
if (ManagedReportsListBox.SelectedItem != null)
{
try
{
if (ChkLocalHost.Checked)
MyUNIApp.Logon(btrFileLocation.Text, btrPassword.Text, System.Environment.MachineName + ":6400", btrSearchPath.Text);
else
MyUNIApp.Logon(btrFileLocation.Text, btrPassword.Text, btrDataFile.Text, btrSearchPath.Text);
//enterpriseService = enterpriseSession.GetService("InfoStore");
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
//MyUNIApp.Visible = false;
MyUNIApp.Interactive = false;
string MySTRTemp = ManagedReportsListBox.SelectedItem.ToString();
int MySI_ID = MySTRTemp.LastIndexOf(@":");
// remove the ID, only wants the name of WEBI doc
string MyUNIName = ManagedReportsListBox.Text.Remove(0, MySI_ID + 2);
int MMySTRTemp = Convert.ToInt32(ManagedReportsListBox.Text.Substring(0, MySI_ID));
btnReportName.Text = "CUID - " + MySTRTemp;
infoObjects = infoStore.Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID='" + MMySTRTemp + "'");
string MyCUID = infoObjects[1].CUID.ToString();
difference = DateTime.Now.Subtract(dtStart);
btnReportObjects.Text += "\n\nReport Document Load: " + difference.Minutes.ToString() + ":" + difference.Seconds.ToString() + "\r\n";
btnCloserpt.Enabled = false;
dtStart = DateTime.Now;
StringWriter writer = new StringWriter();
string myEncodeSession = System.Web.HttpUtility.UrlEncode(mySession);
string myURL = @"http://" + txtTomcatServerPort.Text.ToString() + @"/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=" + MyCUID + "&serSes=" + myEncodeSession;
switch (MyObjectType)
{
case "IE":
{
//Session info too long for IE to use 20xx characters max maybe, depends on how old that user is...
System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Internet Explorer\iexplore.exe", myURL);
}
break;
case "Firefox":
{
System.Diagnostics.Process.Start(@"C:\Program Files\Mozilla Firefox\firefox.exe", myURL);
}
break;
case "Chrome":
{
System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", myURL);
}
break;
case "Other":
{
//System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Internet Explorer\iexplore.exe", myURL)
}
break;
default:
System.Diagnostics.Process.Start(@"C:\Program Files\Mozilla Firefox\firefox.exe", myURL);
break;
}
//http://BIPW12R2:8080/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=AY7lzhaXLgVDoRARitXX9kM // ID 5933
cbLastSaveHistory.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
// do not modify this works
ViewReport.Enabled = true;
btnCloserpt.Enabled = true;
}
}
//Add these required Crystal Assemblies to your project
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using Designer;
using CrystalDecisions.Enterprise.Desktop;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public class frmMain : System.Windows.Forms.Form
{
//.....
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument rptClientDocMgd;
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
Designer.Application MyUNIApp = new Designer.Application();
public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
foreach (Assembly MyVerison in AppDomain.CurrentDomain.GetAssemblies())
{
if (MyVerison.FullName.Substring(0, 38) == "CrystalDecisions.CrystalReports.Engine")
{
//File: C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll
//InternalName: Crystal Reports
//OriginalFilename:
//FileVersion: 13.0.9.1312
//FileDescription: Crystal Reports
//Product: SBOP Crystal Reports
//ProductVersion: 13.0.9.1312
//Debug: False
//Patched: False
//PreRelease: False
//PrivateBuild: False
//SpecialBuild: False
//Language: English (United States)
System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(MyVerison.Location);
txtRuntimeVersion.Text += fileVersionInfo.FileVersion.ToString();
// check if CrsytalDecisions.Enterprise dll's can be loaded ( Anything but Cortez - managed reporting )
CRVer = fileVersionInfo.FileVersion.Substring(0, 2);
//return;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
25 | |
18 | |
16 | |
12 | |
10 | |
8 | |
8 | |
7 | |
7 | |
7 |