public async Task <PaymentHistoryDTO> GetPaymentHistoryById(long id) { Payment payment = await _iPaymentRepository.GetPayment(id); PaymentHistoryDTO paymentHistoryDTO = _iPaymentHistoryDTO.MapToPaymentHistoryDTO(payment); return(paymentHistoryDTO); }
protected void btnAddPaymentHistory_Click(object sender, EventArgs e) { MyFileItAppServiceClient obj = new MyFileItAppServiceClient(); MyFileItResult result = new MyFileItResult(); PaymentHistoryDTO objPayment = new PaymentHistoryDTO(); objPayment.PRIMARYAPPUSERID = 2; objPayment.DATEPURCHASED = DateTime.UtcNow; objPayment.QUANTITY = 1; objPayment.ITEM = "ShareKey"; objPayment.AMOUNT = Convert.ToDecimal("3.99");; objPayment.LAST4CC = "1111"; objPayment.PROMOCODE = ""; objPayment.AUTHORIZATIONNUMBER = "0000"; //objPayment.NAME = "Test Name"; result = obj.AddPaymentHistory(appGlobal.username, appGlobal.password, objPayment); }
//hàm lay lich su giao dich cua khach hang public List <PaymentHistoryDTO> GetInfoPaymentFromAccID(string Accid) { //danh sach thong tin giao dich List <PaymentHistoryDTO> list = new List <PaymentHistoryDTO>(); try { //cau lenh query lay thong tin giao dich string sql = "select c.BillID, a.ProductName, b.NgayDat, c.Size, c.Amount, c.TotalPrice " + "from Product a, Payment b, PaymentInfo c where b.AccID = @id and c.BillID = b.BillID and a.ProductID = c.ProductID"; SqlParameter id = new SqlParameter("@id", System.Data.SqlDbType.NVarChar); id.Value = Accid; SqlDataReader reader = ReadDataPars(sql, new[] { id }); while (reader.Read()) { //truyen thong tin giao dich vao danh sach PaymentHistoryDTO a = new PaymentHistoryDTO(); a.BillID = reader.GetString(0); a.ProductName = reader.GetString(1); a.NgayDat = reader.GetDateTime(2); a.Size = reader.GetString(3); a.Amount = reader.GetInt32(4); a.TotalPrice = reader.GetSqlMoney(5).ToString(); list.Add(a); } reader.Close(); }catch (Exception ex) { MessageBox.Show(ex.Message); } finally { closeConnection(); } return(list); }