コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Authenticate();
        MessageBox.Visible = false;
        ClubBAIST cb = new ClubBAIST();

        if (Request.QueryString["r"] != null)
        {
            if (ScoreExists(HttpContext.Current.User.Identity.Name))
            {
                MessageBox.Visible = true;
            }
            else
            {
                MessageBox.Visible = false;
            }
            int         reservationID = int.Parse(Request.QueryString["r"]);
            Reservation r             = cb.ReadReservation(reservationID);
            User        u             = cb.ReadUserByID(r.UserID);
            Course      c             = cb.ReadCourse(r.CourseID);
            TableRow    row           = new TableRow();
            TableCell   cell          = new TableCell();
            cell.Text = r.ReservedTime.ToString();
            row.Cells.Add(cell);
            cell      = new TableCell();
            cell.Text = u.FirstName + " " + u.LastName;
            if (ScoreExists(u.Email))
            {
                cell.Attributes.Add("style", "background-color:#a0ff6d;");
            }
            row.Cells.Add(cell);
            cell      = new TableCell();
            cell.Text = c.CourseName.ToString();
            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 = String.Format(r.Player2);
            if (r.Player2.Trim() != "" && r.Player2 != null)
            {
                if (ScoreExists(r.Player2))
                {
                    cell.Attributes.Add("style", "background-color:#a0ff6d;");
                }
            }
            row.Cells.Add(cell);
            cell      = new TableCell();
            cell.Text = String.Format(r.Player3);
            if (r.Player3.Trim() != "" && r.Player3 != null)
            {
                if (ScoreExists(r.Player3))
                {
                    cell.Attributes.Add("style", "background-color:#a0ff6d;");
                }
            }
            row.Cells.Add(cell);
            cell      = new TableCell();
            cell.Text = String.Format(r.Player4);
            if (r.Player4.Trim() != "" && r.Player4 != null)
            {
                if (ScoreExists(r.Player2))
                {
                    cell.Attributes.Add("style", "background-color:#a0ff6d;");
                }
            }
            row.Cells.Add(cell);
            ThisReservation.Rows.Add(row);

            PageControls.Controls.Remove(FoundUsersTable);
            PageControls.Controls.Remove(FoundUsersTableLabel);
            PageControls.Controls.Remove(ReservationsTable);
            PageControls.Controls.Remove(ReservationsTableLabel);
            PageControls.Controls.Remove(FoundUsersTableLabel);
            PageControls.Controls.Remove(FoundUsersTable);
            PageControls.Controls.Remove(SearchTable);

            DisableUnusedHoles(r.NumberHoles);
        }
        else
        {
            PageControls.Controls.Remove(ThisReservation);
            PageControls.Controls.Remove(ThisReservationTableLabel);
            PageControls.Controls.Remove(HoleScoresTableLabel);
            PageControls.Controls.Remove(HoleScoresTable);
            PageControls.Controls.Remove(SubmitButton);
            SelectUserTable.Visible = false;

            if (Request.QueryString["u"] != null)
            {
                FoundUsersTableLabel.Visible = false;
            }
            else
            {
                ReservationsTableLabel.Visible = false;
            }
        }
    }