Ejemplo n.º 1
0
        private void ReserveCampspot(int visitorId)
        {
            int    ticketId       = connection.GetTicketIdFromVisitorId(visitorId);
            int    freeCampspotId = connection.GetFreeCampspot();
            double balance        = connection.GetBalanceByEmail(email);

            if (balance - totalPrice >= 0)
            {
                if (connection.UpdateCampspot(ticketId, freeCampspotId))
                {
                    connection.AddCamper(freeCampspotId, ticketId);
                    lbRegisterStatus.Background = Brushes.Green;
                    lbRegisterStatus.Content    = "Campspot reserved";
                }
                else
                {
                    lbRegisterStatus.Background = Brushes.Red;
                    lbRegisterStatus.Content    = "Campspot not reserved";
                    lbRegisterStatus.FontSize   = 60;
                }
            }
            else
            {
                lbRegisterStatus.Content = "Not enough balance";
            }
        }