コード例 #1
0
        private void GetFamilyFromService(CACCCheckInDb.Person person)
        {
            try
            {
                CACCCheckInDb.People people = null;

                if (person != null)
                {
                    logger.Debug("Retrieving GetPeopleByFamilyId from CACCCheckInService");

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

                        if (person.FamilyId.HasValue)
                        {
                            people = new CACCCheckInDb.People(
                                proxy.GetPeopleByFamilyId(person.FamilyId.Value));

                            people.CollectionChanged +=
                                new NotifyCollectionChangedEventHandler(FamilyCollectionChanged);
                            people.ItemEndEdit +=
                                new CACCCheckInDb.ItemEndEditEventHandler(PeopleItemEndEdit);
                        }
                    }
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.FamilyDataContext = 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);
            }
        }
コード例 #2
0
        private void GetPeopleByDeptIdAndClassIdFromService(Guid departmentId, Guid classId)
        {
            try
            {
                CACCCheckInDb.People people = null;

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

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

                    people = new CACCCheckInDb.People(proxy.GetPeopleByDeptIdAndClassId(
                                                          departmentId, classId));
                    people.CollectionChanged +=
                        new NotifyCollectionChangedEventHandler(PeopleCollectionChanged);
                    people.ItemEndEdit +=
                        new CACCCheckInDb.ItemEndEditEventHandler(PeopleItemEndEdit);
                }

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