public ProductTypeWindowViewModel(ChildWindow aChildWindow, ProductTypeEntity aProductTypeEntity)
 {
     childWindow = aChildWindow;
     ProductTypeEntity = aProductTypeEntity;
     OnOK = new DelegateCommand(OnOKCommand);
     OnCancel = new DelegateCommand(OnCancelCommand);
 }
 private void OnAddCommand()
 {
     AddProductTypeEntity = new ProductTypeEntity();
     AddProductTypeEntity.ProductType = new ProductManager.Web.Model.product_type();
     ProductTypeWindow productTypeWindow = new ProductTypeWindow(AddProductTypeEntity);
     productTypeWindow.Closed += productTypeWindow_Closed;
     productTypeWindow.Show();
 }
 private void loadOperationProductType_Completed(object sender, EventArgs e)
 {
     ProductTypeEntityList.Clear();
     LoadOperation loadOperation = sender as LoadOperation;
     foreach (ProductManager.Web.Model.product_type product_type in loadOperation.Entities)
     {
         ProductTypeEntity productTypeEntity = new ProductTypeEntity();
         productTypeEntity.ProductType = product_type;
         productTypeEntity.Update();
         ProductTypeEntityList.Add(productTypeEntity);
     }
     UpdateChanged("ProductTypeEntityList");
     IsBusy = false;
 }
        void loadOperationProductType_Completed(object sender, EventArgs e)
        {
            ProductTypeEntityDictionary.Clear();
            ProductTypeEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.product_type product_type in loadOperation.Entities)
            {
                ProductTypeEntity productTypeEntity = new ProductTypeEntity();
                productTypeEntity.ProductType = product_type;
                productTypeEntity.Update();
                ProductTypeEntityDictionary.Add(productTypeEntity.ProductTypeID, productTypeEntity);
                ProductTypeEntityList.Add(productTypeEntity);
            }

            LoadOperation<ProductManager.Web.Model.product> loadOperationProduct =
               ProductDomainContext.Load<ProductManager.Web.Model.product>(ProductDomainContext.GetProductQuery());
            loadOperationProduct.Completed += loadOperationProductDictionary_Completed;
        }
 public ProductTypeWindow(ProductTypeEntity aProductTypeEntity)
 {
     InitializeComponent();
     this.DataContext = new ProductTypeWindowViewModel(this, aProductTypeEntity);
 }