public int UpdatePatientBaselineAssessment(PatientBaselineAssessment patientBaselineAssessment) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { var patientBaseline = unitOfWork.PatientBaselineAssessmentRepository.FindBy( x => x.PatientId == patientBaselineAssessment.PatientId & !x.DeleteFlag).FirstOrDefault(); if (patientBaseline != null) { patientBaseline.Breastfeeding = patientBaselineAssessment.Breastfeeding; if (patientBaselineAssessment.CD4Count > 0) { patientBaseline.CD4Count = patientBaselineAssessment.CD4Count; } patientBaseline.HBVInfected = patientBaselineAssessment.HBVInfected; patientBaseline.Height = patientBaselineAssessment.Height; patientBaseline.MUAC = patientBaselineAssessment.MUAC; patientBaseline.Pregnant = patientBaselineAssessment.Pregnant; patientBaseline.TBInfected = patientBaselineAssessment.TBInfected; patientBaseline.Weight = patientBaselineAssessment.Weight; patientBaseline.WHOStage = patientBaselineAssessment.WHOStage; unitOfWork.PatientBaselineAssessmentRepository.Update(patientBaseline); Result = unitOfWork.Complete(); } unitOfWork.Dispose(); return(Result); } }
public int ManagePatientBaselineAssessment(int id, int patientId, int patientMasterVisitId, bool hbvInfected, bool pregnant, bool tbInfected, int whoStage, bool breastfeeding, decimal cd4Count, decimal muac, decimal weight, decimal height, int userId) { _id = _patientBaselineAssessment.CheckIfPatientBaselineExists(patientId); var patientArtInitiationBaselinesInsert = new PatientBaselineAssessment() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, HBVInfected = hbvInfected, Pregnant = pregnant, TBInfected = tbInfected, WHOStage = whoStage, Breastfeeding = breastfeeding, // CD4Count = cd4Count, MUAC = muac, Weight = weight, Height = height, CreatedBy = userId }; if (cd4Count > 0) { patientArtInitiationBaselinesInsert.CD4Count = cd4Count; } _result = (_id > 0) ? _patientBaselineAssessment.UpdatePatientBaselineAssessment(patientArtInitiationBaselinesInsert): _patientBaselineAssessment.AddPatientBaselineAssessment(patientArtInitiationBaselinesInsert); return(_result); }
public int AddPatientBaselineAssessment(PatientBaselineAssessment patientBaselineAssessment) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { unitOfWork.PatientBaselineAssessmentRepository.Add(patientBaselineAssessment); Result = unitOfWork.Complete(); unitOfWork.Dispose(); return(Result); } }
public int UpdatePatientBaselineAssessment(int id, int patientId, int patientMasterVisitId, bool hbvInfected, bool pregnant, bool tbInfected, int whoStage, bool breastfeeding, decimal cd4Count, decimal muac, decimal weight, decimal height, int userId) { var patientBaseline = new PatientBaselineAssessment() { HBVInfected = hbvInfected, Pregnant = pregnant, TBInfected = tbInfected, WHOStage = whoStage, Breastfeeding = breastfeeding, CD4Count = cd4Count, MUAC = muac, Weight = weight, Height = height, }; return(_patientBaselineAssessment.UpdatePatientBaselineAssessment(patientBaseline)); }