ScheduleDlg.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 Schedule
  17. {
  18. /// <summary>
  19. /// Summary description for ScheduleDlg.
  20. /// </summary>
  21. public class ScheduleDlg : 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 reportListLBL;
  29. private System.Windows.Forms.ComboBox reportListCB;
  30. private IContainer components;
  31. private System.Windows.Forms.RichTextBox resultsDisplayWindowRTB;
  32. private System.Windows.Forms.GroupBox groupBox1;
  33. private System.Windows.Forms.TextBox reportSearchPathTB;
  34. private System.Windows.Forms.Label ServerUrlLBL;
  35. private System.Windows.Forms.TextBox serverUrlTB;
  36. private System.Windows.Forms.Button buttonCreateSchedule;
  37. public static SamplesConnect cBIConnection = null;
  38. public ScheduleDlg()
  39. {
  40. //
  41. // Required for Windows Form Designer support
  42. //
  43. InitializeComponent();
  44. //
  45. // TODO: Add any constructor code after InitializeComponent call
  46. //
  47. }
  48. /// <summary>
  49. /// Clean up any resources being used.
  50. /// </summary>
  51. protected override void Dispose( bool disposing )
  52. {
  53. if( disposing )
  54. {
  55. if(components != null)
  56. {
  57. components.Dispose();
  58. }
  59. }
  60. base.Dispose( disposing );
  61. }
  62. #region Windows Form Designer generated code
  63. /// <summary>
  64. /// Required method for Designer support - do not modify
  65. /// the contents of this method with the code editor.
  66. /// </summary>
  67. private void InitializeComponent()
  68. {
  69. this.components = new System.ComponentModel.Container();
  70. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScheduleDlg));
  71. this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
  72. this.menuItemFile = new System.Windows.Forms.MenuItem();
  73. this.menuItemExit = new System.Windows.Forms.MenuItem();
  74. this.menuItemHelp = new System.Windows.Forms.MenuItem();
  75. this.menuItemAbout = new System.Windows.Forms.MenuItem();
  76. this.ServerUrlLBL = new System.Windows.Forms.Label();
  77. this.serverUrlTB = new System.Windows.Forms.TextBox();
  78. this.reportListLBL = new System.Windows.Forms.Label();
  79. this.reportListCB = new System.Windows.Forms.ComboBox();
  80. this.resultsDisplayWindowRTB = new System.Windows.Forms.RichTextBox();
  81. this.buttonCreateSchedule = new System.Windows.Forms.Button();
  82. this.groupBox1 = new System.Windows.Forms.GroupBox();
  83. this.reportSearchPathTB = new System.Windows.Forms.TextBox();
  84. this.SuspendLayout();
  85. //
  86. // mainMenu1
  87. //
  88. this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  89. this.menuItemFile,
  90. this.menuItemHelp});
  91. //
  92. // menuItemFile
  93. //
  94. this.menuItemFile.Index = 0;
  95. this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  96. this.menuItemExit});
  97. this.menuItemFile.Text = "File";
  98. //
  99. // menuItemExit
  100. //
  101. this.menuItemExit.Index = 0;
  102. this.menuItemExit.Text = "Exit";
  103. this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
  104. //
  105. // menuItemHelp
  106. //
  107. this.menuItemHelp.Index = 1;
  108. this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  109. this.menuItemAbout});
  110. this.menuItemHelp.Text = "Help";
  111. //
  112. // menuItemAbout
  113. //
  114. this.menuItemAbout.Index = 0;
  115. this.menuItemAbout.Text = "About";
  116. this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
  117. //
  118. // ServerUrlLBL
  119. //
  120. this.ServerUrlLBL.Location = new System.Drawing.Point(16, 16);
  121. this.ServerUrlLBL.Name = "ServerUrlLBL";
  122. this.ServerUrlLBL.Size = new System.Drawing.Size(108, 16);
  123. this.ServerUrlLBL.TabIndex = 0;
  124. this.ServerUrlLBL.Text = "Server URL";
  125. //
  126. // serverUrlTB
  127. //
  128. this.serverUrlTB.BackColor = System.Drawing.SystemColors.Control;
  129. this.serverUrlTB.Location = new System.Drawing.Point(16, 32);
  130. this.serverUrlTB.Name = "serverUrlTB";
  131. this.serverUrlTB.Size = new System.Drawing.Size(600, 20);
  132. this.serverUrlTB.TabIndex = 1;
  133. //
  134. // reportListLBL
  135. //
  136. this.reportListLBL.Location = new System.Drawing.Point(16, 64);
  137. this.reportListLBL.Name = "reportListLBL";
  138. this.reportListLBL.Size = new System.Drawing.Size(72, 16);
  139. this.reportListLBL.TabIndex = 3;
  140. this.reportListLBL.Text = "Report Name";
  141. //
  142. // reportListCB
  143. //
  144. this.reportListCB.Location = new System.Drawing.Point(16, 80);
  145. this.reportListCB.Name = "reportListCB";
  146. this.reportListCB.Size = new System.Drawing.Size(328, 21);
  147. this.reportListCB.TabIndex = 5;
  148. this.reportListCB.SelectedIndexChanged += new System.EventHandler(this.reportListCB_SelectedIndexChanged);
  149. //
  150. // resultsDisplayWindowRTB
  151. //
  152. this.resultsDisplayWindowRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  153. | System.Windows.Forms.AnchorStyles.Left)
  154. | System.Windows.Forms.AnchorStyles.Right)));
  155. this.resultsDisplayWindowRTB.BackColor = System.Drawing.SystemColors.Control;
  156. this.resultsDisplayWindowRTB.Location = new System.Drawing.Point(24, 184);
  157. this.resultsDisplayWindowRTB.Name = "resultsDisplayWindowRTB";
  158. this.resultsDisplayWindowRTB.Size = new System.Drawing.Size(584, 216);
  159. this.resultsDisplayWindowRTB.TabIndex = 6;
  160. this.resultsDisplayWindowRTB.Text = "";
  161. //
  162. // buttonCreateSchedule
  163. //
  164. this.buttonCreateSchedule.Location = new System.Drawing.Point(496, 64);
  165. this.buttonCreateSchedule.Name = "buttonCreateSchedule";
  166. this.buttonCreateSchedule.Size = new System.Drawing.Size(120, 40);
  167. this.buttonCreateSchedule.TabIndex = 7;
  168. this.buttonCreateSchedule.Text = "Create Schedule";
  169. this.buttonCreateSchedule.Click += new System.EventHandler(this.buttonRunOption_Click);
  170. //
  171. // groupBox1
  172. //
  173. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  174. | System.Windows.Forms.AnchorStyles.Left)
  175. | System.Windows.Forms.AnchorStyles.Right)));
  176. this.groupBox1.Location = new System.Drawing.Point(16, 160);
  177. this.groupBox1.Name = "groupBox1";
  178. this.groupBox1.Size = new System.Drawing.Size(600, 248);
  179. this.groupBox1.TabIndex = 10;
  180. this.groupBox1.TabStop = false;
  181. this.groupBox1.Text = "Results Display Window";
  182. //
  183. // reportSearchPathTB
  184. //
  185. this.reportSearchPathTB.BackColor = System.Drawing.SystemColors.Control;
  186. this.reportSearchPathTB.Location = new System.Drawing.Point(16, 120);
  187. this.reportSearchPathTB.Name = "reportSearchPathTB";
  188. this.reportSearchPathTB.Size = new System.Drawing.Size(600, 20);
  189. this.reportSearchPathTB.TabIndex = 11;
  190. //
  191. // ScheduleDlg
  192. //
  193. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  194. this.ClientSize = new System.Drawing.Size(632, 425);
  195. this.Controls.Add(this.reportSearchPathTB);
  196. this.Controls.Add(this.serverUrlTB);
  197. this.Controls.Add(this.buttonCreateSchedule);
  198. this.Controls.Add(this.resultsDisplayWindowRTB);
  199. this.Controls.Add(this.reportListCB);
  200. this.Controls.Add(this.reportListLBL);
  201. this.Controls.Add(this.ServerUrlLBL);
  202. this.Controls.Add(this.groupBox1);
  203. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  204. this.Menu = this.mainMenu1;
  205. this.Name = "ScheduleDlg";
  206. this.Text = "ScheduleDlg";
  207. this.Load += new System.EventHandler(this.ScheduleDlg_Load);
  208. this.ResumeLayout(false);
  209. this.PerformLayout();
  210. }
  211. #endregion
  212. private void menuItemExit_Click(object sender, System.EventArgs e)
  213. {
  214. this.Close();
  215. }
  216. private void menuItemAbout_Click(object sender, System.EventArgs e)
  217. {
  218. SamplesAbout about = new SamplesAbout();
  219. about.applicationName = "Schedule";
  220. about.applicationVersion = "1.1";
  221. about.Show();
  222. }
  223. private void buttonRunOption_Click(object sender, System.EventArgs e)
  224. {
  225. try
  226. {
  227. string resultMessage = "";
  228. BaseClassWrapper selectedObject = null;
  229. selectedObject = (BaseClassWrapper)reportListCB.SelectedItem;
  230. if (selectedObject == null)
  231. {
  232. MessageBox.Show("Please select a valid entry.");
  233. return;
  234. }
  235. Schedule scheduleObj = new Schedule();
  236. scheduleObj.createSchedule(cBIConnection, selectedObject, ref resultMessage);
  237. displayMessage(resultMessage);
  238. }
  239. catch(SoapException ex)
  240. {
  241. displayMessage("...the operation failed.\nThe following information was returned:\n\n" +
  242. SamplesException.getExceptionMessage( ex));
  243. return;
  244. }
  245. catch(System.Exception ex)
  246. {
  247. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  248. {
  249. SamplesException.ShowExceptionMessage( ex.Message, true, "Schedule Sample" );
  250. displayMessage("\n...the operation failed.\nThe page could not be displayed.");
  251. }
  252. return;
  253. }
  254. }
  255. public void setReportList(BaseClassWrapper[] reportAndQueryList)
  256. {
  257. reportListCB.Items.AddRange(reportAndQueryList);
  258. }
  259. public void setSelectedReportIndex(int value)
  260. {
  261. reportListCB.SelectedIndex = value;
  262. }
  263. public void setConnection(SamplesConnect connection, string cBIUrl)
  264. {
  265. cBIConnection = connection;
  266. serverUrlTB.Text = cBIUrl;
  267. }
  268. public void displayMessage(string message)
  269. {
  270. resultsDisplayWindowRTB.AppendText(message + "\n");
  271. }
  272. public void clearResultsWindow()
  273. {
  274. resultsDisplayWindowRTB.Clear();
  275. }
  276. private void reportListCB_SelectedIndexChanged(object sender, System.EventArgs e)
  277. {
  278. BaseClassWrapper selectedObject = (BaseClassWrapper)reportListCB.SelectedItem;
  279. if (selectedObject == null)
  280. {
  281. return;
  282. }
  283. reportSearchPathTB.Text = selectedObject.baseclassobject.searchPath.value;
  284. }
  285. private void ScheduleDlg_Load(object sender, System.EventArgs e)
  286. {
  287. }
  288. }
  289. }