Example #1
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));
        }
Example #2
0
        /// <summary>
        /// Get Last Day Of Month
        /// </summary>
        /// <param name="pDateTime"></param>
        /// <param name="pGetLastSecond"></param>
        /// <returns></returns>
        public static DateTime GetLastDayOfMonth(DateTime pDateTime, bool pGetLastSecond = false)
        {
            DateTime dtTo = pDateTime;

            dtTo = dtTo.AddMonths(1);

            dtTo = dtTo.AddDays(-(dtTo.Day));

            if (pGetLastSecond)
            {
                dtTo = CoreUtilities.GetLastSecondOfDay(dtTo);
            }

            return(dtTo);
        }