示例#1
0
        private void ExeCuteSettleReciept()
        {
            var recieptTemp = RecieptSearchViewModel.SelectedReciept;

            if (recieptTemp == null)
            {
                NotificationService.Warning("No Selected Reciept", "Select a reciept to settle");
                return;
            }
            var reciept = HotelRepository.Reciepts.Get(recieptTemp.Id);
            var bills   = HotelRepository.Bills.GetBillsByReciept(reciept).ToList();

            foreach (var bill in bills.Where(x => x.State.GetType() == typeof(UnsettledBill)))
            {
                bill.State     = new SettledBill();
                bill.PayedDate = DateTime.Now;
                HotelRepository.Bills.Update(bill);
            }
            HotelRepository.Bills.Save();

            reciept.State       = new SettledReciept();
            reciept.SettledDate = DateTime.Now;
            HotelRepository.Reciepts.Update(reciept);
            HotelRepository.Reciepts.Save();

            RecieptSearchViewModel.UpdateRecieptsView();
            Messenger.Default.Send(new UpdateReciptMessage());
            Messenger.Default.Send(new UpdateBillMessage());
        }
示例#2
0
        public RecieptViewModel(IHotelRepository hotelRepository,
                                INotificationService notificationService) : this()
        {
            HotelRepository = hotelRepository;

            NotificationService    = notificationService;
            RecieptSearchViewModel = new RecieptSearchViewModel(HotelRepository);
        }