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.

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