Example #1
0
        private void btnTransaction_Click(object sender, EventArgs e)
        {
            int categoryID = 0;
            int counter    = 0;

            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var proxy = new wref.ProductClient();
                    categoryID = proxy.AddCategory("Electronic Products");
                    counter    = proxy.AddProduct(categoryID);

                    MessageBox.Show($"Num products inserted: {counter.ToString()}");

                    proxy.Close();
                    ts.Complete();
                }
            }
            catch (FaultException fex)
            {
                MessageBox.Show(fex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        public Form1()
        {
            InitializeComponent();

            _proxy = new wref.ProductClient("ProductService_NetTcp");
        }