/// <summary>
        /// Will refresh the data for the currently selected person
        /// in family members list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RefreshFamilyButton_Click(object sender, RoutedEventArgs e)
        {
            CACCCheckInDb.PeopleWithDepartmentAndClassView person = null;

            if (null != PeopleDetail.DataContext)
            {
                CACCCheckInDb.PeopleWithDepartmentAndClassView currentPerson =
                    (CACCCheckInDb.PeopleWithDepartmentAndClassView)PeopleDetail.DataContext;

                person = ((List <CACCCheckInDb.PeopleWithDepartmentAndClassView>)
                          _familyView.SourceCollection).Find(p => p.PersonId.Equals(currentPerson.PersonId));
            }

            PhoneNumberConverter cvt = new PhoneNumberConverter();

            if (null != person)
            {
                person.FirstName   = FirstName.Text;
                person.LastName    = LastName.Text;
                person.PhoneNumber = (string)cvt.ConvertBack(PhoneNumber.Text,
                                                             typeof(string), null, null);
                person.SpecialConditions = SpecialConditions.Text;
                person.DepartmentId      = ((CACCCheckInDb.Department)DepartmentComboBox.SelectedItem).Id;
                person.DepartmentName    = ((CACCCheckInDb.Department)DepartmentComboBox.SelectedItem).Name;
                person.ClassId           = ((CACCCheckInDb.Class)ClassComboBox.SelectedItem).Id;
                person.ClassName         = ((CACCCheckInDb.Class)ClassComboBox.SelectedItem).Name;
                person.FamilyRole        = (string)FamilyRole.SelectedItem;

                _familyView.Refresh();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PeopleDetail_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            CACCCheckInDb.PeopleWithDepartmentAndClassView person =
                e.NewValue as CACCCheckInDb.PeopleWithDepartmentAndClassView;

            if (person == null)
            {
                return;
            }

            ChangeDepartmentComboTo(person.DepartmentId);

            FirstName.Text          = person.FirstName;
            LastName.Text           = person.LastName;
            PhoneNumber.Text        = person.PhoneNumber;
            SpecialConditions.Text  = person.SpecialConditions;
            FamilyRole.SelectedItem = person.FamilyRole;

            ClassComboBox.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle,
                                                 new DispatcherOperationCallback(
                                                     delegate(object arg)
            {
                ChangeClassComboTo(person.ClassId);

                return(null);
            }), null);
        }
        /// <summary>
        /// Asynchronously call to check in child
        /// </summary>
        /// <param name="person"></param>
        public void CheckInPerson(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            CheckInPersonAndPrintLabelDelegate fetcher =
                new CheckInPersonAndPrintLabelDelegate(CheckInPersonAndPrintLabel);

            fetcher.BeginInvoke(person, null, null);
        }
        /// <summary>
        /// Whenever the user selects a new person from the listbox, the DataContext changes
        /// for the PeopleDetail panel. Change the view based on details for
        /// current DataContext.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PeopleDetail_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            CloseErrorDetail();

            if (e.NewValue == null)
            {
                ClearPeopleDetailPanel();
                return;
            }

            // Retrieves the person newly assigned to the DataContext
            CACCCheckInDb.PeopleWithDepartmentAndClassView currentPerson =
                (CACCCheckInDb.PeopleWithDepartmentAndClassView)e.NewValue;

            if (currentPerson != null)
            {
                logger.DebugFormat("Retrieving family members for [{0} {1}]", currentPerson.FirstName,
                                   currentPerson.LastName);
                _presenter.GetFamilyForPerson(currentPerson);
            }
            else
            {
                ClearPeopleDetailPanel();
            }
        }
        /// <summary>
        /// Asynchronously call to get family for person
        /// </summary>
        /// <param name="person"></param>
        public void GetFamilyForPerson(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            GetFamilyFromServiceDelegate fetcher =
                new GetFamilyFromServiceDelegate(GetFamilyFromService);

            fetcher.BeginInvoke(person, null, null);
        }
        private void GetFamilyFromService(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            try
            {
                List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

                if (person != null)
                {
                    using (CACCCheckInServiceProxy proxy =
                               new CACCCheckInServiceProxy())
                    {
                        proxy.Open();

                        if (person.FamilyId.HasValue)
                        {
                            logger.DebugFormat("Retrieving GetFamilyMembersByFamilyId from CACCCheckInService for FamilyId=[{0}]",
                                               person.FamilyId.Value);
                            people = proxy.GetFamilyMembersByFamilyId(person.FamilyId.Value);
                        }
                        else
                        {
                            logger.DebugFormat("Retrieving GetFamilyMembersByFamilyId from CACCCheckInService for PersonId=[{0}]",
                                               person.PersonId);
                            people = proxy.GetFamilyMembersByFamilyId(person.PersonId);
                        }
                    }
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    // We will filter to get ONLY Family members who are
                    // either in Adult or MOPS department. These are
                    // the only valid departments for MOPS check-in
                    // screen. Also, we make sure only records where
                    // ClassRole is Member are needed.
                    View.FamilyDataContext = people.FindAll(p =>
                                                            (p.DepartmentName.Equals(Departments.Adult) ||
                                                             p.DepartmentName.Equals(Departments.MOPS)) &&
                                                            p.ClassRole.Equals(ClassRoles.Member));
                    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>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FamilyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         CACCCheckInDb.PeopleWithDepartmentAndClassView person =
             (CACCCheckInDb.PeopleWithDepartmentAndClassView)e.AddedItems[0];
         PeopleDetail.DataContext = person;
     }
 }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getReportButton_Click(object sender, RoutedEventArgs e)
        {
            SaveReportButton.IsEnabled  = false;
            PrintReportButton.IsEnabled = false;

            CACCCheckInDb.PeopleWithDepartmentAndClassView selectedPerson =
                (CACCCheckInDb.PeopleWithDepartmentAndClassView)PeopleComboBox.SelectedItem;

            _presenter.GetPersonAttendanceOnDate(selectedPerson.PersonId,
                                                 AttendanceDate.SelectedDate);
        }
        /// <summary>
        /// Prints label for one person
        /// </summary>
        /// <param name="date"></param>
        /// <param name="location"></param>
        /// <param name="securityCode"></param>
        /// <param name="person"></param>
        public void PrintLabels(DateTime?date, string location, int securityCode,
                                CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = new List <CACCCheckInDb.PeopleWithDepartmentAndClassView>();

            people.Add(person);

            logger.DebugFormat("Printing label for person: Name=[{0} {1}]",
                               person.FirstName, person.LastName);

            PrintLabels(date, location, securityCode, people);
        }
        /// <summary>
        /// After a person has been checked in, we will find that person in the current
        /// family list and then set the security code to one assigned during check in.
        /// </summary>
        /// <param name="person"></param>
        public void CheckInCompleted(CACCCheckInDb.PeopleWithDepartmentAndClassView personCheckedIn)
        {
            // Look for the person that was checked in in the family list.
            CACCCheckInDb.PeopleWithDepartmentAndClassView person =
                _familyMembers.Find(p => p.PersonId.Equals(personCheckedIn.PersonId));

            // If person is found, update the security code of person in family list
            if (person != null)
            {
                person.SecurityCode = personCheckedIn.SecurityCode;
            }
        }
        /// <summary>
        /// Will add a person to class
        /// </summary>
        /// <param name="person"></param>
        private void AddPersonClassMembership(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            logger.DebugFormat("Adding class membership for [{0} {1}]",
                               person.FirstName, person.LastName);

            // Get a reference to ClassMember record for current person
            CACCCheckInDb.ClassMember newClassMember = (CACCCheckInDb.ClassMember)person;

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

                logger.Debug("Calling InsertClassMember in CACCCheckInService");
                proxy.InsertClassMember(newClassMember);
            }
        }
        /// <summary>
        /// Whenever a person's info changes in the family list we will save the
        /// changes here
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _familyViewEditable_ListChanged(object sender, ListChangedEventArgs e)
        {
            // Only handle the ItemChanged type of change
            switch (e.ListChangedType)
            {
            case ListChangedType.ItemChanged:
                logger.Debug("ItemChanged fired. Updating person if they need persisting.");

                CACCCheckInDb.PeopleWithDepartmentAndClassView updatedPerson =
                    _familyViewEditable.ElementAtOrDefault(e.NewIndex);

                if (updatedPerson.NeedsPersist)
                {
                    _presenter.UpdatePerson((CACCCheckInDb.Person)updatedPerson);
                }
                updatedPerson.NeedsPersist = false;
                break;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Handles when user clicks the Check-In button. Will show the processing control
        /// and start check-in process
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckInButton_Click(object sender, RoutedEventArgs e)
        {
            ShowProcessing(true);

            CACCCheckInDb.PeopleWithDepartmentAndClassView currentPerson =
                (CACCCheckInDb.PeopleWithDepartmentAndClassView)
                    ((CACCCheckInDb.PeopleWithDepartmentAndClassView)PeopleDetail.DataContext).Clone();

            // If there is currently an exclusive check-in class selected,
            // we will update the person info here so that they get checked
            // in to that class instead
            if (_exclusiveCheckInClass != null)
            {
                currentPerson.ClassId   = _exclusiveCheckInClass.Id;
                currentPerson.ClassName = _exclusiveCheckInClass.Name;
            }

            _presenter.CheckInPerson(currentPerson);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Once a child has been checked in, this function is called so that
        /// UI can be updated with information for that child.
        /// </summary>
        /// <param name="person"></param>
        public void CheckInCompleted(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            // Stop the processing animation
            ShowProcessing(false);

            // Update the UI
            CheckInDetailsBegin.Text = String.Empty;
            CheckInDetailsName.Text  = String.Format("{0} {1}",
                                                     person.FirstName, person.LastName);
            CheckInDetailsMiddle.Text  = "was checked into the";
            CheckInDetailsClass.Text   = person.ClassName;
            CheckInDetailsPreDate.Text = "class for";
            CheckInDetailsDate.Text    = String.Format("{0}.", DateTime.Today.ToLongDateString());
            CheckInDetailsEnd.Text     = "Please Take Label From Printer.";

            // Disable check-in button so that check-in can't be performed
            // again for child.
            CheckInButton.IsEnabled = false;
        }
        /// <summary>
        /// Will move a person from current class to new class
        /// </summary>
        /// <param name="person"></param>
        /// <param name="newClass"></param>
        public void UpdatePersonClassMembership(CACCCheckInDb.PeopleWithDepartmentAndClassView person,
                                                CACCCheckInDb.Class newClass)
        {
            try
            {
                logger.DebugFormat("Updating class membership for [{0} {1}]",
                                   person.FirstName, person.LastName);

                // Get a reference to ClassMember record for current person
                CACCCheckInDb.ClassMember oldClassMember = (CACCCheckInDb.ClassMember)person;
                // Create a new ClassMember record to move current person to new class
                CACCCheckInDb.ClassMember newClassMember = new CACCCheckInDb.ClassMember();
                // The new ClassId is used along with current ClassRole and PersonId
                newClassMember.ClassId   = newClass.Id;
                newClassMember.ClassRole = oldClassMember.ClassRole;
                newClassMember.PersonId  = oldClassMember.PersonId;

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

                    logger.Debug("Calling DeleteClassMember in CACCCheckInService");
                    proxy.DeleteClassMember(oldClassMember);

                    logger.Debug("Calling InsertClassMember in CACCCheckInService");
                    proxy.InsertClassMember(newClassMember);
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DisplayExceptionDetail(ex);
                    return(null);
                }), null);
            }
        }
        /// <summary>
        /// After a person has been checked in, we will find that person in the current
        /// family list and then set the security code to one assigned during check in.
        /// </summary>
        /// <param name="person"></param>
        public void CheckInCompleted(CACCCheckInDb.PeopleWithDepartmentAndClassView personCheckedIn)
        {
            // Look for the person that was checked in in the family list.
            CACCCheckInDb.PeopleWithDepartmentAndClassView person =
                FamilyDataContext.FirstOrDefault(p => p.PersonId.Equals(personCheckedIn.PersonId));

            // If person is found, update the security code of person in family list
            // and save the security code to possibly use for other family members
            if (person != null)
            {
                person.SecurityCode          = personCheckedIn.SecurityCode;
                currentSecurityCodeForFamily = Int32.Parse(personCheckedIn.SecurityCode);
            }

            // As each person is checked in, we check to see if anyone in family list
            // is left to be checked in. If not, we can disable the check-in button
            int familyMembersNotCheckedIn = FamilyDataContext.Count(p =>
                                                                    String.IsNullOrEmpty(p.SecurityCode));

            CheckInButton.IsEnabled = (familyMembersNotCheckedIn > 0);
        }
        /// <summary>
        /// Call to see if child is already checked in today to specific class
        /// </summary>
        /// <param name="person"></param>
        /// <returns></returns>
        public bool IsChildAlreadyCheckedInToday(CACCCheckInDb.PeopleWithDepartmentAndClassView person,
                                                 Guid classId)
        {
            bool isCheckedIntoClassToday = false;

            try
            {
                logger.Debug("Retrieving attendance records for person for today.");

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

                    logger.Debug("Calling GetAttendanceByPersonIdAndDate on CACCCheckInService.");

                    // First, we get attendance records for person for Today
                    List <CACCCheckInDb.AttendanceWithDetail> records =
                        proxy.GetAttendanceByPersonIdAndDate(person.PersonId, DateTime.Today);

                    // Then, we see if the attendance was in the specified class
                    isCheckedIntoClassToday = records.Any(r => r.ClassId.Equals(classId));
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DisplayExceptionDetail(ex);
                    return(null);
                }), null);
            }

            return(isCheckedIntoClassToday);
        }
        /// <summary>
        /// Will add the current person to the family members list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddToFamilyButton_Click(object sender, RoutedEventArgs e)
        {
            Guid?currentFamilyId;

            if (null != PeopleDetail.DataContext)
            {
                CACCCheckInDb.PeopleWithDepartmentAndClassView currentPerson =
                    (CACCCheckInDb.PeopleWithDepartmentAndClassView)PeopleDetail.DataContext;
                currentFamilyId = currentPerson.FamilyId;
            }
            else
            {
                currentFamilyId = Guid.NewGuid();
            }

            PhoneNumberConverter cvt = new PhoneNumberConverter();

            CACCCheckInDb.PeopleWithDepartmentAndClassView person =
                new CACCCheckInDb.PeopleWithDepartmentAndClassView();
            person.PersonId    = Guid.NewGuid();
            person.FirstName   = FirstName.Text;
            person.LastName    = LastName.Text;
            person.PhoneNumber = (string)cvt.ConvertBack(PhoneNumber.Text,
                                                         typeof(string), null, null);
            person.SpecialConditions = SpecialConditions.Text;
            person.DepartmentId      = ((CACCCheckInDb.Department)DepartmentComboBox.SelectedItem).Id;
            person.DepartmentName    = ((CACCCheckInDb.Department)DepartmentComboBox.SelectedItem).Name;
            person.ClassId           = ((CACCCheckInDb.Class)ClassComboBox.SelectedItem).Id;
            person.ClassName         = ((CACCCheckInDb.Class)ClassComboBox.SelectedItem).Name;
            person.ClassRole         = ClassRoles.Member;
            person.FamilyId          = currentFamilyId;
            person.FamilyRole        = (string)FamilyRole.SelectedItem;

            _familyMembers.Add(person);
            PeopleDetail.DataContext = person;
            _familyView.Refresh();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Will add a person as teacher to specified class
        /// </summary>
        /// <param name="person"></param>
        /// <param name="newClass"></param>
        public void AddPersonAsTeacherToClass(CACCCheckInDb.PeopleWithDepartmentAndClassView person,
                                              CACCCheckInDb.Class theClass)
        {
            try
            {
                logger.DebugFormat("Updating class membership for [{0} {1}]",
                                   person.FirstName, person.LastName);

                // Get a reference to ClassMember record for current person
                CACCCheckInDb.ClassMember classMember = (CACCCheckInDb.ClassMember)person;

                // The ClassId is used along with ClassRole to update ClassMember record
                classMember.ClassId   = theClass.Id;
                classMember.ClassRole = ClassRoles.Teacher;

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

                    logger.Debug("Calling InsertClassMember in CACCCheckInService");
                    proxy.InsertClassMember(classMember);
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DisplayExceptionDetail(ex);
                    return(null);
                }), null);
            }
        }
        /// <summary>
        /// Whenever family members are loading into list, we will update some
        /// Styles if conditions are met
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FamilyList_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e)
        {
            if (e.Row.Item is CACCCheckInDb.PeopleWithDepartmentAndClassView)
            {
                CACCCheckInDb.PeopleWithDepartmentAndClassView person =
                    (CACCCheckInDb.PeopleWithDepartmentAndClassView)e.Row.Item;

                if (null == person)
                {
                    return;
                }

                if (String.IsNullOrEmpty(person.SpecialConditions))
                {
                    e.DetailsElement.Visibility = Visibility.Collapsed;
                    e.DetailsElement.Style      = null;
                }
                else
                {
                    Style hasSpecialConditions = this.FindResource("HasSpecialConditions") as Style;
                    e.DetailsElement.Style = hasSpecialConditions;
                }
            }
        }
        public void CheckInPersonAndPrintLabel(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            try
            {
                logger.DebugFormat("Checking in person: {0} {1}",
                                   person.FirstName, person.LastName);

                int newSecurityCode = 0;

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

                    // No security codes are currently being used in Children department
                    // so, we will leave this commented out
                    //logger.Debug("Calling GetNewSecurityCodeForToday on CACCCheckInService.");
                    //newSecurityCode = proxy.GetNewSecurityCodeForToday();

                    logger.DebugFormat("Inserting attendance record for person: Name=[{0} {1}], SecurityCode=[{2}]",
                                       person.FirstName, person.LastName, newSecurityCode);

                    proxy.InsertAttendance(new CACCCheckInDb.Attendance
                    {
                        Date         = DateTime.Today,
                        ClassId      = person.ClassId,
                        PersonId     = person.PersonId,
                        SecurityCode = newSecurityCode
                    });
                }

                if (person.ClassRole.Equals(ClassRoles.Teacher))
                {
                    logger.DebugFormat("Printing label for teacher: Name=[{0} {1}]",
                                       person.FirstName, person.LastName);

                    person.SpecialConditions = ClassRoles.Teacher;

                    _labelPrinterService.PrintLabels(null, Constants.ChurchName,
                                                     0, person);
                }
                else
                {
                    logger.DebugFormat("Printing label for person: Name=[{0} {1}], SecurityCode=[{2}]",
                                       person.FirstName, person.LastName, newSecurityCode);

                    _labelPrinterService.PrintLabels(DateTime.Today, Constants.ChurchName,
                                                     newSecurityCode, person);
                }

                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.CheckInCompleted(person);
                    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);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Whenever the user selects a new person from the listbox, the DataContext changes
        /// for the PeopleDetail panel. Change the view based on details for
        /// current DataContext.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PeopleDetail_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            CloseErrorDetail();

            if (e.NewValue == null)
            {
                ClearPeopleDetailPanel();
                return;
            }

            // Retrieves the person newly assigned to the DataContext
            CACCCheckInDb.PeopleWithDepartmentAndClassView currentPerson =
                (CACCCheckInDb.PeopleWithDepartmentAndClassView)e.NewValue;

            if (currentPerson != null)
            {
                CheckInDetailsName.Text = String.Format("{0} {1}",
                                                        currentPerson.FirstName, currentPerson.LastName);
                // If user has selected an exclusive class for check-in,
                // we will use that class instead of default class for
                // the person
                CheckInDetailsClass.Text = (_exclusiveCheckInClass == null) ?
                                           currentPerson.ClassName : _exclusiveCheckInClass.Name;

                Guid targetClassId = (_exclusiveCheckInClass == null) ?
                                     currentPerson.ClassId : _exclusiveCheckInClass.Id;

                // Looking to see if person is already checked in today to class
                if (_presenter.IsChildAlreadyCheckedInToday(currentPerson, targetClassId))
                {
                    CheckInDetailsBegin.Text  = String.Empty;
                    CheckInDetailsMiddle.Text = "is already checked into the";
                    if (currentPerson.ClassRole.Equals(ClassRoles.Teacher))
                    {
                        CheckInDetailsPreDate.Text = "class as TEACHER for";
                    }
                    else
                    {
                        CheckInDetailsPreDate.Text = "class for";
                    }
                    CheckInDetailsDate.Text = String.Format("{0}.", DateTime.Today.ToLongDateString());
                    CheckInDetailsEnd.Text  = "Duplicate Check-In Not Allowed.";

                    CheckInButton.IsEnabled = false;
                }
                else
                {
                    CheckInDetailsBegin.Text  = "To check";
                    CheckInDetailsMiddle.Text = "into the";
                    if (currentPerson.ClassRole.Equals(ClassRoles.Teacher))
                    {
                        CheckInDetailsPreDate.Text = "class as TEACHER for";
                    }
                    else
                    {
                        CheckInDetailsPreDate.Text = "class for";
                    }
                    CheckInDetailsDate.Text = DateTime.Today.ToLongDateString();
                    CheckInDetailsEnd.Text  = "click the Check-In button.";

                    CheckInButton.IsEnabled = true;
                }
            }
            else
            {
                ClearPeopleDetailPanel();
            }
        }
        /// <summary>
        /// Retrieve the attendance records of family for Today
        /// </summary>
        /// <param name="person"></param>
        /// <returns></returns>
        public List <CACCCheckInDb.AttendanceWithDetail> GetAttendanceRecordsForFamilyToday(CACCCheckInDb.PeopleWithDepartmentAndClassView person)
        {
            List <CACCCheckInDb.AttendanceWithDetail> records = null;

            try
            {
                logger.Debug("Retrieving attendance records for family for today.");

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

                    logger.Debug("Calling GetAttendanceByFamilyIdAndDate on CACCCheckInService.");

                    records = proxy.GetAttendanceByFamilyIdAndDate(person.FamilyId.GetValueOrDefault(),
                                                                   DateTime.Today);
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DisplayExceptionDetail(ex);
                    return(null);
                }), null);
            }

            return(records);
        }