internal MessageResponse ProcessHttpRequest(InputFileProperties inputFile)
        {
            try
            {
                if (inputFile == null)
                {
                    return(MessageResponse.error("File Not Found"));
                }

                var inputContent = GetInputFileContentAndLogRequest(inputFile);

                var sb = _psTool.ProcessDataFile(inputContent);

                var errorList = _psTool.GetErrors();
                if (errorList.Any())
                {
                    return(MessageResponse.error(errorList));
                }

                var encryptedData = AESHelper.EncryptAES(sb.ToString(), _configuration["AESKeyBLOB"]);
                return(MessageResponse.ok(encryptedData));
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(MessageResponse.error(e.Message));
            }
        }
        private byte[] GetInputFileContentAndLogRequest(InputFileProperties inputFile)
        {
            // Show all the key-value pairs.
            if (!string.IsNullOrEmpty(inputFile.CaseAction))
            {
                Logger.Info("CaseAction: " + inputFile.CaseAction);
            }
            //if (!string.IsNullOrEmpty(inputFile.VendorCreate))
            //    Logger.Info("VendorCreate[]: " + inputFile.VendorCreate);
            //if (!string.IsNullOrEmpty(inputFile.AddressCreate))
            //    Logger.Info("AddressCreate[]: " + inputFile.AddressCreate);
            //if (!string.IsNullOrEmpty(inputFile.VendorUpdate))
            //    Logger.Info("VendorUpdate[]: " + inputFile.VendorUpdate);
            //if (!string.IsNullOrEmpty(inputFile.AddressUpdate))
            //    Logger.Info("AddressUpdate[]: " + inputFile.AddressUpdate);
            if (!string.IsNullOrEmpty(inputFile.ContainerName))
            {
                Logger.Info("containerName: " + inputFile.ContainerName);
            }
            if (!string.IsNullOrEmpty(inputFile.BlobName))
            {
                Logger.Info("blobName: " + inputFile.BlobName);
            }
            if (!string.IsNullOrEmpty(inputFile.Decrypt))
            {
                Logger.Info("decrypt: " + inputFile.Decrypt);
            }
            if (!string.IsNullOrEmpty(inputFile.SiteName))
            {
                Logger.Info("SiteName: " + inputFile.SiteName);
            }
            var isGetFromBlob = string.IsNullOrEmpty(inputFile.isGetFromBlob) ? false : bool.Parse(inputFile.isGetFromBlob);

            Logger.Info("isGetFromBlob : " + inputFile.isGetFromBlob);

            var byteArr = GetByteFile(inputFile.File, isGetFromBlob, inputFile.ContainerName, inputFile.BlobName);

            return(byteArr);
        }
        public MessageResponse Import(InputFileProperties inputFileProperties, IConfiguration configuration)
        {
            var service = new MasterDataConversionService(new MasterDataPsTool(), configuration);

            return(service.ProcessHttpRequest(inputFileProperties));
        }
Exemple #4
0
 public async Task <IActionResult> Import([FromForm] InputFileProperties inputFileProperties)
 {
     return(Ok());
 }