Ejemplo n.º 1
0
 /// <summary>
 /// Removes a reservation. Asks for approval.
 /// </summary>
 /// <param name="reservation"></param>
 private void Remove(Data.Reservation reservation)
 {
     if (MessageBoxResult.Yes == MessageBox.Show(Properties.Resources.ConfirmationRemoveReservation, Properties.Resources.ConfirmationRemoveReservationCaption, MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No))
     {
         Reservations.Remove(reservation);
         _reservationRepo.DeleteReservation(reservation);
         MessageHandler.InvokeSuccessMessage(Properties.Resources.InformationRemoveReservation, Properties.Resources.InformationReservationRemoved);
     }
 }
Ejemplo n.º 2
0
 public void DeleteReservation(Data.Reservation reservation)
 {
     if (!_context.Reservations.Local.Any(i => i.ID == reservation.ID))
     {
         _context.Reservations.Attach(reservation);
     }
     _context.Reservations.Remove(reservation);
     _context.SaveChanges();
 }
Ejemplo n.º 3
0
 public Data.Reservation UpdateReservation(Data.Reservation reservation)
 {
     if (!_context.Reservations.Local.Any(res => res.ID == reservation.ID))
     {
         _context.Reservations.Attach(reservation);
     }
     _context.Entry(reservation).State = EntityState.Modified;
     _context.SaveChanges();
     return(reservation);
 }
 public static ReservationGetDto FromModel(Data.Reservation reservation)
 {
     return(new ReservationGetDto
     {
         Reference = reservation.Reference,
         EventDate = reservation.EventDate,
         VenueCode = reservation.VenueCode,
         WhenMade = reservation.WhenMade,
         StaffId = reservation.StaffId
     });
 }
Ejemplo n.º 5
0
 public static ReservationGetDto FromModel(Data.Reservation reservation)
 {
     return(new ReservationGetDto
     {
         Reference = reservation.Reference,
         EventDate = reservation.EventDate,
         VenueCode = reservation.VenueCode,
         VenueName = reservation.Availability.Venue.Name,
         VenueCapacity = reservation.Availability.Venue.Capacity,
         VenueCostPerHour = reservation.Availability.CostPerHour,
         WhenMade = reservation.WhenMade,
         StaffId = reservation.StaffId
     });
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds or Edit a new reservation
        /// </summary>
        private void Save()
        {
            try
            {
                Data.Reservation reservation;

                if (!IsNewReservation)
                {
                    reservation = _reservationRepo.GetReservationById(ManipulatedReservation.ID);
                }
                else
                {
                    reservation = new Data.Reservation();
                }

                reservation.Table        = _tableRepo.GetTableById(SelectedTable.Id);
                reservation.AmountPeople = ManipulatedReservation.AmountPeople;
                reservation.LastName     = ManipulatedReservation.LastName;
                reservation.PhoneNumber  = ManipulatedReservation.PhoneNumber;
                reservation.StartTime    = ManipulatedReservation.StartTime;

                if (IsNewReservation)
                {
                    Reservations.Add(reservation);
                    _reservationRepo.AddReservation(reservation);
                    Cancel();
                    MessageHandler.InvokeSuccessMessage(Properties.Resources.Reservations, Properties.Resources.InfoReservationAdded);
                }
                else
                {
                    Reservations.Add(reservation);
                    _reservationRepo.UpdateReservation(reservation);
                    Cancel();
                    MessageHandler.InvokeSuccessMessage(Properties.Resources.Reservations, Properties.Resources.InfoReservationAdded);
                }
            }
            catch (ArgumentException e)
            {
                ErrorHandler.ThrowError(0, e.Message);
            }
            catch (Exception e)
            {
                ErrorHandler.ThrowError(0, e.Message);
            }
        }
Ejemplo n.º 7
0
 public void SetReservation(Data.Reservation reservation)
 {
     try
     {
         ManipulatedReservation = new Business.Reservation()
         {
             ID = reservation.ID, LastName = reservation.LastName, AmountPeople = reservation.AmountPeople, PhoneNumber = reservation.PhoneNumber, StartTime = reservation.StartTime, Table = new Business.Table()
             {
                 Id = reservation.Table.Id, Capacity = reservation.Table.Capacity, IsOccupied = reservation.Table.IsOccupied, Name = reservation.Table.Name
             }
         };
         SelectedTable = reservation.Table;
     }
     catch (Exception ex)
     {
         ErrorHandler.ThrowError(0, ex.Message);
     }
 }
Ejemplo n.º 8
0
        public bool bilpay(Data.Reservation dr)
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "update tb_reservation set pembayaran='" + dr.Pembayaran + "',kembalian=@kembalian-'" + dr.Pembayaran + "', keterangan='" + dr.Keterangan + "' where no_reservation='" + dr.No_reservasi + "' ";
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
Ejemplo n.º 9
0
        public bool deletereservation(Data.Reservation dre)
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "delete from tb_reservation where no_reservation='" + dre.No_reservasi + "'";
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
Ejemplo n.º 10
0
        public bool editreservation(Data.Reservation drv)
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "update tb_reservation set client_id='" + drv.Client_id + "',room_type='" + drv.Room_type + "',room_price='" + drv.Room_price + "', no_room='" + drv.No_room + "',booking_date='" + drv.Booking_date + "', date_in='" + drv.Date_in + "',date_out='" + drv.Date_out + "', cara_bayar='" + drv.Carabayar + "' where no_reservation='" + drv.No_reservasi + "'";
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
Ejemplo n.º 11
0
        public bool reservationclient(Data.Reservation drv)
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "insert into tb_reservation values('" + drv.No_reservasi + "', '" + drv.Client_id + "', '" + drv.Room_type + "', '" + drv.Room_price + "', '" + drv.No_room + "', '" + drv.Booking_date + "', '" + drv.Date_in + "', '" + drv.Date_out + "', null, null, '" + drv.Room_price + "' * '" + drv.No_room + "','" + drv.Carabayar + "', null, null, 'Belum Lunas')";
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(stat);
        }
Ejemplo n.º 12
0
        public bool searchreservid(Data.Reservation dr)
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "select * from tb_reservation where no_reservation='" + dr.No_reservasi + "'";
                //kon.ExecuteQueries("select * from tb_reservation where no_reservation='" + dr.No_reservasi + "'");
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }

            catch (Exception ex)
            {
            }
            return(stat);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Requests the editing of a reservation. This will open the ReservationAddEditViewModel
 /// </summary>
 /// <param name="reservation"><inheritdoc cref="SelectedReservation"/></param>
 private void Edit(Data.Reservation reservation)
 {
     EditRequested?.Invoke(reservation);
 }
Ejemplo n.º 14
0
 public Data.Reservation GetReservationById(int id)
 {
     Data.Reservation reservation = _context.Reservations.FirstOrDefault(x => x.ID == id);
     return(reservation);
 }
Ejemplo n.º 15
0
 public Data.Reservation AddReservation(Data.Reservation reservation)
 {
     _context.Reservations.Add(reservation);
     _context.SaveChanges();
     return(reservation);
 }
Ejemplo n.º 16
0
 private void _reservationsViewModel_EditRequested(Data.Reservation reservation)
 {
     _reservationAddEditViewModel.IsNewReservation = false;
     _reservationAddEditViewModel.SetReservation(reservation);
     CurrentViewModel = _reservationAddEditViewModel;
 }