Last active
May 2, 2023 17:27
-
-
Save carloswm85/33d797bfc1f97bd8ca88aa3ac5b79f96 to your computer and use it in GitHub Desktop.
GetNextExpirationDate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public DateTime? GetNextExpirationDate() | |
| { | |
| DateTime year = new DateTime(DateTime.Now.Year, 1, 1); | |
| DateTime today = DateTime.Now; | |
| IQueryable<ConfiguracionWeb> dates = _unitOfWork.WebConfigurationRepository.GetAll(); | |
| DateTime firstDate = DateTime | |
| .Parse(dates | |
| .First(u => (WebConfigEnumerations)u.enumeracion == WebConfigEnumerations.PrimerVencimiento) | |
| .valor); | |
| DateTime secondDate = DateTime | |
| .Parse(dates | |
| .First(u => (WebConfigEnumerations)u.enumeracion == WebConfigEnumerations.SegundoVencimiento) | |
| .valor); | |
| DateTime firstDateNextYear = new DateTime(firstDate.Year + 1, firstDate.Month, firstDate.Day); | |
| if (today > year && today < firstDate) | |
| return firstDate; | |
| if (today > firstDate && today < secondDate) | |
| return secondDate; | |
| if (today > secondDate) | |
| return firstDateNextYear; | |
| return null; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment