public ProductPartTypeWindowViewModel(ChildWindow aChildWindow, ProductPartTypeEntity aProductPartTypeEntity)
 {
     childWindow = aChildWindow;
     ProductPartTypeEntity = aProductPartTypeEntity;
     OnOK = new DelegateCommand(OnOKCommand);
     OnCancel = new DelegateCommand(OnCancelCommand);
 }
 private void OnAddCommand()
 {
     AddProductPartTypeEntity = new ProductPartTypeEntity();
     AddProductPartTypeEntity.ProductPartType = new ProductManager.Web.Model.product_part_type();
     ProductPartTypeWindow productPartTypeWindow = new ProductPartTypeWindow(AddProductPartTypeEntity);
     productPartTypeWindow.Closed += productPartTypeWindow_Closed;
     productPartTypeWindow.Show();
 }
 void loadOperationFileType_Completed(object sender, EventArgs e)
 {
     ProductPartTypeEntityList.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);
     }
     UpdateChanged("FileTypeEntityList");
     IsBusy = false;
 }
        public void LoadData()
        {
            IsBusy = true;
            systemManageDomainContext = new SystemManageDomainContext();
            systemManageDomainContext.PropertyChanged -= systemManageDomainContext_PropertyChanged;
            systemManageDomainContext.PropertyChanged += systemManageDomainContext_PropertyChanged;
            ProductPartTypeEntityList.Clear();

            selectProductPartTypeEntity = null;
            LoadOperation<ProductManager.Web.Model.product_part_type> loadOperationProductPartType =
                systemManageDomainContext.Load<ProductManager.Web.Model.product_part_type>(systemManageDomainContext.GetProduct_part_typeQuery());
            loadOperationProductPartType.Completed += loadOperationFileType_Completed;
        }
        void loadOperationPartTimeType_Completed(object sender, EventArgs e)
        {
            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();
                ProductPartTypeDictionary.Add(productPartTypeEntity.ProductPartTypeID, productPartTypeEntity);
            }

            App app = Application.Current as App;
            LoadOperation<ProductManager.Web.Model.user_project> loadOperationUserProject =
               ProductDomainContext.Load<ProductManager.Web.Model.user_project>(ProductDomainContext.GetUserProjectQuery(app.UserInfo.UserID));
            loadOperationUserProject.Completed += LoadUserProjectComplete;
        }
        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();
            }
        }