Ejemplo n.º 1
0
        public List <CHCNotificationSample> GetCHCNotificationSamples(CHCNotificationSamplesRequest cnData)
        {
            string stProc = FetchCHCNotificationSamples;
            var    pList  = new List <SqlParameter>()
            {
                new SqlParameter("@UserId", cnData.userId),
                new SqlParameter("@CollectedFrom", cnData.collectionFrom),
                new SqlParameter("@Notification", cnData.notification),
            };
            var allData = UtilityDL.FillData <CHCNotificationSample>(stProc, pList);

            return(allData);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetCHCUnsentSamples(CHCNotificationSamplesRequest cnData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - Received unsent data - {JsonConvert.SerializeObject(cnData)}");
            var unsentSamples = await _chcNotificationsService.RetrieveUnsentSamples(cnData);

            _logger.LogInformation($"Received unsent sample data {unsentSamples}");
            _logger.LogDebug($"Response - Received unsent data   - {JsonConvert.SerializeObject(unsentSamples)}");
            return(Ok(new CHCUnsentSamplesResponse
            {
                Status = unsentSamples.Status,
                Message = unsentSamples.Message,
                UnsentSamplesDetail = unsentSamples.UnsentSamplesDetail,
            }));
        }
Ejemplo n.º 3
0
        public async Task <CHCUnsentSamplesResponse> RetrieveUnsentSamples(CHCNotificationSamplesRequest cnData)
        {
            var chcUnsentresponse = new CHCUnsentSamplesResponse();

            try
            {
                var unsentSampleDetail = _chcNotificationsData.GetANMUnsentSamples(cnData);

                var chcUnsent = new List <CHCUnsentSample>();

                foreach (var unsent in unsentSampleDetail)
                {
                    var unsentSample = new CHCUnsentSample();
                    unsentSample.barcodeNo          = unsent.barcodeNo;
                    unsentSample.contactNo          = unsent.contactNo;
                    unsentSample.gestationalAge     = unsent.gestationalAge;
                    unsentSample.rchId              = unsent.rchId;
                    unsentSample.sampleCollectionId = unsent.sampleCollectionId;
                    unsentSample.subjectName        = unsent.subjectName;
                    unsentSample.uniqueSubjectId    = unsent.uniqueSubjectId;
                    unsentSample.sampleDateTime     = unsent.sampleDateTime;
                    DateTime myDate1    = DateTime.Now;
                    DateTime myDate2    = Convert.ToDateTime(unsent.sampleDateTime);
                    TimeSpan difference = myDate1.Subtract(myDate2);
                    double   totalHours = Math.Round(difference.TotalHours);
                    unsentSample.sampleAging = Convert.ToString(totalHours); //+ " Hrs";
                    chcUnsent.Add(unsentSample);
                }
                chcUnsentresponse.UnsentSamplesDetail = chcUnsent;
                chcUnsentresponse.Status  = "true";
                chcUnsentresponse.Message = string.Empty;
            }
            catch (Exception e)
            {
                chcUnsentresponse.Status  = "false";
                chcUnsentresponse.Message = e.Message;
            }
            return(chcUnsentresponse);
        }
Ejemplo n.º 4
0
 public CHCNotificationsSampleResponse GetANMNotificationSamples(CHCNotificationSamplesRequest cnData)
 {
     _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
     try
     {
         _logger.LogDebug($"Request - Received sample data - {JsonConvert.SerializeObject(cnData)}");
         var notificationSamples = _chcNotificationsService.GetCHCNotificationSamples(cnData);
         _logger.LogInformation($"Received sample data {notificationSamples}");
         _logger.LogDebug($"Response - Received sample data   - {JsonConvert.SerializeObject(notificationSamples)}");
         return(notificationSamples.Count == 0 ? new CHCNotificationsSampleResponse {
             Status = "true", Message = "No sample data  found", SampleList = new List <CHCNotificationSample>()
         }
         : new CHCNotificationsSampleResponse {
             Status = "true", Message = string.Empty, SampleList = notificationSamples
         });
     }
     catch (Exception e)
     {
         _logger.LogError($"Error in  receiving samples data {e.StackTrace}");
         return(new CHCNotificationsSampleResponse {
             Status = "false", Message = e.Message, SampleList = null
         });
     }
 }
Ejemplo n.º 5
0
        public List <CHCNotificationSample> GetCHCNotificationSamples(CHCNotificationSamplesRequest cnData)
        {
            var notificationSamples = _chcNotificationsData.GetCHCNotificationSamples(cnData);

            return(notificationSamples);
        }