public async Task <IActionResult> AddMolecularSpecimenResult(AddSpecimenSampleTestRequest mrRequest) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Specimen samples to update molecular test result - {JsonConvert.SerializeObject(mrRequest)}"); var rsResponse = await _mlResultProcessService.AddSpecimenSamplesTestResult(mrRequest); return(Ok(new ServiceResponse { Status = rsResponse.Status, Message = rsResponse.Message, })); }
public async Task <ServiceResponse> AddSpecimenSamplesTestResult(AddSpecimenSampleTestRequest mrData) { var sResponse = new ServiceResponse(); string message = CheckSpecimenVal(mrData); try { if (message == "") { var result = _mlResultProcessData.AddSpecimenSamplesTestResult(mrData); if (string.IsNullOrEmpty(result.message)) { sResponse.Status = "false"; sResponse.Message = $"Unable to update the molecular specimen result for this uniquesubjectid - {mrData.uniqueSubjectId}"; return(sResponse); } else { sResponse.Status = "true"; sResponse.Message = result.message; return(sResponse); } } else { sResponse.Status = "false"; sResponse.Message = message; return(sResponse); } } catch (Exception e) { sResponse.Status = "false"; sResponse.Message = $"Unable to update the molecular specimen result - {e.Message}"; return(sResponse); } }
public string CheckSpecimenVal(AddSpecimenSampleTestRequest mrData) { string msg = ""; if (string.IsNullOrEmpty(mrData.uniqueSubjectId)) { msg = "Uniquesubjectid is missing"; } else if (mrData.pndtFoetusId <= 0) { msg = "Invalid pndt foetus id"; } else if (mrData.sampleProcessed == true) { if (mrData.zygosityId <= 0) { msg = "Invalid zygosity Id"; } else if (mrData.testResult == "") { msg = "Test result is missing"; } } else if (mrData.sampleProcessed == false) { if (string.IsNullOrEmpty(mrData.reasonForClose)) { msg = "Reason for close is missing"; } } if (mrData.userId <= 0) { msg = "Invalid user Id"; } return(msg); }
public MolecularMsg AddSpecimenSamplesTestResult(AddSpecimenSampleTestRequest rData) { string stProc = AddMolecularSpecimenTestResult; var pList = new List <SqlParameter>() { new SqlParameter("@UniqueSubjectId", rData.uniqueSubjectId), new SqlParameter("@PNDTFoetusId", rData.pndtFoetusId), new SqlParameter("@ZygosityId", rData.zygosityId), new SqlParameter("@Mutation1Id", rData.mutation1Id), new SqlParameter("@Mutation2Id", rData.mutation2Id), new SqlParameter("@Mutation3", rData.mutation3), new SqlParameter("@TestResult", rData.testResult), new SqlParameter("@IsDamaged", rData.sampleDamaged), new SqlParameter("@IsProcessed", rData.sampleProcessed), new SqlParameter("@IsComplete", rData.completeStatus), new SqlParameter("@ReasonForClose", rData.reasonForClose), new SqlParameter("@TestDate", rData.testDate), new SqlParameter("@UserId", rData.userId), new SqlParameter("@MolecularLabId", rData.molecularLabId), }; var allReceivedSubject = UtilityDL.FillEntity <MolecularMsg>(stProc, pList); return(allReceivedSubject); }