public int generateTno()
        {
            int value = 0;

            //Set isolation level
            TransactionOptions ops = new TransactionOptions();

            ops.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;

            //Wrapp transaction
            using (TransactionScope trans = new TransactionScope(TransactionScopeOption.Required, ops))
            {
                try
                {
                    var result = db.getHighestTno();

                    foreach (var res in result)
                    {
                        if (res.Column1 == null)
                        {
                            value = 0;
                        }

                        else if (res.Column1 != null)
                        {
                            value = Convert.ToInt32(res.Column1.ToString());
                        }
                    }
                    db.SubmitChanges();
                    trans.Complete();
                }
                catch (SqlException e)
                {
                    MessageBox.Show(e.Message.ToString());
                }
                catch (TransactionAbortedException tab)
                {
                    MessageBox.Show(tab.Message.ToString());
                }
                catch (TransactionInDoubtException tib)
                {
                    MessageBox.Show(tib.Message.ToString());
                }
            }

            return(value + 1);
        }