Exemplo n.º 1
0
        // get total riders
        public Sum_Avg totalRiders(int stationID)
        {
            int pas  = 0;
            int days = 0;

            // query for the number of riders
            var query = from riders in m_CTA.Riderships
                        where riders.StationID == stationID
                        select riders;


            // got total riders
            foreach (var row in query)
            {
                pas = pas + row.DailyTotal;
            }

            // query for total days
            var query2 = from riders in m_CTA.Riderships
                         where riders.StationID == stationID
                         group riders by riders.TheDate into grp
                         select new { key = grp.Key, count = grp.Count() };

            // got total days
            foreach (var row in query2)
            {
                days = days + row.count;
            }

            double average = pas / days;

            Sum_Avg myResult = new Sum_Avg(pas, average);

            return(myResult);
        }
Exemplo n.º 2
0
        // get total riders
        public Sum_Avg totalRiders(int stationID)
        {
            int pas = 0;
            int days = 0;

            // query for the number of riders
            var query = from riders in m_CTA.Riderships
                        where riders.StationID == stationID
                        select riders;

            // got total riders
            foreach (var row in query)
            {
                pas = pas + row.DailyTotal;
            }

            // query for total days
            var query2 = from riders in m_CTA.Riderships
                         where riders.StationID == stationID
                         group riders by riders.TheDate into grp
                         select new { key = grp.Key, count = grp.Count() };

            // got total days
            foreach (var row in query2)
            {
                days = days + row.count;
            }

            double average = pas / days;

            Sum_Avg myResult = new Sum_Avg(pas,average);
            return myResult;
        }