ViewReportsDlg.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /**
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: DOCS
  4. (C) Copyright IBM Corp. 2005, 2008
  5. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
  6. IBM Corp.
  7. */
  8. using System;
  9. using System.Drawing;
  10. using System.Collections;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using System.Web.Services.Protocols;
  14. using SamplesCommon;
  15. using cognosdotnet_10_2;
  16. namespace ViewReports
  17. {
  18. /// <summary>
  19. /// Summary description for ViewReportsDlg.
  20. /// </summary>
  21. public class ViewReportsDlg : System.Windows.Forms.Form
  22. {
  23. private System.Windows.Forms.MainMenu mainMenu1;
  24. private System.Windows.Forms.MenuItem menuItemFile;
  25. private System.Windows.Forms.MenuItem menuItemExit;
  26. private System.Windows.Forms.MenuItem menuItemHelp;
  27. private System.Windows.Forms.MenuItem menuItemAbout;
  28. private System.Windows.Forms.Label BIServerURLLBL;
  29. private System.Windows.Forms.Button viewReportsButton;
  30. private System.Windows.Forms.GroupBox groupBox1;
  31. private System.Windows.Forms.RichTextBox resultsDisplayWindowRTB;
  32. private IContainer components;
  33. private System.Windows.Forms.TextBox serverUrlTB;
  34. private contentManagerService1 cBIServer = null;
  35. public ViewReportsDlg()
  36. {
  37. //
  38. // Required for Windows Form Designer support
  39. //
  40. InitializeComponent();
  41. //
  42. // TODO: Add any constructor code after InitializeComponent call
  43. //
  44. }
  45. /// <summary>
  46. /// Clean up any resources being used.
  47. /// </summary>
  48. protected override void Dispose( bool disposing )
  49. {
  50. if( disposing )
  51. {
  52. if(components != null)
  53. {
  54. components.Dispose();
  55. }
  56. }
  57. base.Dispose( disposing );
  58. }
  59. #region Windows Form Designer generated code
  60. /// <summary>
  61. /// Required method for Designer support - do not modify
  62. /// the contents of this method with the code editor.
  63. /// </summary>
  64. private void InitializeComponent()
  65. {
  66. this.components = new System.ComponentModel.Container();
  67. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ViewReportsDlg));
  68. this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
  69. this.menuItemFile = new System.Windows.Forms.MenuItem();
  70. this.menuItemExit = new System.Windows.Forms.MenuItem();
  71. this.menuItemHelp = new System.Windows.Forms.MenuItem();
  72. this.menuItemAbout = new System.Windows.Forms.MenuItem();
  73. this.BIServerURLLBL = new System.Windows.Forms.Label();
  74. this.serverUrlTB = new System.Windows.Forms.TextBox();
  75. this.viewReportsButton = new System.Windows.Forms.Button();
  76. this.groupBox1 = new System.Windows.Forms.GroupBox();
  77. this.resultsDisplayWindowRTB = new System.Windows.Forms.RichTextBox();
  78. this.groupBox1.SuspendLayout();
  79. this.SuspendLayout();
  80. //
  81. // mainMenu1
  82. //
  83. this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  84. this.menuItemFile,
  85. this.menuItemHelp});
  86. //
  87. // menuItemFile
  88. //
  89. this.menuItemFile.Index = 0;
  90. this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  91. this.menuItemExit});
  92. this.menuItemFile.Text = "File";
  93. //
  94. // menuItemExit
  95. //
  96. this.menuItemExit.Index = 0;
  97. this.menuItemExit.Text = "Exit";
  98. this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
  99. //
  100. // menuItemHelp
  101. //
  102. this.menuItemHelp.Index = 1;
  103. this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  104. this.menuItemAbout});
  105. this.menuItemHelp.Text = "Help";
  106. //
  107. // menuItemAbout
  108. //
  109. this.menuItemAbout.Index = 0;
  110. this.menuItemAbout.Text = "About";
  111. this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
  112. //
  113. // BIServerURLLBL
  114. //
  115. this.BIServerURLLBL.Location = new System.Drawing.Point(24, 16);
  116. this.BIServerURLLBL.Name = "BIServerURLLBL";
  117. this.BIServerURLLBL.Size = new System.Drawing.Size(147, 24);
  118. this.BIServerURLLBL.TabIndex = 0;
  119. this.BIServerURLLBL.Text = "Server URL";
  120. this.BIServerURLLBL.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  121. //
  122. // serverUrlTB
  123. //
  124. this.serverUrlTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  125. | System.Windows.Forms.AnchorStyles.Right)));
  126. this.serverUrlTB.BackColor = System.Drawing.SystemColors.Control;
  127. this.serverUrlTB.Location = new System.Drawing.Point(177, 16);
  128. this.serverUrlTB.Name = "serverUrlTB";
  129. this.serverUrlTB.Size = new System.Drawing.Size(487, 20);
  130. this.serverUrlTB.TabIndex = 1;
  131. //
  132. // viewReportsButton
  133. //
  134. this.viewReportsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  135. this.viewReportsButton.Location = new System.Drawing.Point(576, 48);
  136. this.viewReportsButton.Name = "viewReportsButton";
  137. this.viewReportsButton.Size = new System.Drawing.Size(88, 32);
  138. this.viewReportsButton.TabIndex = 2;
  139. this.viewReportsButton.Text = "View Reports";
  140. this.viewReportsButton.Click += new System.EventHandler(this.viewReportsButton_Click);
  141. //
  142. // groupBox1
  143. //
  144. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  145. | System.Windows.Forms.AnchorStyles.Left)
  146. | System.Windows.Forms.AnchorStyles.Right)));
  147. this.groupBox1.Controls.Add(this.resultsDisplayWindowRTB);
  148. this.groupBox1.Location = new System.Drawing.Point(16, 88);
  149. this.groupBox1.Name = "groupBox1";
  150. this.groupBox1.Size = new System.Drawing.Size(648, 304);
  151. this.groupBox1.TabIndex = 3;
  152. this.groupBox1.TabStop = false;
  153. this.groupBox1.Text = "Results Display Window";
  154. //
  155. // resultsDisplayWindowRTB
  156. //
  157. this.resultsDisplayWindowRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  158. | System.Windows.Forms.AnchorStyles.Left)
  159. | System.Windows.Forms.AnchorStyles.Right)));
  160. this.resultsDisplayWindowRTB.BackColor = System.Drawing.SystemColors.Control;
  161. this.resultsDisplayWindowRTB.Location = new System.Drawing.Point(8, 16);
  162. this.resultsDisplayWindowRTB.Name = "resultsDisplayWindowRTB";
  163. this.resultsDisplayWindowRTB.Size = new System.Drawing.Size(632, 280);
  164. this.resultsDisplayWindowRTB.TabIndex = 0;
  165. this.resultsDisplayWindowRTB.Text = "";
  166. //
  167. // ViewReportsDlg
  168. //
  169. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  170. this.ClientSize = new System.Drawing.Size(680, 401);
  171. this.Controls.Add(this.groupBox1);
  172. this.Controls.Add(this.viewReportsButton);
  173. this.Controls.Add(this.serverUrlTB);
  174. this.Controls.Add(this.BIServerURLLBL);
  175. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  176. this.Menu = this.mainMenu1;
  177. this.Name = "ViewReportsDlg";
  178. this.Text = "ViewReportsDlg";
  179. this.groupBox1.ResumeLayout(false);
  180. this.ResumeLayout(false);
  181. this.PerformLayout();
  182. }
  183. #endregion
  184. private void menuItemExit_Click(object sender, System.EventArgs e)
  185. {
  186. this.Close();
  187. }
  188. private void menuItemAbout_Click(object sender, System.EventArgs e)
  189. {
  190. SamplesAbout about = new SamplesAbout();
  191. about.applicationName = "ViewReports Sample";
  192. about.applicationVersion = "1.1";
  193. about.Show();
  194. }
  195. private void viewReportsButton_Click(object sender, System.EventArgs e)
  196. {
  197. string resultMessage = "";
  198. clearResultsWindow();
  199. try
  200. {
  201. ViewReports viewReportsObj = new ViewReports();
  202. displayMessage("Sending queries...");
  203. viewReportsObj.doViewReportsAndQueries(cBIServer, ref resultMessage);
  204. displayMessage(resultMessage);
  205. }
  206. catch(SoapException ex)
  207. {
  208. displayMessage("\n...the operation failed.\nThe following information was returned:");
  209. displayMessage(SamplesException.getExceptionMessage( ex));
  210. return;
  211. }
  212. catch(System.Exception ex)
  213. {
  214. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  215. {
  216. SamplesException.ShowExceptionMessage( ex.Message, true, "ViewReports Sample" );
  217. }
  218. return;
  219. }
  220. }
  221. public void setConnection(contentManagerService1 cBICMS, string cBIUrl)
  222. {
  223. cBIServer = cBICMS;
  224. serverUrlTB.Text = cBIUrl;
  225. }
  226. public void displayMessage(string message)
  227. {
  228. resultsDisplayWindowRTB.AppendText(message + "\n");
  229. }
  230. public void clearResultsWindow()
  231. {
  232. resultsDisplayWindowRTB.Clear();
  233. }
  234. }
  235. }