public static bool IsValidGregorianDate(int intGCDay, int intGCMonth, int intGCYear) { if (EthiopianCalendarDateTime.IsValidRange(intGCYear, 1900, 9998) == true) { if (EthiopianCalendarDateTime.IsValidRange(intGCMonth, 1, 12) == true) { if (EthiopianCalendarDateTime.IsValidRange(intGCDay, 1, DateTime.DaysInMonth(intGCYear, intGCMonth)) == true) { return(true); } else { EthiopianCalendarDateTime.ErrorMessage = "Day should be from 1 to " + DateTime.DaysInMonth(intGCYear, intGCMonth); return(false); } } else { EthiopianCalendarDateTime.ErrorMessage = "Month should be from 1 to 12"; return(false); } } else { EthiopianCalendarDateTime.ErrorMessage = "Gregorian calendar year should be from 1900 to 9998"; return(false); } }
public static bool IsValidEthiopicDate(int intEthDay, int intEthMonth, int intEthYear) { if (EthiopianCalendarDateTime.IsValidRange(intEthDay, 1, 30) == true) { if (EthiopianCalendarDateTime.IsValidRange(intEthMonth, 1, 13) == true) { if (EthiopianCalendarDateTime.IsValidRange(intEthYear, 1900, 9991)) { if (EthiopianCalendarDateTime.IsETLeapYear(intEthYear) == true) { if (intEthMonth == 13) { if (EthiopianCalendarDateTime.IsValidRange(intEthDay, 1, 6) == true) { } else { EthiopianCalendarDateTime.ErrorMessage = "Day should be from 1 to 6"; return(false); } } } else { if (intEthMonth == 13) { if (EthiopianCalendarDateTime.IsValidRange(intEthDay, 1, 5) == true) { } else { EthiopianCalendarDateTime.ErrorMessage = "Day should be from 1 to 5"; return(false); } } } } else { EthiopianCalendarDateTime.ErrorMessage = "Year should be from 1900 to 9991"; return(false); } } else { EthiopianCalendarDateTime.ErrorMessage = "Month should be from 1 to 13"; return(false); } } else { EthiopianCalendarDateTime.ErrorMessage = "Day should be from 1 to 30"; return(false); } return(true); }