public static bool Put(DicomPatientData person) { string key = person.PatientKey; bool ok = true; using (var outStream = new MemoryStream()) { Serializer.Serialize <DicomPatientData>(outStream, person); ok = dbClientDicomPatients.Update(key, outStream.ToArray()); } if (ok) { dbClientUpdates1.InsertAutoIncrement(DB_DICOMPATIENTS, StringToolkit.GetBytes(key)); byte[] byteGps = dbClientGpsFiles.Get(key); if ((byteGps == null) || (byteGps.Length == 0)) { // it doesn't exist, insert it PatientGPSFileList gps = new PatientGPSFileList { EntryTimestamp = DateTime.Now.Ticks }; using (var outStream = new MemoryStream()) { Serializer.Serialize <PatientGPSFileList>(outStream, gps); ok &= dbClientGpsFiles.Create(key, outStream.ToArray()); } if (ok) { dbClientUpdates1.InsertAutoIncrement(DB_GPSFILES, StringToolkit.GetBytes(key)); } } return(ok); } return(false); }
public static bool Put(Patient person) { string key = person.GetFallbackKey().ToUpper(); bool ok = true; byte[] bytePatient = dbClientPatients.Get(key); if ((bytePatient == null) || (bytePatient.Length == 0)) { // it doesn't exist, insert it using (var outStream = new MemoryStream()) { Serializer.Serialize <Patient>(outStream, person); ok = dbClientPatients.Create(key, outStream.ToArray()); } if (ok) { dbClientUpdates1.InsertAutoIncrement(DB_PATIENTS, StringToolkit.GetBytes(key)); return(ok); } } return(false); }