Exemplo n.º 1
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ClubBAIST cb = new ClubBAIST();

        int[] pars = new int[18];
        pars[0]  = int.Parse(Par1.SelectedValue);
        pars[1]  = int.Parse(Par2.SelectedValue);
        pars[2]  = int.Parse(Par3.SelectedValue);
        pars[3]  = int.Parse(Par4.SelectedValue);
        pars[4]  = int.Parse(Par5.SelectedValue);
        pars[5]  = int.Parse(Par6.SelectedValue);
        pars[6]  = int.Parse(Par7.SelectedValue);
        pars[7]  = int.Parse(Par8.SelectedValue);
        pars[8]  = int.Parse(Par9.SelectedValue);
        pars[9]  = int.Parse(Par10.SelectedValue);
        pars[10] = int.Parse(Par11.SelectedValue);
        pars[11] = int.Parse(Par12.SelectedValue);
        pars[12] = int.Parse(Par13.SelectedValue);
        pars[13] = int.Parse(Par14.SelectedValue);
        pars[14] = int.Parse(Par15.SelectedValue);
        pars[15] = int.Parse(Par16.SelectedValue);
        pars[16] = int.Parse(Par17.SelectedValue);
        pars[17] = int.Parse(Par18.SelectedValue);
        bool b = cb.CreateCourse(DescriptionTB.Text, pars, decimal.Parse(CourseRatingTB.Text), decimal.Parse(SlopeRatingTB.Text));
    }
Exemplo n.º 2
0
    private void Authenticate()
    {
        SecurityController s  = HttpContext.Current.User as SecurityController;
        ClubBAIST          cb = new ClubBAIST();

        if (s != null)
        {
            if (s.IsInAnyRoles("ADMIN"))
            {
                AdminStuff();
            }
            else
            {
                NotAdminStuff();
            }
            if (!s.IsInAnyRoles("ADMIN", "Gold", "Silver", "Bronze"))
            {
                Response.Redirect("Default.aspx");
            }
        }
        else
        {
            FormsAuthentication.SignOut();
            Response.Redirect("login.aspx");
        }
    }
Exemplo n.º 3
0
    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?
        }
    }
Exemplo n.º 4
0
    private void ListReservationsForUser(int userID)
    {
        ClubBAIST          cb           = new ClubBAIST();
        List <Reservation> reservations = cb.ReadReservationBatchForMember(userID, HttpContext.Current.User.Identity.Name);

        foreach (Reservation r in reservations)
        {
            if (DateTime.Compare(r.ReservedTime, DateTime.Today) < 0)
            {
                TableRow   row  = new TableRow();
                TableCell  cell = new TableCell();
                LinkButton lb   = new LinkButton();
                lb.Text = r.ReservedTime.ToString();
                lb.Attributes.Add("href", "SubmitScore.aspx?r=" + r.ReservationID);
                cell.Controls.Add(lb);
                row.Cells.Add(cell);
                ReservationsTable.Rows.Add(row);
            }
        }
        PageControls.Controls.Remove(FoundUsersTableLabel);
        PageControls.Controls.Remove(FoundUsersTable);
        PageControls.Controls.Remove(HoleScoresTable);
        PageControls.Controls.Remove(HoleScoresTableLabel);
        PageControls.Controls.Remove(SubmitButton);
    }
    private void FillStandingReservations()
    {
        H2Title.InnerText = "Pending Standing Reservation Requests";
        ClubBAIST cb = new ClubBAIST();
        //gets reservations that are not approved(0), but active(1)
        List <StandingReservation> sr = cb.ReadStandingReservations(0, 1);

        ListStandingReservations(sr);
    }
Exemplo n.º 6
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ClubBAIST cb = new ClubBAIST();
        bool      b  = cb.CreateUser(FirstNameTB.Text, LastNameTB.Text, PhoneTB.Text, EmailTB.Text, PasswordTB.Text, int.Parse(MembershipLevelDD.SelectedValue));

        if (b)
        {
            //User feedback
        }
    }
    protected void Approve_Click(object sender, EventArgs e)
    {
        ClubBAIST           cb = new ClubBAIST();
        StandingReservation sr = cb.ReadStandingReservation(int.Parse(Request.QueryString["sr"]));
        bool b = cb.UpdateStandingReservationApproval(sr.StandingReservationID, 1, 1);

        if (!b)
        {
        }
    }
    private void NotAdminStuff()
    {
        //this guy is not an admin
        MemberSearch.Controls.Clear();
        FoundUsers.Controls.Clear();
        SecurityController s  = HttpContext.Current.User as SecurityController;
        ClubBAIST          cb = new ClubBAIST();
        User u = cb.ReadUser(s.Identity.Name);
        List <Reservation> userTeeTimes = cb.ReadReservationBatchForMember(u.UserID, s.Identity.Name);

        ListReservations(userTeeTimes);
    }
    protected void PendingReservations_Click(object sender, EventArgs e)
    {
        H2Title.InnerText = "Pending Standing Reservation Requests";
        ClubBAIST cb = new ClubBAIST();
        List <StandingReservation> sr = cb.ReadStandingReservations(0, 1); //gets standing reservations that are not approved(0), but active(1)

        ListStandingReservations(sr);
        PendingReservationsButton.Visible  = false;
        PendingReservationsButton.Enabled  = false;
        ApprovedReservationsButton.Visible = true;
        ApprovedReservationsButton.Enabled = true;
    }
    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);
        }
    }
Exemplo n.º 11
0
    private void NotAdminStuff()
    {
        //this guy is not an admin
        MemberSearch.Controls.Remove(SearchTable);
        FoundUsers.Controls.Remove(FoundUsersTable);
        FoundUsers.Controls.Remove(FoundUsersTableLabel);
        SecurityController s    = HttpContext.Current.User as SecurityController;
        ClubBAIST          cb   = new ClubBAIST();
        User         u          = cb.ReadUser(s.Identity.Name);
        List <Score> userScores = cb.ReadScores(u.Email);

        ListScores(userScores);
    }
Exemplo n.º 12
0
    protected void UserSearchButton_Click(object sender, EventArgs e)
    {
        ClubBAIST   cb    = new ClubBAIST();
        List <User> users = cb.SearchUsers(UserSearchTB.Text, UserSearchTB.Text, UserSearchTB.Text, UserSearchTB.Text);

        foreach (User u in users)
        {
            LinkButton lb = new LinkButton();
            lb.Text = u.FirstName + " " + u.LastName;
            lb.Attributes.Add("href", "CreateStandingReservation.aspx?u=" + u.UserID.ToString());
            AStuff.Controls.Add(lb);
        }
    }
    private void FillForm()
    {
        ClubBAIST   cb = new ClubBAIST();
        Reservation r  = cb.ReadReservation(int.Parse(Request.QueryString["r"]));

        Calendar.SelectedDate       = r.ReservedTime.Date;
        NumberHolesDD.SelectedValue = r.NumberHoles.ToString();
        NumberCartsDD.SelectedValue = r.NumberCarts.ToString();
        CourseDD.SelectedValue      = r.CourseID.ToString();
        Player2TB.Text = r.Player2;
        Player3TB.Text = r.Player3;
        Player4TB.Text = r.Player4;
    }
Exemplo n.º 14
0
    protected void DaySelected(object sender, EventArgs e)
    {
        DateTime selectedDay = Calendar.SelectedDate;

        if (selectedDay < DateTime.Today)
        {
            msg.Text = "you can't book in the past";
            Calendar.SelectedDate = DateTime.Today;
        }
        ClubBAIST                  cb                   = new ClubBAIST();
        List <Reservation>         TeeTimesForDay       = cb.ReadReservationBatchByTimeFrame(selectedDay, selectedDay.AddDays(1));
        List <StandingReservation> StandingReservations = cb.ReadStandingReservations(1, 1);//get approved and active reservations

        TeeTimesDD.Items.Clear();
        DateTime bufferDateTime = selectedDay.AddHours(7.00);
        bool     offset         = true;

        while (bufferDateTime <= selectedDay.AddHours(18))
        {
            ListItem li = new ListItem();
            li.Text  = bufferDateTime.TimeOfDay.ToString();
            li.Value = MakeFormattedDate(bufferDateTime);

            foreach (Reservation r in TeeTimesForDay)
            {
                if (r.ReservedTime == bufferDateTime)
                {
                    li.Attributes.Add("disabled", "true");
                }
            }
            foreach (StandingReservation sr in StandingReservations)
            {
                if (sr.ReservedTime.DayOfWeek.ToString() == bufferDateTime.DayOfWeek.ToString() && sr.ReservedTime.TimeOfDay.ToString() == bufferDateTime.TimeOfDay.ToString())
                {
                    li.Attributes.Add("disabled", "true");
                }
            }
            TeeTimesDD.Items.Add(li);
            if (offset)
            {
                bufferDateTime = bufferDateTime.AddMinutes(7.00);
                offset         = false;
            }
            else
            {
                bufferDateTime = bufferDateTime.AddMinutes(8.00);
                offset         = true;
            }
        }
    }
Exemplo n.º 15
0
    private void FillCourseDropDown()
    {
        CourseDD.Items.Clear();
        ClubBAIST     cb = new ClubBAIST();
        List <Course> cs = cb.ReadAllCourses();

        foreach (Course c in cs)
        {
            ListItem li = new ListItem();
            li.Text  = c.CourseName;
            li.Value = c.CourseID.ToString();
            CourseDD.Items.Add(li);
        }
    }
Exemplo n.º 16
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        int[] scores = new int[18];
        scores[0]  = int.Parse(Par1.SelectedValue);
        scores[1]  = int.Parse(Par2.SelectedValue);
        scores[2]  = int.Parse(Par3.SelectedValue);
        scores[3]  = int.Parse(Par4.SelectedValue);
        scores[4]  = int.Parse(Par5.SelectedValue);
        scores[5]  = int.Parse(Par6.SelectedValue);
        scores[6]  = int.Parse(Par7.SelectedValue);
        scores[7]  = int.Parse(Par8.SelectedValue);
        scores[8]  = int.Parse(Par9.SelectedValue);
        scores[9]  = int.Parse(Par10.SelectedValue);
        scores[10] = int.Parse(Par11.SelectedValue);
        scores[11] = int.Parse(Par12.SelectedValue);
        scores[12] = int.Parse(Par13.SelectedValue);
        scores[13] = int.Parse(Par14.SelectedValue);
        scores[14] = int.Parse(Par15.SelectedValue);
        scores[15] = int.Parse(Par16.SelectedValue);
        scores[16] = int.Parse(Par17.SelectedValue);
        scores[17] = int.Parse(Par18.SelectedValue);
        int total = 0;

        for (int i = 0; i < scores.Length; i++)
        {
            total = total + scores[i];
        }
        string             email = UsersOnReservationDD.SelectedValue;
        ClubBAIST          cb    = new ClubBAIST();
        SecurityController s     = HttpContext.Current.User as SecurityController;
        bool b;

        if (s != null)
        {
            if (Request.QueryString["r"] != null)
            {
                if (s.IsInAnyRoles("ADMIN"))
                {
                    b = cb.CreateScore(int.Parse(Request.QueryString["r"]), email, scores, total);
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    User u = cb.ReadUser(HttpContext.Current.User.Identity.Name);
                    b = cb.CreateScore(int.Parse(Request.QueryString["r"]), u.Email, scores, total);
                    Response.Redirect("Default.aspx");
                }
            }
        }
    }
Exemplo n.º 17
0
    private void FillMemberShipLevels()
    {
        MembershipLevelDD.Items.Clear();
        ClubBAIST cb = new ClubBAIST();
        List <MembershipLevel> mls = cb.ReadMembershipLevels();

        foreach (MembershipLevel ml in mls)
        {
            ListItem li = new ListItem();
            li.Text  = ml.Description;
            li.Value = ml.MembershipLevelID.ToString();
            MembershipLevelDD.Items.Add(li);
        }
    }
    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);
        }
    }
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ClubBAIST   cb = new ClubBAIST();
        Reservation r  = cb.ReadReservation(int.Parse(Request.QueryString["r"]));
        bool        b  = cb.UpdateReservation(int.Parse(Request.QueryString["r"]), r.UserID, int.Parse(CourseDD.SelectedValue), DateTime.Parse(TeeTimesDD.SelectedValue), int.Parse(NumberHolesDD.SelectedValue), int.Parse(NumberCartsDD.SelectedValue), Player2TB.Text, Player3TB.Text, Player4TB.Text);

        if (!b)
        {
            //Response.Write("Something went wrong.");
        }
        else
        {
            Response.Redirect("ViewReservations.aspx?r=" + r.UserID);
        }
    }
Exemplo n.º 20
0
    private void AdminStuff()
    {
        ClubBAIST cb = new ClubBAIST();

        if (Request.QueryString["u"] != null)
        {
            PageControls.Controls.Remove(SelectUserTable);
            User u = cb.ReadUserByID(int.Parse(Request.QueryString["u"]));
            ListReservationsForUser(u.UserID);
        }
        else
        {
            if (Request.QueryString["r"] != null)
            {
                //fill UsersOnReservationDD with players on the reservation
                Reservation r  = cb.ReadReservation(int.Parse(Request.QueryString["r"]));
                User        u  = cb.ReadUserByID(r.UserID);
                ListItem    li = new ListItem();
                li.Text  = u.FirstName + " " + u.LastName;
                li.Value = u.Email;
                UsersOnReservationDD.Items.Add(li);
                if (r.Player2 != null && r.Player2.Trim() != "")
                {
                    u        = cb.ReadUser(r.Player2);
                    li       = new ListItem();
                    li.Text  = u.FirstName + " " + u.LastName;
                    li.Value = u.Email;
                    UsersOnReservationDD.Items.Add(li);
                }
                if (r.Player3 != null && r.Player3.Trim() != "")
                {
                    u        = cb.ReadUser(r.Player3);
                    li       = new ListItem();
                    li.Text  = u.FirstName + " " + u.LastName;
                    li.Value = u.Email;
                    UsersOnReservationDD.Items.Add(li);
                }
                if (r.Player4 != null && r.Player4.Trim() != "")
                {
                    u        = cb.ReadUser(r.Player4);
                    li       = new ListItem();
                    li.Text  = u.FirstName + " " + u.LastName;
                    li.Value = u.Email;
                    UsersOnReservationDD.Items.Add(li);
                }
            }
        }
    }
    private void FillForm()
    {
        //this page will break
        ClubBAIST           cb = new ClubBAIST();
        StandingReservation sr = cb.ReadStandingReservation(int.Parse(Request.QueryString["sr"]));

        Calendar.SelectedDate       = sr.ReservedTime.Date;
        EndCalendar.SelectedDate    = sr.EndTime.Date;
        EndCalendar.VisibleDate     = sr.EndTime.Date;
        NumberHolesDD.SelectedValue = sr.NumberHoles.ToString();
        NumberCartsDD.SelectedValue = sr.NumberCarts.ToString();
        CourseDD.SelectedValue      = sr.CourseID.ToString();
        Player2TB.Text = sr.Player2;
        Player3TB.Text = sr.Player3;
        Player4TB.Text = sr.Player4;
    }
Exemplo n.º 22
0
    protected void UserSearchButton_Click(object sender, EventArgs e)
    {
        ClubBAIST   cb    = new ClubBAIST();
        List <User> users = cb.SearchUsers(UserSearchTB.Text, UserSearchTB.Text, UserSearchTB.Text, UserSearchTB.Text);

        foreach (User u in users)
        {
            TableRow   row  = new TableRow();
            TableCell  cell = new TableCell();
            LinkButton lb   = new LinkButton();
            lb.Text = u.FirstName + " " + u.LastName;
            lb.Attributes.Add("href", "SubmitScore.aspx?u=" + u.UserID.ToString());
            cell.Controls.Add(lb);
            row.Cells.Add(cell);
            FoundUsersTable.Rows.Add(row);
        }
    }
Exemplo n.º 23
0
    private void AdminStuff()
    {
        //this guy is totally admin
        ClubBAIST cb = new ClubBAIST();

        if (Request.QueryString["u"] != null)
        {
            int          userID     = int.Parse(Request.QueryString["u"]);
            User         u          = cb.ReadUserByID(userID);
            List <Score> userScores = cb.ReadScores(u.Email);
            ListScores(userScores);
        }
        else
        {
            List <Score> allScores = cb.ReadAllScores();
            ListScores(allScores);
        }
    }
    private void AdminStuff()
    {
        //this guy is totally admin
        ClubBAIST cb = new ClubBAIST();

        if (Request.QueryString["u"] != null)
        {
            int  userID = int.Parse(Request.QueryString["u"]);
            User u      = cb.ReadUserByID(userID);
            List <Reservation> reservations = cb.ReadReservationBatchForMember(u.UserID, u.Email);
            ListReservations(reservations);
        }
        else
        {
            List <Reservation> reservations = cb.ReadReservationBatchByTimeFrame(DateTime.Today, DateTime.Today.AddDays(7));
            ListReservations(reservations);
        }
    }
Exemplo n.º 25
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ClubBAIST cb = new ClubBAIST();

        if (cb.IsAuthenticated(UserEmail.Text, Password.Text))
        {
            User                      thisUser        = cb.ReadUser(UserEmail.Text);
            MembershipLevel           ml              = cb.ReadMembershipLevel(thisUser.MembershipLevel);
            FormsAuthenticationTicket authTicket      = new FormsAuthenticationTicket(1, UserEmail.Text, DateTime.Now, DateTime.Now.AddMinutes(30), false, ml.Description);
            string                    encryptedTicket = FormsAuthentication.Encrypt(authTicket);
            HttpCookie                authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            Response.Cookies.Add(authCookie);
            Response.Redirect(FormsAuthentication.GetRedirectUrl(UserEmail.Text, false));
        }
        else
        {
            Msg.Text = "Login failed, check username or password.";
        }
    }
Exemplo n.º 26
0
    private bool ScoreExists(string email)
    {
        ClubBAIST   cb     = new ClubBAIST();
        Reservation r      = cb.ReadReservation(int.Parse(Request.QueryString["r"]));
        User        u      = cb.ReadUser(email);
        bool        exists = false;

        if (u.Email != null)
        {
            List <Score> scoresForThisReservation = cb.ReadScoresForReservation(r.ReservationID);
            foreach (Score s in scoresForThisReservation)
            {
                if (s.UserEmail == u.Email || s.UserEmail == r.Player2 || s.UserEmail == r.Player3 || s.UserEmail == r.Player4)
                {
                    exists = true;
                }
            }
        }
        return(exists);
    }
Exemplo n.º 27
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ClubBAIST          cb = new ClubBAIST();
        User               u  = cb.ReadUser(HttpContext.Current.User.Identity.Name);
        bool               b;
        SecurityController s = HttpContext.Current.User as SecurityController;

        if (s != null)
        {
            if (s.IsInAnyRoles("ADMIN"))
            {
                b = cb.CreateStandingReservation(int.Parse(Request.QueryString["u"]), int.Parse(CourseDD.SelectedValue), DateTime.Parse(TeeTimesDD.SelectedValue), EndCalendar.SelectedDate, int.Parse(NumberHolesDD.SelectedValue), int.Parse(NumberCartsDD.SelectedValue), Player2TB.Text, Player3TB.Text, Player4TB.Text);
                Response.Redirect("Default.aspx");
            }
            else
            {
                b = cb.CreateStandingReservation(u.UserID, int.Parse(CourseDD.SelectedValue), DateTime.Parse(TeeTimesDD.SelectedValue), EndCalendar.SelectedDate, int.Parse(NumberHolesDD.SelectedValue), int.Parse(NumberCartsDD.SelectedValue), Player2TB.Text, Player3TB.Text, Player4TB.Text);
                Response.Redirect("Default.aspx");
            }
        }
    }
Exemplo n.º 28
0
    private void NotAdminStuff()
    {
        PageControls.Controls.Remove(FoundUsersTableLabel);
        PageControls.Controls.Remove(FoundUsersTable);
        PageControls.Controls.Remove(SearchTable);
        PageControls.Controls.Remove(SelectUserTable);
        ClubBAIST cb = new ClubBAIST();
        User      u  = cb.ReadUser(HttpContext.Current.User.Identity.Name);

        if (Request.QueryString["r"] != null)
        {
            Reservation r = cb.ReadReservation(int.Parse(Request.QueryString["r"]));
            if (u.UserID != r.UserID && u.Email != r.Player2 && u.Email != r.Player3 && u.Email != r.Player4)
            {
                Response.Redirect("SubmitScore.aspx");
            }
        }
        else
        {
            ListReservationsForUser(u.UserID);
        }
    }
    protected void DaySelected(object sender, EventArgs e)
    {
        DateTime           selectedDay    = Calendar.SelectedDate;
        ClubBAIST          cb             = new ClubBAIST();
        Reservation        thisR          = cb.ReadReservation(int.Parse(Request.QueryString["r"]));
        List <Reservation> TeeTimesForDay = cb.ReadReservationBatchByTimeFrame(selectedDay, selectedDay.AddDays(1));

        TeeTimesDD.Items.Clear();
        DateTime bufferDateTime = selectedDay.AddHours(7.00);
        bool     offset         = true;

        while (bufferDateTime <= selectedDay.AddHours(18))
        {
            ListItem li = new ListItem();
            li.Text  = bufferDateTime.TimeOfDay.ToString();
            li.Value = MakeFormattedDate(bufferDateTime);

            foreach (Reservation r in TeeTimesForDay)
            {
                if (r.ReservedTime == bufferDateTime && r.ReservationID != thisR.ReservationID)
                {
                    li.Attributes.Add("disabled", "true");
                }
            }
            TeeTimesDD.Items.Add(li);
            if (offset)
            {
                bufferDateTime = bufferDateTime.AddMinutes(7.00);
                offset         = false;
            }
            else
            {
                bufferDateTime = bufferDateTime.AddMinutes(8.00);
                offset         = true;
            }
        }
        TeeTimesDD.SelectedValue = MakeFormattedDate(thisR.ReservedTime);
    }
    protected void SearchByTimeFrameButton_Click(object sender, EventArgs e)
    {
        while (TeeTimesTable.Rows.Count > 1)
        {
            TeeTimesTable.Rows.RemoveAt(1);
        }
        DateTime           minDay       = DateTime.Parse(MinDay.Text);
        DateTime           maxDay       = DateTime.Parse(MaxDay.Text);
        ClubBAIST          cb           = new ClubBAIST();
        List <Reservation> reservations = cb.ReadReservationBatchByTimeFrame(minDay, maxDay);

        if (Request.QueryString["u"] != null)
        {
            foreach (Reservation r in reservations.ToList())
            {
                if (r.UserID != int.Parse(Request.QueryString["u"]))
                {
                    reservations.Remove(r);
                }
            }
        }
        ListReservations(reservations);
    }