public PNDTMsg AddPNDTestNew(AddPNDTRequest aData) { string stProc = AddPNDT; var pList = new List <SqlParameter>() { new SqlParameter("@PrePNDTCounsellingId", aData.prePNDTCounsellingId), new SqlParameter("@ANWSubjectId", aData.anwsubjectId ?? aData.anwsubjectId), new SqlParameter("@SpouseSubjectId", aData.spouseSubjectId ?? aData.spouseSubjectId), new SqlParameter("@PNDTDateTime", aData.pndtDateTime ?? aData.pndtDateTime), new SqlParameter("@CounsellorId", aData.counsellorId), new SqlParameter("@ObstetricianId", aData.obstetricianId), new SqlParameter("@ClinicalHistory", aData.clinicalHistory ?? aData.clinicalHistory), new SqlParameter("@Examination", aData.examination ?? aData.examination), new SqlParameter("@ProcedureOfTestingId", aData.procedureOfTestingId), new SqlParameter("@OthersPOT", aData.othersProcedureofTesting ?? aData.othersProcedureofTesting), new SqlParameter("@PNDTComplecationsId", aData.pndtComplecationsId ?? aData.pndtComplecationsId), new SqlParameter("@OthersComplecations", aData.othersComplecations ?? aData.othersComplecations), new SqlParameter("@MotherVoided", aData.motherVoided), new SqlParameter("@MotherVitalStable", aData.motherVitalStable), new SqlParameter("@FoetalHeartRateDocumentScan", aData.foetalHeartRateDocumentScan), new SqlParameter("@UserId", aData.userId), new SqlParameter("@PregnancyType", aData.pregnancyType), new SqlParameter("@SampleRefId", aData.sampleRefId ?? aData.sampleRefId), new SqlParameter("@FoetusName", aData.foetusName ?? aData.foetusName), new SqlParameter("@CVSSampleRefId", aData.cvsSampleRefId ?? aData.cvsSampleRefId), new SqlParameter("@PNDTLocationId", aData.pndtLocationId), new SqlParameter("@AssistedBy", aData.assistedBy ?? aData.assistedBy), }; var pndtTest = UtilityDL.FillEntity <PNDTMsg>(stProc, pList); return(pndtTest); }
public async Task <AddPNDTResponse> AddPNDTestNew(AddPNDTRequest aData) { var sResponse = new AddPNDTResponse(); var msg = AddPNDTCheckValidation(aData); try { if (msg == "") { var pndtMsg = _pndtObstetricianData.AddPNDTestNew(aData); sResponse.Status = "true"; sResponse.Message = string.Empty; sResponse.data = pndtMsg; return(sResponse); } else { sResponse.Status = "false"; sResponse.Message = msg; return(sResponse); } } catch (Exception e) { sResponse.Status = "false"; sResponse.Message = $"Unable to add PND Test - {e.Message}"; return(sResponse); } }
public async Task <IActionResult> AddPNDT(AddPNDTRequest aData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); var pndTest = await _pndtObstetricianService.AddPNDTestNew(aData); _logger.LogInformation($"Add PNDTest for the counselled positive subjects {pndTest}"); return(Ok(new AddPNDTResponse { Status = pndTest.Status, Message = pndTest.Message, data = pndTest.data, })); }
public string AddPNDTCheckValidation(AddPNDTRequest aData) { string msg = ""; List <string> stringSampleRefIdList = aData.sampleRefId.Split(',').ToList(); List <string> stringCVSList = aData.cvsSampleRefId.Split(',').ToList(); List <string> stringFoetusList = aData.foetusName.Split(',').ToList(); int sr, cv, fn; sr = stringSampleRefIdList.Count(); cv = stringCVSList.Count(); fn = stringFoetusList.Count(); if (aData.obstetricianId <= 0) { msg = "Invalid Obstetrician"; } else if (string.IsNullOrEmpty(aData.pndtDateTime)) { msg = "PNDT date and time is missing"; } else if (string.IsNullOrEmpty(aData.clinicalHistory)) { msg = "Clinical history is missing"; } else if (string.IsNullOrEmpty(aData.examination)) { msg = "Examination is missing"; } else if (aData.procedureOfTestingId <= 0) { msg = "Invalid procedure for testing id"; } else if (string.IsNullOrEmpty(aData.pndtComplecationsId)) { msg = "Complications are missing"; } else if (aData.pregnancyType <= 0) { msg = "Invalid type of pregnancy"; } else if (string.IsNullOrEmpty(aData.sampleRefId)) { msg = "Sample reference id is missing"; } else if (string.IsNullOrEmpty(aData.foetusName)) { msg = "Foetus name is missing"; } else if (string.IsNullOrEmpty(aData.cvsSampleRefId)) { msg = "CVS sample id is missing"; } else if (string.IsNullOrEmpty(aData.assistedBy)) { msg = "Assisted by is missing"; } if (sr != cv || sr != fn || cv != fn) { msg = "samplerefid , foetusname , cvssamplerefid counts are not equal."; } return(msg); }