日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

一個傳統的C2C網站的用戶充值的过程

發(fā)布時間:2025/7/14 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一個傳統的C2C網站的用戶充值的过程 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?


  • #region 插入用戶匯款充值記錄
  • public void UserRemittance(UserAccountRecord userAccountRecord, WebBankAccountRecord webBankAccountRecord)
  • {
  • /// <summary>
  • ///用戶賬戶收支明細(xì)
  • /// </summary>
  • IUserAccountRecordsRepository IUARRpstry = new UserAccountRecordsRepository();
  • /// <summary>
  • /// 用戶賬戶余額
  • /// </summary>
  • IUserAccountBalancesRepository IUABRpstry = new UserAccountBalancesRepository();
  • /// <summary>
  • /// 網(wǎng)站銀行賬戶收支明細(xì)
  • /// </summary>
  • IWebBankAccountRecordsRepository IWBARRpstry = new WebBankAccountRecordsRepository();
  • /// <summary>
  • /// 網(wǎng)站銀行賬戶余額
  • /// </summary>
  • IWebAccountBalancesRepository IWABRpstry = new WebAccountBalancesRepository();
  • using (TransactionScope ts = new TransactionScope())
  • {
  • try
  • {
  • using (TransactionScope ts2 = new TransactionScope())
  • {
  • //第一步:插入新的記錄到用戶賬戶收支明細(xì)表(UserAccountRecords)
  • #region 第一步:插入新的記錄到用戶賬戶收支明細(xì)表(UserAccountRecords)
  • try
  • {
  • using (TransactionScope ts3 = new TransactionScope())
  • {
  • try
  • {
  • IUARRpstry.Insert(userAccountRecord);
  • ts3.Complete();
  • }
  • catch (Exception err)
  • {
  • throw err;
  • }
  • finally
  • {
  • ts3.Dispose();
  • }
  • }
  • #endregion
  • //第二步:更新用戶賬戶余額(UserAccountBalances)
  • #region 第二步:更新用戶賬戶余額(UserAccountBalances)
  • Entity.UserAccountBalance userAccountBalanceLinq = (from userAccountBalance in IUABRpstry.GetUserAccountBalances().Where(x => x.UserID.Equals(userAccountRecord.UserID))
  • select userAccountBalance).SingleOrDefault();
  • decimal totalBalance = (from useraccountrecord in IUARRpstry.GetUserAccountRecords().Where(x => x.UserID.Equals(userAccountRecord.UserID) && x.Status.Equals(Entity.UserAccountRecordStatus.Normal))
  • select useraccountrecord.Amount).Sum();
  • userAccountBalanceLinq.TotalBalance = totalBalance;
  • IUABRpstry.Update(userAccountBalanceLinq, Entity.UserAccountBalancesColumnEnum.TotalBalance);
  • #endregion
  • //第三步:插入新的記錄到網(wǎng)站銀行賬戶收支明細(xì)(WebBankAccountRecords)
  • #region 插入新的記錄到網(wǎng)站銀行賬戶收支明細(xì)(WebBankAccountRecords)
  • IWBARRpstry.Insert(webBankAccountRecord);
  • #endregion
  • ts2.Complete();
  • }
  • catch (Exception err)
  • {
  • throw err;
  • }
  • finally
  • {
  • ts2.Dispose();
  • }
  • }
  • //第四步:更新網(wǎng)站銀行賬戶余額(WebAccountBalances)
  • #region 第四步:更新網(wǎng)站銀行賬戶余額(WebAccountBalances)
  • decimal BankAccountBalance;
  • int sum = (from balance in IWBARRpstry.GetWebBankAccountRecords().Where(x => x.Status.Equals(Entity.WebBankAccountRecordStatus.Normal))
  • select balance).Count();
  • if (sum == 0)
  • {
  • BankAccountBalance = 0;
  • }
  • else
  • {
  • BankAccountBalance = (from balance in IWBARRpstry.GetWebBankAccountRecords().Where(x => x.Status.Equals(Entity.WebBankAccountRecordStatus.Normal))
  • select balance.Amount).Sum();
  • }
  • Entity.WebAccountBalance webAccountBalance = (from webAB in IWABRpstry.GetWebAccountBalances()
  • select webAB).SingleOrDefault();
  • webAccountBalance.BankAcountBalance = BankAccountBalance;
  • IWABRpstry.Update(webAccountBalance, Entity.WebAccountBalancesColumnEnum.BankAcountBalance);
  • #endregion
  • ts.Complete();
  • }
  • catch (Exception err)
  • {
  • throw err;
  • }
  • finally
  • {
  • ts.Dispose();
  • }
  • }
  • }
  • #endregion
  • 轉(zhuǎn)載于:https://www.cnblogs.com/lori/archive/2011/05/20/2052072.html

    總結(jié)

    以上是生活随笔為你收集整理的一個傳統的C2C網站的用戶充值的过程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。