Ejemplo n.º 1
0
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            this.importantPartSource = new EntityList <ProductManager.Web.Model.important_part>(this.productDomainContext.important_parts);
            this.importantPartLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.important_part>(
                this.LoadImportantPartEntities,
                this.LoadImportantPartCompleted);
            this.importantPartView = new DomainCollectionView <ProductManager.Web.Model.important_part>(this.importantPartLoader, this.importantPartSource);
            using (this.importantPartView.DeferRefresh())
            {
                this.importantPartView.MoveToFirstPage();
            }
            IsBusy = false;
        }
        public LinkFileViewModel(ChildWindow aChildWindow, Dictionary <int, FileTypeEntity> aFileTypeDictionary)
        {
            documentManagerContext        = new Web.DocumentManagerDomainContext();
            childWindow                   = aChildWindow;
            SelectTaxPayerDocumentEntitis = new ObservableCollection <TaxPayerDocumentEntity>();
            TaxPayerEntityList            = new ObservableCollection <TaxPayerEntity>();
            TaxPayerEntityLinkList        = new ObservableCollection <TaxPayerEntity>();
            TaxPayerDocumentEntityList    = new ObservableCollection <TaxPayerDocumentEntity>();
            FileTypeEntityDictionary      = aFileTypeDictionary;
            GroupID          = 1;
            OnOK             = new DelegateCommand(OnOKCommand, CanOKCommand);
            OnCancel         = new DelegateCommand(OnCancelCommand);
            OnReflash        = new DelegateCommand(OnReflashCommand);
            OnAddToTaxPayer  = new DelegateCommand(OnAddToTaxPayerCommand);
            OnRemoveTaxPayer = new DelegateCommand(OnRemoveTaxPayerCommand);

            taxPayerSource = new EntityList <DocumentManager.Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader <DocumentManager.Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                LoadOperationTaxPayerCompleted
                );
            taxPayerView = new DomainCollectionView <DocumentManager.Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            taxPayerDocumentSource = new EntityList <DocumentManager.Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader <DocumentManager.Web.Model.taxpayerdocument>(
                LoadTaxPayerDocumentEntities,
                LoadOperationTaxPayerDocumentCompleted
                );
            taxPayerDocumentView = new DomainCollectionView <DocumentManager.Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
        public LinkFileViewModel(ChildWindow aChildWindow, Dictionary<int, FileTypeEntity> aFileTypeDictionary)
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();
            childWindow = aChildWindow;
            SelectTaxPayerDocumentEntitis = new ObservableCollection<TaxPayerDocumentEntity>();
            TaxPayerEntityList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerEntityLinkList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerDocumentEntityList = new ObservableCollection<TaxPayerDocumentEntity>();
            FileTypeEntityDictionary = aFileTypeDictionary;
            GroupID = 1;
            OnOK = new DelegateCommand(OnOKCommand, CanOKCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);
            OnReflash = new DelegateCommand(OnReflashCommand);
            OnAddToTaxPayer = new DelegateCommand(OnAddToTaxPayerCommand);
            OnRemoveTaxPayer = new DelegateCommand(OnRemoveTaxPayerCommand);

            taxPayerSource = new EntityList<DocumentManager.Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                LoadOperationTaxPayerCompleted
                );
            taxPayerView = new DomainCollectionView<DocumentManager.Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            taxPayerDocumentSource = new EntityList<DocumentManager.Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayerdocument>(
                LoadTaxPayerDocumentEntities,
                LoadOperationTaxPayerDocumentCompleted
                );
            taxPayerDocumentView = new DomainCollectionView<DocumentManager.Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
        public DocumentManagerViewModel()
        {
            TaxPayerList                 = new ObservableCollection <TaxPayerEntity>();
            TaxPayerTypeList             = new ObservableCollection <TaxPayerTypeEntity>();
            TaxPayerTypeEntityDictionary = new Dictionary <int, TaxPayerTypeEntity>();
            FileTypeList                 = new ObservableCollection <FileTypeEntity>();
            FileTypeDictionary           = new Dictionary <int, FileTypeEntity>();
            UserEntityDictionary         = new Dictionary <int, UserEntity>();

            DocumentViewModel = new DocumentViewModel();
            DocumentViewModel.BeginLoadings  += BeginLoading;
            DocumentViewModel.FinishLoadings += FinishLoading;

            documentManagerContext = new DocumentManager.Web.DocumentManagerDomainContext();
            OnAddTaxPayer          = new DelegateCommand(onAddTaxPayer);
            OnAddProject           = new DelegateCommand(onAddProject, canAddProject);
            OnModifyTaxPayer       = new DelegateCommand(onModifyTaxPayer, canModifyTaxPayer);
            OnDeleteTaxPayer       = new DelegateCommand(onDeleteTaxPayer, canDeleteTacPayer);

            OnRefresh         = new DelegateCommand(onRefresh);
            OnDoubleClickList = new DelegateCommand(onDoubleClickList);

            taxPayerDocumentSource = new EntityList <Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader <Web.Model.taxpayerdocument>(
                LoadTaxPayerDocument,
                LoadTaxPayerDocument_Complete
                );
            taxPayerDocumentView = new DomainCollectionView <Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
        /// <summary>
        /// Initializes a new instance of the CarsListViewModel class.
        /// </summary>
        public CarsListViewModel()
        {
            this._source = new EntityList<Car>(this._context.Cars);
            this._loader = new DomainCollectionViewLoader<Car>(
                                    this.LoadCars,
                                    this.OnLoadCarsCompleted);
            this._view = new DomainCollectionView<Car>(this._loader, this._source);

            #region DesignerProperties.IsInDesignTool
            // Swap out the loader for design-time scenarios
            if (IsInDesignMode)
            {
                DesignCarsLoader loader = new DesignCarsLoader();
                this._view = new DomainCollectionView<Car>(loader, loader.Source);
            }
            #endregion

            // Go back to the first page when the sorting changes
            INotifyCollectionChanged notifyingSortDescriptions =
                (INotifyCollectionChanged)this.CollectionView.SortDescriptions;
            notifyingSortDescriptions.CollectionChanged +=
                (sender, e) => this._view.MoveToFirstPage();

            this.Init();
            this.LoadView();

            //TO DO:Implement LoadNomenclatures method
            //this.LoadNomenclatures();
        }
        public LinkResponsePersonModel(ChildWindow aChildWindow
                                      , ProductDomainContext aProductDomainContext
                                      , Dictionary<int, DepartmentEntity> aDepartmentEntityDictionary
                                      , Dictionary<String, UserEntity> aUserEntityDictionary)
        {
            ProductDomainContext = aProductDomainContext;
            childWidow = aChildWindow;
            DepartmentEntityDictionary = aDepartmentEntityDictionary;
            UserEntityDictionary = aUserEntityDictionary;

            ProjectEntityList = new ObservableCollection<ProjectEntity>();
            ProjectLinkEntityList = new ObservableCollection<ProjectEntity>();
            ProjectResponsibleEntityList = new ObservableCollection<ProjectResponsibleEntity>();
            ProjectResponsibleEntityALLList = new ObservableCollection<ProjectResponsibleEntity>();

            OnReflash = new DelegateCommand(OnReflashCommand);
            OnAddToProject = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);
            OnOk = new DelegateCommand(OnOkCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);

            projectSource = new EntityList<ProductManager.Web.Model.project>(ProductDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView<ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectResponsibSource = new EntityList<ProductManager.Web.Model.project_responsible>(ProductDomainContext.project_responsibles);
            projectResponsibLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_responsible>(
                LoadProjectResponseEntities,
                LoadOperationProjectResponseCompleted
                );
            projectResponsibleView = new DomainCollectionView<ProductManager.Web.Model.project_responsible>(projectResponsibLoader, projectResponsibSource);
        }
Ejemplo n.º 7
0
        public LinkFileViewModel(string aManufactureNumber, ObservableCollection <ProjectEntity> aProjectEntityList,
                                 Dictionary <int, DepartmentEntity> aDepartmentDictionary,
                                 Dictionary <int, UserEntity> aUserEntityDictionary,
                                 Dictionary <int, FileTypeEntity> aFileTypeEntityDictionary)
        {
            ManufactureNumber = aManufactureNumber;

            ProjectEntityList     = new ObservableCollection <ProjectEntity>();
            ProjectLinkEntityList = new ObservableCollection <ProjectEntity>();

            ProjectFilesEntityList      = new ObservableCollection <ProjectFilesEntity>();
            ProductDomainContextForFile = new ProductDomainContext();
            DepartmentDictionary        = aDepartmentDictionary;
            UserEntityDictionary        = aUserEntityDictionary;
            FileTypeEntityDictionary    = aFileTypeEntityDictionary;

            OnReflash = new DelegateCommand(OnReflashCommand);

            OnAddToProject  = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);

            projectSource = new EntityList <ProductManager.Web.Model.project>(ProductDomainContextForFile.projects);
            projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView <ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectFileSource = new EntityList <ProductManager.Web.Model.project_files>(ProductDomainContextForFile.project_files);
            projectFileLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project_files>(
                LoadProjectFileEntities,
                loadOperationProjectFiles_Completed
                );
            projectFileView = new DomainCollectionView <ProductManager.Web.Model.project_files>(projectFileLoader, projectFileSource);
        }
        private void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (Web.Model.user user in loadOperation.Entities)
            {
                UserEntity lUserEntity = new UserEntity();
                lUserEntity.User = user;
                lUserEntity.Update();
                UserEntityDictionary.Add(lUserEntity.UserId, lUserEntity);
            }
            DocumentViewModel.UserEntityDictionary = UserEntityDictionary;

            taxPayerSource = new EntityList <Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader <Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                loadOperation_Completed);
            taxPayerView = new DomainCollectionView <Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            TaxPayerSearch.taxPayerView = taxPayerView;

            using (this.taxPayerView.DeferRefresh())
            {
                this.taxPayerView.MoveToFirstPage();
            }
        }
Ejemplo n.º 9
0
        private void LoadOperationProjectResponsibleCompleted(LoadOperation <project_responsible> aLoadOperation)
        {
            responsibleManufactureCollection.Clear();
            foreach (project_responsible pr in aLoadOperation.Entities)
            {
                responsibleManufactureCollection.Add(pr.manufacture_number);
            }

            /*
             * if (0 == responsibleManufactureCollection.Count)
             * {
             *  IsBusy = false;
             *  return;
             * }
             */
            planManagerDomainContext.projects.Clear();
            projectSource = new EntityList <project>(planManagerDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader <project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted);
            projectView = new DomainCollectionView <project>(projectLoader, projectSource);
            using (projectView.DeferRefresh())
            {
                projectView.MoveToFirstPage();
            }
        }
Ejemplo n.º 10
0
        private void loadOperationProductPartType_Completed(object sender, EventArgs e)
        {
            ProductPartTypeEntityList.Clear();
            ProductPartTypeDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.product_part_type product_part_type in loadOperation.Entities)
            {
                ProductPartTypeEntity productPartTypeEntity = new ProductPartTypeEntity();
                productPartTypeEntity.ProductPartType = product_part_type;
                productPartTypeEntity.Update();
                ProductPartTypeEntityList.Add(productPartTypeEntity);
                ProductPartTypeDictionary.Add(productPartTypeEntity.ProductPartTypeID, productPartTypeEntity);
            }

            this.productPartTimeSource = new EntityList <ProductManager.Web.Model.product_part_time>(this.ProductDomainContext.product_part_times);
            this.productPartTimeLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.product_part_time>(
                this.LoadProductPartTimeEntities,
                this.LoadOperationProductPartTimeCompleted);
            this.productPartTimeView = new DomainCollectionView <ProductManager.Web.Model.product_part_time>(this.productPartTimeLoader, this.productPartTimeSource);
            using (this.CollectionProductPartTimeView.DeferRefresh())
            {
                this.productPartTimeView.MoveToFirstPage();
            }
        }
        public LinkFileViewModel( string aManufactureNumber, ObservableCollection<ProjectEntity> aProjectEntityList,
                    Dictionary<int, DepartmentEntity> aDepartmentDictionary,
                    Dictionary<int, UserEntity> aUserEntityDictionary,
                    Dictionary<int, FileTypeEntity> aFileTypeEntityDictionary)
        {
            ManufactureNumber = aManufactureNumber;

            ProjectEntityList = new ObservableCollection<ProjectEntity>();
            ProjectLinkEntityList = new ObservableCollection<ProjectEntity>();

            ProjectFilesEntityList = new ObservableCollection<ProjectFilesEntity>();
            ProductDomainContextForFile = new ProductDomainContext();
            DepartmentDictionary = aDepartmentDictionary;
            UserEntityDictionary = aUserEntityDictionary;
            FileTypeEntityDictionary = aFileTypeEntityDictionary;

            OnReflash = new DelegateCommand(OnReflashCommand);

            OnAddToProject = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);

            projectSource = new EntityList<ProductManager.Web.Model.project>(ProductDomainContextForFile.projects);
            projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView<ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectFileSource = new EntityList<ProductManager.Web.Model.project_files>(ProductDomainContextForFile.project_files);
            projectFileLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_files>(
                LoadProjectFileEntities,
                loadOperationProjectFiles_Completed
                );
            projectFileView = new DomainCollectionView<ProductManager.Web.Model.project_files>(projectFileLoader, projectFileSource);
        }
        private void loadOperationTaxPayerType_Completed(object sender, EventArgs e)
        {
            TaxPayerTypeList.Clear();
            TaxPayerTypeEntityDictionary.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (Web.Model.taxpayertype taxpayertype in loadOperation.Entities)
            {
                TaxPayerTypeEntity lTaxPayerTypeEntity = new TaxPayerTypeEntity();
                lTaxPayerTypeEntity.TaxPayerType = taxpayertype;
                lTaxPayerTypeEntity.Update();
                TaxPayerTypeList.Add(lTaxPayerTypeEntity);
                TaxPayerTypeEntityDictionary.Add(lTaxPayerTypeEntity.TaxPayerTypeId, lTaxPayerTypeEntity);
            }

            taxPayerSource = new EntityList <Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader <Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                loadOperation_Completed);
            taxPayerView = new DomainCollectionView <Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            using (this.taxPayerView.DeferRefresh())
            {
                this.taxPayerView.MoveToFirstPage();
            }
        }
        void loadOperationFileType_Completed(object sender, EventArgs e)
        {
            FileTypeEntityDictionary.Clear();
            FileTypeEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.filetype filetype in loadOperation.Entities)
            {
                FileTypeEntity fileTypeEntity = new FileTypeEntity();
                fileTypeEntity.FileType = filetype;
                fileTypeEntity.Update();
                FileTypeEntityDictionary.Add(fileTypeEntity.FileTypeID, fileTypeEntity);
                FileTypeEntityList.Add(fileTypeEntity);
            }

            this.prjectSource  = new EntityList <ProductManager.Web.Model.project>(this.ProductDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView <ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                //this.projectView.PageSize = 5;
                this.projectView.MoveToFirstPage();
            }
            this.IsBusy = false;
        }
Ejemplo n.º 14
0
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                departmentIdNameDictionary.Add(departmentEntity.DepartmentID, departmentEntity.DepartmentName);
            }

            planManagerDomainContext.projects.Clear();

            this.prjectSource  = new EntityList <ProductManager.Web.Model.project>(this.planManagerDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView <ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }
            //LoadOperation<ProductManager.Web.Model.project> loadOperationProject =
            //    planManagerDomainContext.Load<project>(planManagerDomainContext.GetProjectQuery());
            //loadOperationProject.Completed += loadOperationProject_Completed;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the CarsListViewModel class.
        /// </summary>
        public CarsListViewModel()
        {
            this._source = new EntityList <Car>(this._context.Cars);
            this._loader = new DomainCollectionViewLoader <Car>(
                this.LoadCars,
                this.OnLoadCarsCompleted);
            this._view = new DomainCollectionView <Car>(this._loader, this._source);

            #region DesignerProperties.IsInDesignTool
            // Swap out the loader for design-time scenarios
            if (IsInDesignMode)
            {
                DesignCarsLoader loader = new DesignCarsLoader();
                this._view = new DomainCollectionView <Car>(loader, loader.Source);
            }
            #endregion

            // Go back to the first page when the sorting changes
            INotifyCollectionChanged notifyingSortDescriptions =
                (INotifyCollectionChanged)this.CollectionView.SortDescriptions;
            notifyingSortDescriptions.CollectionChanged +=
                (sender, e) => this._view.MoveToFirstPage();

            this.Init();
            this.LoadView();

            //TO DO:Implement LoadNomenclatures method
            //this.LoadNomenclatures();
        }
        public DocumentManagerViewModel()
        {
            TaxPayerList = new ObservableCollection<TaxPayerEntity>();
            TaxPayerTypeList = new ObservableCollection<TaxPayerTypeEntity>();
            TaxPayerTypeEntityDictionary = new Dictionary<int, TaxPayerTypeEntity>();
            FileTypeList = new ObservableCollection<FileTypeEntity>();
            FileTypeDictionary = new Dictionary<int, FileTypeEntity>();
            UserEntityDictionary = new Dictionary<int, UserEntity>();

            DocumentViewModel = new DocumentViewModel();
            DocumentViewModel.BeginLoadings += BeginLoading;
            DocumentViewModel.FinishLoadings += FinishLoading;

            documentManagerContext = new DocumentManager.Web.DocumentManagerDomainContext();
            OnAddTaxPayer = new DelegateCommand(onAddTaxPayer);
            OnAddProject = new DelegateCommand(onAddProject, canAddProject);
            OnModifyTaxPayer = new DelegateCommand(onModifyTaxPayer, canModifyTaxPayer);
            OnDeleteTaxPayer = new DelegateCommand(onDeleteTaxPayer, canDeleteTacPayer);

            OnRefresh = new DelegateCommand(onRefresh);
            OnDoubleClickList = new DelegateCommand(onDoubleClickList);

            taxPayerDocumentSource = new EntityList<Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader<Web.Model.taxpayerdocument>(
                LoadTaxPayerDocument,
                LoadTaxPayerDocument_Complete
                );
            taxPayerDocumentView = new DomainCollectionView<Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the PointsViewModelNew class.
        /// </summary>
        public MapViewModel()
        {
            source = new EntityList<Point>(context.Points);
            loader = new DomainCollectionViewLoader<Point>(LoadPoints, OnLoadPointsCompleted);
            view = new DomainCollectionView<Point>(loader, source);

            #region DesignerProperties.IsInDesignTool
            // Swap out the loader for design-time scenarios
            if (IsInDesignMode)
            {
                DesignPointsLoader designLoader = new DesignPointsLoader();
                this.view = new DomainCollectionView<Point>(designLoader, designLoader.Source);
            }
            #endregion

            //Move to first page when SortDescriptions is changed
            INotifyCollectionChanged notifySortDescriptions =
                (INotifyCollectionChanged)this.view.SortDescriptions;
            notifySortDescriptions.CollectionChanged +=
                (s, e) => view.MoveToFirstPage();

            using (this.View.DeferRefresh())
            {
                this.View.PageSize = 10;
                this.View.MoveToFirstPage();
            }

            this.RegisterMessages();
        }
Ejemplo n.º 18
0
 public ProductEntity()
 {
     this.productPartTimeSource = new EntityList<ProductManager.Web.Model.product_part_time>(this.ProductDomainContext.product_part_times);
     this.productPartTimeLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product_part_time>(
         this.LoadProductPartTime,
         this.LoadOperationProductPartTimeCompleted
         );
     this.productPartTimeView = new DomainCollectionView<ProductManager.Web.Model.product_part_time>(this.productPartTimeLoader, this.productPartTimeSource);
 }
Ejemplo n.º 19
0
 public ProductEntity()
 {
     this.productPartTimeSource = new EntityList <ProductManager.Web.Model.product_part_time>(this.ProductDomainContext.product_part_times);
     this.productPartTimeLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.product_part_time>(
         this.LoadProductPartTime,
         this.LoadOperationProductPartTimeCompleted
         );
     this.productPartTimeView = new DomainCollectionView <ProductManager.Web.Model.product_part_time>(this.productPartTimeLoader, this.productPartTimeSource);
 }
Ejemplo n.º 20
0
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (department department in loadOperation.Entities)
            {
                departmentIdNameDictionary.Add(department.department_id, department.department_name);
            }

            productDomainContext.project_responsibles.Clear();
            projectResponsibleSource = new EntityList <project_responsible>(productDomainContext.project_responsibles);
            projectResponsibleLoader = new DomainCollectionViewLoader <project_responsible>(
                LoadProjectResponsibleEntities,
                LoadOperationProjectResponsibleCompleted);
            projectResponsibleView = new DomainCollectionView <project_responsible>(projectResponsibleLoader, projectResponsibleSource);
            using (projectResponsibleView.DeferRefresh())
            {
                projectResponsibleView.MoveToFirstPage();
            }

            productDomainContext.questiontraces.Clear();
            questionTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceLoader = new DomainCollectionViewLoader <questiontrace>(
                LoadQuestionTraceEntities,
                LoadOperationQuestionTraceCompleted
                );
            questionTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(questionTraceLoader, questionTraceSource);
            using (questionTraceView.DeferRefresh())
            {
                questionTraceView.MoveToFirstPage();
            }

            questionTraceTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceTraceLoader = new DomainCollectionViewLoader <questiontrace>(
                LoadQuestionTraceTraceEntities,
                LoadOperationQuestionTraceTraceCompleted
                );
            questionTraceTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(questionTraceTraceLoader, questionTraceTraceSource);
            using (questionTraceTraceView.DeferRefresh())
            {
                questionTraceTraceView.MoveToFirstPage();
            }

            planOutlineFileSource  = new EntityList <ProductManager.Web.Model.plan_outline_files>(planManagerDomainContext.plan_outline_files);
            planOutlineFilesLoader = new DomainCollectionViewLoader <plan_outline_files>(
                LoadPlanOutLineEntities,
                LoadPlanOutLineEntitiesCompleted
                );
            planOutlineFilesView = new DomainCollectionView <ProductManager.Web.Model.plan_outline_files>(planOutlineFilesLoader, planOutlineFileSource);

            using (planOutlineFilesView.DeferRefresh())
            {
                planOutlineFilesView.MoveToFirstPage();
            }
        }
        public StandBookViewModel()
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();

            StandBookEntityList = new ObservableCollection<StandBookEntity>();

            standbookSource = new EntityList<Web.Model.standbook>(documentManagerContext.standbooks);
            standbookLoader = new DomainCollectionViewLoader<Web.Model.standbook>(
                LoadStandBook,
                LoadStandBook_Complete
                );
            standbookView = new DomainCollectionView<Web.Model.standbook>(standbookLoader, standbookSource);
        }
Ejemplo n.º 22
0
        public StandBookViewModel()
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();

            StandBookEntityList = new ObservableCollection <StandBookEntity>();

            standbookSource = new EntityList <Web.Model.standbook>(documentManagerContext.standbooks);
            standbookLoader = new DomainCollectionViewLoader <Web.Model.standbook>(
                LoadStandBook,
                LoadStandBook_Complete
                );
            standbookView = new DomainCollectionView <Web.Model.standbook>(standbookLoader, standbookSource);
        }
        public void LoadData()
        {
            IsBusy = true;

            this.userSource = new EntityList <DocumentManager.Web.Model.user>(this.documentManagerContext.users);
            this.userLoader = new DomainCollectionViewLoader <DocumentManager.Web.Model.user>(
                this.LoadUserEntities,
                this.loadOperation_Completed);
            this.userView = new DomainCollectionView <DocumentManager.Web.Model.user>(this.userLoader, this.userSource);

            using (this.userView.DeferRefresh())
            {
                this.userView.MoveToFirstPage();
            }
        }
Ejemplo n.º 24
0
        public void LoadData()
        {
            IsBusy = true;

            this.taxPayerTypeSource = new EntityList <DocumentManager.Web.Model.taxpayertype>(this.documentManagerContext.taxpayertypes);
            this.taxPayerTypeLoader = new DomainCollectionViewLoader <DocumentManager.Web.Model.taxpayertype>(
                this.LoadTaxPayerTypeEntities,
                this.loadOperation_Completed);
            this.taxPayerTypeView = new DomainCollectionView <DocumentManager.Web.Model.taxpayertype>(this.taxPayerTypeLoader, this.taxPayerTypeSource);

            using (this.taxPayerTypeView.DeferRefresh())
            {
                this.taxPayerTypeView.MoveToFirstPage();
            }
        }
Ejemplo n.º 25
0
        public QuestionTraceListViewModel()
        {
            QuestionTraceEntityList = new ObservableCollection <QuestionTraceEntity>();
            DepartmentEntityList    = new ObservableCollection <DepartmentEntity>();

            this.questionTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(this.ProductDomainContext.questiontraces);
            this.questionTraceLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.questiontrace>(
                this.LoadQuestionTraceEntities,
                this.LoadOperationQuestionTraceCompleted);
            this.questionTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(this.questionTraceLoader, this.questionTraceSource);

            DepartmentEntityDictionary = new Dictionary <int, DepartmentEntity>();
            UserEntityDictionary       = new Dictionary <int, UserEntity>();
            OnSearch = new DelegateCommand(OnSearchCommand);
        }
        public QuestionTraceListViewModel()
        {
            QuestionTraceEntityList = new ObservableCollection<QuestionTraceEntity>();
            DepartmentEntityList = new ObservableCollection<DepartmentEntity>();

            this.questionTraceSource = new EntityList<ProductManager.Web.Model.questiontrace>(this.ProductDomainContext.questiontraces);
            this.questionTraceLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.questiontrace>(
                this.LoadQuestionTraceEntities,
                this.LoadOperationQuestionTraceCompleted);
            this.questionTraceView = new DomainCollectionView<ProductManager.Web.Model.questiontrace>(this.questionTraceLoader, this.questionTraceSource);

            DepartmentEntityDictionary = new Dictionary<int, DepartmentEntity>();
            UserEntityDictionary = new Dictionary<int, UserEntity>();
            OnSearch = new DelegateCommand(OnSearchCommand);
        }
        public void LoadData()
        {
            IsBusy = true;

            fileTypeSource = new EntityList <Web.Model.filetype>(documentManagerContext.filetypes);
            fileTypeLoader = new DomainCollectionViewLoader <Web.Model.filetype>(
                loadFileTypeEntities,
                loadOperation_Completed);
            fileTypeView = new DomainCollectionView <Web.Model.filetype>(fileTypeLoader, fileTypeSource);

            using (this.fileTypeView.DeferRefresh())
            {
                fileTypeView.MoveToFirstPage();
            }
        }
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            ProjectTotalMonay.Clear();
            ProjectPartMoney.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();

                string lProjectName = lStandBookEntity.ProjectName;

                decimal lTotalMoney;
                if (!ProjectTotalMonay.TryGetValue(lProjectName, out lTotalMoney))
                {
                    ProjectTotalMonay.Add(lProjectName, lStandBookEntity.TotalMoney.GetValueOrDefault(0));
                }

                decimal lPartMoney;
                if (ProjectPartMoney.TryGetValue(lProjectName, out lPartMoney))
                {
                    ProjectPartMoney[lProjectName] += lStandBookEntity.ThisPartMoney.GetValueOrDefault(0);
                }
                else
                {
                    ProjectPartMoney.Add(lProjectName, lStandBookEntity.ThisPartMoney.GetValueOrDefault(0));
                }


                //TaxPayerTypeEntityDictionary.Add(lTaxPayerTypeEntity.TaxPayerTypeId, lTaxPayerTypeEntity);
            }

            standBookSource = new EntityList <Web.Model.standbook>(documentManagerContext.standbooks);
            standBookLoader = new DomainCollectionViewLoader <Web.Model.standbook>(
                LoadStandBookEntities,
                loadOperation_Completed);
            standBookView = new DomainCollectionView <Web.Model.standbook>(standBookLoader, standBookSource);


            using (this.standBookView.DeferRefresh())
            {
                this.standBookView.MoveToFirstPage();
            }
        }
Ejemplo n.º 29
0
		/// <summary>
		/// Initializes a new instance of the TestViewModel class.
		/// </summary>
		public TestViewModel()
		{
			this._source = new EntityList<TEntity>(this._context.GetEntitySet<TEntity>);
			this._loader = new DomainCollectionViewLoader<TEntity>(
				 this.LoadSampleEntities,
				 this.OnLoadSampleEntitiesCompleted);
			this._view = new DomainCollectionView<TEntity>(this._loader, this._source);
			INotifyCollectionChanged notifyingSortDescriptions =
		(INotifyCollectionChanged)this.CollectionView.SortDescriptions;
			notifyingSortDescriptions.CollectionChanged +=
			  (sender, e) => this._view.MoveToFirstPage();
			using (this.CollectionView.DeferRefresh())
			{
				this._view.PageSize = 10;
				this._view.MoveToFirstPage();
			}
		}
        public DocumentViewModel()
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();
            TaxPayerDocumentList   = new ObservableCollection <TaxPayerDocumentEntity>();

            OnAddSignalDocument  = new DelegateCommand(onAddSignalDocument, canAddSignalDocument);
            OnAddMultiDocument   = new DelegateCommand(onAddMultiDocument, canAddMultiDocument);
            OnMergeImageDocument = new DelegateCommand(onMergeImages, canMergeImages);
            OnLinkDocument       = new DelegateCommand(onLinkDocument, canLinkDocument);
            OnDeleteDocument     = new DelegateCommand(onDeleteDocument, canDeleteDocument);

            taxPayerDocumentSource = new EntityList <Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader <Web.Model.taxpayerdocument>(
                LoadTaxPayerDocument,
                LoadTaxPayerDocument_Complete
                );
            taxPayerDocumentView = new DomainCollectionView <Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
        public DocumentViewModel()
        {
            documentManagerContext = new Web.DocumentManagerDomainContext();
            TaxPayerDocumentList = new ObservableCollection<TaxPayerDocumentEntity>();

            OnAddSignalDocument = new DelegateCommand(onAddSignalDocument, canAddSignalDocument);
            OnAddMultiDocument = new DelegateCommand(onAddMultiDocument, canAddMultiDocument);
            OnMergeImageDocument = new DelegateCommand(onMergeImages, canMergeImages);
            OnLinkDocument = new DelegateCommand(onLinkDocument, canLinkDocument);
            OnDeleteDocument = new DelegateCommand(onDeleteDocument, canDeleteDocument);

            taxPayerDocumentSource = new EntityList<Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
            taxPayerDocumentLoader = new DomainCollectionViewLoader<Web.Model.taxpayerdocument>(
                LoadTaxPayerDocument,
                LoadTaxPayerDocument_Complete
                );
            taxPayerDocumentView = new DomainCollectionView<Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
        }
Ejemplo n.º 32
0
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            UserEntity userEntityZero = new UserEntity();

            userEntityZero.UserID    = -2;
            userEntityZero.CUserName = "******";
            UserEntityList.Add(userEntityZero);


            this.prjectSource  = new EntityList <ProductManager.Web.Model.project>(this.ProductDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView <ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }

            this.questionTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(this.ProductDomainContext.questiontraces);
            this.questionTraceLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.questiontrace>(
                this.LoadQuestionTraceEntities,
                this.LoadOperationQuestionTraceCompleted);
            this.questionTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(this.questionTraceLoader, this.questionTraceSource);

            this.IsBusy = false;
        }
Ejemplo n.º 33
0
        private void DocumentTotal_Completed(object sender, EventArgs e)
        {
            IsBusy = false;
            var lValue = (System.ServiceModel.DomainServices.Client.InvokeOperation <int>)sender;

            DocumentTotal = "档案总数 : " + lValue.Value.ToString();

            UpdateChanged("DocumentTotal");

            taxPayerSource = new EntityList <Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader <Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                loadOperation_Completed);
            taxPayerView = new DomainCollectionView <Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            using (this.taxPayerView.DeferRefresh())
            {
                this.taxPayerView.MoveToFirstPage();
            }
        }
        public void LoadData()
        {
            prjectSource  = new EntityList <Web.Model.project>(ProductDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView <ProductManager.Web.Model.project>(projectLoader, prjectSource);

            projectResponsibleSource = new EntityList <Web.Model.project_responsible>(ProductDomainContext.project_responsibles);
            projectResponsibleLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project_responsible>(
                LoadProjectResponsibleEntities,
                LoadProjectResponsibleCompleted
                );
            projectResponsibleView = new DomainCollectionView <ProductManager.Web.Model.project_responsible>(projectResponsibleLoader, projectResponsibleSource);

            using (projectView.DeferRefresh())
            {
                projectView.MoveToFirstPage();
            }
        }
Ejemplo n.º 35
0
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntityDictionary.Add(user.user_name, null);
            }

            this.userSource = new EntityList <ProductManager.Web.Model.user>(this.systemManageDomainContext.users);
            this.userLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.user>(
                this.LoadUserEntities,
                this.loadOperation_Completed);
            this.userView = new DomainCollectionView <ProductManager.Web.Model.user>(this.userLoader, this.userSource);

            using (this.CollectionView.DeferRefresh())
            {
                this.userView.MoveToFirstPage();
            }
        }
        private void loadOperationProject_Completed(object sender, EventArgs e)
        {
            ProjectEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.project project in loadOperation.Entities)
            {
                ProjectEntity projectEntity = new ProjectEntity();
                projectEntity.Project = project;
                projectEntity.Update();
                ProjectEntityDictionary.Add(projectEntity.ManufactureNumber, projectEntity);
            }

            this.productSource = new EntityList <ProductManager.Web.Model.product>(this.ProductDomainContext.products);
            this.productLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.product>(
                this.LoadProductEntities,
                this.LoadOperationProductCompleted);
            this.productView = new DomainCollectionView <ProductManager.Web.Model.product>(this.productLoader, this.productSource);
            using (this.productView.DeferRefresh())
            {
                this.productView.MoveToFirstPage();
            }
        }
Ejemplo n.º 37
0
        private void LoadOperationProjectCompleted(LoadOperation <project> aLoadOperation)
        {
            projectRecentUpdateList.Clear();
            DateTime currentDateTime = DateTime.Now;

            foreach (project projectItem in aLoadOperation.Entities)
            {
                if (!projectItem.plan_update_date.HasValue)
                {
                    continue;
                }

                TimeSpan difference = projectItem.plan_update_date.Value - currentDateTime;
                if (difference.Days >= 7)
                {
                    continue;
                }

                ProjectEntity projectEntity = new ProjectEntity();
                projectEntity.Project = projectItem;
                projectEntity.Update();
                projectEntity.Project = null;
                projectRecentUpdateList.Add(projectEntity);
            }

            planManagerDomainContext.plans.Clear();

            planSource = new EntityList <plan>(planManagerDomainContext.plans);
            planLoader = new DomainCollectionViewLoader <plan>(
                LoadPlanEntities,
                LoadOperationPlanCompleted);
            planView = new DomainCollectionView <plan>(planLoader, planSource);
            using (planView.DeferRefresh())
            {
                planView.MoveToFirstPage();
            }
        }
        public LinkResponsePersonModel(ChildWindow aChildWindow
                                       , ProductDomainContext aProductDomainContext
                                       , Dictionary <int, DepartmentEntity> aDepartmentEntityDictionary
                                       , Dictionary <String, UserEntity> aUserEntityDictionary)
        {
            ProductDomainContext       = aProductDomainContext;
            childWidow                 = aChildWindow;
            DepartmentEntityDictionary = aDepartmentEntityDictionary;
            UserEntityDictionary       = aUserEntityDictionary;

            ProjectEntityList               = new ObservableCollection <ProjectEntity>();
            ProjectLinkEntityList           = new ObservableCollection <ProjectEntity>();
            ProjectResponsibleEntityList    = new ObservableCollection <ProjectResponsibleEntity>();
            ProjectResponsibleEntityALLList = new ObservableCollection <ProjectResponsibleEntity>();


            OnReflash       = new DelegateCommand(OnReflashCommand);
            OnAddToProject  = new DelegateCommand(OnAddToProjectCommand);
            OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);
            OnOk            = new DelegateCommand(OnOkCommand);
            OnCancel        = new DelegateCommand(OnCancelCommand);

            projectSource = new EntityList <ProductManager.Web.Model.project>(ProductDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted
                );
            projectView = new DomainCollectionView <ProductManager.Web.Model.project>(projectLoader, projectSource);

            projectResponsibSource = new EntityList <ProductManager.Web.Model.project_responsible>(ProductDomainContext.project_responsibles);
            projectResponsibLoader = new DomainCollectionViewLoader <ProductManager.Web.Model.project_responsible>(
                LoadProjectResponseEntities,
                LoadOperationProjectResponseCompleted
                );
            projectResponsibleView = new DomainCollectionView <ProductManager.Web.Model.project_responsible>(projectResponsibLoader, projectResponsibSource);
        }
        private void loadOperationProject_Completed(object sender, EventArgs e)
        {
            ProjectEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.project project in loadOperation.Entities)
            {
                ProjectEntity projectEntity = new ProjectEntity();
                projectEntity.Project = project;
                projectEntity.Update();
                ProjectEntityDictionary.Add(projectEntity.ManufactureNumber, projectEntity);
            }

            this.productSource = new EntityList<ProductManager.Web.Model.product>(this.ProductDomainContext.products);
            this.productLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product>(
                this.LoadProductEntities,
                this.LoadOperationProductCompleted);
            this.productView = new DomainCollectionView<ProductManager.Web.Model.product>(this.productLoader, this.productSource);
            using (this.productView.DeferRefresh())
            {
                this.productView.MoveToFirstPage();
            }
        }
        private void loadOperationProductPartType_Completed(object sender, EventArgs e)
        {
            ProductPartTypeEntityList.Clear();
            ProductPartTypeDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.product_part_type product_part_type in loadOperation.Entities)
            {
                ProductPartTypeEntity productPartTypeEntity = new ProductPartTypeEntity();
                productPartTypeEntity.ProductPartType = product_part_type;
                productPartTypeEntity.Update();
                ProductPartTypeEntityList.Add(productPartTypeEntity);
                ProductPartTypeDictionary.Add(productPartTypeEntity.ProductPartTypeID, productPartTypeEntity);
            }

            this.productPartTimeSource = new EntityList<ProductManager.Web.Model.product_part_time>(this.ProductDomainContext.product_part_times);
            this.productPartTimeLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product_part_time>(
                this.LoadProductPartTimeEntities,
                this.LoadOperationProductPartTimeCompleted);
            this.productPartTimeView = new DomainCollectionView<ProductManager.Web.Model.product_part_time>(this.productPartTimeLoader, this.productPartTimeSource);
            using (this.CollectionProductPartTimeView.DeferRefresh())
            {
                this.productPartTimeView.MoveToFirstPage();
            }
        }
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            ProjectTotalMonay.Clear();
            ProjectPartMoney.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();

                string lProjectName = lStandBookEntity.ProjectName;

                decimal lTotalMoney;
                if (!ProjectTotalMonay.TryGetValue(lProjectName, out lTotalMoney))
                {
                    ProjectTotalMonay.Add(lProjectName, lStandBookEntity.TotalMoney.GetValueOrDefault(0));
                }

                decimal lPartMoney;
                if (ProjectPartMoney.TryGetValue(lProjectName, out lPartMoney))
                {
                    ProjectPartMoney[lProjectName] += lStandBookEntity.ThisPartMoney.GetValueOrDefault(0);
                }
                else
                {
                    ProjectPartMoney.Add(lProjectName, lStandBookEntity.ThisPartMoney.GetValueOrDefault(0));
                }

                //TaxPayerTypeEntityDictionary.Add(lTaxPayerTypeEntity.TaxPayerTypeId, lTaxPayerTypeEntity);
            }

            standBookSource = new EntityList<Web.Model.standbook>(documentManagerContext.standbooks);
            standBookLoader = new DomainCollectionViewLoader<Web.Model.standbook>(
                LoadStandBookEntities,
                loadOperation_Completed);
            standBookView = new DomainCollectionView<Web.Model.standbook>(standBookLoader, standBookSource);

            using (this.standBookView.DeferRefresh())
            {
                this.standBookView.MoveToFirstPage();
            }
        }
        public void LoadData()
        {
            IsBusy = true;

            fileTypeSource = new EntityList<Web.Model.filetype>(documentManagerContext.filetypes);
            fileTypeLoader = new DomainCollectionViewLoader<Web.Model.filetype>(
                loadFileTypeEntities,
                loadOperation_Completed);
            fileTypeView = new DomainCollectionView<Web.Model.filetype>(fileTypeLoader, fileTypeSource);

            using (this.fileTypeView.DeferRefresh())
            {
                fileTypeView.MoveToFirstPage();
            }
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntityDictionary.Add(user.user_name, null);
            }

            this.userSource = new EntityList<ProductManager.Web.Model.user>(this.systemManageDomainContext.users);
            this.userLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.user>(
                this.LoadUserEntities,
                this.loadOperation_Completed);
            this.userView = new DomainCollectionView<ProductManager.Web.Model.user>(this.userLoader, this.userSource);

            using (this.CollectionView.DeferRefresh())
            {
                this.userView.MoveToFirstPage();
            }
        }
        void loadOperationFileType_Completed(object sender, EventArgs e)
        {
            FileTypeEntityDictionary.Clear();
            FileTypeEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.filetype filetype in loadOperation.Entities)
            {
                FileTypeEntity fileTypeEntity = new FileTypeEntity();
                fileTypeEntity.FileType = filetype;
                fileTypeEntity.Update();
                FileTypeEntityDictionary.Add(fileTypeEntity.FileTypeID, fileTypeEntity);
                FileTypeEntityList.Add(fileTypeEntity);
            }

            this.prjectSource = new EntityList<ProductManager.Web.Model.project>(this.ProductDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView<ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }

            this.IsBusy = false;
        }
        public void LoadData()
        {
            IsBusy = true;

            this.userSource = new EntityList<DocumentManager.Web.Model.user>(this.documentManagerContext.users);
            this.userLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.user>(
                this.LoadUserEntities,
                this.loadOperation_Completed);
            this.userView = new DomainCollectionView<DocumentManager.Web.Model.user>(this.userLoader, this.userSource);

            using (this.userView.DeferRefresh())
            {
                this.userView.MoveToFirstPage();
            }
        }
        private void OnViewAllPlanCommand()
        {
            IsBusy = true;
            currentViewType = ViewType.ViewTypeAll;

            planSource = new EntityList<plan>(planManagerDomainContext.plans);
            planLoader = new DomainCollectionViewLoader<plan>(
                LoadPlanEntities,
                LoadOperationPlanCompleted);
            planView = new DomainCollectionView<plan>(planLoader, planSource);
            using (planView.DeferRefresh())
            {
                planView.MoveToFirstPage();
            }
        }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentNameIdDictionary.Clear();
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (department department in loadOperation.Entities)
            {
                if (!departmentNameIdDictionary.Keys.Contains(department.department_name))
                {
                    departmentNameIdDictionary.Add(department.department_name, department.department_id);
                }
                departmentIdNameDictionary.Add(department.department_id, department.department_name);
            }

            planManagerDomainContext.projects.Clear();

            this.prjectSource = new EntityList<project>(this.planManagerDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader<project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView<project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }
        }
        private void OnViewSingleHistoryCommand()
        {
            IsBusy = true;
            if (!SelectProjectEntity.HasHistory)
            {
                Message.ErrorMessage("无历史计划版本");
                IsBusy = false;
                return;
            }

            currentViewType = ViewType.ViewTypeHistory;

            planSource = new EntityList<plan>(planManagerDomainContext.plans);
            planLoader = new DomainCollectionViewLoader<plan>(
                LoadPlanEntities,
                LoadOperationPlanCompleted);
            planView = new DomainCollectionView<plan>(planLoader, planSource);
            using (planView.DeferRefresh())
            {
                planView.MoveToFirstPage();
            }
        }
        private void LoadOperationProjectResponsibleCompleted(LoadOperation<project_responsible> aLoadOperation)
        {
            responsibleManufactureCollection.Clear();
            foreach (project_responsible pr in aLoadOperation.Entities)
            {
                responsibleManufactureCollection.Add(pr.manufacture_number);
            }

            /*
            if (0 == responsibleManufactureCollection.Count)
            {
                IsBusy = false;
                return;
            }
            */
            planManagerDomainContext.projects.Clear();
            projectSource = new EntityList<project>(planManagerDomainContext.projects);
            projectLoader = new DomainCollectionViewLoader<project>(
                LoadProjectEntities,
                LoadOperationProjectCompleted);
            projectView = new DomainCollectionView<project>(projectLoader, projectSource);
            using (projectView.DeferRefresh())
            {
                projectView.MoveToFirstPage();
            }
        }
        private void LoadOperationProjectCompleted(LoadOperation<project> aLoadOperation)
        {
            projectRecentUpdateList.Clear();
            DateTime currentDateTime = DateTime.Now;
            foreach (project projectItem in aLoadOperation.Entities)
            {
                if (!projectItem.plan_update_date.HasValue)
                {
                    continue;
                }

                TimeSpan difference = projectItem.plan_update_date.Value - currentDateTime;
                if (difference.Days >= 7)
                {
                    continue;
                }

                ProjectEntity projectEntity = new ProjectEntity();
                projectEntity.Project = projectItem;
                projectEntity.Update();
                projectEntity.Project = null;
                projectRecentUpdateList.Add(projectEntity);
            }

            planManagerDomainContext.plans.Clear();

            planSource = new EntityList<plan>(planManagerDomainContext.plans);
            planLoader = new DomainCollectionViewLoader<plan>(
                LoadPlanEntities,
                LoadOperationPlanCompleted);
            planView = new DomainCollectionView<plan>(planLoader, planSource);
            using (planView.DeferRefresh())
            {
                planView.MoveToFirstPage();
            }
        }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (department department in loadOperation.Entities)
            {
                departmentIdNameDictionary.Add(department.department_id, department.department_name);
            }

            productDomainContext.project_responsibles.Clear();
            projectResponsibleSource = new EntityList<project_responsible>(productDomainContext.project_responsibles);
            projectResponsibleLoader = new DomainCollectionViewLoader<project_responsible>(
                LoadProjectResponsibleEntities,
                LoadOperationProjectResponsibleCompleted);
            projectResponsibleView = new DomainCollectionView<project_responsible>(projectResponsibleLoader, projectResponsibleSource);
            using (projectResponsibleView.DeferRefresh())
            {
                projectResponsibleView.MoveToFirstPage();
            }

            productDomainContext.questiontraces.Clear();
            questionTraceSource = new EntityList<ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceLoader = new DomainCollectionViewLoader<questiontrace>(
                LoadQuestionTraceEntities,
                LoadOperationQuestionTraceCompleted
                );
            questionTraceView = new DomainCollectionView<ProductManager.Web.Model.questiontrace>(questionTraceLoader, questionTraceSource);
            using (questionTraceView.DeferRefresh())
            {
                questionTraceView.MoveToFirstPage();
            }

            questionTraceTraceSource = new EntityList<ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceTraceLoader = new DomainCollectionViewLoader<questiontrace>(
                LoadQuestionTraceTraceEntities,
                LoadOperationQuestionTraceTraceCompleted
                );
            questionTraceTraceView = new DomainCollectionView<ProductManager.Web.Model.questiontrace>(questionTraceTraceLoader, questionTraceTraceSource);
            using (questionTraceTraceView.DeferRefresh())
            {
                questionTraceTraceView.MoveToFirstPage();
            }

            planOutlineFileSource = new EntityList<ProductManager.Web.Model.plan_outline_files>(planManagerDomainContext.plan_outline_files);
            planOutlineFilesLoader = new DomainCollectionViewLoader<plan_outline_files>(
                LoadPlanOutLineEntities,
                LoadPlanOutLineEntitiesCompleted
                );
            planOutlineFilesView = new DomainCollectionView<ProductManager.Web.Model.plan_outline_files>(planOutlineFilesLoader, planOutlineFileSource);

            using (planOutlineFilesView.DeferRefresh())
            {
                planOutlineFilesView.MoveToFirstPage();
            }
        }
        private void OnViewSinglePlanCommand()
        {
            IsBusy = true;

            if (null == SelectedProjectList || SelectedProjectList.Count <= 1)
            {
                if (null == SelectProjectEntity.PlanVersionID
                                || null == SelectProjectEntity.ManufactureNumber
                                || string.Empty == SelectProjectEntity.PlanVersionID
                                || string.Empty == SelectProjectEntity.ManufactureNumber)
                {
                    Message.ErrorMessage("生产令号或版本号无效");
                    IsBusy = false;
                    return;
                }

                currentViewType = ViewType.ViewTypeSingle;
            }
            else
            {
                currentViewType = ViewType.ViewTypeMulti;
            }

            planSource = new EntityList<plan>(planManagerDomainContext.plans);
            planLoader = new DomainCollectionViewLoader<plan>(
                LoadPlanEntities,
                LoadOperationPlanCompleted);
            planView = new DomainCollectionView<plan>(planLoader, planSource);
            using (planView.DeferRefresh())
            {
                planView.MoveToFirstPage();
            }
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            this.importantPartSource = new EntityList<ProductManager.Web.Model.important_part>(this.productDomainContext.important_parts);
            this.importantPartLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.important_part>(
                this.LoadImportantPartEntities,
                this.LoadImportantPartCompleted);
            this.importantPartView = new DomainCollectionView<ProductManager.Web.Model.important_part>(this.importantPartLoader, this.importantPartSource);
            using (this.importantPartView.DeferRefresh())
            {
                this.importantPartView.MoveToFirstPage();
            }
            IsBusy = false;
        }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                departmentIdNameDictionary.Add(departmentEntity.DepartmentID, departmentEntity.DepartmentName);
            }
            IsBusy = true;

            planManagerDomainContext.projects.Clear();
            //LoadOperation<project> loadOperationProject =
            //    planManagerDomainContext.Load<project>(planManagerDomainContext.GetProjectQuery());
            //loadOperationProject.Completed += loadOperationProject_Completed;
            this.prjectSource = new EntityList<project>(this.planManagerDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader<project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView<project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }
        }
        private void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (Web.Model.user user in loadOperation.Entities)
            {
                UserEntity lUserEntity = new UserEntity();
                lUserEntity.User = user;
                lUserEntity.Update();
                UserEntityDictionary.Add(lUserEntity.UserId, lUserEntity);
            }
            DocumentViewModel.UserEntityDictionary = UserEntityDictionary;

            taxPayerSource = new EntityList<Web.Model.taxpayer>(documentManagerContext.taxpayers);
            taxPayerLoader = new DomainCollectionViewLoader<Web.Model.taxpayer>(
                LoadTaxPayerEntities,
                loadOperation_Completed);
            taxPayerView = new DomainCollectionView<Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);

            using (this.taxPayerView.DeferRefresh())
            {
                this.taxPayerView.MoveToFirstPage();
            }
        }
 public void LoadData()
 {
     IsBusy = true;
     SystemManageDomainContext = new SystemManageDomainContext();//.RejectChanges();
     ProductDomainContext = new ProductDomainContext();//.RejectChanges();
     ProductDomainContextForFile = new ProductDomainContext();//.RejectChanges();
     ProductDomainContext.PropertyChanged -= ProductDomainContext_PropertyChanged;
     ProductDomainContext.PropertyChanged += ProductDomainContext_PropertyChanged;
     selectProjectEntity = null;
     projectView = null;
     productView = null;
     projectResponsibleView = null;
     ProductEntityList.Clear();
     ProjectResponsibleEntityList.Clear();
     LoadOperation<ProductManager.Web.Model.department> loadOperationDepartment =
         SystemManageDomainContext.Load<ProductManager.Web.Model.department>(SystemManageDomainContext.GetDepartmentQuery());
     loadOperationDepartment.Completed += loadOperationDepartment_Completed;
 }
        void LoadUserProjectComplete(object sender, EventArgs e)
        {
            UserProjectEntityDictionary.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user_project user_project in loadOperation.Entities)
            {
                UserProjectEntity lUserProjectEntity = new UserProjectEntity();
                lUserProjectEntity.UserProject = user_project;
                lUserProjectEntity.Update();
                UserProjectEntity lUserProjectEntityTemp;
                if (!UserProjectEntityDictionary.TryGetValue(lUserProjectEntity.ManufactureNumber, out lUserProjectEntityTemp))
                {
                    UserProjectEntityDictionary.Add(lUserProjectEntity.ManufactureNumber, lUserProjectEntity);
                }

            }

            this.prjectSource = new EntityList<ProductManager.Web.Model.project>(this.ProductDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView<ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }

            this.productSource = new EntityList<ProductManager.Web.Model.product>(this.ProductDomainContext.products);
            this.productLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product>(
                this.LoadProductEntities,
                this.LoadOperationProductCompleted
                );
            this.productView = new DomainCollectionView<ProductManager.Web.Model.product>(this.productLoader, this.productSource);

            this.projectResponsibleSource = new EntityList<ProductManager.Web.Model.project_responsible>(this.ProductDomainContext.project_responsibles);
            this.projectResponsibleLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_responsible>(
                this.LoadProjectResponsibleEntities,
                this.LoadOperationProjectResponsibleCompleted);
            this.projectResponsibleView = new DomainCollectionView<ProductManager.Web.Model.project_responsible>(this.projectResponsibleLoader, this.projectResponsibleSource);

            this.importantPartSource = new EntityList<ProductManager.Web.Model.important_part>(this.ProductDomainContext.important_parts);
            this.importantPartLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.important_part>(
                this.LoadImportantPartEntities,
                this.LoadImportantPartCompleted);
            this.importantPartView = new DomainCollectionView<ProductManager.Web.Model.important_part>(this.importantPartLoader, this.importantPartSource);

            this.importantPartRejesterSource = new EntityList<ProductManager.Web.Model.important_part_rejester>(this.ProductDomainContext.important_part_rejesters);
            this.importantPartRejesterLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.important_part_rejester>(
                this.LoadImportantPartRejesterEntities,
                this.LoadImportantPartRejesterCompleted
                );
            this.importantPartRejesterView = new DomainCollectionView<ProductManager.Web.Model.important_part_rejester>(this.importantPartRejesterLoader, this.importantPartRejesterSource);
            UpdateChanged("CollectionProjectView");
            IsBusy = false;
        }
        public void LoadData()
        {
            IsBusy = true;

            this.taxPayerTypeSource = new EntityList<DocumentManager.Web.Model.taxpayertype>(this.documentManagerContext.taxpayertypes);
            this.taxPayerTypeLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayertype>(
                this.LoadTaxPayerTypeEntities,
                this.loadOperation_Completed);
            this.taxPayerTypeView = new DomainCollectionView<DocumentManager.Web.Model.taxpayertype>(this.taxPayerTypeLoader, this.taxPayerTypeSource);

            using (this.taxPayerTypeView.DeferRefresh())
            {
                this.taxPayerTypeView.MoveToFirstPage();
            }
        }