private static IDictionary<string, PaymentWS> GetPayments(List<string> bookingIds) { IDictionary<string, PaymentWS> ret = new Dictionary<string, PaymentWS>(); using (PaymentEntities context = new PaymentEntities()) { foreach (Payment pay in context.Payment.Where(LinqUtil.BuildContainsExpression<Payment, string>(p => p.bookingId, bookingIds))) { if (!pay.CreditCardReference.IsLoaded) { pay.CreditCardReference.Load(); } CreditCard cc = pay.CreditCard; CreditCardWS ccws = new CreditCardWS(cc.number, cc.user, cc.validThrough); ret.Add(pay.bookingId, new PaymentWS(pay.bookingId, ccws, pay.amount, pay.date)); } } return ret; }
public BookingWSPage getBookingPage(string tenantName, int fromIdx, int count) { FinanceServiceDefault.BookingWSPage wsPage = client.getBookingPage(tenantName, fromIdx, count); List<BookingWS> bookings = new List<BookingWS>(); foreach (FinanceServiceDefault.BookingWS bkg in wsPage.Bookings) { PaymentWS payment = null; if (bkg.Payment != null) { FinanceServiceDefault.PaymentWS pay = bkg.Payment; CreditCardWS creditCard = new CreditCardWS(pay.CreditCard.CCNumber, pay.CreditCard.User, pay.CreditCard.ValidThrough); payment = new PaymentWS(pay.BookingId, creditCard, pay.Amount, bkg.Payment.Date); } bookings.Add(new BookingWS(bkg.BookingId, bkg.BookingDate, bkg.UserName, bkg.JourneyId, bkg.JourneyName, payment)); } BookingWSPage retPage = new BookingWSPage(bookings, wsPage.FromIdx, wsPage.Count, wsPage.Total); return retPage; }
public PaymentWS(string bookingId, CreditCardWS creditCard, decimal amount, DateTime date) { this.BookingId = bookingId; this.CreditCard = creditCard; this.Amount = amount; this.Date = date; }