コード例 #1
0
ファイル: DataMapper.cs プロジェクト: davinx/himedi
 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
ファイル: StoreData.cs プロジェクト: davinx/himedi
 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;
 }