Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionOptions options = new TransactionOptions();
                options.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
//                options.Timeout = new TimeSpan(0, 0, 3);
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                {
                    m_proxy.SetCounter1(int.Parse(this.txtCounter.Text));

                    // pause for transaction timeout
                    //                  Thread.Sleep(5000);

                    m_proxy.SetCounter2(int.Parse(this.txtCounter.Text));

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                m_proxy = new CountersClient.localhost.CountersServiceClient();
            }

            GetCounters();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    m_proxy.SetCounter1(int.Parse(this.txtCounter.Text));
                    m_proxy.SetCounter2(int.Parse(this.txtCounter.Text));

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                m_proxy = new CountersClient.localhost.CountersServiceClient();
            }
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionOptions options = new TransactionOptions();
                options.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                {
                    m_proxy.SetCounter1(int.Parse(this.txtCounter.Text));
                    m_proxy.SetCounter2(int.Parse(this.txtCounter.Text));

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                m_proxy = new CountersClient.localhost.CountersServiceClient();
            }

            GetCounters();
        }