/// <summary> /// Assigns the values automatic dictionary. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="item">The item.</param> private static void AssignValuesToDictionary(Dictionary<DateTime, IList<ReleaseListItem>> dictionary, ReleaseListItem item) { if (dictionary.ContainsKey(item.StartDate.Value.Date)) { dictionary[item.StartDate.Value.Date].Add(item); } else { IList<ReleaseListItem> releaseItems = new List<ReleaseListItem>(); releaseItems.Add(item); dictionary.Add(item.StartDate.Value.Date, releaseItems); } }
/// <summary> /// Validates the dates. /// </summary> /// <param name="release">The release.</param> /// <param name="currentDate">Current date</param> /// <returns>True or false</returns> private static bool ValidateDates(ReleaseListItem release, DateTime currentDate) { if (release.StartDate.Value.Date == currentDate.Date && currentDate.Date < release.EndDate.Value.Date) { release.EndDate = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 23, 59, 59); } else if (release.StartDate.Value.Date < currentDate.Date && currentDate.Date < release.EndDate.Value.Date) { release.StartDate = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 00, 00, 00); release.EndDate = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 23, 59, 59); } else if (release.StartDate.Value.Date < currentDate.Date && currentDate.Date == release.EndDate.Value.Date) { release.StartDate = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 00, 00, 00); } return true; }