Exemple #1
0
            //private List<PremiumCode> outputCodes = new List<PremiumCode>();

            private void findAndAddHours(PremiumCode pc, List <PremiumCode> outputCodes)
            {
                outputCodes.Sort(PremiumCode.compareByStartDate());
                int index = outputCodes.BinarySearch(pc, PremiumCode.compareByStartDate());

                if (index >= 0)
                {
                    outputCodes[index].Hours.Add(pc.Hours);
                }
                else
                {
                    outputCodes.Add(pc);
                    outputCodes.Sort(PremiumCode.compareByStartDate());
                }
            }
Exemple #2
0
        private int findFirstDateInstance(DateTime d, List <PremiumCode> c)
        {
            int index = c.BinarySearch(new PremiumCode(String.Empty, d.Date), PremiumCode.compareByStartDate());

            if (index < 0)
            {
                return(index);
            }

            for (; index > 0 && c[index - 1].StartDate.Date == d.Date; --index)
            {
                ;
            }

            return(index);
        }