Beispiel #1
0
        private void GetAttendanceByDeptIdFromService(Guid departmentId)
        {
            try
            {
                CACCCheckInDb.AttendanceRecords attendance = null;

                logger.Debug("Retrieving GetAttendanceByDeptId from CACCCheckInService");

                using (CACCCheckInServiceProxy proxy =
                           new CACCCheckInServiceProxy())
                {
                    proxy.Open();

                    attendance = new CACCCheckInDb.AttendanceRecords(proxy.GetAttendanceByDeptId(departmentId));

                    logger.Debug("Hooking up CollectionChanged event handler for attendance records");

                    attendance.CollectionChanged +=
                        new NotifyCollectionChangedEventHandler(AttendanceRecordsCollectionChanged);
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.AttendanceDataContext = attendance;
                    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);
            }
        }