private void GetClassAttendanceInDateRangeFromService(Guid departmentId, Guid classId, DateTime?attendanceStartDate, DateTime?attendanceEndDate) { try { List <CACCCheckInDb.AttendanceWithDetail> records = null; using (CACCCheckInServiceProxy proxy = new CACCCheckInServiceProxy()) { proxy.Open(); if (classId.Equals(new Guid("00000000-0000-0000-0000-000000000000"))) { logger.Debug("Retrieving GetAttendanceByDepartmentAndDateRange from CACCCheckInServiceProxy"); records = proxy.GetAttendanceByDepartmentAndDateRange(departmentId, attendanceStartDate.Value, attendanceEndDate.Value); } else { logger.Debug("Retrieving GetAttendanceByDepartmentAndClassIdAndDateRange from CACCCheckInServiceProxy"); records = proxy.GetAttendanceByDepartmentAndClassIdAndDateRange( departmentId, classId, attendanceStartDate.Value, attendanceEndDate.Value); } } Debug.Assert(View != null); View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind, new DispatcherOperationCallback( delegate(object arg) { View.ReportDataContext = records; return(null); }), null); } catch (Exception ex) { Debug.Assert(View != null); View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind, new DispatcherOperationCallback( delegate(object arg) { View.DisplayExceptionDetail(ex); return(null); }), null); } }