コード例 #1
0
        public string checkANMValidation(AddShipmentANMCHCRequest asData)
        {
            var message = "";

            if (asData.barcodeNo == "")
            {
                message = "Barcode is missing";
            }
            else if (asData.anmId <= 0)
            {
                message = "Invalid ANM id";
            }
            else if (asData.testingCHCId <= 0)
            {
                message = "Invalid testing CHC id";
            }
            else if (asData.riId <= 0)
            {
                message = "Invalid RI id";
            }
            else if (asData.ilrId <= 0)
            {
                message = "Invalid ILR id";
            }
            else if (asData.avdId <= 0)
            {
                message = "Invalid AVD id";
            }
            if (asData.avdContactNo == "")
            {
                message = "AVD contactno is missing";
            }
            return(message);
        }
コード例 #2
0
 public List <ANMCHCShipmentID> AddANMCHCShipment(AddShipmentANMCHCRequest asData)
 {
     try
     {
         string stProc = AddShipment;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@BarcodeNo", asData.barcodeNo ?? asData.barcodeNo),
             new SqlParameter("@ShipmentFrom", asData.shipmentFrom),
             new SqlParameter("@ANM_ID", asData.anmId),
             new SqlParameter("@RIID", asData.riId),
             new SqlParameter("@ILR_ID", asData.ilrId),
             new SqlParameter("@AVDID", asData.avdId),
             new SqlParameter("@AVDContactNo", asData.avdContactNo ?? asData.avdContactNo),
             new SqlParameter("@AlternateAVD", asData.alternateAVD.ToCheckNull()),
             new SqlParameter("@AlternateAVDContactNo", asData.alternateAVDContactNo.ToCheckNull()),
             new SqlParameter("@TestingCHCID", asData.testingCHCId),
             new SqlParameter("@DateofShipment", asData.dateOfShipment ?? asData.dateOfShipment),
             new SqlParameter("@TimeofShipment", asData.timeOfShipment ?? asData.timeOfShipment),
             new SqlParameter("@Createdby", asData.createdBy),
             new SqlParameter("@Source", asData.source ?? asData.source),
         };
         var allData = UtilityDL.FillData <ANMCHCShipmentID>(stProc, pList);
         return(allData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #3
0
        public async Task <IActionResult> AddShipment(AddShipmentANMCHCRequest asData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - Adding ANM shipment data - {JsonConvert.SerializeObject(asData)}");
            var sampleShipment = await _anmchcShipmentService.AddANMCHCShipment(asData);

            _logger.LogInformation($"add samples to shipment for ANM user {sampleShipment}");
            _logger.LogDebug($"Response - Adding ANM shipment data - {JsonConvert.SerializeObject(sampleShipment)}");
            return(Ok(new AddShipmentResponse
            {
                Status = sampleShipment.Status,
                Message = sampleShipment.Message,
                Shipment = sampleShipment.Shipment,
            }));
        }
コード例 #4
0
        public async Task <AddShipmentResponse> AddANMCHCShipment(AddShipmentANMCHCRequest asData)
        {
            var shipmentResponse = new AddShipmentResponse();

            try
            {
                var msg = checkANMValidation(asData);
                if (msg == "")
                {
                    var shipmentDetails = _anmchcShipmentData.AddANMCHCShipment(asData);
                    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);
        }