SubmitDlg.cs 13 KB

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