コード例 #1
0
 public string AddSampleRecollection(SampleRecollectionRequest srData)
 {
     try
     {
         string stProc = AddANMSampleRecollection;
         var    retVal = new SqlParameter("@Scope_output", 1);
         retVal.Direction = ParameterDirection.Output;
         var pList = new List <SqlParameter>
         {
             new SqlParameter("@UniqueSubjectID", srData.uniqueSubjectId ?? srData.uniqueSubjectId),
             new SqlParameter("@BarcodeNo", srData.barcodeNo ?? srData.barcodeNo),
             new SqlParameter("@SampleCollectionDate", srData.sampleCollectionDate ?? srData.sampleCollectionDate),
             new SqlParameter("@SampleCollectionTime", srData.sampleCollectionTime ?? srData.sampleCollectionTime),
             new SqlParameter("@Reason", srData.reason ?? srData.reason),
             new SqlParameter("@CollectionFrom", srData.collectionFrom),
             new SqlParameter("@CollectedBy", srData.collectedBy),
             retVal
         };
         UtilityDL.ExecuteNonQuery(stProc, pList);
         return($"Sample recollected successfully");
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #2
0
        public async Task <IActionResult> AddSampleRecollection(SampleRecollectionRequest srData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - Adding sample recollection data - {JsonConvert.SerializeObject(srData)}");
            var sampleRecollection = await _anmNotificationsService.AddSampleRecollection(srData);

            _logger.LogInformation($" Add the new sample recollection of subject which are damaged sample or timout expiry sample {sampleRecollection}");
            _logger.LogDebug($"Response - Adding sample recollection data - {JsonConvert.SerializeObject(sampleRecollection)}");
            return(Ok(new ServiceResponse
            {
                Status = sampleRecollection.Status,
                Message = sampleRecollection.Message,
            }));
        }
コード例 #3
0
        public async Task <ServiceResponse> AddSampleRecollection(SampleRecollectionRequest srData)
        {
            var sResponse = new ServiceResponse();

            try
            {
                if (string.IsNullOrEmpty(srData.uniqueSubjectId))
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Uniquesubjectid is missing";
                    return(sResponse);
                }
                if (string.IsNullOrEmpty(srData.barcodeNo))
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Barcode is missing";
                    return(sResponse);
                }
                if (string.IsNullOrEmpty(srData.sampleCollectionDate))
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Sample collection date is missing";
                    return(sResponse);
                }
                if (string.IsNullOrEmpty(srData.sampleCollectionTime))
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Sample collection time is missing";
                    return(sResponse);
                }
                if (string.IsNullOrEmpty(srData.reason))
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Invalid Reason";
                    return(sResponse);
                }
                if (srData.collectionFrom <= 0)
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Invalid collection from data";
                    return(sResponse);
                }
                if (srData.collectedBy <= 0)
                {
                    sResponse.Status  = "false";
                    sResponse.Message = "Invalid collection by data";
                    return(sResponse);
                }
                var barcode = _anmNotificationsData.FetchBarcode(srData.barcodeNo);
                if (barcode.Count <= 0)
                {
                    var result = _anmNotificationsData.AddSampleRecollection(srData);
                    if (string.IsNullOrEmpty(result))
                    {
                        sResponse.Status  = "false";
                        sResponse.Message = $"Unable to collect sampele for this uniquesubjectid - {srData.uniqueSubjectId}";
                        return(sResponse);
                    }
                    else
                    {
                        sResponse.Status  = "true";
                        sResponse.Message = result;
                        return(sResponse);
                    }
                }
                else
                {
                    sResponse.Status  = "false";
                    sResponse.Message = $" This barcode no- {srData.barcodeNo} is already associated with another subject";
                    return(sResponse);
                }
            }
            catch (Exception e)
            {
                sResponse.Status  = "false";
                sResponse.Message = $"Unable to collect sampele for this uniquesubjectid - {srData.uniqueSubjectId} - {e.Message}";
                return(sResponse);
            }
        }