Exemple #1
0
        public void UpdateDealer(Dealers dealer)
        {
            var dealerFromDb = _dealersRepository.Get(dealer.Id);

            if (dealerFromDb != null)
            {
                _util.CopyProperties(dealer, dealerFromDb);
                _dealersRepository.Update(dealerFromDb);
            }
            else
            {
                throw new Exception("This dealer does not exist");
            }
        }
Exemple #2
0
        public void UpdateDhlRegistration(HdlRegistration hdlRegistration)
        {
            var registrationFromDb = _dhlRegistrationRepository.Get(hdlRegistration.Id);

            if (registrationFromDb != null)
            {
                _util.CopyProperties(hdlRegistration, registrationFromDb);

                _dhlRegistrationRepository.Update(registrationFromDb);
            }
            else
            {
                throw new Exception("This registration does not exist");
            }
        }
        public void UpdatePatient(DataEntities.Patient patient)
        {
            var patientFromDb = patientsRepository.Get(patient.Id);

            if (patientFromDb != null)
            {
                util.CopyProperties(patient, patientFromDb);
                patientsRepository.Update(patientFromDb);
            }
            else
            {
                throw new Exception("This patient that you are trying to update does not exist");
            }

            patientsRepository.Update(patient);
        }
        public void UpdateAbbrevation(Abbrevations abbrevation)
        {
            var abbrevationFromDb = _abbreavationsRepository.Get(abbrevation.Id);

            if (abbrevationFromDb != null)
            {
                _util.CopyProperties(abbrevation, abbrevationFromDb);
                _abbreavationsRepository.Update(abbrevationFromDb);
            }
            else
            {
                throw new Exception("This abbrevation is not available");
            }
        }
        public void UpdateBillPayment(PatientBillPayment billPayment)
        {
            var patientBillPaymentFromDb = billPaymentRepository.Get(billPayment.Id);

            if (patientBillPaymentFromDb != null)
            {
                _util.CopyProperties(billPayment, patientBillPaymentFromDb);
                billPaymentRepository.Update(patientBillPaymentFromDb);

                var billFromDb = patientBillRepository.Get(billPayment.BillId);
                if (billFromDb != null)
                {
                    billFromDb.AmountPaid = (double?)billPayment.PaymentAmount;
                    billFromDb.Balance    = (double?)billPayment.Balance;
                    patientBillRepository.Update(billFromDb);
                }
            }
            else
            {
                throw new Exception("This patient bill payment record does not exist");
            }
        }