public PatientIcf GetPatientIcf(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIcf patientIcf = _unitOfWork.PatientIcfRepository.GetById(id); _unitOfWork.Dispose(); return(patientIcf); } }
public int UpdatePatientIcf(PatientIcf p) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { _unitOfWork.PatientIcfRepository.Update(p); _result = _unitOfWork.Complete(); _unitOfWork.Dispose(); return(_result); } }
public void DeletePatientIcf(int id) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { PatientIcf icf = _unitOfWork.PatientIcfRepository.GetById(id); _unitOfWork.PatientIcfRepository.Remove(icf); _unitOfWork.Dispose(); _unitOfWork.Complete(); } }
public int UpdatePatientIcf(PatientIcf p) { PatientIcf patientIcf = new PatientIcf() { Id = p.Id, PatientId = p.PatientId, PatientMasterVisitId = p.PatientMasterVisitId, Cough = p.Cough, Fever = p.Fever, NightSweats = p.NightSweats, WeightLoss = p.WeightLoss, OnIpt = p.OnIpt, OnAntiTbDrugs = p.OnAntiTbDrugs, EverBeenOnIpt = p.EverBeenOnIpt }; return(_patientIcf.UpdatePatientIcf(patientIcf)); }
public int AddPatientIcf(PatientIcf p) { PatientIcf patientIcf = new PatientIcf() { PatientId = p.PatientId, PatientMasterVisitId = p.PatientMasterVisitId, Cough = p.Cough, Fever = p.Fever, NightSweats = p.NightSweats, WeightLoss = p.WeightLoss, OnAntiTbDrugs = p.OnAntiTbDrugs, OnIpt = p.OnIpt, EverBeenOnIpt = p.EverBeenOnIpt, CreatedBy = SessionManager.UserId }; return(_patientIcf.AddPatientIcf(patientIcf)); }
public string AddPatientIcf(int patientId, int patientMasterVisitId, int cough, int fever, int nightSweats, int weightLoss, int onAntiTbDrugs, int onIpt, int everBeenOnIpt) { LookupLogic lookUp = new LookupLogic(); //cough bool?_cough = null; if (lookUp.GetLookupItemNameById(cough) == "Yes") { _cough = true; } else if (lookUp.GetLookupItemNameById(cough) == "No") { _cough = false; } //fever bool?_fever = null; if (lookUp.GetLookupItemNameById(fever) == "Yes") { _fever = true; } else if (lookUp.GetLookupItemNameById(fever) == "No") { _fever = false; } //night sweat bool?_nightSweat = null; if (lookUp.GetLookupItemNameById(nightSweats) == "Yes") { _nightSweat = true; } else if (lookUp.GetLookupItemNameById(nightSweats) == "No") { _nightSweat = false; } //weight loss bool?_WeightLoss = null; if (lookUp.GetLookupItemNameById(weightLoss) == "Yes") { _WeightLoss = true; } else if (lookUp.GetLookupItemNameById(weightLoss) == "No") { _WeightLoss = false; } //onAntiTBdrugs bool _onAntiTbDrugs = false; string passedValue = lookUp.GetLookupItemNameById(onAntiTbDrugs); if (passedValue == "Yes") { _onAntiTbDrugs = true; } else if (lookUp.GetLookupItemNameById(onAntiTbDrugs) == "No") { _onAntiTbDrugs = false; } //onIPT bool _onIpt = false; if (lookUp.GetLookupItemNameById(onIpt) == "Yes") { _onIpt = true; } else if (lookUp.GetLookupItemNameById(onIpt) == "No") { _onIpt = false; } //everBeenOnIpt bool?_everBeenOnIpt = null; if (lookUp.GetLookupItemNameById(everBeenOnIpt) == "Yes") { _everBeenOnIpt = true; } else if (lookUp.GetLookupItemNameById(everBeenOnIpt) == "No") { _everBeenOnIpt = false; } PatientIcf patientIcf = new PatientIcf() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, Cough = _cough, Fever = _fever, NightSweats = _nightSweat, WeightLoss = _WeightLoss, OnIpt = _onIpt, OnAntiTbDrugs = _onAntiTbDrugs, EverBeenOnIpt = _everBeenOnIpt }; try { var icf = new PatientIcfManager(); var x = icf.GetByPatientId(patientId).FirstOrDefault(m => m.PatientMasterVisitId == patientMasterVisitId); if (x == null) { Result = icf.AddPatientIcf(patientIcf); } else { patientIcf.Id = x.Id; Result = icf.UpdatePatientIcf(patientIcf); } if (Result > 0) { Msg = "Patient ICF saved successfully!"; } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public string AddPatientIcf(int patientId, int patientMasterVisitId, string cough, string fever, string nightSweats, string weightLoss, bool onAntiTbDrugs, bool onIpt, bool everBeenOnIpt) { bool?_cough = null; if (cough.Trim().ToLower() == "true") { _cough = true; } else if (cough.Trim().ToLower() == "false") { _cough = false; } bool?_fever = null; if (fever.Trim().ToLower() == "true") { _fever = true; } else if (fever.Trim().ToLower() == "false") { _fever = false; } bool?_nightSweat = null; if (nightSweats.Trim().ToLower() == "true") { _nightSweat = true; } else if (nightSweats.Trim().ToLower() == "false") { _nightSweat = false; } bool?_WeightLoss = null; if (weightLoss.Trim().ToLower() == "true") { _WeightLoss = true; } else if (weightLoss.Trim().ToLower() == "false") { _WeightLoss = false; } PatientIcf patientIcf = new PatientIcf() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, Cough = _cough, Fever = _fever, NightSweats = _nightSweat, WeightLoss = _WeightLoss, OnIpt = onIpt, OnAntiTbDrugs = onAntiTbDrugs, EverBeenOnIpt = everBeenOnIpt }; try { var icf = new PatientIcfManager(); var x = icf.GetByPatientId(patientId).FirstOrDefault(m => m.PatientMasterVisitId == patientMasterVisitId); if (x == null) { Result = icf.AddPatientIcf(patientIcf); } else { patientIcf.Id = x.Id; Result = icf.UpdatePatientIcf(patientIcf); } if (Result > 0) { Msg = "Patient ICF saved successfully!"; } } catch (Exception e) { Msg = e.Message; } return(Msg); }