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.

254 lines
7.3 KiB

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. namespace OCAWReports
  13. {
  14. /// <summary>
  15. /// Summary description for automanual.
  16. /// </summary>
  17. public class automanual : System.Web.UI.Page
  18. {
  19. protected System.Web.UI.WebControls.Table tblAutoManual;
  20. protected System.Web.UI.WebControls.Image imgAutoManualDaily;
  21. protected System.Web.UI.WebControls.Image imgAutoManualTotal;
  22. /*************************************************************************************
  23. * module: automanual.aspx.cs - Page_Load
  24. *
  25. * author: Tim Ragain
  26. * date: Jan 22, 2002
  27. *
  28. * Purpose: to Create both gif charts from the Office Watson Controls and set the images to those
  29. * files. Create OCAData object and return data for anonymous versus customer uploads. Set the information
  30. * in the tables to correspond to the graphs.
  31. *************************************************************************************/
  32. private void Page_Load(object sender, System.EventArgs e)
  33. {
  34. int x = -1;
  35. int y = 0;
  36. int rowCnt = 7;
  37. int rowCtr = 0;
  38. int cellCtr = 0;
  39. int cellCnt = 3;
  40. string sFName;
  41. long[] LACustomer = new long[7];
  42. long[] LAAnon = new long[7];
  43. long[] LANulls = new long[7];
  44. long lTemp = 0,lTotalAnon = 0,lTotalCustomer = 0;
  45. Object[] yColTitle = new Object[7];
  46. Object[] xAutoManValues = new Object[7];
  47. Object[] yColTitle2 = new Object[3];
  48. Object[] xAutoManValues2 = new Object[3];
  49. OCAData.CCountDailyClass rpt = new OCAData.CCountDailyClass();
  50. System.DateTime dDate = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month,
  51. System.DateTime.Now.Day);
  52. OWC.WCChart oWeeklyChart, oAvgChart;
  53. OWC.ChartSpaceClass oSpace = new OWC.ChartSpaceClass();
  54. OWC.ChartSpaceClass oSpace1 = new OWC.ChartSpaceClass();
  55. OWC.WCSeries oSeries, oSeries1;
  56. OWC.WCDataLabels oLabels;
  57. OWC.WCDataLabelsCollection oLabelCollection;
  58. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TKWUCDSQLA02");
  59. SqlCommand cm = new SqlCommand();
  60. SqlDataReader dr;
  61. oSpace.Clear();
  62. oSpace.Refresh();
  63. oWeeklyChart = oSpace.Charts.Add(0);
  64. oWeeklyChart.Type = OWC.ChartChartTypeEnum.chChartTypeBarClustered;
  65. oWeeklyChart.HasLegend = true;
  66. cn.Open();
  67. cm.CommandType = CommandType.StoredProcedure;
  68. cm.CommandTimeout = 240;
  69. cm.CommandText = "GetSnapshot";
  70. cm.Connection = cn;
  71. cm.Parameters.Add("@CreatedDate", System.Data.SqlDbType.DateTime);
  72. cm.Parameters["@CreatedDate"].Value = dDate.AddDays(-1);
  73. dr = cm.ExecuteReader();
  74. for(x = 0; x < 7; x++)
  75. {
  76. try
  77. {
  78. dr.Read();
  79. lTotalCustomer = dr.GetInt32(3);
  80. // LAAnon[x] = lTotalCustomer;
  81. lTemp = dr.GetInt32(4);
  82. LAAnon[x] = lTemp;
  83. lTemp = lTotalCustomer - lTemp;
  84. LACustomer[x] = lTemp;
  85. lTotalCustomer = lTotalCustomer + LACustomer[x];
  86. lTotalAnon = lTotalAnon + lTemp;
  87. }
  88. catch
  89. {
  90. LAAnon[x] = 0;
  91. lTemp = 0;
  92. LACustomer[x] = 0;
  93. }
  94. }
  95. //Begin Image One
  96. for(x=0, y=6;x<7;x++,y--)
  97. {
  98. oSeries = oWeeklyChart.SeriesCollection.Add(x);
  99. xAutoManValues.SetValue(LACustomer[x].ToString(), 0);
  100. xAutoManValues.SetValue(LAAnon[x].ToString(), 1);
  101. yColTitle.SetValue("Auto", 0);
  102. yColTitle.SetValue("Manual", 1);
  103. oWeeklyChart.HasTitle = true;
  104. oWeeklyChart.Title.Caption = "Database - Manual vs Auto Uploads";
  105. oSeries.Caption = dDate.AddDays(-y).Date.ToString(); //chDimCategories
  106. oSeries.SetData(OWC.ChartDimensionsEnum.chDimCategories, -1, yColTitle);
  107. oSeries.SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xAutoManValues);
  108. oSeries.Type = OWC.ChartChartTypeEnum.chChartTypeColumnClustered;
  109. }
  110. sFName = "Anon";
  111. try
  112. {
  113. oSpace.ExportPicture(Server.MapPath(sFName), "gif", 707, 476);
  114. imgAutoManualDaily.ImageUrl = sFName;
  115. }
  116. catch
  117. {
  118. }
  119. //End Image one
  120. //Begin Image Two
  121. oSpace1.Clear();
  122. oSpace1.Refresh();
  123. oAvgChart = oSpace1.Charts.Add(0);
  124. oAvgChart.Type = OWC.ChartChartTypeEnum.chChartTypeBarClustered;
  125. oAvgChart.HasLegend = true;
  126. lTemp = lTotalCustomer + lTotalAnon;
  127. oSeries1 = oAvgChart.SeriesCollection.Add(0);
  128. oLabelCollection = oSeries1.DataLabelsCollection;
  129. oLabels = oLabelCollection.Add();
  130. oLabels.HasPercentage = true;
  131. oLabels.HasValue = false;
  132. xAutoManValues2.SetValue(lTotalAnon.ToString(), 0);
  133. xAutoManValues2.SetValue(lTotalCustomer.ToString(), 1);
  134. yColTitle2.SetValue("Manual", 0);
  135. yColTitle2.SetValue("Auto", 1);
  136. oAvgChart.HasTitle = true;
  137. oAvgChart.Title.Caption = "Database - Average Weekly Uploads";
  138. oSeries1.Caption = "Average Weekly"; //chDimCategories
  139. oSeries1.SetData(OWC.ChartDimensionsEnum.chDimCategories, -1, yColTitle2);
  140. oSeries1.SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xAutoManValues2);
  141. oSeries1.Type = OWC.ChartChartTypeEnum.chChartTypePie;
  142. sFName = "AnonPer";
  143. try
  144. {
  145. oSpace1.ExportPicture(Server.MapPath(sFName), "gif", 707, 476);
  146. imgAutoManualTotal.ImageUrl = sFName;
  147. }
  148. catch
  149. {
  150. }
  151. //End Image Two
  152. //Begin Table
  153. for(rowCtr=0, y=8; rowCtr <= rowCnt; rowCtr++, y--)
  154. {
  155. TableRow tRow = new TableRow();
  156. tblAutoManual.Rows.Add(tRow);
  157. //tRow.CssClass = "clsTRMenu";
  158. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  159. {
  160. TableCell tCell = new TableCell();
  161. if(rowCtr == 0)
  162. {
  163. switch(cellCtr)
  164. {
  165. case 1 :
  166. tCell.Text = "Date";
  167. break;
  168. case 2 :
  169. tCell.Text = "Auto";
  170. break;
  171. case 3 :
  172. tCell.Text = "Manual";
  173. break;
  174. default:
  175. tCell.Text = "0";
  176. break;
  177. }
  178. tCell.Style["font-size"] = "small";
  179. }
  180. else
  181. {
  182. switch(cellCtr)
  183. {
  184. case 1 :
  185. tCell.Text = dDate.AddDays(-y).ToShortDateString();
  186. break;
  187. case 2 :
  188. tCell.Text = LACustomer[rowCtr-1].ToString();
  189. break;
  190. case 3 :
  191. tCell.Text = LAAnon[rowCtr-1].ToString();
  192. break;
  193. default:
  194. tCell.Text = "0";
  195. break;
  196. }
  197. tCell.Style["background-color"] = "white";
  198. tCell.Style["font-size"] = "small-x";
  199. tCell.Style["color"] = "#6487dc";
  200. tCell.Style["font-weight"] = "Bold";
  201. }
  202. tCell.Style["font-family"] = "Tahoma";
  203. tRow.Cells.Add(tCell);
  204. }
  205. }
  206. //End Table
  207. }
  208. #region Web Form Designer generated code
  209. override protected void OnInit(EventArgs e)
  210. {
  211. //
  212. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  213. //
  214. InitializeComponent();
  215. base.OnInit(e);
  216. }
  217. /// <summary>
  218. /// Required method for Designer support - do not modify
  219. /// the contents of this method with the code editor.
  220. /// </summary>
  221. private void InitializeComponent()
  222. {
  223. this.Load += new System.EventHandler(this.Page_Load);
  224. }
  225. #endregion
  226. }
  227. }