Esempio n. 1
0
 public void Dispose()
 {
     if (channel != null)
     {
         channel.Dispose();
         channel = null;
     }
 }
Esempio n. 2
0
        private void DoSave()
        {
            ExecuteFaultHandledOperation(() =>
            {
                var product = SelectedProduct as ProductWrapper;
                IProductService product_service = service_factory.CreateClient <IProductService>();
                IEntityProductService entity_product_service = service_factory.CreateClient <IEntityProductService>();
                using (TransactionScope scope = new TransactionScope()) // TransactionScopeAsyncFlowOption.Enabled
                {
                    using (product_service)
                    {
                        //*** Make sure the attributes are set before the save happens!!
                        int ret_val = product_service.CreateProduct(product.Model);
                        // We need to create a relationship in the entity product table too, or adding new products is a waste of time.
                        if (product.ProductKey == 0)
                        {
                            EntityProduct ent_prod = new EntityProduct()
                            {
                                EntityProductEntityKey     = CurrentCompanyKey,
                                EntityProductEntityTypeKey = QIQOEntityType.Company,
                                ProductKey       = ret_val,
                                EntityProductSeq = 1,
                                ProductType      = product.ProductType,
                                Comment          = string.Format($"New product {product.ProductName} (Key: {ret_val.ToString()}) entry for company {CurrentCompanyName}")
                            };

                            using (entity_product_service)
                            {
                                int ep_ret = entity_product_service.CreateEntityProduct(ent_prod);
                            }
                            product.ProductKey = ret_val;
                        }

                        product.AcceptChanges();
                        //Products.Add(product);
                        AddNewProductToCache(product);
                        SelectedProduct = null;
                        RaisePropertyChanged("Products");
                    }
                    scope.Complete();
                }
                event_aggregator.GetEvent <ProductNewProductCompleteEvent>().Publish(ViewNames.ProductHomeView);
            });
        }
Esempio n. 3
0
 public EntityProductClient(string endpoint)
 {
     channel = new ChannelFactory <IEntityProductService>(endpoint).CreateChannel();
 }
 public EntityProductClient(EndpointConfiguration endpoint)
 {
     channel = new ChannelFactory <IEntityProductService>(GetBindingForEndpoint(EndpointConfigurationType.NetTcpBinding),
                                                          GetEndpointAddress(endpoint)).CreateChannel();
 }