private void FreeSlot_Click(object sender, RoutedEventArgs e) { if (TimeOutText.Text == "" || TimeOutText.Text == null) { MessageBox.Show("Please Calculate the amount first!"); return; } ParkingEntryViewModel entryVM = (ParkingEntryViewModel)this.DataContext; entryVM.SetTimeOut(timeout, SlotID); entryVM.SetTotalAmount(amount, SlotID); try { if (entryVM.FreeSlot(SlotID, timeout, amount)) { SlotFreed = true; MessageBox.Show("Slot Free!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Close(); }
private void CalculateAmount_Click(object sender, RoutedEventArgs e) { ParkingEntryViewModel entryVM = (ParkingEntryViewModel)this.DataContext; string entryid = entryVM.GetEntryID(SlotID); DateTime tout = DateTime.Now; timeout = tout; decimal totalamount = entryVM.GetAmount(entryid, tout); amount = totalamount; TimeOutText.Text = tout.ToString(); AmountText.Text = totalamount.ToString(); }