public string GetPatientIptOutcome(int patientId) { try { var iptOutcome = new PatientIptOutcomeManager(); var x = iptOutcome.GetByPatientId(patientId).FirstOrDefault(); if (x != null) { PatientIptOutcome patientIptOutcome = new PatientIptOutcome() { PatientId = x.PatientId, PatientMasterVisitId = x.PatientMasterVisitId, IptEvent = x.IptEvent, ReasonForDiscontinuation = x.ReasonForDiscontinuation, Id = x.Id, IPTOutComeDate = x.IPTOutComeDate }; JavaScriptSerializer parser = new JavaScriptSerializer(); Msg = parser.Serialize(patientIptOutcome); } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public string AddPatientIptOutcome(int patientId, DateTime?IPTDate, int patientMasterVisitId, int iptEvent, string reasonForDiscontinuation) { PatientIptOutcome patientIptOutcome = new PatientIptOutcome() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, IptEvent = iptEvent, ReasonForDiscontinuation = reasonForDiscontinuation, IPTOutComeDate = IPTDate }; try { var iptOutcome = new PatientIptOutcomeManager(); var x = iptOutcome.GetByPatientId(patientId).FirstOrDefault(n => n.PatientMasterVisitId == patientMasterVisitId); if (x == null) { Result = iptOutcome.AddPatientIptOutcome(patientIptOutcome); } else { patientIptOutcome.Id = x.Id; Result = iptOutcome.UpdatePatientIptOutcome(patientIptOutcome); } if (Result > 0) { Msg = "Patient IPT Outcome saved successfully!"; } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public PatientIptOutcome GetPatientIptOutcome(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIptOutcome patientIptOutcome = _unitOfWork.PatientIptOutcomeRepository.GetById(id); _unitOfWork.Dispose(); return(patientIptOutcome); } }
public int UpdatePatientIptOutcome(PatientIptOutcome p) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { _unitOfWork.PatientIptOutcomeRepository.Update(p); _result = _unitOfWork.Complete(); _unitOfWork.Dispose(); return(_result); } }
public void DeletePatientIptOutcome(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIptOutcome icf = _unitOfWork.PatientIptOutcomeRepository.GetById(id); _unitOfWork.PatientIptOutcomeRepository.Remove(icf); _unitOfWork.Complete(); _unitOfWork.Dispose(); } }
public int AddPatientIptOutcome(PatientIptOutcome p) { PatientIptOutcome patientIptOutcome = new PatientIptOutcome() { PatientId = p.PatientId, PatientMasterVisitId = p.PatientMasterVisitId, IptEvent = p.IptEvent, ReasonForDiscontinuation = p.ReasonForDiscontinuation, CreatedBy = SessionManager.UserId }; return(_patientIptOutcome.AddPatientIptOutcome(patientIptOutcome)); }