private void InnerPrintTeacherLabelsForDepartment(string departmentName) { List <CACCCheckInDb.PeopleWithDepartmentAndClassView> teachers = null; try { using (CACCCheckInServiceProxy proxy = new CACCCheckInServiceProxy()) { proxy.Open(); teachers = proxy.GetPeopleWithDepartmentAndClassByDepartment(departmentName); } teachers = teachers.FindAll(p => p.ClassRole.Equals(ClassRoles.Teacher)); logger.DebugFormat("Printing labels for [{0}] teachers.", teachers.Count); teachers.ForEach(t => t.SpecialConditions = ClassRoles.Teacher); _labelPrinterService.PrintLabels(null, Constants.ChurchName, 0, teachers); View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind, new DispatcherOperationCallback( delegate(object arg) { View.LabelPrintingCompleted(); 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); } }
private void GetDepartmentPeopleFromService(string departmentName) { try { List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null; logger.Debug("Retrieving GetPeopleWithDepartmentAndClassByDepartment from CACCCheckInServiceProxy"); using (CACCCheckInServiceProxy proxy = new CACCCheckInServiceProxy()) { proxy.Open(); people = proxy.GetPeopleWithDepartmentAndClassByDepartment(departmentName); } Debug.Assert(View != null); View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind, new DispatcherOperationCallback( delegate(object arg) { View.DepartmentPeopleDataContext = people; 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); } }