public PaymentSchedule GetPaymentSchedule(int studentNo) { var query = new StringBuilder(); query.AppendFormat("SELECT [StudentNo], [Student],[Amount],[Description],[AmountUnpaid],[Scheduled],[DepositDate] ") .AppendFormat(" FROM vWebPaymentSchedule ") .AppendFormat(" WHERE StudentNo={0} ", studentNo) .AppendFormat(" ORDER BY [DepositDate] ASC"); var payments = new List <Payment.PaymentInfo>(); using (var reader = this.ExecuteReader(CommandType.Text, query.ToString())) { while (reader.Read()) { int colIndex = -1; var payment = new Payment.PaymentInfo { StudentNo = reader[++colIndex] as int?, Student = reader[++colIndex] as string, Amount = reader[++colIndex] as decimal?, Description = reader[++colIndex] as string, AmountUnpaid = reader[++colIndex] as string, Scheduled = reader[++colIndex] as DateTime?, DepositDate = reader[++colIndex] as DateTime? }; payments.Add(payment); } } return(new PaymentSchedule(payments)); }
public PaymentSchedule GetPaymentSchedule(int studentNo) { var query = new StringBuilder(); query.AppendFormat("SELECT AwardDisbursementNo, [StudentNo], [Student],[Amount],[Description],[AmountUnpaid],[Scheduled],[DepositDate],dbo.GetStudentCurrentBalanceDue('" + studentNo + "') as paymentdue, dbo.GetStudentPendingPaymentForApproval('" + studentNo + "') as paymentPending ,ARPaymentStatus") .AppendFormat(" FROM vWebPaymentSchedule ") .AppendFormat(" WHERE StudentNo={0} ", studentNo) .AppendFormat(" ORDER BY [Scheduled] ASC"); var payments = new List <Payment.PaymentInfo>(); using (var reader = this.ExecuteReader(CommandType.Text, query.ToString())) { while (reader.Read()) { int colIndex = -1; var payment = new Payment.PaymentInfo { AwardDisbursementNo = reader[++colIndex] as int?, StudentNo = reader[++colIndex] as int?, Student = reader[++colIndex] as string, Amount = reader[++colIndex] as decimal?, Description = reader[++colIndex] as string, AmountUnpaid = reader[++colIndex] as string, Scheduled = reader[++colIndex] as DateTime?, DepositDate = reader[++colIndex] as DateTime?, PaymentDue = reader[++colIndex] as decimal?, PendingPaymentForApproval = reader[++colIndex] as decimal?, ARPaymentStatus = reader[++colIndex] as string }; payments.Add(payment); } } return(new PaymentSchedule(payments)); }