Exemplo n.º 1
0
        public VerifyFatcaFlagResponseModel VerifyFatcaFlag(VerifyFatcaFlagRequestModel requestModel)
        {
            Logging.WriteLog(requestModel);
            VerifyFatcaFlagResponseModel responseModel = new VerifyFatcaFlagResponseModel();

            responseModel.ReferenceNo = requestModel.ReferenceNo;
            try
            {
                string _sql = $"SELECT {nameof(DPI2195F1.F1CIFNO)}, TRIM({nameof(DPI2195F1.F1STS)}) AS {nameof(DPI2195F1.F1STS)}, TRIM({nameof(DPI2195F1.F1COD)}) AS {nameof(DPI2195F1.F1COD)} " +
                              $"FROM {appSettingService.GetLibrary(nameof(DPI2195F1))}.{nameof(DPI2195F1)} " +
                              $"WHERE {nameof(DPI2195F1.F1ID)} = '{requestModel.CustomerId}' AND {nameof(DPI2195F1.F1CIFNO)} = '{requestModel.CustomerNumber}'";

                if (AS400Singleton.Instance.ExecuteSql(_sql, out DataTable oDt, out string oMessage))
                {
                    if (oDt.Rows.Count > 0)
                    {
                        foreach (DataRow row in oDt.Rows)
                        {
                            responseModel.CustomerNumber = row[nameof(DPI2195F1.F1CIFNO)].ToString();
                            responseModel.FatcaFlag      = row[nameof(DPI2195F1.F1STS)].ToString();
                            responseModel.FatcaCode      = row[nameof(DPI2195F1.F1COD)].ToString();
                            break;
                        }
                    }
                    else
                    {
                        throw new NotFoundException($"{requestModel.CustomerNumber}");
                    }
                }
                else
                {
                    throw new Exception(oMessage);
                }
            }
Exemplo n.º 2
0
 public VerifyFatcaFlagResponseModel VerifyFatcaFlag([FromBody] VerifyFatcaFlagRequestModel model)
 {
     return(service.VerifyFatcaFlag(model));
 }