Ejemplo n.º 1
0
        public void AddServicesToBill()
        {
            var bill = _billRepository.GetUnpaidBillByPatientId(_view.PatientId);

            // clear in case of update.
            _billRepository.ClearServicesInBill(bill);

            if (_temporarySelectedServices.Count > 0)
            {
                foreach (clinic_service serviceSelected in _temporarySelectedServices)
                {
                    try
                    {
                        _billRepository.AddServiceToBill(bill.id, serviceSelected);
                    }
                    catch (ArgumentOutOfRangeException ex)
                    {
                        _view.ErrMessage = ex.Message;
                    }
                }
            }
            _billRepository.CalculateTotalMoneyInBill(bill.id);
        }
Ejemplo n.º 2
0
        public void AddPresciptionToBill()
        {
            var bill = _billRepository.GetUnpaidBillByPatientId(_view.PatientId);

            // clear prescription in case of update prescription.
            _billRepository.ClearPresciptionInBill(bill);

            foreach (prescription prescriptionItem in _temporaryPrescription)
            {
                if (!bill.prescriptions.Contains(prescriptionItem))
                {
                    try
                    {
                        _prescriptionRepository.AddPrescriptionToDatabase(prescriptionItem);
                    }
                    catch (ArgumentOutOfRangeException ex)
                    {
                        _view.ErrMessage = ex.Message;
                    }
                }
            }

            _billRepository.CalculateTotalMoneyInBill(bill.id);
        }