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 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); }
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); }
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"); } } } }
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."; } }
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); }
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"); } } }
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); } }