Browser.proc.TrendCount.Page_Load C# (CSharp) Метод

Page_Load() защищенный Метод

protected Page_Load ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int callstack_uid;
            short fromDate = 60;
            short toDate = 0;

            if (int.TryParse(Request.QueryString["callstack_uid"], out callstack_uid) == false)
                callstack_uid = 1;

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Counts");

                TrendCountList trendCount = new TrendCountList();

                DB.LoadTrendCount(callstack_uid, fromDate, toDate,
                    delegate(string version, string date, int count)
                    {
                        //dailyCountList[date] = count;

                        DailyCountList dcl;
                        if (trendCount.TryGetValue(version, out dcl) == false)
                        {
                            trendCount[version] = new DailyCountList();
                            for (int i = fromDate; i >= toDate; i--)
                            {
                                TimeSpan days = new TimeSpan(i, 0, 0, 0);
                                DateTime saveDate = DateTime.Now.Subtract(days);

                                string simulated_date = string.Format("{0:0000}-{1:00}-{2:00}", saveDate.Year, saveDate.Month, saveDate.Day);

                                trendCount[version][simulated_date] = 0;
                            }
                        }

                        trendCount[version][date] = count;
                    }
                );

                foreach (KeyValuePair<string, DailyCountList> trend in trendCount)
                {
                    writer.WriteStartElement("Version");
                    writer.WriteAttributeString("name", trend.Key.Replace("\0", ""));

                    foreach (KeyValuePair<string, int> v in trend.Value)
                    {
                        writer.WriteStartElement("Count");
                        writer.WriteAttributeString("date", v.Key);
                        writer.WriteAttributeString("count", v.Value.ToString());
                        writer.WriteEndElement();
                    }

                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
TrendCount