示例#1
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);
        }