Exemplo n.º 1
0
        private void Exit_Click_1(object sender, RoutedEventArgs e)
        {
            var stAppEnter = new StAppEnter();

            Close();
            stAppEnter.Show();
        }
Exemplo n.º 2
0
        private void ButtonEnd_Click(object sender, RoutedEventArgs e)
        {
            currentStation.NumberOfBikes -= 1;
            currentStation.NumberOfSlots += 1;
            bicycle.StationId             = null;
            context.Rides.Add(new Ride
            {
                UserId         = currentUser.Id,
                BicycleId      = bicycle.Id,
                BeginingOfRide = DateTime.Now,
                TotalRideTime  = null,
                MoneyPaid      = 0,
                IsRideFinished = false
            });
            currentUser.Balance -= 60;
            context.SaveChanges();
            MessageBox.Show(" Операция успешно проведена");
            var stAppEnter = new StAppEnter();

            stAppEnter.Show();
            this.Close();
        }
Exemplo n.º 3
0
        private void HiddenButton_Click(object sender, RoutedEventArgs e)
        {
            currentRide.Bicycle.CurrentSlot = int.Parse(NumberOfSlot.Text);
            currentRide.MoneyPaid           = 60 + 2 * (days * 1440 + hours * 60 + minutes);
            currentRide.TotalRideTime       = totalRTime;
            currentRide.IsRideFinished      = true;
            currentRide.Bicycle.StationId   = currentStation.Id;
            currentStation.NumberOfSlots   -= 1;
            currentStation.NumberOfBikes   += 1;

            decimal newBalance = currentUser.Balance - currentRide.MoneyPaid;

            if (days >= 2)
            {
                newBalance -= 3000;
            }
            currentUser.Balance = newBalance;
            MessageBox.Show(" Возврат совершён успешно!");
            cont.SaveChanges();
            var stAppEnter = new StAppEnter();

            stAppEnter.Show();
            this.Close();
        }