public PatientIpt GetPatientIpt(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIpt patientIpt = _unitOfWork.PatientIptRepository.GetById(id); _unitOfWork.Dispose(); return(patientIpt); } }
public int UpdatePatientIpt(PatientIpt p) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { _unitOfWork.PatientIptRepository.Update(p); _result = _unitOfWork.Complete(); _unitOfWork.Dispose(); return(_result); } }
public void DeletePatientIpt(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIpt icf = _unitOfWork.PatientIptRepository.GetById(id); _unitOfWork.PatientIptRepository.Remove(icf); _unitOfWork.Complete(); _unitOfWork.Dispose(); } }
public string AddIpt(int patientId, int patientMasterVisitId, decimal weight, DateTime iptDueDate, DateTime iptDateCollected, bool hepatotoxicity, bool peripheralneoropathy, bool rash, int adheranceMeasurement, string hepatotoxicityAction, string peripheralneoropathyAction, string rashAction, string adheranceMeasurementAction) { PatientIpt patientIpt = new PatientIpt() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, Weight = Convert.ToInt32(weight), AdheranceMeasurement = adheranceMeasurement, Hepatotoxicity = hepatotoxicity, IptDateCollected = iptDateCollected, IptDueDate = iptDueDate, Peripheralneoropathy = peripheralneoropathy, Rash = rash, HepatotoxicityAction = hepatotoxicityAction, PeripheralneoropathyAction = peripheralneoropathyAction, RashAction = rashAction, AdheranceMeasurementAction = adheranceMeasurementAction, }; try { var ipt = new PatientIptManager(); var x = ipt.GetByPatientId(patientId).FirstOrDefault(m => m.PatientMasterVisitId == patientMasterVisitId); if (x == null) { Result = ipt.AddPatientIpt(patientIpt); } else { patientIpt.Id = x.Id; Result = ipt.UpdatePatientIpt(patientIpt); } if (Result > 0) { Msg = "Patient IPT saved successfully!"; } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public int AddPatientIpt(PatientIpt p) { PatientIpt patientIpt = new PatientIpt() { PatientId = p.PatientId, PatientMasterVisitId = p.PatientMasterVisitId, Weight = p.Weight, AdheranceMeasurement = p.AdheranceMeasurement, Hepatotoxicity = p.Hepatotoxicity, IptDateCollected = p.IptDateCollected, IptDueDate = p.IptDueDate, Peripheralneoropathy = p.Peripheralneoropathy, Rash = p.Rash, HepatotoxicityAction = p.HepatotoxicityAction, PeripheralneoropathyAction = p.PeripheralneoropathyAction, RashAction = p.RashAction, AdheranceMeasurementAction = p.AdheranceMeasurementAction, CreatedBy = SessionManager.UserId }; return(_patientIpt.AddPatientIpt(patientIpt)); }