예제 #1
0
        public void GetNextSaturdayTest(string test, string actual)
        {
            //      var TimeSheetApp = new TimeSheetApproval();
            var testDate = Convert.ToDateTime(test);
            var result   = TimeSheetApproval.GetNextSaturdayOfWeek(testDate);

            Assert.Equal(Convert.ToDateTime(actual), result);
        }
예제 #2
0
        public List <TimeSheet> GetEmployeeTimeSheetWeekFromDate(DateTime date, int employeeId)
        {
            //use date.date to get midnight
            var DateStart  = TimeSheetApproval.GetPreviousSundayOfWeek(date.Date);
            var DateEnd    = TimeSheetApproval.GetNextSaturdayOfWeek(date.Date);
            var TimeSheets = _db.TimeSheets.Where(x => ((x.EmployeeId == employeeId) && (x.Date.CompareTo(DateStart) >= 0) && (x.Date.CompareTo(DateEnd) <= 0))).AsNoTracking();

            return(Mapper.Map(TimeSheets));
        }