Example #1
0
        //This method is used to get the difference of days from fromDate string and toDate string.
        public static int GetDifference(string fromDateString, string toDateString)
        {
            if (!(IsValidDateString(fromDateString) && IsValidDateString(toDateString)))
            {
                throw new Exception("Invalid Date");
            }
            FromDate = new DateModel(fromDateString);
            ToDate   = new DateModel(toDateString);
            var dateHelper = new DateHelper(FromDate, ToDate);

            return(dateHelper.GetDifference());
        }
Example #2
0
        //This method is used to check if from date is less than to date
        public static bool IsFromDateLessThanToDate(string fromDateString, string toDateString)
        {
            if (!(IsValidDateString(fromDateString) && IsValidDateString(toDateString)))
            {
                throw new Exception("Invalid Date");
            }
            FromDate = new DateModel(fromDateString);
            ToDate   = new DateModel(toDateString);
            var dateHelper = new DateHelper(FromDate, ToDate);

            return(dateHelper.IsFromDateLessThanToDate());
        }
Example #3
0
 public DateHelper(DateModel fromDate, DateModel toDate)
 {
     this.FromDate = fromDate;
     this.ToDate   = toDate;
 }