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.

277 lines
6.9 KiB

  1. #define FILE_SERVER //FILE_LOCAL FILE_SERVER
  2. using System;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Web;
  8. using System.Web.SessionState;
  9. using System.Web.UI;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.HtmlControls;
  12. using System.Text;
  13. using System.Data.SqlClient;
  14. using System.Web.Security;
  15. using System.Security.Principal;
  16. using System.Security.Permissions;
  17. namespace OCAWReports
  18. {
  19. /// <summary>
  20. /// Summary description for DailyReport1.
  21. /// </summary>
  22. public class DailyReport1 : System.Web.UI.Page
  23. {
  24. protected System.Web.UI.WebControls.Image imgWeekly;
  25. protected System.Web.UI.WebControls.Table tblDifference;
  26. protected System.Web.UI.WebControls.Table tblUploads;
  27. private void Page_Load(object sender, System.EventArgs e)
  28. {
  29. int rowCnt = 1;
  30. int rowCtr=0;
  31. int cellCtr=0;
  32. int cellCnt = 4;
  33. string sFName;
  34. long lACount;
  35. long LAWatson;
  36. long LAArchive;
  37. long lCount=0;
  38. Object[] yValues = new Object[7];
  39. Object[] xValues = new Object[7];
  40. SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TKWUCDSQLA02");
  41. SqlCommand cm = new SqlCommand();
  42. SqlDataReader dr;
  43. string sPath;
  44. OCAData.CCountDailyClass rpt = new OCAData.CCountDailyClass();
  45. System.DateTime dDate = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month,
  46. System.DateTime.Now.Day);
  47. OWC.WCChart oChart, oChart1;
  48. OWC.ChartSpaceClass oSpace = new OWC.ChartSpaceClass();
  49. OWC.ChartSpaceClass oSpace1 = new OWC.ChartSpaceClass();
  50. OWC.WCSeries oSeries, oSeries1;
  51. cn.Open();
  52. cm.CommandType = CommandType.StoredProcedure;
  53. cm.CommandTimeout = 240;
  54. cm.CommandText = "GetDailySnapshot";
  55. cm.Connection = cn;
  56. cm.Parameters.Add("@CreatedDate", System.Data.SqlDbType.DateTime);
  57. cm.Parameters["@CreatedDate"].Value = dDate.AddDays(-1);
  58. dr = cm.ExecuteReader();
  59. try
  60. {
  61. dr.Read();
  62. LAWatson = dr.GetInt32(0);
  63. LAArchive = dr.GetInt32(1);
  64. }
  65. catch
  66. {
  67. LAWatson = 0;
  68. LAArchive = 0;
  69. }
  70. oSpace.Clear();
  71. oSpace.Refresh();
  72. oChart = oSpace.Charts.Add(0);
  73. oChart.Type = OWC.ChartChartTypeEnum.chChartTypeBarClustered;
  74. oSeries = oChart.SeriesCollection.Add(0);
  75. lACount = rpt.GetDailyCount(dDate.AddDays(-1));
  76. xValues.SetValue(lACount.ToString(), 0);
  77. xValues.SetValue(LAWatson.ToString(), 1);
  78. xValues.SetValue(LAArchive.ToString(), 2);
  79. yValues.SetValue("Database", 0);
  80. yValues.SetValue("Watson", 1);
  81. yValues.SetValue("Archive", 2);
  82. oChart.HasTitle = true;
  83. oChart.Title.Caption = "Database - Server Comparison Chart";
  84. oSeries.Caption = dDate.Date.ToString(); //chDimCategories
  85. oSeries.SetData(OWC.ChartDimensionsEnum.chDimCategories, -1, yValues);
  86. oSeries.SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xValues);
  87. oSeries.Type = OWC.ChartChartTypeEnum.chChartTypeColumnClustered;
  88. sFName = "Daily";
  89. sPath = Server.MapPath(sFName);
  90. try
  91. {
  92. oSpace.ExportPicture(sPath, "gif", 707, 476);
  93. imgWeekly.ImageUrl = sFName;
  94. }
  95. catch
  96. {
  97. }
  98. // Response.Write(Server.MapPath(sFName));
  99. oSpace1.Clear();
  100. oSpace1.Refresh();
  101. oChart1 = oSpace1.Charts.Add(0);
  102. oChart1.Type = OWC.ChartChartTypeEnum.chChartTypeBarClustered;
  103. oSeries1 = oChart1.SeriesCollection.Add(0);
  104. for(rowCtr=0; rowCtr <= rowCnt; rowCtr++)
  105. {
  106. TableRow tRow = new TableRow();
  107. tblUploads.Rows.Add(tRow);
  108. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  109. {
  110. TableCell tCell = new TableCell();
  111. if(rowCtr == 0)
  112. {
  113. switch(cellCtr)
  114. {
  115. case 1 :
  116. tCell.Text = "Date";
  117. break;
  118. case 2 :
  119. tCell.Text = "DB Count";
  120. break;
  121. case 3 :
  122. tCell.Text = "Watson";
  123. break;
  124. case 4 :
  125. tCell.Text = "Archive";
  126. break;
  127. default:
  128. tCell.Text = "0";
  129. break;
  130. }
  131. tCell.Style["font-size"] = "small";
  132. }
  133. else
  134. {
  135. switch(cellCtr)
  136. {
  137. case 1 :
  138. tCell.Text = dDate.AddDays(-1).ToShortDateString();
  139. break;
  140. case 2 :
  141. tCell.Text = lACount.ToString();
  142. break;
  143. case 3 :
  144. tCell.Text = LAWatson.ToString();
  145. break;
  146. case 4 :
  147. tCell.Text = LAArchive.ToString();
  148. break;
  149. default:
  150. tCell.Text = "0";
  151. break;
  152. }
  153. tCell.Style["background-color"] = "white";
  154. tCell.Style["font-size"] = "x-small";
  155. tCell.Style["color"] = "#6487dc";
  156. tCell.Style["font-weight"] = "Bold";
  157. }
  158. tCell.Style["font-family"] = "Tahoma";
  159. tRow.Cells.Add(tCell);
  160. }
  161. }
  162. for(rowCtr=0; rowCtr <= rowCnt; rowCtr++)
  163. {
  164. TableRow tRow = new TableRow();
  165. tblDifference.Rows.Add(tRow);
  166. for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
  167. {
  168. TableCell tCell = new TableCell();
  169. if(rowCtr == 0)
  170. {
  171. switch(cellCtr)
  172. {
  173. case 1 :
  174. tCell.Text = "Date";
  175. break;
  176. case 2 :
  177. tCell.Text = "Archive vs Watson";
  178. break;
  179. case 3 :
  180. tCell.Text = "SQL vs Archive";
  181. break;
  182. case 4 :
  183. tCell.Text = "SQL vs Watson";
  184. break;
  185. default:
  186. tCell.Text = "0";
  187. break;
  188. }
  189. tCell.Style["font-size"] = "small";
  190. }
  191. else
  192. {
  193. switch(cellCtr)
  194. {
  195. case 1 :
  196. tCell.Text = dDate.AddDays(-1).ToShortDateString();
  197. break;
  198. case 2 :
  199. lCount = LAArchive - LAWatson;
  200. tCell.Text = lCount.ToString();
  201. break;
  202. case 3 :
  203. lCount = lACount - LAArchive;
  204. tCell.Text = lCount.ToString();;
  205. break;
  206. case 4 :
  207. lCount = lACount - LAWatson;
  208. tCell.Text = lCount.ToString();
  209. break;
  210. default:
  211. tCell.Text = "0";
  212. break;
  213. }
  214. tCell.Style["background-color"] = "white";
  215. tCell.Style["font-size"] = "x-small";
  216. tCell.Style["color"] = "#6487dc";
  217. tCell.Style["font-weight"] = "Bold";
  218. }
  219. tCell.Style["font-family"] = "Tahoma";
  220. tRow.Cells.Add(tCell);
  221. }
  222. }
  223. }
  224. #region Web Form Designer generated code
  225. override protected void OnInit(EventArgs e)
  226. {
  227. //
  228. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  229. //
  230. InitializeComponent();
  231. base.OnInit(e);
  232. }
  233. /// <summary>
  234. /// Required method for Designer support - do not modify
  235. /// the contents of this method with the code editor.
  236. /// </summary>
  237. private void InitializeComponent()
  238. {
  239. this.Load += new System.EventHandler(this.Page_Load);
  240. }
  241. #endregion
  242. }
  243. }