Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
#if DEBUG
            path = @"u:\beta-challoners\DCGS.UI.TV\content\calendar_staff";
#else
            path = @"d:\beta-challoners\DCGS.UI.TV\content\calendar_staff";
#endif
            if (!IsPostBack)
            {
#if DEBUG
                string s = ""; string url = "https://www.google.com/calendar/feeds/challoners.org_feci78hr5nl5dils4thcg4lot4%40group.calendar.google.com/private-85fb073b5e78ff584fd6d3172a2f1a27/basic";
                using (WebClient client = new WebClient())
                { s = client.DownloadString(url); }
                XmlDocument   doc = new XmlDocument();
                XmlTextReader x1  = new XmlTextReader(url);
                doc.Load(url);
                string      s1     = "";
                XmlNodeList nodes1 = doc.DocumentElement.SelectNodes("entry");
                XmlNodeList nodes4 = doc.DocumentElement.ChildNodes;
                foreach (XmlNode node in nodes4)
                {
                    if (node.Name == "entry")
                    {
                        XmlNodeList nodes5 = node.ChildNodes; s1 += "</br>";
                        foreach (XmlNode n1 in nodes5)
                        {
                            s = n1.Name;
                            if (n1.Name == "summary")
                            {
                                s1 += n1.InnerText;
                            }
                            if (n1.Name == "title")
                            {
                                s1 += n1.InnerText;
                            }
                        }
                    }
                }
#else
#endif

                Response.Redirect("../content/Calendar_new.aspx");  //to new Google calander
                EventList.LoadXML_months(path, DateTime.Now.Month, 1, DateTime.Now.Year);
                ViewState.Add("EventList", EventList);
                ViewState.Add("path", path);
                //Label_Heading.Text = "Click on a day to display detail";
            }
        }
Exemple #2
0
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            EventList = (CalendarEventList )ViewState["EventList"];
            path      = (string)ViewState["path"];
            if (EventList == null)
            {
                EventList.LoadXML_months(path, DateTime.Now.Month, 1, DateTime.Now.Year);
            }
            DateTime t = e.Day.Date;

            e.Day.IsSelectable = false;
            foreach (CalendarEvent ev in EventList.EventList)
            {
                if ((ev.date.Day == t.Day) && (ev.date.Month == t.Month) && Display_CalendarItem(ev))
                {
                    string s = ev.title; if (s.Length > 14)
                    {
                        s = s.Substring(0, 14) + "...";
                    }
                    e.Day.IsSelectable = true;
                    e.Cell.ForeColor   = System.Drawing.Color.Black;
                    Label l1 = new Label();
                    l1.Text      = "<BR>" + s;
                    l1.Font.Size = FontUnit.XSmall;
                    e.Cell.Controls.Add(l1);
                    if (ev.Categories.Contains("Event"))
                    {
                        l1.ForeColor = System.Drawing.Color.Red;
                    }
                    if (ev.Categories.Contains("Meeting"))
                    {
                        l1.ForeColor = System.Drawing.Color.Green;
                    }
                    if (ev.Categories.Contains("Match"))
                    {
                        l1.ForeColor = System.Drawing.Color.Chocolate;
                    }
                    if (ev.Categories.Contains("Visit"))
                    {
                        l1.ForeColor = System.Drawing.Color.Blue;
                    }
                }
            }
        }