Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

867 lines
31 KiB

  1. #define FILE_SERVER //FILE_LOCAL FILE_SERVER
  2. using System;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using System.Threading;
  8. using System.IO;
  9. using System.Resources;
  10. using System.Globalization;
  11. using System.Text;
  12. using System.Runtime.InteropServices;
  13. using Microsoft.Win32;
  14. using System.Security.Permissions;
  15. namespace OCAReports
  16. {
  17. /// <summary>
  18. /// Summary description for frmWeekly.
  19. /// </summary>
  20. public class frmWeekly : System.Windows.Forms.Form
  21. {
  22. private System.Windows.Forms.StatusBar statusBar1;
  23. private System.Windows.Forms.MonthCalendar monthCalendar1;
  24. private System.Windows.Forms.TabControl tabControl1;
  25. private System.Windows.Forms.TabPage tabPage1;
  26. private System.Windows.Forms.TabPage tabPage2;
  27. private System.Windows.Forms.TabPage tabPage3;
  28. private AxMSChart20Lib.AxMSChart axMSChart1;
  29. private System.Windows.Forms.Label lblNotes100;
  30. private System.Windows.Forms.Label label7;
  31. private System.Windows.Forms.Label label5;
  32. private System.Windows.Forms.Label label6;
  33. private System.Windows.Forms.Label label4;
  34. private System.Windows.Forms.Label label3;
  35. private System.Windows.Forms.Label lblPurpose;
  36. private System.Windows.Forms.Label lblStatement;
  37. private System.ComponentModel.Container components = null;
  38. private System.Windows.Forms.ProgressBar progressBar1;
  39. /// <summary>
  40. /// Required designer variable.
  41. /// </summary>
  42. #region ########################Global Variables######################################
  43. /*************************************************************************************
  44. * module: frmAnonCust.cs - Global varibles and objects
  45. *
  46. * author: Tim Ragain
  47. * date: Jan 22, 2002
  48. *
  49. * Purpose: All global threads and variables are declared.
  50. *
  51. *************************************************************************************/
  52. public long[] lCount = new long[7];
  53. public long[] lWatson = new long[7];
  54. public long[] lArchive = new long[7];
  55. public DateTime[] lDate = new DateTime[7];
  56. Thread t_DayOne;
  57. Thread t_DayTwo;
  58. Thread t_DayThree;
  59. Thread t_DayFour;
  60. Thread t_DayFive;
  61. Thread t_DaySix;
  62. Thread t_DaySeven;
  63. const string sPurpose = "Purpose";
  64. private System.Windows.Forms.PictureBox pictureBox1;
  65. const string sPurposeDetails = "The purpose of the following report is to gauge the overall condition and status of " +
  66. "the Windows Online Crash Analysis Web site. Through the use of SQL queries and file counts it should be possible " +
  67. "to generate a high level understanding of Web site traffic, type of submissions and solution status";
  68. private bool bIsStillProcessing = false;
  69. private bool bHasProcessed = false;
  70. #endregion
  71. public frmWeekly()
  72. {
  73. //
  74. // Required for Windows Form Designer support
  75. //
  76. InitializeComponent();
  77. //
  78. // TODO: Add any constructor code after InitializeComponent call
  79. //
  80. }
  81. /// <summary>
  82. /// Clean up any resources being used.
  83. /// </summary>
  84. protected override void Dispose( bool disposing )
  85. {
  86. if( disposing )
  87. {
  88. if(components != null)
  89. {
  90. components.Dispose();
  91. }
  92. }
  93. base.Dispose( disposing );
  94. }
  95. #region Windows Form Designer generated code
  96. /// <summary>
  97. /// Required method for Designer support - do not modify
  98. /// the contents of this method with the code editor.
  99. /// </summary>
  100. private void InitializeComponent()
  101. {
  102. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmWeekly));
  103. this.statusBar1 = new System.Windows.Forms.StatusBar();
  104. this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
  105. this.tabControl1 = new System.Windows.Forms.TabControl();
  106. this.tabPage1 = new System.Windows.Forms.TabPage();
  107. this.axMSChart1 = new AxMSChart20Lib.AxMSChart();
  108. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  109. this.tabPage2 = new System.Windows.Forms.TabPage();
  110. this.tabPage3 = new System.Windows.Forms.TabPage();
  111. this.label5 = new System.Windows.Forms.Label();
  112. this.label6 = new System.Windows.Forms.Label();
  113. this.label4 = new System.Windows.Forms.Label();
  114. this.label3 = new System.Windows.Forms.Label();
  115. this.label7 = new System.Windows.Forms.Label();
  116. this.lblNotes100 = new System.Windows.Forms.Label();
  117. this.progressBar1 = new System.Windows.Forms.ProgressBar();
  118. this.lblPurpose = new System.Windows.Forms.Label();
  119. this.lblStatement = new System.Windows.Forms.Label();
  120. this.tabControl1.SuspendLayout();
  121. this.tabPage1.SuspendLayout();
  122. ((System.ComponentModel.ISupportInitialize)(this.axMSChart1)).BeginInit();
  123. this.tabPage3.SuspendLayout();
  124. this.SuspendLayout();
  125. //
  126. // statusBar1
  127. //
  128. this.statusBar1.Location = new System.Drawing.Point(0, 512);
  129. this.statusBar1.Name = "statusBar1";
  130. this.statusBar1.Size = new System.Drawing.Size(968, 22);
  131. this.statusBar1.TabIndex = 68;
  132. //
  133. // monthCalendar1
  134. //
  135. this.monthCalendar1.Location = new System.Drawing.Point(760, 88);
  136. this.monthCalendar1.Name = "monthCalendar1";
  137. this.monthCalendar1.TabIndex = 66;
  138. this.monthCalendar1.DateSelected += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateSelected);
  139. //
  140. // tabControl1
  141. //
  142. this.tabControl1.Controls.AddRange(new System.Windows.Forms.Control[] {
  143. this.tabPage1,
  144. this.tabPage2,
  145. this.tabPage3});
  146. this.tabControl1.Location = new System.Drawing.Point(8, 88);
  147. this.tabControl1.Name = "tabControl1";
  148. this.tabControl1.SelectedIndex = 0;
  149. this.tabControl1.Size = new System.Drawing.Size(736, 400);
  150. this.tabControl1.TabIndex = 78;
  151. //
  152. // tabPage1
  153. //
  154. this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] {
  155. this.axMSChart1,
  156. this.pictureBox1});
  157. this.tabPage1.Location = new System.Drawing.Point(4, 22);
  158. this.tabPage1.Name = "tabPage1";
  159. this.tabPage1.Size = new System.Drawing.Size(728, 374);
  160. this.tabPage1.TabIndex = 0;
  161. this.tabPage1.Text = "Graphical";
  162. //
  163. // axMSChart1
  164. //
  165. this.axMSChart1.ContainingControl = this;
  166. this.axMSChart1.DataSource = null;
  167. this.axMSChart1.Location = new System.Drawing.Point(8, 8);
  168. this.axMSChart1.Name = "axMSChart1";
  169. this.axMSChart1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMSChart1.OcxState")));
  170. this.axMSChart1.Size = new System.Drawing.Size(720, 344);
  171. this.axMSChart1.TabIndex = 71;
  172. //
  173. // pictureBox1
  174. //
  175. this.pictureBox1.Name = "pictureBox1";
  176. this.pictureBox1.Size = new System.Drawing.Size(720, 360);
  177. this.pictureBox1.TabIndex = 72;
  178. this.pictureBox1.TabStop = false;
  179. this.pictureBox1.Visible = false;
  180. //
  181. // tabPage2
  182. //
  183. this.tabPage2.Location = new System.Drawing.Point(4, 22);
  184. this.tabPage2.Name = "tabPage2";
  185. this.tabPage2.Size = new System.Drawing.Size(728, 374);
  186. this.tabPage2.TabIndex = 1;
  187. this.tabPage2.Text = "Statistical";
  188. this.tabPage2.Paint += new System.Windows.Forms.PaintEventHandler(this.tabPage2_Paint);
  189. //
  190. // tabPage3
  191. //
  192. this.tabPage3.Controls.AddRange(new System.Windows.Forms.Control[] {
  193. this.label5,
  194. this.label6,
  195. this.label4,
  196. this.label3,
  197. this.label7,
  198. this.lblNotes100});
  199. this.tabPage3.Location = new System.Drawing.Point(4, 22);
  200. this.tabPage3.Name = "tabPage3";
  201. this.tabPage3.Size = new System.Drawing.Size(728, 374);
  202. this.tabPage3.TabIndex = 2;
  203. this.tabPage3.Text = "Notes";
  204. //
  205. // label5
  206. //
  207. this.label5.Location = new System.Drawing.Point(32, 146);
  208. this.label5.Name = "label5";
  209. this.label5.Size = new System.Drawing.Size(576, 40);
  210. this.label5.TabIndex = 80;
  211. this.label5.Text = "The data contained with the table below describes the files which were uploaded f" +
  212. "or each respective server and the entries made by the Online Crash Analysis Web " +
  213. "Site.";
  214. //
  215. // label6
  216. //
  217. this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  218. this.label6.Location = new System.Drawing.Point(32, 108);
  219. this.label6.Name = "label6";
  220. this.label6.Size = new System.Drawing.Size(240, 24);
  221. this.label6.TabIndex = 79;
  222. this.label6.Text = "Upload File";
  223. //
  224. // label4
  225. //
  226. this.label4.Location = new System.Drawing.Point(32, 54);
  227. this.label4.Name = "label4";
  228. this.label4.Size = new System.Drawing.Size(576, 40);
  229. this.label4.TabIndex = 78;
  230. this.label4.Text = "The data below has been compiled for a one week period and is formatted into sepa" +
  231. "rate tables for readability and general understanding of how the data was graphe" +
  232. "d.";
  233. //
  234. // label3
  235. //
  236. this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  237. this.label3.Location = new System.Drawing.Point(32, 16);
  238. this.label3.Name = "label3";
  239. this.label3.Size = new System.Drawing.Size(240, 24);
  240. this.label3.TabIndex = 77;
  241. this.label3.Text = "Site Data";
  242. //
  243. // label7
  244. //
  245. this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  246. this.label7.Location = new System.Drawing.Point(32, 200);
  247. this.label7.Name = "label7";
  248. this.label7.Size = new System.Drawing.Size(240, 24);
  249. this.label7.TabIndex = 76;
  250. this.label7.Text = "Notes";
  251. //
  252. // lblNotes100
  253. //
  254. this.lblNotes100.Location = new System.Drawing.Point(32, 238);
  255. this.lblNotes100.Name = "lblNotes100";
  256. this.lblNotes100.Size = new System.Drawing.Size(576, 98);
  257. this.lblNotes100.TabIndex = 0;
  258. this.lblNotes100.Text = @"Under optimal conditions, the baseline should be the number of files uploaded to the Office Watson server*. This value corresponds to the number of customers that encounter a Stop error and choose to submit the file to Microsoft for analysis. Once the user clicks the Close button on the Error reporting dialog, Internet Explorer is launched and the Auto.asp Web page is displayed. At this time, the Web page connects to the Office Watson server and copies the file locally. At the same time, an entry is made in the KACustomer2 database, which corresponds to the SQL entry. This file is then submitted to the Online Crash Analysis central FileMover for processing and archival. At the time of archival, the file is moved to our Archive server and moved to a directory corresponding the data that the file was moved.";
  259. //
  260. // progressBar1
  261. //
  262. this.progressBar1.Location = new System.Drawing.Point(560, 504);
  263. this.progressBar1.Name = "progressBar1";
  264. this.progressBar1.Size = new System.Drawing.Size(384, 23);
  265. this.progressBar1.TabIndex = 69;
  266. this.progressBar1.Visible = false;
  267. //
  268. // lblPurpose
  269. //
  270. this.lblPurpose.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  271. this.lblPurpose.Location = new System.Drawing.Point(8, 8);
  272. this.lblPurpose.Name = "lblPurpose";
  273. this.lblPurpose.Size = new System.Drawing.Size(112, 24);
  274. this.lblPurpose.TabIndex = 72;
  275. this.lblPurpose.Text = "Purpose";
  276. //
  277. // lblStatement
  278. //
  279. this.lblStatement.Location = new System.Drawing.Point(8, 38);
  280. this.lblStatement.Name = "lblStatement";
  281. this.lblStatement.Size = new System.Drawing.Size(744, 40);
  282. this.lblStatement.TabIndex = 71;
  283. this.lblStatement.Text = @"The purpose of the following report is to gauge the overall condition and status of the Windows Online Crash Analysis Web site. Through the use of SQL queries and file counts it should be possible to generate a high level understanding of Web site traffic, type of submissions and solution status";
  284. //
  285. // frmWeekly
  286. //
  287. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  288. this.ClientSize = new System.Drawing.Size(968, 534);
  289. this.Controls.AddRange(new System.Windows.Forms.Control[] {
  290. this.progressBar1,
  291. this.tabControl1,
  292. this.lblPurpose,
  293. this.lblStatement,
  294. this.statusBar1,
  295. this.monthCalendar1});
  296. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  297. this.Name = "frmWeekly";
  298. this.Text = "Executive Summary Weekly Report";
  299. this.Resize += new System.EventHandler(this.frmWeekly_Resize);
  300. this.Closing += new System.ComponentModel.CancelEventHandler(this.frmWeekly_Closing);
  301. this.Load += new System.EventHandler(this.frmWeekly_Load);
  302. this.tabControl1.ResumeLayout(false);
  303. this.tabPage1.ResumeLayout(false);
  304. ((System.ComponentModel.ISupportInitialize)(this.axMSChart1)).EndInit();
  305. this.tabPage3.ResumeLayout(false);
  306. this.ResumeLayout(false);
  307. }
  308. #endregion
  309. /*************************************************************************************
  310. * module: frmWeekly.cs - frmWeekly_Load
  311. *
  312. * author: Tim Ragain
  313. * date: Jan 22, 2002
  314. *
  315. * Purpose: Initialize the calendar control to display one week. Each day is represented
  316. * by a global thread. Set the form title bar to the appropriate start and end days.
  317. *************************************************************************************/
  318. private void frmWeekly_Load(object sender, System.EventArgs e)
  319. {
  320. DateTime dDate = DateTime.Today;
  321. short x = 0, y = 0;
  322. for(x=7, y=1;x>=1;x--, y++)
  323. {
  324. axMSChart1.Row = y;
  325. axMSChart1.RowLabel = dDate.AddDays(-(x)).ToShortDateString(); //+ dDate.Date.ToString();
  326. }
  327. monthCalendar1.SelectionStart = dDate.AddDays(-7);
  328. monthCalendar1.SelectionEnd = dDate.AddDays(-1);
  329. this.Show();
  330. this.Refresh();
  331. axMSChart1.RowCount = 7;
  332. this.ParentForm.Refresh();
  333. this.Text = "Executive Summary Weekly Report " + monthCalendar1.SelectionStart.ToShortDateString() + " - " +
  334. monthCalendar1.SelectionEnd.ToShortDateString();
  335. }
  336. /*************************************************************************************
  337. * module: frmWeekly.cs - GetData
  338. *
  339. * author: Tim Ragain
  340. * date: Jan 22, 2002
  341. *
  342. * Purpose: Initializes the threads. Appropriately sets the legend of the calendar control,
  343. * initializes the progress bar, disables the cmdGetData button. Initializes each
  344. * column on the calendar to the appropriated days. New ThreadStart delegate is created
  345. * and each delegate is set to the appropriate day from the end date. All threads are then
  346. * started.
  347. *************************************************************************************/
  348. public void GetData()
  349. {
  350. System.DateTime dDate = new System.DateTime(monthCalendar1.SelectionStart.Year, monthCalendar1.SelectionStart.Month,
  351. monthCalendar1.SelectionStart.Day);
  352. RegistryKey regArchive = Registry.CurrentUser.OpenSubKey("software").OpenSubKey("microsoft", true).CreateSubKey("OCATools").CreateSubKey("OCAReports").CreateSubKey("Archive");
  353. RegistryKey regWatson = Registry.CurrentUser.OpenSubKey("software").OpenSubKey("microsoft", true).CreateSubKey("OCATools").CreateSubKey("OCAReports").CreateSubKey("Watson");
  354. bIsStillProcessing = true;
  355. try
  356. {
  357. if(regArchive.GetValue("Loc0").ToString().Length == 0)
  358. {
  359. frmLocation fLoc = new frmLocation();
  360. fLoc.ShowDialog(this);
  361. }
  362. }
  363. catch
  364. {
  365. frmLocation fLoc = new frmLocation();
  366. fLoc.ShowDialog(this);
  367. }
  368. try
  369. {
  370. if(regWatson.GetValue("Loc0").ToString().Length == 0)
  371. {
  372. frmLocation fLoc = new frmLocation();
  373. fLoc.ShowDialog(this);
  374. }
  375. }
  376. catch
  377. {
  378. frmLocation fLoc = new frmLocation();
  379. fLoc.ShowDialog(this);
  380. }
  381. // cmdGetData.Enabled = false;
  382. progressBar1.Visible = true;
  383. progressBar1.Minimum = 0;
  384. progressBar1.Maximum = 22;
  385. progressBar1.Value = 0;
  386. progressBar1.Visible = true;
  387. progressBar1.Refresh();
  388. axMSChart1.ShowLegend = true;
  389. axMSChart1.Plot.SeriesCollection[1].LegendText = "Database";
  390. axMSChart1.Plot.SeriesCollection[2].LegendText = "Watson";
  391. axMSChart1.Plot.SeriesCollection[3].LegendText = "Archive";
  392. ThreadStart s_DayOne = new ThreadStart(this.TDayOne);
  393. t_DayOne = new Thread(s_DayOne);
  394. t_DayOne.Name = "Thread One";
  395. ThreadStart s_DayTwo = new ThreadStart(this.TDayTwo);
  396. t_DayTwo = new Thread(s_DayTwo);
  397. t_DayTwo.Name = "Thread Two";
  398. ThreadStart s_DayThree = new ThreadStart(this.TDayThree);
  399. t_DayThree = new Thread(s_DayThree);
  400. t_DayThree.Name = "Thread Three";
  401. ThreadStart s_DayFour = new ThreadStart(this.TDayFour);
  402. t_DayFour = new Thread(s_DayFour);
  403. t_DayFour.Name = "Thread Four";
  404. ThreadStart s_DayFive = new ThreadStart(this.TDayFive);
  405. t_DayFive = new Thread(s_DayFive);
  406. t_DayFive.Name = "Thread Five";
  407. ThreadStart s_DaySix = new ThreadStart(this.TDaySix);
  408. t_DaySix = new Thread(s_DaySix);
  409. t_DaySix.Name = "Thread Six";
  410. ThreadStart s_DaySeven = new ThreadStart(this.TDaySeven);
  411. t_DaySeven = new Thread(s_DaySeven);
  412. t_DaySeven.Name = "Thread Seven";
  413. //WaitForSingleObject(tSeven, -1);
  414. t_DayOne.Start();
  415. t_DayTwo.Start();
  416. t_DayThree.Start();
  417. t_DayFour.Start();
  418. t_DayFive.Start();
  419. t_DaySix.Start();
  420. t_DaySeven.Start();
  421. statusBar1.Text = "Done";
  422. }
  423. /*************************************************************************************
  424. * module: frmWeekly.cs - All procedures
  425. *
  426. * author: Tim Ragain
  427. * date: Jan 22, 2002
  428. *
  429. * Purpose: calls TLoadData and sends the appropriate day and count information.
  430. *
  431. *************************************************************************************/
  432. private void TDayOne()
  433. {
  434. this.TLoadData(0, 1);
  435. }
  436. private void TDayTwo()
  437. {
  438. this.TLoadData(1, 2);
  439. }
  440. private void TDayThree()
  441. {
  442. this.TLoadData(2, 3);
  443. }
  444. private void TDayFour()
  445. {
  446. this.TLoadData(3, 4);
  447. }
  448. private void TDayFive()
  449. {
  450. this.TLoadData(4, 5);
  451. }
  452. private void TDaySix()
  453. {
  454. this.TLoadData(5, 6);
  455. }
  456. private void TDaySeven()
  457. {
  458. this.TLoadData(6, 7);
  459. }
  460. /*************************************************************************************
  461. * module: frmWeekly.cs - TLoadData
  462. *
  463. * author: Tim Ragain
  464. * date: Jan 22, 2002
  465. *
  466. * Purpose: Takes two variables the x represents the day as an integer and the sCount is a
  467. * short representing the column of the Calendar control. This initializes the OCAData.dll
  468. * control and calls the GetDailyCount and GetDailyAnon procedures. The anonymous count is
  469. * subtracted from the total count to get the customer count. The appropriate column
  470. * and row is updated.
  471. *************************************************************************************/
  472. private void TLoadData(int x, short sCount)
  473. {
  474. OCAData.CCountDailyClass rpt = new OCAData.CCountDailyClass();
  475. string strArchive, strWatson;
  476. int y = 0;
  477. RegistryKey regArchive = Registry.CurrentUser.OpenSubKey("software").OpenSubKey("microsoft", true).CreateSubKey("OCATools").CreateSubKey("OCAReports").CreateSubKey("Archive");
  478. RegistryKey regWatson = Registry.CurrentUser.OpenSubKey("software").OpenSubKey("microsoft", true).CreateSubKey("OCATools").CreateSubKey("OCAReports").CreateSubKey("Watson");
  479. System.DateTime dDate = new System.DateTime(monthCalendar1.SelectionStart.Year, monthCalendar1.SelectionStart.Month,
  480. monthCalendar1.SelectionStart.Day);
  481. long lngCount = 0, l_WatsonCount = 0, l_ArchiveCount = 0;
  482. statusBar1.Text = "Getting Daily Count for " + dDate.AddDays(x).Date.ToShortDateString() + " from database";
  483. lDate[x] = dDate.AddDays(x).Date;
  484. try
  485. {
  486. lngCount = rpt.GetDailyCount(dDate.AddDays(x));
  487. }
  488. catch
  489. {
  490. // MessageBox.Show("Error: " + e.Message.ToString(), iLast.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  491. }
  492. lock(this)
  493. {
  494. lCount[x] = lngCount;
  495. axMSChart1.Column = 1;
  496. axMSChart1.Row = sCount;
  497. axMSChart1.RowLabel = dDate.AddDays(x).ToShortDateString();
  498. axMSChart1.Data = lngCount.ToString();
  499. }
  500. UpdateStatus();
  501. statusBar1.Text = "Getting Daily Count for " + dDate.AddDays(x).Date.ToString() + " from Watson Server";
  502. #if(FILE_SERVER)
  503. for(y = 0;y < 10; y++)
  504. {
  505. if(regWatson.GetValue("Loc" + y.ToString()).ToString().Length > 0)
  506. {
  507. strWatson = regWatson.GetValue("Loc" + y.ToString()).ToString();
  508. l_WatsonCount = rpt.GetFileCount(OCAData.ServerLocation.Watson, strWatson, dDate.AddDays(x));
  509. if(l_WatsonCount > 0)
  510. {
  511. y = 10;
  512. }
  513. }
  514. else
  515. {
  516. l_WatsonCount = 0;
  517. }
  518. }
  519. //l_WatsonCount = rpt.GetFileCount(OCAData.ServerLocation.Watson, "Z:\\", dDate.AddDays(x));
  520. #elif(FILE_LOCAL)
  521. l_WatsonCount = rpt.GetFileCount(OCAData.ServerLocation.Watson, "C:\\MiniDumps\\Watson\\", dDate.AddDays(x));
  522. #endif
  523. lock(this)
  524. {
  525. lWatson[x] = l_WatsonCount;
  526. axMSChart1.Column = 2;
  527. axMSChart1.Row = sCount;
  528. axMSChart1.Data = l_WatsonCount.ToString();
  529. }
  530. UpdateStatus();
  531. statusBar1.Text = "Getting Daily Count for " + dDate.AddDays(x).Date.ToString() + " from Archive Server";
  532. #if(FILE_SERVER)
  533. try
  534. {
  535. for(y = 0;y < 10; y++)
  536. {
  537. if(regArchive.GetValue("Loc" + y.ToString()).ToString().Length > 0)
  538. {
  539. strArchive = regArchive.GetValue("Loc" + y.ToString()).ToString();
  540. l_ArchiveCount = rpt.GetFileCount(OCAData.ServerLocation.Archive, strArchive, dDate.AddDays(x));
  541. if(l_ArchiveCount > 0)
  542. {
  543. y = 10;
  544. }
  545. }
  546. else
  547. {
  548. l_ArchiveCount = 0;
  549. }
  550. }
  551. //l_ArchiveCount = rpt.GetFileCount(OCAData.ServerLocation.Archive, "Y:\\", dDate.AddDays(x));
  552. }
  553. catch
  554. {
  555. l_ArchiveCount = 0;
  556. }
  557. #elif(FILE_LOCAL)
  558. l_ArchiveCount = rpt.GetFileCount(OCAData.ServerLocation.Archive, "C:\\MiniDumps\\Archive\\", dDate.AddDays(x));
  559. #endif
  560. // if(l_ArchiveCount == 0)
  561. // {
  562. //#if(FILE_SERVER)
  563. // l_ArchiveCount = rpt.GetFileCount(OCAData.ServerLocation.Archive, "X:\\", dDate.AddDays(x));
  564. //#elif(FILE_LOCAL)
  565. // l_ArchiveCount = rpt.GetFileCount(OCAData.ServerLocation.Archive, "C:\\MiniDumps\\Archive\\", dDate.AddDays(x));
  566. //#endif
  567. // }
  568. lock(this)
  569. {
  570. lArchive[x] = l_ArchiveCount;
  571. axMSChart1.Column = 3;
  572. axMSChart1.Row = sCount;
  573. axMSChart1.Data = l_ArchiveCount.ToString();
  574. }
  575. UpdateStatus();
  576. this.Refresh();
  577. }
  578. /*************************************************************************************
  579. * module: frmWeekly.cs - monthCalendar1_DateSelected
  580. *
  581. * author: Tim Ragain
  582. * date: Jan 22, 2002
  583. *
  584. * Purpose: To set the selection dates for one week after the user selects an ending
  585. * date. Also resets the title bar of the form for the new dates.
  586. *************************************************************************************/
  587. private void monthCalendar1_DateSelected(object sender, System.Windows.Forms.DateRangeEventArgs e)
  588. {
  589. System.DateTime dDate = new System.DateTime(monthCalendar1.SelectionStart.Year, monthCalendar1.SelectionStart.Month,
  590. monthCalendar1.SelectionStart.Day);
  591. monthCalendar1.SelectionStart = dDate.AddDays(-6);
  592. monthCalendar1.SelectionEnd = dDate.Date;
  593. this.Text = "Executive Summary Weekly Report " + monthCalendar1.SelectionStart.ToShortDateString() + " - " +
  594. monthCalendar1.SelectionEnd.ToShortDateString();
  595. tabPage2.Refresh();
  596. }
  597. /*************************************************************************************
  598. * module: frmWeekly.cs - tabPage2_Paint
  599. *
  600. * author: Tim Ragain
  601. * date: Jan 22, 2002
  602. *
  603. * Purpose: Paints the grid for the tab2 control. The global variables lAnonymous[x] and
  604. * lCustomer[x] are used to display the appropriate information to the grid.
  605. *************************************************************************************/
  606. private void tabPage2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  607. {
  608. Pen curvePen = new Pen(Color.Blue);
  609. Pen dbPen = new Pen(Color.DarkBlue);
  610. Pen whPen = new Pen(Color.White);
  611. float row = .05F;
  612. int x = 0, y = 0, min = 3, max = 12, pad = 10, top = 5, cols=4;
  613. int colwidth = 0;
  614. PointF pt = new PointF(0, 0);
  615. Font ft = new Font("Verdona", 12);
  616. SolidBrush sb = new SolidBrush(Color.Black);
  617. StringBuilder strTemp = new StringBuilder(40);
  618. System.DateTime dDate = new System.DateTime(monthCalendar1.SelectionEnd.Year, monthCalendar1.SelectionEnd.Month,
  619. monthCalendar1.SelectionEnd.Day);
  620. colwidth = tabPage2.Width / cols;
  621. for(x=min;x<max;x++)
  622. {
  623. if(x > (min - 1) && x < top)
  624. {
  625. e.Graphics.DrawLine(dbPen, pad, tabPage2.Height * (row * x),
  626. tabPage2.Width - pad, tabPage2.Height * (row * x));
  627. }
  628. else
  629. {
  630. e.Graphics.DrawLine(curvePen, pad, tabPage2.Height * (row * x),
  631. tabPage2.Width - pad, tabPage2.Height * (row * x));
  632. }
  633. }
  634. //x y x1 y1
  635. for(x=0;x<cols;x++)
  636. {
  637. //left side light blue
  638. e.Graphics.DrawLine(curvePen, pad + (colwidth * x),
  639. tabPage2.Height * (row * (min + 1)),
  640. pad + (colwidth * x), tabPage2.Height * (row * (max - 1)));
  641. //right side light blue
  642. e.Graphics.DrawLine(curvePen, tabPage2.Width - pad,
  643. tabPage2.Height * (row * (min + 1)),
  644. tabPage2.Width - pad, tabPage2.Height * (row * (max - 1)));
  645. //left side upper dark blue
  646. e.Graphics.DrawLine(dbPen, pad + (colwidth * x),
  647. tabPage2.Height * (row * min),
  648. pad + (colwidth * x), tabPage2.Height * (row * (min + 1)));
  649. //right side upper dark blue
  650. e.Graphics.DrawLine(dbPen, tabPage2.Width - pad,
  651. tabPage2.Height * (row * min),
  652. tabPage2.Width - pad, tabPage2.Height * (row * (min + 1)));
  653. }
  654. for(x=0,y=6;x<7;x++,y--)
  655. {
  656. pt.X = pad + (colwidth * x);
  657. pt.Y = tabPage2.Height * (row * min);
  658. strTemp.Remove(0, strTemp.Length);
  659. switch(x)
  660. {
  661. case 0:
  662. strTemp.Append("Date");
  663. break;
  664. case 1:
  665. strTemp.Append("Daily");
  666. break;
  667. case 2:
  668. strTemp.Append("Watson");
  669. break;
  670. case 3:
  671. strTemp.Append("Archive");
  672. break;
  673. default:
  674. strTemp.Append("");
  675. break;
  676. }
  677. e.Graphics.DrawString(strTemp.ToString(), ft, sb, pt, System.Drawing.StringFormat.GenericDefault);
  678. pt.X = pad + (colwidth * 0);
  679. pt.Y = ((tabPage2.Height * row) * (min + (x + 1)));
  680. e.Graphics.DrawString(dDate.AddDays(-y).Date.ToString(), ft, sb, pt, System.Drawing.StringFormat.GenericDefault);
  681. pt.X = pad + (colwidth * 1);
  682. pt.Y = ((tabPage2.Height * row) * (min + (x + 1)));
  683. e.Graphics.DrawString(lCount[x].ToString(), ft, sb, pt, System.Drawing.StringFormat.GenericDefault);
  684. pt.X = pad + (colwidth * 2);
  685. pt.Y = ((tabPage2.Height * row) * (min + (x + 1)));
  686. e.Graphics.DrawString(lWatson[x].ToString(), ft, sb, pt, System.Drawing.StringFormat.GenericDefault);
  687. pt.X = pad + (colwidth * 3);
  688. pt.Y = ((tabPage2.Height * row) * (min + (x + 1)));
  689. e.Graphics.DrawString(lArchive[x].ToString(), ft, sb, pt, System.Drawing.StringFormat.GenericDefault);
  690. }
  691. curvePen.Dispose();
  692. dbPen.Dispose();
  693. whPen.Dispose();
  694. }
  695. /*************************************************************************************
  696. * module: frmWeekly.cs - frmWeekly_Resize
  697. *
  698. * author: Tim Ragain
  699. * date: Jan 22, 2002
  700. *
  701. * Purpose: to set the controls to the proper position and resize after resizing
  702. * the form
  703. *************************************************************************************/
  704. private void frmWeekly_Resize(object sender, System.EventArgs e)
  705. {
  706. int buf = 20;
  707. progressBar1.Top = statusBar1.Top;
  708. progressBar1.Left = this.Width - progressBar1.Width;
  709. monthCalendar1.Left = this.Width - (monthCalendar1.Width + buf);
  710. // cmdGetData.Left = monthCalendar1.Left;
  711. tabControl1.Width = this.Width - (monthCalendar1.Width + (buf * 3));
  712. tabControl1.Height = this.Height - (statusBar1.Height + lblPurpose.Height + lblStatement.Height + (buf * 4));
  713. axMSChart1.Height = tabPage1.Height - buf;
  714. axMSChart1.Width = tabPage1.Width - buf;
  715. }
  716. /*************************************************************************************
  717. * module: frmWeekly.cs - UpdateStatus
  718. *
  719. * author: Tim Ragain
  720. * date: Jan 22, 2002
  721. *
  722. * Purpose: This updates the progress bar and when all threads are returned the
  723. * status bar is updated to done and the cmdGetData button is enabled.
  724. *************************************************************************************/
  725. private void UpdateStatus()
  726. {
  727. progressBar1.Value = progressBar1.Value + 1;
  728. axMSChart1.Refresh();
  729. progressBar1.Refresh();
  730. if(progressBar1.Value >= 21)
  731. {
  732. statusBar1.Text = "Done";
  733. progressBar1.Visible = false;
  734. bIsStillProcessing = false;
  735. bHasProcessed = true;
  736. // cmdGetData.Enabled = true;
  737. }
  738. }
  739. /*************************************************************************************
  740. * module: frmWeekly.cs - frmWeekly_Closing
  741. *
  742. * author: Tim Ragain
  743. * date: Jan 22, 2002
  744. *
  745. * Purpose: If any threads are still alive meaning the user prematurely closes the form
  746. * before all threads are returned then the threads are checked to see if they are still
  747. * running and if so then the thread is aborted.
  748. *************************************************************************************/
  749. private void frmWeekly_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  750. {
  751. if(t_DayOne != null)
  752. {
  753. if(t_DayOne.IsAlive)
  754. {
  755. t_DayOne.Abort();
  756. }
  757. }
  758. if(t_DayTwo != null)
  759. {
  760. if(t_DayTwo.IsAlive)
  761. {
  762. t_DayTwo.Abort();
  763. }
  764. }
  765. if(t_DayThree != null)
  766. {
  767. if(t_DayThree.IsAlive)
  768. {
  769. t_DayThree.Abort();
  770. }
  771. }
  772. if(t_DayFour != null)
  773. {
  774. if(t_DayFour.IsAlive)
  775. {
  776. t_DayFour.Abort();
  777. }
  778. }
  779. if(t_DayFive != null)
  780. {
  781. if(t_DayFive.IsAlive)
  782. {
  783. t_DayFive.Abort();
  784. }
  785. }
  786. if(t_DaySix != null)
  787. {
  788. if(t_DaySix.IsAlive)
  789. {
  790. t_DaySix.Abort();
  791. }
  792. }
  793. if(t_DaySeven != null)
  794. {
  795. if(t_DaySeven.IsAlive)
  796. {
  797. t_DaySeven.Abort();
  798. }
  799. }
  800. }
  801. public bool HasProcessed
  802. {
  803. get
  804. {
  805. return bHasProcessed;
  806. }
  807. }
  808. public bool StillProcessing
  809. {
  810. get
  811. {
  812. return bIsStillProcessing;
  813. }
  814. // set
  815. // {
  816. // if(IsStillProcessing!=value)
  817. // {
  818. // IsStillProcessing = value;
  819. // }
  820. // }
  821. }
  822. }
  823. }