public decimal TotalWeeklyHours(DateTime submitDate, int userID) { DateTime weekDay = submitDate.Date.AddDays(7); int weekOfDay = (int)weekDay.DayOfWeek; weekOfDay = weekOfDay == 0 ? 7 : weekOfDay; weekDay = weekDay.AddDays(-weekOfDay + 1).AddSeconds(-1); DateTime oneDay = weekDay.AddDays(-6).Date; TimeSheetApplication tsApp = new TimeSheetApplication(); string interval = System.Configuration.ConfigurationManager.AppSettings["TimesheetHoursUserID"]; string[] list = interval.Split(','); decimal hours = 0; for (var i = 0; i < list.Length; i++) { if (userID == int.Parse(list[i])) { hours = tsApp.GetTimesheetsHoursByWeek(userID, oneDay, weekDay); break; } } return(hours); }
public EventsApplication() { mgr = new EventsManager(ObjectFactory.GetInstance <IEventRepository>(), ObjectFactory.GetInstance <IEventCommentsRepository>()); tsp = new TimeSheetApplication(); }