Beispiel #1
0
        public string checkshipmentValidation(AddPickandPackRequest asData)
        {
            var message = "";

            if (asData.barcodeNo == "")
            {
                message = "Barcode is missing";
            }
            else if (asData.hospitalId <= 0)
            {
                message = "Invalid hospital id";
            }
            else if (asData.molecularLabId <= 0)
            {
                message = "Invalid molecular lab id";
            }
            else if (string.IsNullOrEmpty(asData.senderName))
            {
                message = " Sender name is missing";
            }
            else if (string.IsNullOrEmpty(asData.contactNo))
            {
                message = " Contactno is missing";
            }
            else if (string.IsNullOrEmpty(asData.dateOfShipment))
            {
                message = " Shipment date is missing";
            }
            else if (string.IsNullOrEmpty(asData.dateOfShipment))
            {
                message = " Shipment time is missing";
            }
            return(message);
        }
Beispiel #2
0
        public async Task <IActionResult> AddShipment(AddPickandPackRequest asData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Adding shipment data - {JsonConvert.SerializeObject(asData)}");
            var sampleShipment = await _pickandPackService.AddShipment(asData);

            return(Ok(new AddShipmentResponse
            {
                Status = sampleShipment.Status,
                Message = sampleShipment.Message,
                Shipment = sampleShipment.Shipment,
            }));
        }
Beispiel #3
0
        public async Task <AddShipmentResponse> AddShipment(AddPickandPackRequest asData)
        {
            var shipmentResponse = new AddShipmentResponse();

            try
            {
                var msg = checkshipmentValidation(asData);
                if (msg == "")
                {
                    var shipmentDetails = _pickandPackData.AddShipment(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);
        }
Beispiel #4
0
 public List <ShipmentsId> AddShipment(AddPickandPackRequest asData)
 {
     try
     {
         string stProc = AddShipments;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@BarcodeNo", asData.barcodeNo ?? asData.barcodeNo),
             new SqlParameter("@HospitalId", asData.hospitalId),
             new SqlParameter("@MolecularLabId", asData.molecularLabId),
             new SqlParameter("@SenderName", asData.senderName ?? asData.senderName),
             new SqlParameter("@ContactNo", asData.contactNo ?? asData.contactNo),
             new SqlParameter("@DateofShipment", asData.dateOfShipment ?? asData.dateOfShipment),
             new SqlParameter("@TimeofShipment", asData.timeOfShipment ?? asData.timeOfShipment),
             new SqlParameter("@Createdby", asData.userId),
         };
         var allData = UtilityDL.FillData <ShipmentsId>(stProc, pList);
         return(allData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }