private void GetDepartmentClassesFromService(Guid departmentId)
        {
            try
            {
                List <CACCCheckInDb.Class> classes = null;

                logger.Debug("Retrieving GetClassesByDeptId from CACCCheckInServiceProxy");

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

                    classes = proxy.GetClassesByDeptId(departmentId);
                }

                // Add a bogus class to the list, this will be used
                // so user can select it to signify default
                classes.Insert(0, new CACCCheckInDb.Class
                {
                    Name = String.Empty,
                    Id   = new Guid("00000000-0000-0000-0000-000000000000")
                });

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DepartmentClassesDataContext = classes;
                    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 GetDataForClassComboFromService(Guid departmentId, bool fromCombo)
        {
            try
            {
                List <CACCCheckInDb.Class> classes = null;

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

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

                    classes = proxy.GetClassesByDeptId(departmentId);
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    if (fromCombo)
                    {
                        View.ClassFromDataContext = classes;
                    }
                    else
                    {
                        View.ClassToDataContext = classes;
                    }
                    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);
            }
        }
Пример #3
0
        private void GetDepartmentClassesFromService(Guid departmentId)
        {
            try
            {
                CACCCheckInDb.Classes classes = null;

                logger.Debug("Retrieving GetClassesByDeptId from CACCCheckInServiceProxy");

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

                    classes = new CACCCheckInDb.Classes(proxy.GetClassesByDeptId(departmentId));
                    classes.CollectionChanged +=
                        new NotifyCollectionChangedEventHandler(ClassesCollectionChanged);
                    classes.ItemEndEdit +=
                        new CACCCheckInDb.ItemEndEditEventHandler(ClassesItemEndEdit);
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.ClassesDataContext = classes;
                    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);
            }
        }
Пример #4
0
        private void GetUnassignedClassesFromService()
        {
            try
            {
                CACCCheckInDb.ClassBindingList classes = null;

                logger.Debug("Retrieving GetClassesByDeptId from CACCCheckInServiceProxy");

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

                    classes = new CACCCheckInDb.ClassBindingList(proxy.GetClassesByDeptId(new Nullable <Guid>()));
                }

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