Esempio 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);
                }
            }
Esempio n. 2
0
        public IEnumerable <ParameterResponseModel> GetParameter(AS400AppSettingModel appSettings, string[] condition = null, string keyconcat = "")
        {
            LIB   = appSettingService.GetLibrary(appSettings.File);
            FILE  = appSettings.File;
            KEY   = appSettings.Key;
            VALUE = appSettings.Value;
            if (!string.IsNullOrEmpty(keyconcat))
            {
                SQL = SQL
                      .Replace($"[{ nameof(AppSettings.KEY) }]", KEY)
                      .Replace($"TRIM({KEY})", $"{keyconcat}")
                      .Replace($"[{ nameof(AppSettings.VALUE) }]", VALUE)
                      .Replace($"[LIB]", LIB)
                      .Replace($"[FILE]", FILE);
            }
            else
            {
                SQL = SQL
                      .Replace($"[{ nameof(AppSettings.KEY) }]", KEY)
                      .Replace($"[{ nameof(AppSettings.VALUE) }]", VALUE)
                      .Replace($"[LIB]", LIB)
                      .Replace($"[FILE]", FILE);
            }


            if (condition != null)
            {
                if (condition.Length > 0)
                {
                    for (int i = 0; i < condition.Length; i++)
                    {
                        if (i == 0)
                        {
                            SQL += " WHERE " + condition[i];
                        }
                        else
                        {
                            SQL += " AND " + condition[i];
                        }
                    }
                }
            }

            return(ExecuteGetParameter(SQL));
        }
Esempio n. 3
0
        public VerifyConsentResponseModel VerifyConsent(VerifyConsentRequestModel requestModel)
        {
            Logging.WriteLog(requestModel);
            VerifyConsentResponseModel responseModel = new VerifyConsentResponseModel();

            responseModel.ReferenceNo = requestModel.ReferenceNo;
            try
            {
                if (IsCifExists(requestModel.CustomerNumber, out string oMessage))
                {
                    string sql = $"SELECT TRIM({nameof(DPI2142F1.F1CIF)}) AS {nameof(DPI2142F1.F1CIF)}, TRIM({nameof(DPI2142F1.F1TYP)}) AS {nameof(DPI2142F1.F1TYP)}, " +
                                 $"TRIM({nameof(DPI2142F1.F1COD)}) AS {nameof(DPI2142F1.F1COD)}, TRIM({nameof(DPI2142F1.F1STS)}) AS {nameof(DPI2142F1.F1STS)} " +
                                 $"FROM {appSetting.GetLibrary(nameof(DPI2142F1))}.{nameof(DPI2142F1)} " +
                                 $"WHERE {nameof(DPI2142F1.F1TYP)} = '001' AND {nameof(DPI2142F1.F1CIF)} = '{requestModel.CustomerNumber}' " +
                                 $"ORDER BY {nameof(DPI2142F1.F1UPDT7)} DESC";
                    if (AS400Singleton.Instance.ExecuteSql(sql, out DataTable oDt, out oMessage))
                    {
                        if (oDt.Rows.Count > 0)
                        {
                            foreach (DataRow row in oDt.Rows)
                            {
                                responseModel.CustomerNumber = row[nameof(DPI2142F1.F1CIF)].ToString();
                                responseModel.DocumentType   = row[nameof(DPI2142F1.F1TYP)].ToString();
                                responseModel.DocumentCode   = row[nameof(DPI2142F1.F1COD)].ToString();
                                responseModel.ConsentFlag    = row[nameof(DPI2142F1.F1STS)].ToString();
                            }
                        }
                        else
                        {
                            throw new NotFoundException($"Information on consent");
                        }
                    }
                    else
                    {
                        throw new Exception(oMessage);
                    }
                }
                else
                {
                    throw new Exception(oMessage);
                }
            }