Series GetRankingData()
    {
        MembershipEvents events = MembershipEvents.LoadAll();
        DateTime         today  = DateTime.Today;

        DateTime dateIterator = new DateTime(2006, 1, 1);
        int      eventIndex   = 0;

        List <DateBar> dateBars = new List <DateBar>();

        while (eventIndex < events.Count)
        {
            int      newMembersThisDate = 0;
            DateTime nextDate           = dateIterator.AddDays(1);
            while (eventIndex < events.Count && events[eventIndex].DateTime < nextDate)
            {
                if (events[eventIndex].DeltaCount > 0 && events [eventIndex].OrganizationId == 1)
                {
                    newMembersThisDate++;
                }

                eventIndex++;
            }

            DateBar dateBar = new DateBar();
            dateBar.Date             = dateIterator;
            dateBar.RecruitedMembers = newMembersThisDate;
            dateBars.Add(dateBar);

            dateIterator = nextDate;
        }

        dateBars.Sort();
        dateBars.Reverse();

        Series series = new Series();

        for (int index = 20; index >= 0; index--)
        {
            DateBar bar = dateBars[index];

            Element element = new Element();
            element.YValue = bar.RecruitedMembers;
            element.Name   = bar.Date.ToString("yyyy-MM-dd");

            if (bar.Date == today)
            {
                element.Color = Color.Violet;
                element.Name  = "IDAG";
            }

            series.Elements.Add(element);
        }

        series.DefaultElement.Color     = System.Drawing.Color.DarkViolet;
        series.DefaultElement.ShowValue = true;

        return(series);
    }
        public int CompareTo(object obj)
        {
            DateBar otherBar = (DateBar)obj;

            return(this.RecruitedMembers.CompareTo(otherBar.RecruitedMembers));
        }
    Series GetRankingData()
	{
        MembershipEvents events = MembershipEvents.LoadAll();
        DateTime today = DateTime.Today;

        DateTime dateIterator = new DateTime(2006, 1, 1);
        int eventIndex = 0;

        List<DateBar> dateBars = new List<DateBar>();
        while (eventIndex < events.Count)
        {
            int newMembersThisDate = 0;
            DateTime nextDate = dateIterator.AddDays(1);
            while (eventIndex < events.Count && events[eventIndex].DateTime < nextDate)
            {
               if (events[eventIndex].DeltaCount > 0 && events [eventIndex].OrganizationId == 1)
               {
                   newMembersThisDate++;
               }

               eventIndex++;
            }

            DateBar dateBar = new DateBar();
            dateBar.Date = dateIterator;
            dateBar.RecruitedMembers = newMembersThisDate;
            dateBars.Add(dateBar);

            dateIterator = nextDate;
        }

        dateBars.Sort();
        dateBars.Reverse();

        Series series = new Series();

        for (int index = 20; index >= 0; index --)
        {
            DateBar bar = dateBars[index];

            Element element = new Element();
            element.YValue = bar.RecruitedMembers;
            element.Name = bar.Date.ToString("yyyy-MM-dd");

            if (bar.Date == today)
            {
                element.Color = Color.Violet;
                element.Name = "IDAG";
            }

            series.Elements.Add(element);
        }

		series.DefaultElement.Color = System.Drawing.Color.DarkViolet;
		series.DefaultElement.ShowValue = true;

		return series;
	}