Beispiel #1
0
        public void DetermineReserveButton(bool updateAd = false)
        {
            if (updateAd)
            {
                _currentAd = AdController.GetAd(_currentAd.Id);
            }

            //If it's a selling ad and the user is logged in
            if (_currentAd.Type == AdType.Selling && AuthHelper.IsLoggedIn())
            {
                BtnReserve.Visible = true;

                //If the ad is unreserved
                if (_currentAd.ReservedBy == null)
                {
                    var user = AuthController.GetUpdatedCurrentUserDetails();
                    //Only enabled if the user is not the author and has reservations
                    BtnReserve.Enabled =
                        (_currentAd.Author.Email != user.Email && user.Reservations > 0);
                }
                else
                {
                    BtnReserve.Enabled = false;
                }
            }
            else
            {
                BtnReserve.Visible = false;
            }
        }
Beispiel #2
0
        public void DetermineReserveText(bool updateAd = false)
        {
            if (updateAd)
            {
                _currentAd = AdController.GetAd(_currentAd.Id);
            }

            if (_currentAd.ReservedBy != null)
            {
                LblReservedBy.Visible = true;
                LblReservedBy.Text    = "Reserved by " + _currentAd.ReservedBy.Name;
            }
            else
            {
                LblReservedBy.Visible = false;
            }
        }