Web Services 如何在c#中返回一个对象?

fae0ux8s  于 2022-11-15  发布在  C#
关注(0)|答案(2)|浏览(203)

我正在用C#填充一个对象内部的数据,但我不知道如何返回这个对象。我创建了一个名为ArasOrder的对象,并填充了数据,我想返回ArasOrder对象。我该怎么做呢?

public class ArasDeneme
{
    public static void aras()
    {
        var ArasService = new ArasTEST.Service();
        var ArasGonderi = new ArasTEST.ShippingOrder();
        var ArasOrder = new ArasTEST.Order();
        var parametreler = ArasKargoTEST.ParametreGet();
        var newentegrationcode = "";
        foreach (var item in parametreler)
        {
            var encode = entegrationcode();
            var YeniGelenDesi = DesiHesabi(item.WebSiparisNo);

            var yeniteminyeri = item.TeminYeri;
            newentegrationcode = 123+ "" + encode;
            ArasOrder.UserName = "";
            ArasOrder.Password = "";
            ArasOrder.ReceiverName = item.KargoAdSoyad;
            ArasOrder.ReceiverPhone1 = item.KargoTelefon;
            ArasOrder.ReceiverCityName = item.KargoIlAdi;
            ArasOrder.ReceiverTownName = item.KargoIlceAdi;
            ArasOrder.ReceiverAddress = item.KargoAdres;
            ArasOrder.TradingWaybillNumber = item.WebSiparisNo;
            ArasOrder.PieceCount = "1";
            ArasOrder.IntegrationCode = newentegrationcode;
            ArasOrder.PayorTypeCode = "1";
            ArasOrder.IsWorldWide = "0";
            ArasOrder.IsCod = "0";
            ArasOrder.VolumetricWeight = YeniGelenDesi;
            ArasOrder.SenderAccountAddressId = "1071";
            ArasTEST.PieceDetail[] ArasPieceDetails = new ArasTEST.PieceDetail[1];
            PieceDetail ArasPieceDetail1 = new PieceDetail();
            ArasPieceDetail1.BarcodeNumber = newentegrationcode;
            ArasPieceDetail1.VolumetricWeight = YeniGelenDesi;
            ArasPieceDetail1.Weight = "1";
            ArasPieceDetail1.Description = "";
            ArasPieceDetails[0] = ArasPieceDetail1;
            ArasOrder.PieceDetails = ArasPieceDetails;
            var ArasOrderInfo = new ArasTEST.Order[1];
            ArasOrderInfo[0] = ArasOrder;
            var takipNoResult = ArasService.SetOrder("", "", "");
            var ArasOrderResultInfo = takipNoResult[0];
            var SonucKodu = takipNoResult[0].ResultCode;
            var SonucMesaji = takipNoResult[0].ResultMessage;
            var SonucInvoiceKey = takipNoResult[0].InvoiceKey;
        }
    }
}
k5ifujac

k5ifujac1#

应该定义返回类型并返回示例。

public static ArasTEST aras()
{
    // insert code here...

    return ArasOrder;
}
ipakzgxi

ipakzgxi2#

将void更改为ArasDememe返回类型。
便叫如:
(a)在第一个字符串中输入第一个字符;

相关问题