예제 #1
0
        public async Task <bool> AddAsync(BO.WithdrawHistory obj)
        {
            try
            {
                await using (SqlConnection connection = await _context.GetConnection())
                {
                    await using (SqlCommand command = new SqlCommand("AddWithdraw", connection)
                    {
                        CommandType = CommandType.StoredProcedure
                    })
                    {
                        command.Parameters.AddWithValue("@BidderId", obj.UserId);
                        command.Parameters.AddWithValue("@AuctionId", obj.AuctionId);
                        command.Parameters.AddWithValue("@EventId", obj.EventId);
                        command.Parameters.AddWithValue("@Date", obj.WithdrawDate);
                        command.Parameters.AddWithValue("@Amount", obj.WithdrawAmount);

                        return(await command.ExecuteNonQueryAsync() != -1);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
예제 #2
0
        public async Task <List <BO.WithdrawHistory> > ConvertToObj(SqlDataReader reader)
        {
            var objects = new List <BO.WithdrawHistory>();

            while (await reader.ReadAsync())
            {
                BO.WithdrawHistory obj = new BO.WithdrawHistory()
                {
                    Id             = int.Parse(reader["Id"].ToString()),
                    WithdrawDate   = DateTime.Parse(reader["WithdrawDate"].ToString()),
                    WithdrawAmount = decimal.Parse(reader["WithdrawAmount"].ToString()),
                    EventId        = int.Parse(reader["EventId"].ToString()),
                    AuctionId      = int.Parse(reader["AuctionId"].ToString()),
                    UserId         = int.Parse(reader["UserId"].ToString())
                };

                objects.Add(obj);
            }

            return(objects);
        }
예제 #3
0
        public async Task <BO.Bids> GetThrowbackAsync(BO.WithdrawHistory obj)
        {
            try
            {
                await using (SqlConnection connection = await _context.GetConnection())
                {
                    await using (SqlCommand command = new SqlCommand("GetWithdrawThrowback", connection)
                    {
                        CommandType = CommandType.StoredProcedure
                    })
                    {
                        command.Parameters.AddWithValue("@BidderId", obj.UserId);
                        command.Parameters.AddWithValue("@AuctionId", obj.AuctionId);
                        command.Parameters.AddWithValue("@EventId", obj.EventId);

                        await using SqlDataReader reader = command.ExecuteReader();
                        var objBidHistory = new BO.Bids();
                        while (await reader.ReadAsync())
                        {
                            objBidHistory.Id        = int.Parse(reader["Id"].ToString());
                            objBidHistory.AuctionId = int.Parse(reader["AuctionId"].ToString());
                            objBidHistory.EventId   = int.Parse(reader["EventId"].ToString());
                            objBidHistory.UserId    = int.Parse(reader["UserId"].ToString());
                            objBidHistory.BidAmount = decimal.Parse(reader["BidAmount"].ToString());
                            objBidHistory.BidDate   = DateTime.Parse(reader["BidDate"].ToString());
                        }

                        return(objBidHistory);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
예제 #4
0
 public async Task <Bids> GetThrowbackAsync(BO.WithdrawHistory obj)
 {
     return(await _dalWithdraw.GetThrowbackAsync(obj));
 }
예제 #5
0
 public async Task <bool> AddAsync(BO.WithdrawHistory obj)
 {
     return(await _dalWithdraw.AddAsync(obj));
 }