示例#1
0
 public static AccountSummaryInfo PopulateAccountSummary(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     AccountSummaryInfo info = new AccountSummaryInfo();
     if (reader["AccountAmount"] != DBNull.Value)
     {
         info.AccountAmount = (decimal) reader["AccountAmount"];
     }
     if (reader["FreezeBalance"] != DBNull.Value)
     {
         info.FreezeBalance = (decimal) reader["FreezeBalance"];
     }
     info.UseableBalance = info.AccountAmount - info.FreezeBalance;
     return info;
 }
示例#2
0
 public override AccountSummaryInfo GetMyAccountSummary()
 {
     AccountSummaryInfo info = new AccountSummaryInfo();
     DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT SUM(Amount) AS FreezeBalance FROM Hishop_DistributorBalanceDrawRequest WHERE UserId=@UserId; SELECT TOP 1 Balance AS AccountAmount FROM Hishop_DistributorBalanceDetails WHERE UserId= @UserId ORDER BY JournalNumber DESC;");
     database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, HiContext.Current.User.UserId);
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read() && (DBNull.Value != reader["FreezeBalance"]))
         {
             info.DrawRequestBalance = info.FreezeBalance = (decimal)reader["FreezeBalance"];
         }
         if ((reader.NextResult() && reader.Read()) && (DBNull.Value != reader["AccountAmount"]))
         {
             info.AccountAmount = (decimal)reader["AccountAmount"];
         }
     }
     info.UseableBalance = info.AccountAmount - info.FreezeBalance;
     return info;
 }