Example #1
0
        private void GetDataForAdultListFromService(string targetDepartment)
        {
            try
            {
                List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

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

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

                    if (targetDepartment.Equals(Departments.MOPS))
                    {
                        people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(
                            Departments.Adult, "MOPS Adults");
                    }
                    if (targetDepartment.Equals(Departments.LadiesBibleStudy))
                    {
                        people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(
                            Departments.Adult, "Ladies Bible Study Adults");
                    }
                    else
                    {
                        people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(
                            Departments.Adult, "Adult");
                    }
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.AdultsDataContext =
                        new ObservableCollection <CACCCheckInDb.PeopleWithDepartmentAndClassView>(
                            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);
            }
        }
Example #2
0
        private void GetDataForTeacherListFromService(string departmentName, string className)
        {
            List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

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

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

                people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(departmentName,
                                                                                   className);
            }

            var filteredPeople = (from p in people
                                  where p.ClassRole.Equals(ClassRoles.Teacher)
                                  select p).ToList();

            Debug.Assert(View != null);
            View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                            new DispatcherOperationCallback(
                                                delegate(object arg)
            {
                View.TeachersDataContext =
                    new ObservableCollection <CACCCheckInDb.PeopleWithDepartmentAndClassView>(
                        filteredPeople);
                return(null);
            }), null);
        }
        private void GetDataForClassListFromService(string departmentName, string className, bool fromList)
        {
            try
            {
                List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

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

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

                    people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(
                        departmentName, className);
                }

                logger.Debug("Filtering people to only show Class Members and NOT Teachers.");
                var filteredPeople = new ObservableCollection <CACCCheckInDb.PeopleWithDepartmentAndClassView>(
                    (from p in people
                     where p.ClassRole.Equals(ClassRoles.Member)
                     select p).ToList());

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    if (fromList)
                    {
                        View.ClassFromListDataContext = filteredPeople;
                    }
                    else
                    {
                        View.ClassToListDataContext = filteredPeople;
                    }
                    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 GetPeopleFromService()
        {
            try
            {
                List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

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

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

                    // We retrieve just the Adult members here.
                    people = proxy.GetPeopleWithDepartmentAndClassByDepartmentAndClass(Departments.Adult,
                                                                                       "MOPS Adults");
                }

                // Filter the list of adults to make sure we only get Member records. If we
                // don't do this, it is possible we might get multiple records for people
                // who are serve in Member and Teacher class roles.
                var filteredPeople = (from p in people
                                      where p.ClassRole.Equals(ClassRoles.Member)
                                      select p).ToList();

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