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.

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