public ActionResult OnPost()
        {
            _authenticatedUser = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _golferScorecard.Course = Course;
            _golferScorecard.Date   = GameDate;
            _golferScorecard.Rounds = Rounds;

            _golferScorecard.Golfer = (Golfer)_authenticatedUser;

            var result = _requestDirector.RecordPlayerScores(_golferScorecard);

            if (!result)
            {
                return(Page());
            }

            Alert = $"Golfer Score recorded Successfully";
            return(RedirectToPage("Index"));
        }
Exemple #2
0
        public ActionResult OnPost(string submit)
        {
            var authenticatedUser  = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);
            var requestedDayOfWeek = Request.Query["day"];
            var requestedTime      = DateTime.Parse(Request.Query["time"]);
            var requestedStartDate = InputtedStartDate;
            var requestedEndDate   = InputtedEndDate;

            if (!ModelState.IsValid)
            {
                return(Page());
            }
            var result = false;

            _selectedStandingTeeTimeRequest = _requestDirector.FindStandingTeeTimeRequest(requestedDayOfWeek,
                                                                                          requestedStartDate, requestedEndDate, requestedTime);
            _selectedStandingTeeTimeRequest.Shareholder1.FullName = InputtedShareholder1;
            _selectedStandingTeeTimeRequest.Shareholder2.FullName = InputtedShareholder2;
            _selectedStandingTeeTimeRequest.Shareholder3.FullName = InputtedShareholder3;
            _selectedStandingTeeTimeRequest.Shareholder4.FullName = InputtedShareholder4;

            if (IsNullOrEmpty(_selectedStandingTeeTimeRequest.BookerId) || _selectedStandingTeeTimeRequest.BookerId == " " ||
                _selectedStandingTeeTimeRequest.BookerId == "")
            {
                _selectedStandingTeeTimeRequest.BookerId = authenticatedUser.Id;
            }

            if (submit == "cancelStandingTeeTimeRequest")
            {
                _selectedStandingTeeTimeRequest.BookerId = " ";
            }

            result = submit switch
            {
                "submitStandingTeeTimeRequest" => _requestDirector.SubmitStandingTeeTimeRequest(_selectedStandingTeeTimeRequest),
                "cancelStandingTeeTimeRequest" => _requestDirector.CancelStandingTeeTimeRequest(_selectedStandingTeeTimeRequest),
                _ => result
            };

            if (!result)
            {
                return(Page());
            }

            Alert = $"Edited Standing Time for {requestedDayOfWeek} at {requestedTime:hh:mm tt}";
            return(RedirectToPage("SubmitStandingTeeTimeRequest"));
        }
    }
Exemple #3
0
        public void OnGet()
        {
            AuthenticatedUser = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);
            SelectedDate      = DateTime.Parse(Request.Query["date"]);
            SelectedTime      = DateTime.Parse(Request.Query["time"]);

            SelectedTeeTime          = _requestDirector.FindTeeTime(SelectedDate, SelectedTime);
            ReservedGolfer1Name      = SelectedTeeTime.Golfer1.FullName;
            ReservedGolfer2Name      = SelectedTeeTime.Golfer2.FullName;
            ReservedGolfer3Name      = SelectedTeeTime.Golfer3.FullName;
            ReservedGolfer4Name      = SelectedTeeTime.Golfer4.FullName;
            ReservedGolfer1CheckedIn = SelectedTeeTime.Golfer1CheckedIn;
            ReservedGolfer2CheckedIn = SelectedTeeTime.Golfer2CheckedIn;
            ReservedGolfer3CheckedIn = SelectedTeeTime.Golfer3CheckedIn;
            ReservedGolfer4CheckedIn = SelectedTeeTime.Golfer4CheckedIn;
        }
Exemple #4
0
 public void OnGet()
 {
     authenticatedPlayer  = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);
     PlayerHandicapFactor = _requestDirector.ViewPlayerHandicap(authenticatedPlayer);
 }
Exemple #5
0
        public ActionResult OnPost(string submit)
        {
            AuthenticatedUser = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);
            SelectedDate      = DateTime.Parse(Request.Query["date"]);
            SelectedTime      = DateTime.Parse(Request.Query["time"]);

            if (!ModelState.IsValid)
            {
                return(Page());
            }
            var result = false;

            SelectedTeeTime = _requestDirector.FindTeeTime(SelectedDate, SelectedTime);

            SelectedTeeTime.Golfer1.FullName = ReservedGolfer1Name;
            SelectedTeeTime.Golfer2.FullName = ReservedGolfer2Name;
            SelectedTeeTime.Golfer3.FullName = ReservedGolfer3Name;
            SelectedTeeTime.Golfer4.FullName = ReservedGolfer4Name;
            if (IsNullOrEmpty(SelectedTeeTime.BookerId) || SelectedTeeTime.BookerId == " " ||
                SelectedTeeTime.BookerId == "")
            {
                SelectedTeeTime.BookerId = AuthenticatedUser.Id;
            }

            var cancelledGolfers = new List <string>();

            switch (submit)
            {
            case "cancelForGolferOne":
                cancelledGolfers.Add(ReservedGolfer1Name);
                break;

            case "cancelForGolferTwo":
                cancelledGolfers.Add(ReservedGolfer2Name);
                break;

            case "cancelForGolferThree":
                cancelledGolfers.Add(ReservedGolfer3Name);
                break;

            case "cancelForGolferFour":
                cancelledGolfers.Add(ReservedGolfer4Name);
                break;

            case "cancelTeeTime":
                if (!IsNullOrEmpty(ReservedGolfer1Name))
                {
                    cancelledGolfers.Add(ReservedGolfer1Name);
                }
                if (!IsNullOrEmpty(ReservedGolfer2Name))
                {
                    cancelledGolfers.Add(ReservedGolfer2Name);
                }
                if (!IsNullOrEmpty(ReservedGolfer3Name))
                {
                    cancelledGolfers.Add(ReservedGolfer3Name);
                }
                if (!IsNullOrEmpty(ReservedGolfer4Name))
                {
                    cancelledGolfers.Add(ReservedGolfer4Name);
                }
                SelectedTeeTime.BookerId = " ";
                break;

            case "CheckInGolfers":
                SelectedTeeTime.Golfer1CheckedIn = ReservedGolfer1CheckedIn;
                SelectedTeeTime.Golfer2CheckedIn = ReservedGolfer2CheckedIn;
                SelectedTeeTime.Golfer3CheckedIn = ReservedGolfer3CheckedIn;
                SelectedTeeTime.Golfer4CheckedIn = ReservedGolfer4CheckedIn;
                break;
            }

            result = submit switch
            {
                "cancelForGolferOne" => _requestDirector.CancelTeeTime(SelectedTeeTime, cancelledGolfers),
                "cancelForGolferTwo" => _requestDirector.CancelTeeTime(SelectedTeeTime, cancelledGolfers),
                "cancelForGolferThree" => _requestDirector.CancelTeeTime(SelectedTeeTime, cancelledGolfers),
                "cancelForGolferFour" => _requestDirector.CancelTeeTime(SelectedTeeTime, cancelledGolfers),
                "cancelTeeTime" => _requestDirector.CancelTeeTime(SelectedTeeTime, cancelledGolfers),
                "Add" => _requestDirector.ReserveTeeTime(SelectedTeeTime),
                "CheckInGolfers" => _requestDirector.CheckInGolfers(SelectedTeeTime),
                _ => result
            };

            if (!result)
            {
                return(Page());
            }

            Alert = $"Modified TeeTime for {SelectedDate:dddd, dd MMMM yyyy} at {SelectedTime:hh:mm tt}";
            return(RedirectToPage("ReserveTeeTime"));
        }
 public void OnGet()
 {
     AuthenticatedUser          = ClubBaistUsers.GetUserFromUserName(User.Identity.Name);
     AuthenticatedMemberAccount = _requestDirector.ViewMemberAccount(AuthenticatedUser.Id);
 }
        public void OnPost()
        {
            var selectedDate = DateTime.Parse(Request.Query["date"]);

            RequestedDailyTeeSheet = _requestDirector.FindDailyTeeSheet(selectedDate, ClubBaistUsers.GetUserFromUserName(User.Identity.Name));
        }