private void ListStandingReservations(List <StandingReservation> sr) { for (int i = 1; i < StandingReservationsTable.Rows.Count; i++) { StandingReservationsTable.Rows.RemoveAt(i);//remove all table rows except the header } ClubBAIST cb = new ClubBAIST(); foreach (StandingReservation s in sr) { User u = cb.ReadUserByID(s.UserID); Course c = cb.ReadCourse(s.CourseID); TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = u.FirstName + " " + u.LastName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = c.CourseName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = cb.MakeHumanFriendlyDate(s.ReservedTime); row.Cells.Add(cell); cell = new TableCell(); cell.Text = cb.MakeHumanFriendlyDate(s.EndTime); row.Cells.Add(cell); cell = new TableCell(); cell.Text = s.ReservedTime.DayOfWeek.ToString() + "s, " + s.ReservedTime.TimeOfDay.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = cb.GetHolesReservationDescription(s.NumberHoles); row.Cells.Add(cell); cell = new TableCell(); cell.Text = s.NumberCarts.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = s.Player2; row.Cells.Add(cell); cell = new TableCell(); cell.Text = s.Player3; row.Cells.Add(cell); cell = new TableCell(); cell.Text = s.Player4; row.Cells.Add(cell); cell = new TableCell(); LinkButton lb = new LinkButton(); lb.Text = "Edit"; lb.Attributes.Add("href", "UpdateStandingReservation.aspx?sr=" + s.StandingReservationID.ToString()); cell.Controls.Add(lb); row.Cells.Add(cell); StandingReservationsTable.Rows.Add(row); } }
private void ListScores(List <Score> userScores) { ClubBAIST cb = new ClubBAIST(); foreach (Score sc in userScores) { Reservation r = cb.ReadReservation(sc.ReservationID); Course course = cb.ReadCourse(r.CourseID); //use sc to get score info, total score TableRow tr = new TableRow(); TableCell c = new TableCell(); c.Text = cb.MakeHumanFriendlyDate(r.ReservedTime); tr.Cells.Add(c); c = new TableCell(); c.Text = r.ReservedTime.TimeOfDay.ToString(); tr.Cells.Add(c); c = new TableCell(); c.Text = course.CourseName; tr.Cells.Add(c); c = new TableCell(); c.Text = sc.RoundTotal.ToString(); tr.Cells.Add(c); c = new TableCell(); c.Text = sc.HandicapDifferential.ToString(); tr.Cells.Add(c); ScoresTable.Rows.Add(tr); //button to view whole score breakdown? } }
public void ListReservations(List <Reservation> reservations) { if (reservations.Count == 0) { msg.Text = "No reservations to display"; } ClubBAIST cb = new ClubBAIST(); foreach (Reservation r in reservations) { User u = cb.ReadUserByID(r.UserID); Course c = cb.ReadCourse(r.CourseID); TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = u.FirstName + " " + u.LastName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = cb.MakeHumanFriendlyDate(r.ReservedTime); row.Cells.Add(cell); cell = new TableCell(); cell.Text = r.ReservedTime.TimeOfDay.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = c.CourseName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = r.NumberCarts.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = cb.GetHolesReservationDescription(r.NumberHoles); row.Cells.Add(cell); cell = new TableCell(); cell.Text = r.Player2.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = r.Player3.ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = r.Player4.ToString(); row.Cells.Add(cell); cell = new TableCell(); LinkButton lb = new LinkButton(); lb.Text = "Edit"; lb.Attributes.Add("href", "UpdateReservation.aspx?r=" + r.ReservationID.ToString()); cell.Controls.Add(lb); row.Cells.Add(cell); TeeTimesTable.Rows.Add(row); } }