Example #1
0
        /// <summary>
        /// EachMonth
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public static IEnumerable EachMonth(this DateTime start, DateTime end)
        {
            DateTime startMonth = CoreUtilities.GetFirstDayOfMonth(start);
            DateTime endMonth   = CoreUtilities.GetFirstDayOfMonth(end);

            while (startMonth <= endMonth)
            {
                yield return(startMonth);

                startMonth = startMonth.AddMonths(1);
            }
        }
Example #2
0
        /// <summary>
        /// Build History Request Criteria
        /// </summary>
        /// <param name="pRequestDateTime"></param>
        /// <param name="pHistortyMonthsCount"></param>
        /// <returns></returns>
        public static RequestCriteriaInfo BuildHistoryRequestCriteria(DateTime pRequestDateTime, int pHistortyMonthsCount)
        {
            DateTime dtHistoryMonth = pRequestDateTime;

            if (pHistortyMonthsCount > 0)
            {
                dtHistoryMonth = pRequestDateTime.AddMonths(CoreUtilities.GetNegativeNumber(pHistortyMonthsCount));
            }

            DateTime dtStart = CoreUtilities.GetFirstDayOfMonth(dtHistoryMonth);
            DateTime dtEnd   = CoreUtilities.GetLastSecondOfDay(CoreUtilities.GetLastDayOfMonth(pRequestDateTime.AddMonths(-1)));

            return(new RequestCriteriaInfo(dtStart, dtEnd));
        }