private void FillTaskAdvancedFields(Model.Task task) { var eventDao = new EventInfoDao(dao.usingDbUtility); var eventList = eventDao.GetLinkedEventList(task.id); if (eventList.Length == 0) { task._hasLinkedEvent = false; task._firstStartTime = DateTime.MaxValue; task._lastEndTime = DateTime.MinValue; } else { task._hasLinkedEvent = true; task._firstStartTime = DateTime.MaxValue; task._lastEndTime = DateTime.MinValue; foreach (var item in eventList) { var fm = new FormulaManager(item.remindFormula); var startTime = fm.GetStartDate(); startTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, item.startTime.Hour, item.startTime.Minute, 0); var endTime = fm.GetEndDate(); endTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, item.endTime.Hour, item.endTime.Minute, 59); task._firstStartTime = startTime < task._firstStartTime ? startTime : task._firstStartTime; task._lastEndTime = endTime > task._lastEndTime ? endTime : task._lastEndTime; } } }
public EventInfoService(DbUtility db = null) { dao = new EventInfoDao(db); }