Ejemplo n.º 1
0
        public void Update(Patient patient)
        {
            IQueryable <PatientInformation> apatient = from patients in patientDC.PatientInformations where (patients.Id == patient.Id) select patients;
            bool insert = false;

            try
            {
                pi = apatient.Single <PatientInformation>();
            }
            catch (Exception ex)
            {
                insert = true;
                ex.GetHashCode();
            }

            pi.FirstName = patient.FirstName;
            pi.LastName  = patient.LastName;

            pi.BirthDate       = dataEncryptionAlgorithm.EncryptData(patient.Birthday);
            pi.TelephoneNumber = dataEncryptionAlgorithm.EncryptData(patient.PhoneNumber);
            pi.EmailAddress    = dataEncryptionAlgorithm.EncryptData(patient.Email);

            if (insert)
            {
                patientDC.PatientInformations.InsertOnSubmit(pi);
                patientDC.SubmitChanges();
            }
            else
            {
                patientDC.SubmitChanges();
            }
        }
        public void Update(PatientAppointment patientAppt)
        {
            PatientAppointmentInformation patientApptRecord = null;
            bool insert = false;

            try
            {
                var appointmentquery = from patients in patientApptDataContext.PatientAppointmentInformations where patients.ApptId == patientAppt.ApptId select patients;
                patientApptRecord = appointmentquery.First();

                patientApptRecord.LV  = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseLV);
                patientApptRecord.RLU = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseRLU);
                patientApptRecord.KD1 = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseKD1);
                patientApptRecord.SP  = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseSP);
                patientApptRecord.LHT = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseLHT);
                patientApptRecord.KD2 = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseKD2);

                patientApptRecord.ImageBeforeTherapy = dataEncryptionAlgorithm.EncryptData(patientAppt.ImageBeforeTherapy);
                patientApptRecord.ImageAfterTherapy  = dataEncryptionAlgorithm.EncryptData(patientAppt.ImageAfterTherapy);

                patientApptRecord.TherapyPerformed = dataEncryptionAlgorithm.EncryptData(patientAppt.OilsAndTherapy);
                patientApptRecord.SessionGoals     = dataEncryptionAlgorithm.EncryptData(patientAppt.SessionGoals);
            }
            catch (Exception ex)
            {
                ex.GetHashCode();
                insert = true;
            }

            if (insert)
            {
                patientApptRecord             = new PatientAppointmentInformation();
                patientApptRecord.PatientId   = patientAppt.PatientId;
                patientApptRecord.ApptId      = Guid.NewGuid();
                patientApptRecord.ApptDate    = patientAppt.AppointmentDate;
                patientApptRecord.TherapistId = patientAppt.TherapistId;

                patientApptRecord.LV  = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseLV);
                patientApptRecord.RLU = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseRLU);
                patientApptRecord.KD1 = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseKD1);
                patientApptRecord.SP  = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseSP);
                patientApptRecord.LHT = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseLHT);
                patientApptRecord.KD2 = dataEncryptionAlgorithm.EncryptData(patientAppt.PulseKD2);

                patientApptRecord.ImageBeforeTherapy = dataEncryptionAlgorithm.EncryptData(patientAppt.ImageBeforeTherapy);
                patientApptRecord.ImageAfterTherapy  = dataEncryptionAlgorithm.EncryptData(patientAppt.ImageAfterTherapy);

                patientApptRecord.TherapyPerformed = dataEncryptionAlgorithm.EncryptData(patientAppt.OilsAndTherapy);
                patientApptRecord.SessionGoals     = dataEncryptionAlgorithm.EncryptData(patientAppt.SessionGoals);


                patientApptDataContext.PatientAppointmentInformations.InsertOnSubmit(patientApptRecord);
            }

            patientApptDataContext.SubmitChanges();
        }