Example #1
0
        public async Task <ActionResult <HttpResultModel> > GetAll()
        {
            HttpResultModel httpResult = new HttpResultModel();

            try
            {
                VRTSoapService.vrtserviceRD3SoapClient            service        = new VRTSoapService.vrtserviceRD3SoapClient();
                ChannelFactory <VRTSoapService.vrtserviceRD3Soap> channelFactory = service.ChannelFactory;
                VRTSoapService.vrtserviceRD3Soap channel = channelFactory.CreateChannel();

                VRTSoapService.ServiceRequest serviceRequest = new VRTSoapService.ServiceRequest
                {
                    Body = new VRTSoapService.ServiceRequestBody
                    {
                        username         = soapUsername,
                        password         = soapPassword,
                        ShopName         = "",
                        BusinessTypeCode = "",
                        ProvinceCode     = 0,
                        StreetCode       = 0
                    }
                };

                VRTSoapService.ServiceResponse responseMessage = await channel.ServiceAsync(serviceRequest);

                VRTSoapService.vrt soapResult = responseMessage?.Body?.ServiceResult;
                List <VRT>         listVRT    = new List <VRT>();

                if (soapResult != null)
                {
                    int countRecord = soapResult.vShopName.Count();

                    for (int index = 0; index < countRecord; index++)
                    {
                        VRT vrtModel = new VRT
                        {
                            vShopName         = soapResult.vShopName[index]?.ToString(),
                            vBusinessTypeName = soapResult.vBusinessTypeName[index]?.ToString(),
                            vBusinessName     = soapResult.vBusinessName[index]?.ToString(),
                            vHouseNumber      = soapResult.vHouseNumber[index]?.ToString(),
                            vStreetName       = soapResult.vStreetName[index]?.ToString(),
                            vThambolName      = soapResult.vThambolName[index]?.ToString(),
                            vAmphurName       = soapResult.vAmphurName[index]?.ToString(),
                            vProvinceName     = soapResult.vProvinceName[index]?.ToString(),
                            vPostCode         = soapResult.vPostCode[index]?.ToString(),
                            vmsgerr           = soapResult.vmsgerr.Count() > 0 ? soapResult.vmsgerr[index]?.ToString() : null,
                        };
                        listVRT.Add(vrtModel);
                    }
                }

                httpResult.SetPropertyHttpResult(httpResult, true, "", "", StatusCodes.Status200OK, listVRT);
            }
            catch (Exception ex)
            {
                httpResult.SetPropertyHttpResult(httpResult, false, "", ex.Message, StatusCodes.Status500InternalServerError);
            }

            return(httpResult);
        }
Example #2
0
 public System.Threading.Tasks.Task <VRTSoapService.ServiceResponse> ServiceAsync(string username, string password, string ShopName, string BusinessTypeCode, int ProvinceCode, int StreetCode)
 {
     VRTSoapService.ServiceRequest inValue = new VRTSoapService.ServiceRequest();
     inValue.Body                  = new VRTSoapService.ServiceRequestBody();
     inValue.Body.username         = username;
     inValue.Body.password         = password;
     inValue.Body.ShopName         = ShopName;
     inValue.Body.BusinessTypeCode = BusinessTypeCode;
     inValue.Body.ProvinceCode     = ProvinceCode;
     inValue.Body.StreetCode       = StreetCode;
     return(((VRTSoapService.vrtserviceRD3Soap)(this)).ServiceAsync(inValue));
 }
Example #3
0
 System.Threading.Tasks.Task <VRTSoapService.ServiceResponse> VRTSoapService.vrtserviceRD3Soap.ServiceAsync(VRTSoapService.ServiceRequest request)
 {
     return(base.Channel.ServiceAsync(request));
 }