public List <SubjectSamples> Retrieve(SubjectSampleRequest ssData) { string stProc = FetchSubjectNotSampleCollected; var pList = new List <SqlParameter>() { new SqlParameter("@UserID", ssData.userId), new SqlParameter("@FromDate", ssData.fromDate ?? ssData.fromDate), new SqlParameter("@ToDate", ssData.toDate ?? ssData.toDate), new SqlParameter("@SubjectType", ssData.subjectType), new SqlParameter("@RegisteredFrom", ssData.registeredFrom), }; var allData = UtilityDL.FillData <SubjectSamples>(stProc, pList); return(allData); }
public SubjectSampleResponse GetSubjectList(SubjectSampleRequest ssData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); var fromDate = ""; var toDate = ""; if (ssData.fromDate == "" || ssData.fromDate == null) { fromDate = DateTime.Now.AddYears(-1).ToString("dd/MM/yyyy"); } else { fromDate = ssData.fromDate; } if (ssData.toDate == "" || ssData.toDate == null) { toDate = DateTime.Now.ToString("dd/MM/yyyy"); } else { toDate = ssData.toDate; } try { var subjectList = _sampleCollectionService.Retrieve(ssData); _logger.LogInformation($"Received subject Data {subjectList}"); return(subjectList.Count == 0 ? new SubjectSampleResponse { Status = "true", Message = "No subjects found", fromDate = fromDate, toDate = toDate, SubjectList = new List <SubjectSamples>() } : new SubjectSampleResponse { Status = "true", Message = string.Empty, fromDate = fromDate, toDate = toDate, SubjectList = subjectList }); } catch (Exception e) { _logger.LogError($"Error in receiving subject data {e.StackTrace}"); return(new SubjectSampleResponse { Status = "false", Message = e.Message, fromDate = fromDate, toDate = toDate, SubjectList = null }); } }
public List <SubjectSamples> Retrieve(SubjectSampleRequest ssData) { var subjectSamples = _sampleCollectionData.Retrieve(ssData); return(subjectSamples); }