Пример #1
0
        private static async Task GetVendorsUseBapi()
        {
            const string COMPANY_CODE = "200";

            IVendorManager            manager = ServiceProvider.GetRequiredService <IVendorManager>();
            VendorBapiOutputParameter result  = await manager.GetVendorsByCompanyCodeAsync(COMPANY_CODE);

            manager.Print(result);
        }
Пример #2
0
        public VendorBapiOutputParameter GetVerdorsByCompanyCode(string companyCode)
        {
            using IRfcConnection connection = _serviceProvider.GetService <IRfcConnection>();
            connection?.Connect();

            var inputParameter = new VendorBapiInputParameter
            {
                CompanyCode = companyCode
            };

            using IReadBapi <VendorBapiOutputParameter> rfcFunction = _serviceProvider.GetService <IReadBapi <VendorBapiOutputParameter> >();
            VendorBapiOutputParameter result = rfcFunction?.GetBapi(connection, "BBP_VENDOR_GETLIST", inputParameter);

            return(result);
        }
Пример #3
0
        public void Print(VendorBapiOutputParameter vendor)
        {
            if (vendor == null)
            {
                Console.WriteLine("Vendor Not Found!");
                return;
            }

            Console.WriteLine($"======= Vendor List ================");
            Console.WriteLine($"= TotalRecordCount={vendor.Vendors.Count()}. Printed top 10 record =");
            Console.WriteLine("".PadLeft(20, '='));
            foreach (var vendorItem in vendor.Vendors.Take(10))
            {
                Console.WriteLine($"{vendorItem.VendorNo} - {vendorItem.Name}");
            }
        }
Пример #4
0
        public async Task <IActionResult> GetVendorsUseBapi()
        {
            try
            {
                const string COMPANY_CODE = "200";

                IVendorManager            manager = _serviceProvider.GetRequiredService <IVendorManager>();
                VendorBapiOutputParameter result  = await manager.GetVendorsByCompanyCodeAsync(COMPANY_CODE);

                return(View(result.Vendors));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "GetVendorsUseBapi Execution Error");
                throw;
            }
        }