public List <CHCShipmentID> AddCHCShipment(AddCHCShipmentRequest csData) { try { string stProc = AddCHCShipments; var pList = new List <SqlParameter> { new SqlParameter("@BarcodeNo", csData.barcodeNo ?? csData.barcodeNo), new SqlParameter("@LabTechnicianName", csData.labTechnicianName ?? csData.labTechnicianName), new SqlParameter("@CHCUserID", csData.chcUserId), new SqlParameter("@TestingCHCID", csData.testingCHCId), new SqlParameter("@ReceivingCentralLabId", csData.receivingCentralLabId), new SqlParameter("@LogicsProviderID", csData.logisticsProviderId), new SqlParameter("@DeliveryExecutiveName", csData.deliveryExecutiveName ?? csData.deliveryExecutiveName), new SqlParameter("@ExecutiveContactNo", csData.executiveContactNo ?? csData.executiveContactNo), new SqlParameter("@DateofShipment", csData.dateOfShipment ?? csData.dateOfShipment), new SqlParameter("@TimeofShipment", csData.timeOfShipment ?? csData.timeOfShipment), new SqlParameter("@Createdby", csData.createdBy), new SqlParameter("@Source", csData.source ?? csData.source), }; var allData = UtilityDL.FillData <CHCShipmentID>(stProc, pList); return(allData); } catch (Exception e) { throw e; } }
public async Task <IActionResult> AddCHCShipment(AddCHCShipmentRequest csData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Request - Adding CHC shipment data - {JsonConvert.SerializeObject(csData)}"); var sampleShipment = await _chcReceiptService.AddCHCShipment(csData); _logger.LogInformation($"Adding CHC shipment data - {sampleShipment}"); _logger.LogDebug($"Respone - Adding CHC shipment data - {JsonConvert.SerializeObject(sampleShipment)}"); return(Ok(new CHCShipmentResponse { Status = sampleShipment.Status, Message = sampleShipment.Message, Shipment = sampleShipment.Shipment, })); }
public async Task <CHCShipmentResponse> AddCHCShipment(AddCHCShipmentRequest csData) { var shipmentResponse = new CHCShipmentResponse(); try { var msg = checkCHCValidation(csData); if (msg == "") { var shipmentDetails = _chcReceiptData.AddCHCShipment(csData); foreach (var shipment in shipmentDetails) { shipmentResponse.Shipment = shipment; if (!string.IsNullOrEmpty(shipmentResponse.Shipment.shipmentId)) { shipmentResponse.Status = "true"; shipmentResponse.Message = ""; } else { shipmentResponse.Status = "false"; shipmentResponse.Message = shipmentResponse.Shipment.errorMessage; } } } else { shipmentResponse.Status = "false"; shipmentResponse.Message = msg; } } catch (Exception e) { shipmentResponse.Status = "false"; shipmentResponse.Message = e.Message; } return(shipmentResponse); }
public string checkCHCValidation(AddCHCShipmentRequest csData) { var message = ""; if (csData.barcodeNo == "") { message = "Barcode is missing"; } if (csData.labTechnicianName == "") { message = "Lab Technician name is missing"; } else if (csData.chcUserId <= 0) { message = "Invalid chc user id"; } else if (csData.testingCHCId <= 0) { message = "Invalid testing CHC id"; } else if (csData.receivingCentralLabId <= 0) { message = "Invalid central lab id"; } else if (csData.logisticsProviderId <= 0) { message = "Invalid logistics provider id"; } else if (csData.deliveryExecutiveName == "") { message = "Delivery executive name is missing"; } else if (csData.executiveContactNo == "") { message = "Executive contactno is missing"; } return(message); }