Example #1
0
        public IEnumerable <IGrouping <string, Nanny> > GroupNannyByChildAge(bool sort = false)//grouping the nannies by child age
        {
            Idal mydal = FactoryDal.getDal();
            IEnumerable <IGrouping <string, Nanny> > ChildAge;

            if (sort)
            {
                ChildAge = from n in mydal.GetNannysList()
                           orderby n.range //field in nanny that contain the range of the children's ages
                           group n by n.range;
            }
            else
            {
                ChildAge = from n in mydal.GetNannysList()
                           group n by n.range;
            }

            return(ChildAge.ToList());
        }
Example #2
0
        public IEnumerable <IGrouping <float, Nanny> > GroupNannyByChildAgeMaxOrMin(bool max, bool sort = false)//grouping the nannies by maximum child age or minimum
        {
            Idal mydal = FactoryDal.getDal();
            IEnumerable <IGrouping <float, Nanny> > ChildAge;

            if (max)
            {
                if (sort)
                {
                    ChildAge = from n in mydal.GetNannysList()
                               orderby n.MaxChildrensAge
                               group n by n.MaxChildrensAge;
                }
                else
                {
                    ChildAge = from n in mydal.GetNannysList()
                               group n by n.MaxChildrensAge;
                }
            }

            else
            {
                if (sort)
                {
                    ChildAge = from n in mydal.GetNannysList()
                               orderby n.MinChildrensAge
                               group n by n.MinChildrensAge;
                }
                else
                {
                    ChildAge = from n in mydal.GetNannysList()
                               group n by n.MinChildrensAge;
                }
            }

            return(ChildAge.ToList());
        }