/// <summary> /// Deprecated Method for adding a new object to the PatientMedications EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPatientMedications(PatientMedication patientMedication) { base.AddObject("PatientMedications", patientMedication); }
/*Save Patient Meditation, supplement, hospitalization etc.. info*/ public static string SavePatientInfo(string key, string title, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? ExamId = _etc.PatientExams.Where(d => d.PatientId == ParentId).OrderByDescending(d => d.ExamId).Select(d=>d.ExamId).FirstOrDefault(); long? PhealthId = _etc.PatientResultQuestions.Where(d => d.ExamId == ExamId).Select(d => d.PHealthId).FirstOrDefault(); string Result = string.Empty; switch (key) { case "1": PatientMedication _pmedi = new PatientMedication(); _pmedi.Title = title; _pmedi.PHealthId = PhealthId; //By default 1 change it dynamically _pmedi.DateAdded = DateTime.Now; _etc.AddToPatientMedications(_pmedi); _etc.SaveChanges(); Result = _pmedi.MedicationId.ToString(); break; case "2": PatientSupplement _psup = new PatientSupplement(); _psup.Title = title; _psup.PHealthId = PhealthId; //By default 1 change it dynamically _psup.DateAdded = DateTime.Now; _etc.AddToPatientSupplements(_psup); _etc.SaveChanges(); Result = _psup.SupplementId.ToString(); break; case "3": PatientHospitalized _phos = new PatientHospitalized(); _phos.Title = title; _phos.PHealthId = PhealthId; //By default 1 change it dynamically _phos.DateAdded = DateTime.Now; _etc.AddToPatientHospitalizeds(_phos); _etc.SaveChanges(); Result = _phos.HospitalizationId.ToString(); break; } return Result; }
/// <summary> /// Create a new PatientMedication object. /// </summary> /// <param name="medicationId">Initial value of the MedicationId property.</param> public static PatientMedication CreatePatientMedication(global::System.Int64 medicationId) { PatientMedication patientMedication = new PatientMedication(); patientMedication.MedicationId = medicationId; return patientMedication; }