Ejemplo 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();
        }
Ejemplo n.º 2
0
 private void GetCounters()
 {
     using (localhost.CountersServiceClient proxy = GetProxy())
     {
         this.bindingSource1.DataSource = proxy.GetCounters();
     }
 }
Ejemplo n.º 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         m_proxy.ResetCounters();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         m_proxy = new CountersClient.localhost.CountersServiceClient();
     }
 }
Ejemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                using (localhost.CountersServiceClient proxy = GetProxy())
                {
                    proxy.ResetCounters();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            GetCounters();
        }
Ejemplo n.º 5
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();
            }
        }
Ejemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    m_proxy.ResetCounters();

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

            GetCounters();
        }
Ejemplo n.º 7
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();
        }