Esempio n. 1
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            //BeginTransaction
            using (IDbTransaction tx = DBC.GetTransaction())
            {
                try
                {
                    BoxTxn          boxTxn = new BoxTxn(this.DBC, tx);
                    List <Vote>     votes  = GetVoteResult();
                    IBoxTransaction voteTx = new VoteTxn(votes);
                    boxTxn.Add(voteTx);
                    boxTxn.DoTransaction(boxTxn.GetTransactionCommands(), tx);
                    boxTxn.Clear();

                    tx.Commit();
                }
                catch (Exception ex)
                {
                    tx.Rollback();
                }
            }
        }