Ejemplo n.º 1
0
        public IActionResult FindAll([FromBody] DTO.TranSearchObj dto)
        {
            TransactionDAO dao = new TransactionDAO(_context);
            List <AccessoryTransaction> list;

            if (dto.UsernameSearch.Equals(""))
            {
                if (dto.StatusSearch.Equals("All"))
                {
                    list = dao.FindAll();
                }
                else
                {
                    list = dao.FindAllByStatus(dto.StatusSearch);
                }
            }
            else
            {
                if (dto.StatusSearch.Equals("All"))
                {
                    list = dao.FindByUsername(dto.UsernameSearch);
                }
                else
                {
                    list = dao.FindByStatusAndUsername(dto.StatusSearch, dto.UsernameSearch);
                }
            }
            return(new JsonResult(list));
        }
Ejemplo n.º 2
0
        public IActionResult FindTranByUsername([FromBody] string username)
        {
            TransactionDAO dao = new TransactionDAO(_context);
            List <AccessoryTransaction> list = dao.FindByUsername(username);

            return(new JsonResult(list));
        }
        private void selectedProductRepartition_Load(object sender, EventArgs e)
        {
            TransactionDAO transactionDao = new TransactionDAO();

            try
            {
                List <Transaction> transactions = transactionDao.getTransactionsListByProductID(Code);
                this.statusLabel.Text = "Product Transaction Repartition";
                this.statusStrip1.Refresh();
                decimal total = 0;
                if (transactions != null)
                {
                    transactions.ForEach(item =>
                    {
                        total = total + (item.Product.PrixUnitaire * (1 + item.Product.Tva)) * item.Quantity;
                    });
                    productChart.Series["Repartition"].Points.AddXY("Total Transactions By Product", total);
                }
                else
                {
                    throw new exceptions("There's currently no transaction for the selected product");
                }
            }catch (exceptions exception)
            {
                MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 4
0
        private void coBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            listfilter = new List <Transaction>();
            using (var transdao = new TransactionDAO())
            {
                listTransaksi = transdao.GetAllTransactionDataByID(user.ID.ToString());
            }

            foreach (var item in listTransaksi)
            {
                if (coBoxMonth.SelectedIndex == 0 && item.Date.Month == DateTime.Today.Month)
                {
                    listfilter.Add(item);
                }

                else if (coBoxMonth.SelectedIndex == 1 && item.Date.Month == DateTime.Today.Month - 1)
                {
                    listfilter.Add(item);
                }

                else if (coBoxMonth.SelectedIndex == 2 && item.Date.Month == DateTime.Today.Month - 2)
                {
                    listfilter.Add(item);
                }
            }

            fillChart(listfilter);
        }
Ejemplo n.º 5
0
        private void FrmDetailTransaksi_Load(object sender, EventArgs e)
        {
            this.listAwal = new List <Transaction>();
            try
            {
                using (var transdao = new TransactionDAO())
                {
                    ListTransaction = transdao.GetAllTransactionDataByID(user.ID.ToString());
                }

                foreach (var item in ListTransaction)
                {
                    if (item.Date == DateTime.Parse(Date))
                    {
                        listAwal.Add(item);
                    }
                }

                dgvData.DataSource = listAwal;
                this.dgvData.Columns[0].DataPropertyName = "Category";
                this.dgvData.Columns[1].DataPropertyName = "SubCategory";
                this.dgvData.Columns[2].DataPropertyName = "Amount";
                this.dgvData.Columns[3].DataPropertyName = "Note";

                lblResult.Text = "Results : " + dgvData.Rows.Count.ToString() + " Row(s)";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public FrmReportOUT()
        {
            InitializeComponent();

            _custDAO  = new CustomerDAO(Setting.GetConnectionString());
            _transDAO = new TransactionDAO(Setting.GetConnectionString());
        }
Ejemplo n.º 7
0
        public long InputCode(string code, string captcha, string token)
        {
            try
            {
                if (!CheckCaptcha(captcha, token))
                {
                    return(-2);
                }

                if (string.IsNullOrEmpty(code) || code.Length != 12)
                {
                    return(-55);
                }
                var result = TransactionDAO.InputCode(AccountSession.AccountID, AccountSession.AccountName, code);
                if (result == null || result.Gold <= 0)
                {
                    return(-56);
                }
                return(result.Gold);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }
            return(-56);
        }
Ejemplo n.º 8
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         using (var transdao = new TransactionDAO())
         {
             if (dgvData.SelectedRows != null)
             {
                 DataGridViewRow row = dgvData.CurrentRow;
                 foreach (var item in listAwal)
                 {
                     if (item.SubCategory.ToString() == row.Cells[1].Value.ToString() && item.Amount.ToString() == row.Cells[2].Value.ToString() && item.Note.ToString() == row.Cells[3].Value.ToString())
                     {
                         this.Hide();
                         new FrmAddTransaction(user, ComboIn, ComboEx, true, item).ShowDialog();
                         this.Show();
                     }
                 }
             }
         }
         FrmDetailTransaksi_Load(null, null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 9
0
        public void LoadDataBranchData(int branch_id)
        {
            List <string[]> list = new TransactionDAO().getTransactionsGroupedByDate(branch_id);

            string[] dates = new string[list.Count];
            int[]    total = new int[list.Count];

            int i = 0;

            foreach (string[] item in list)
            {
                string   dateString     = item[0];
                DateTime dateFromString =
                    DateTime.Parse(dateString, System.Globalization.CultureInfo.InvariantCulture);

                dates[i] = dateFromString.Year.ToString() + "/" + dateFromString.Month + "/" + dateFromString.Day;
                total[i] = int.Parse(item[1]);
                i++;
            }

            var series = new Series("Total");

            series.Points.DataBindXY(dates, total);
            chartDailyTotal.Series.Clear();
            chartDailyTotal.Series.Add(series);
        }
        public FrmReportStock()
        {
            InitializeComponent();

            _itmDAO   = new ItemDAO(Setting.GetConnectionString());
            _transDAO = new TransactionDAO(Setting.GetConnectionString());
        }
        public dynamic GetTransactionFees(int month, int year)
        {
            DateTime start = new DateTime(year, month, 1);
            DateTime end   = new DateTime(year, month, 1).AddMonths(1).AddDays(-1);

            return(TransactionDAO.GetTransactionFees(start, end));
        }
Ejemplo n.º 12
0
        public string ReturnFromKitchen(Transaction aTransaction)
        {
            string sr = "";

            try
            {
                TransactionDAO aDao = new TransactionDAO();
                aDao.InsertTransactionForReport(aTransaction);
                StockBLL aBll   = new StockBLL();
                Stock    dStock = new Stock();
                dStock = aTransaction.Stock;
                aBll.InsertStockOrUpdate(dStock);
                Stock cStock = new Stock();
                cStock         = aTransaction.Stock;
                cStock.Stocks *= -1;
                aBll.UpdateKitchenStockByStockId(cStock);
                sr = "Insert Successfully";
            }
            catch
            {
                sr = "Plz Try again";
            }



            return(sr);
        }
Ejemplo n.º 13
0
        public FrmReportIN()
        {
            InitializeComponent();

            _suppDAO  = new SupplierDAO(Setting.GetConnectionString());
            _transDAO = new TransactionDAO(Setting.GetConnectionString());
        }
Ejemplo n.º 14
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (txtDelete.Text.Trim() == "")
            {
                MessageBox.Show("Please type the required string !", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtDelete.Text != "DELETE MY ACCOUNT")
            {
                MessageBox.Show("Confirmation string is wrong ! Remember to use capslock. ", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtDelete.Text == "DELETE MY ACCOUNT")
            {
                try
                {
                    using (var transdao = new TransactionDAO())
                    {
                        transdao.DeleteAllTransactionsByID(user.ID);
                    }
                    using (var userdao = new UserDAO())
                    {
                        userdao.Delete(user);
                    }

                    MessageBox.Show("Account Deleted !", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Boolean = true;
                    this.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public CashoutModel Cashout(int cardType, int prize)
        {
            try
            {
                List <CardConfig> data = TransactionDAO.GetCardConfigs().ToList();
                var d = data.FirstOrDefault(x => x.Type == cardType && x.Prize == prize);
                if (d == null)
                {
                    return new CashoutModel {
                               Status = -100
                    }
                }
                ;

                return(TransactionDAO.Cashout(AccountSession.AccountID, AccountSession.AccountName, cardType, prize, prize * (d.CashoutRate - d.Promotion) / 100));
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(new CashoutModel
            {
                Status = -99
            });
        }
        public int topupPostBackGA(int card_id, string phoneNum, string result, int menhGiaThe, int menhGiaDK, int menhGiaThuc, string status, string requestId)
        {
            try
            {
                int stt = -1;
                if (status == "success")
                {
                    stt = 1;
                }
                var his = TransactionDAO.GetTopupHistory(requestId);
                if (his != null)
                {
                    List <CardConfig> data = TransactionDAO.GetCardConfigs().ToList();
                    var d = data.FirstOrDefault(x => x.Type == his.CardType && x.Prize == menhGiaThuc);
                    if (d == null)
                    {
                        d = new CardConfig();
                    }
                    long exchangeValue = menhGiaThuc * d.TopupRate / 100;
                    exchangeValue += (exchangeValue * d.Promotion / 100);
                    //TransactionDAO.UpdatePayResult(id, status, amount);
                    TransactionDAO.RetopupCard(requestId, menhGiaThuc, exchangeValue, stt);
                }

                return(1);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(-99);
        }
        public string callbackbb2d([FromBody] paybb2dCallBack pay)
        {
            NLogManager.LogMessage(JsonConvert.SerializeObject(pay));
            try
            {
                var his = TransactionDAO.GetTopupHistory(pay.RefCode);
                if (his != null)
                {
                    List <CardConfig> data = TransactionDAO.GetCardConfigs().ToList();
                    var d = data.FirstOrDefault(x => x.Type == his.CardType && x.Prize == pay.Amount);
                    if (d == null)
                    {
                        d = new CardConfig();
                    }
                    long exchangeValue = pay.Amount * d.TopupRate / 100;
                    exchangeValue += (exchangeValue * d.Promotion / 100);
                    if (pay.Status != 1 && pay.Status > 0)
                    {
                        pay.Status *= -1;
                    }
                    TransactionDAO.UpdatePayResult(pay.RefCode, pay.Status, pay.Amount);
                    TransactionDAO.RetopupCard(pay.RefCode, pay.Amount, exchangeValue, pay.Status);
                }

                return("1|success");
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return("-1|failed");
        }
        public string callbackgg([FromBody] PayGooglesCallback pay)
        {
            NLogManager.LogMessage("CALLBACK PAY GG: " + JsonConvert.SerializeObject(pay));
            try
            {
                var his = TransactionDAO.GetTopupHistory(pay.transaction_id);
                if (his != null)
                {
                    List <CardConfig> data = TransactionDAO.GetCardConfigs().ToList();
                    var d = data.FirstOrDefault(x => x.Type == his.CardType && x.Prize == pay.amount);
                    if (d == null)
                    {
                        d = new CardConfig();
                    }
                    long exchangeValue = pay.amount * d.TopupRate / 100;
                    exchangeValue += (exchangeValue * d.Promotion / 100);
                    if (pay.error_code != 1 && pay.error_code > 0)
                    {
                        pay.error_code *= -1;
                    }
                    TransactionDAO.UpdatePayResult(pay.transaction_id, pay.error_code, pay.amount);
                    TransactionDAO.RetopupCard(pay.transaction_id, pay.amount, exchangeValue, pay.error_code);
                }

                return("1|success");
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return("-1|failed");
        }
        private void addproductbtn_Click_1(object sender, EventArgs e)
        {
            TransactionDAO transactionDAO = new TransactionDAO();
            Transaction    transaction    = new Transaction();

            transaction.Code       = code;
            transaction.Quantity   = int.Parse(this.quantity.Text);
            this.message.ForeColor = Color.OrangeRed;

            try
            {
                if (transaction.Product.Quantity < transaction.Quantity)
                {
                    throw new INSUFFICIENT_QUANTITY("There's not a susfficiant Quantity to accept your transaction");
                }
                transactionDAO.updateTransaction(transaction);
                this.message.Text = "The Selected Transaction Has Been Updated With Success";
            }catch (INSUFFICIENT_QUANTITY exception)
            {
                this.message.Text = "An Error Has Occured While Updating The Selected Transaction";

                string title   = "Exception";
                string message = exception.Message;
                MessageBox.Show(message, title);
            }
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            Console.WriteLine("Eve Market Discovery");
            Console.WriteLine("-------------------------");

            var transactionDAO = new TransactionDAO();

            //long jitaRegionId = 10000002;
            //long amarrRegionId = 10000043;
            //long heimatarRegionId - rens = 10000030;
            //long metropolisRegionId - hek = 10000042;

            Console.WriteLine("Getting cached data. This can take awhile...");

            int itemLimit     = -1;
            var eveMarketData = new EveMarketData(itemLimit);

            Console.WriteLine("Cache loaded..");
            Console.WriteLine("Press [H] For History Analysis. Press [O] For Order Analysis");

            var @char = Console.ReadKey().KeyChar;

            if (@char == 'h')
            {
                GetHistoryAnalysis(eveMarketData, itemLimit);
            }
            else if (@char == 'o')
            {
                GetOrderAnalysis(eveMarketData, itemLimit);
            }

            Console.ReadLine();
        }
Ejemplo n.º 21
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         using (var transdao = new TransactionDAO())
         {
             if (dgvData.SelectedRows != null)
             {
                 DataGridViewRow row = dgvData.CurrentRow;
                 foreach (var item in listAwal)
                 {
                     if (item.SubCategory.ToString() == row.Cells[1].Value.ToString() && item.Amount.ToString() == row.Cells[2].Value.ToString() && item.Note.ToString() == row.Cells[3].Value.ToString())
                     {
                         DialogResult = MessageBox.Show("Are you sure you want to delete this transaction ?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                         if (DialogResult == DialogResult.Yes)
                         {
                             transdao.Delete(item);
                         }
                         break;
                     }
                 }
             }
         }
         FrmDetailTransaksi_Load(null, null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public dynamic GetDashboard(int month, int year)
        {
            try
            {
                var result          = new List <AgencyCashFlow>();
                var refundLogs      = new List <RefundLog>();
                var transactionLogs = new List <TransactionLog>();

                int      from = int.Parse($"{year.ToString("D4")}{month.ToString("D2")}01");
                DateTime _end = new DateTime(year, month, 1).AddMonths(1).AddDays(-1);
                int      to   = int.Parse($"{year.ToString("D4")}{month.ToString("D2")}{_end.Day.ToString("D2")}");

                var agencies = new List <Ag>();

                var curLevel = UserContext.UserInfo.GroupID;
                if (curLevel == 0)
                {
                    agencies        = AgencyDAO.GetAgencies(null);
                    refundLogs      = TransactionDAO.GetRefundLogs(null, from, to);
                    transactionLogs = TransactionDAO.GetTransactionLogs(null, from, to);
                }
                else
                {
                    var curId = UserContext.UserInfo.AccountID;
                    agencies        = AgencyDAO.GetAgencies(curId);
                    refundLogs      = TransactionDAO.GetRefundLogs(curId, from, to);
                    transactionLogs = TransactionDAO.GetTransactionLogs(curId, from, to);
                }

                var rootAgenciesId = agencies.Select(x => x.GameAccountId);
                foreach (var item in agencies)
                {
                    var trf              = refundLogs.Where(x => x.AccountId == item.ID).Sum(x => x.TotalRefund);
                    var totalGold        = transactionLogs.Where(x => (x.SenderID == item.GameAccountId && !rootAgenciesId.Contains(x.RecvID)) || (x.RecvID == item.GameAccountId && !rootAgenciesId.Contains(x.SenderID))).Sum(x => x.Amount);
                    var transactionCount = transactionLogs.Where(x => (x.SenderID == item.GameAccountId && !rootAgenciesId.Contains(x.RecvID)) || (x.RecvID == item.GameAccountId && !rootAgenciesId.Contains(x.SenderID))).Count();

                    var statisticItem = new AgencyCashFlow
                    {
                        Displayname      = item.Displayname,
                        Gold             = item.Gold,
                        LockedGold       = item.LockedGold,
                        TotalGold        = totalGold,
                        TRF              = trf,
                        TRF2             = 0,
                        TransactionCount = transactionCount,
                        Level            = item.Level
                    };

                    result.Add(statisticItem);
                }

                return(result);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(null);
        }
Ejemplo n.º 23
0
 public bool GetOTP(long accountId, string tel)
 {
     try
     {
         var status = OTP.OTP.GenerateOTP(accountId, tel);
         NLogManager.LogMessage("OTP Agency: " + status);
         if (int.Parse(status) < 0)
         {
             return(false);
         }
         bool deduct = TransactionDAO.DeductGold(accountId, 1000, "Phí dịch vụ OTP", 2);
         if (!deduct)
         {
             NLogManager.LogMessage("Tru phi dich vu OTP dai ly that bai: " + accountId);
             return(false);
         }
         SmsService.SendMessage(tel, $"Ma xac nhan: " + status);
         return(true);
     }
     catch (Exception ex)
     {
         NLogManager.PublishException(ex);
     }
     return(false);
 }
        public bool UpdateState(long transId, int state)
        {
            try
            {
                if (UserContext.UserInfo.GroupID != 0)
                {
                    var agencyAccount = AgencyDAO.GetById(UserContext.UserInfo.AccountID);
                    if (agencyAccount == null)
                    {
                        return(false);
                    }
                    TransactionDAO.UpdateState(transId, state, agencyAccount.GameAccountId);
                }
                else
                {
                    TransactionDAO.UpdateStateAdmin(transId, state);
                }
                return(true);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(false);
        }
Ejemplo n.º 25
0
        private void GetData()
        {
            DBHelper helper = null;

            helper = new DBHelper(_conStrPortalDbRoot);

            DataTable dt;
            long      accID = 0;
            var       query = "";

            if (_id > 0)
            {
                var account = AgencyDAO.GetById(_id);
                if (UserContext.UserInfo.GroupID == 0)
                {
                    if (account != null)
                    {
                        if (account.IsAgency == true)
                        {
                            accID = account.ID;
                        }
                    }
                }
                else
                {
                    if (account != null)
                    {
                        if (account.IsAgency == true)
                        {
                            var agencyInfo = TransactionDAO.GetAgencyInfo(account.GameAccountId);
                            if (agencyInfo != null && agencyInfo.Creator == UserContext.UserInfo.AccountID)
                            {
                                accID = account.GameAccountId;
                            }
                        }
                    }
                }
            }
            else
            {
                var agency = AgencyDAO.GetById(UserContext.UserInfo.AccountID);
                accID = agency.GameAccountId;
            }

            if (_type == 0)
            {
                query = $"select top 1000 * from ag.[Transaction] where {accID} in (SenderID, RecvID) and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc";
            }
            else if (_type == 1)
            {
                query = $"select top 1000 * from ag.[Transaction] where RecvID = {accID} and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc";
            }
            else
            {
                query = $"select top 1000 * from ag.[Transaction] where SenderID = {accID} and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc";
            }
            dt = helper.GetDataTable(query);
            CreateSheet("Lịch sử giao dịch", dt);
        }
Ejemplo n.º 26
0
        public List <Transaction> GetTransactionBetweenDate(DateTime fromdate, DateTime todate)
        {
            List <Transaction> aTransactions   = new List <Transaction>();
            TransactionDAO     aTransactionDao = new TransactionDAO();

            aTransactions = aTransactionDao.GetTransactionBetweenDate(fromdate, todate);
            return(aTransactions);
        }
        public List <PlayLog> GetPlayLog()
        {
            try
            {
                var accountId = AccountSession.AccountID;


                var trans = TransactionDAO.GetGameGoldTransaction_v1(accountId, 200);
                return(trans.Select(x => new PlayLog()
                {
                    Amount = x.Amount,
                    Balance = x.Balance,
                    CreatedTime = x.CreatedTime,
                    ID = x.ID,
                    GameName = x.GameName,
                    Type = x.Type
                }).ToList());



                //var games = GameDAO.GameList(accountId);

                //var linq = (from item in trans
                //           join game in games on item.GameId equals game.ID
                //           into plays

                //           from play in plays.DefaultIfEmpty()
                //           select new
                //           {
                //               ID = item.ID,
                //               GameName = play.Name,
                //               CreatedTime = item.CreatedTime,
                //               Amount = item.Amount,
                //               Balance = item.Balance,
                //               Type = item.Type
                //           }).Select(x => new PlayLog {
                //               ID = x.ID,
                //               GameName = x.GameName,
                //               CreatedTime = x.CreatedTime,
                //               Amount = x.Amount,
                //               Balance = x.Balance,
                //               Type = x.Type
                //           });

                //return linq.ToList();
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
                NLogManager.LogError("ERROR GetPlayLog: " + ex);
            }

            return(null);
        }
        public FrmTransaction(bool itemOUT)
        {
            InitializeComponent();
            _itemDAO  = new ItemDAO(Setting.GetConnectionString());
            _suppDAO  = new SupplierDAO(Setting.GetConnectionString());
            _transDAO = new TransactionDAO(Setting.GetConnectionString());
            _custDAO  = new CustomerDAO(Setting.GetConnectionString());

            this.dgvItemData.AutoGenerateColumns = false;

            _itemOUT = itemOUT;
        }
 public dynamic GetListTransactionFee(long id)
 {
     try
     {
         return(TransactionDAO.Search(id));
     }
     catch (Exception ex)
     {
         NLogManager.PublishException(ex);
     }
     return(null);
 }
        private void updateTransactionScreen_Load(object sender, EventArgs e)
        {
            TransactionDAO transactionDAO = new TransactionDAO();
            Transaction    transaction    = transactionDAO.GetTransaction(code);

            this.statusLabel.Text = "Update Transaction";
            this.statusStrip1.Refresh();
            this.transactionCode.Enabled = false;
            this.transactionCode.Text    = code;
            this.product.Text            = transaction.Product.Name;
            this.client.Text             = transaction.Client.Name;
        }
Ejemplo n.º 31
0
 /// <summary>
 /// inserts user details & retreives orderID
 /// </summary>
 /// <param name="userTransaction">TransactionDAO</param>
 /// <returns></returns>
 public string GetOrderId(TransactionDAO userTransaction)
 {
     ITransactionDatabaseService transactionDatabaseService = null;
     try
     {
         transactionDatabaseService = DBDelegateFactory.Current.TransactionDatabaseService;
         return transactionDatabaseService.GetOrderId(userTransaction);
     }
     finally
     {
         transactionDatabaseService = null;
     }
 }
Ejemplo n.º 32
0
 /// <summary>
 /// inserts user details & retreives orderID
 /// </summary>
 /// <param name="userTransaction">TransactionDAO</param>
 /// <returns></returns>
 public string GetOrderId(TransactionDAO userTransaction)
 {
     using (TransactionScope tranScope = new TransactionScope())
     {
         Database database = null;
         DbCommand insertCommand = null;
         DataSet dataset = null;
         try
         {
             database = DatabaseFactory.CreateDatabase();
             insertCommand = database.GetStoredProcCommand("uspGetOrderId");
             database.AddInParameter(insertCommand, "@userId", DbType.String,userTransaction.UserID);
             database.AddInParameter(insertCommand, "@address", DbType.String,userTransaction.DeliveryAddress);
             dataset = database.ExecuteDataSet(insertCommand);
             tranScope.Complete();
             return dataset.Tables[0].Rows[0][0].ToString();
         }
         catch (SqlException ex)
         {
             SpencerLogger.Error("UserDetailsDBLL->GetOrderId()", ex);
             throw new BaseException("DBSelect");
         }
         catch (Exception ex)
         {
             SpencerLogger.Error("UserDetailsDatabaseService->GetOrderId()", ex);
             throw new BaseException("DBInsert");
         }
         finally
         {
             if (insertCommand.Connection.State == ConnectionState.Open)
                 insertCommand.Connection.Close();
             insertCommand = null;
             database = null;
         }
     }
 }