/// <summary> /// Reprints the label for attendance record /// </summary> /// <param name="record"></param> public void ReprintLabel(CACCCheckInDb.AttendanceWithDetail record) { InnerReprintLabelDelegate fetcher = new InnerReprintLabelDelegate(InnerReprintLabel); fetcher.BeginInvoke(record, null, null); }
private void InnerReprintLabel(CACCCheckInDb.AttendanceWithDetail record) { try { logger.DebugFormat("Reprinting label for person: Name=[{0} {1}], SecurityCode=[{2}]", record.FirstName, record.LastName, record.SecurityCode); _labelPrinterService.PrintLabels(record.Date, Constants.ChurchName, record.SecurityCode, (CACCCheckInDb.PeopleWithDepartmentAndClassView)record); View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind, new DispatcherOperationCallback( delegate(object arg) { View.ProcessingCompleted(); 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); } }
/// <summary> /// We handle the RoutedCommand CanExecuteEvent which is triggered by the DataGrid /// Interested in the Delete command so that we can ask for permission to delete /// the Class /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCanExecuteRoutedEventHandler(object sender, CanExecuteRoutedEventArgs e) { RoutedCommand routedCommand = (e.Command as RoutedCommand); if (routedCommand != null) { if (routedCommand.Name == "Delete") { CloseErrorDetail(); if (null == _attendanceView.CurrentItem) { return; } CACCCheckInDb.AttendanceWithDetail record = _attendanceView.CurrentItem as CACCCheckInDb.AttendanceWithDetail; string deleteMessage = String.Format("You have selected an attendance record of [{0} {1}] for deletion? Click Yes to delete or No to cancel.", record.FirstName, record.LastName); if (MessageBoxResult.No == MessageBox.Show(deleteMessage, "Delete Attendance Record", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No)) { e.CanExecute = false; e.Handled = true; } } } }
/// <summary> /// Reprints label for selected attendance record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReprintNameTagLabelButton_Click(object sender, RoutedEventArgs e) { if (null == _attendanceView.CurrentItem) { return; } ShowProcessing(true); logger.Debug("Reprinting label for selected attendance record."); CACCCheckInDb.AttendanceWithDetail record = _attendanceView.CurrentItem as CACCCheckInDb.AttendanceWithDetail; _presenter.ReprintLabel(record); }