Avatar of lankapala
lankapala

asked on 

C# WebAPI Array issue

Hi, I'm trying send to using SOAP to data,but it's keep sending the same value. I created array ,but didn't work

My code
OMS.OfferOrdered oOfferOrdered = new OMS.OfferOrdered();
            newOrders.Offers = new OMS.OfferOrdered[TotalNumberLine];
            OMS.OfferIDHeader oOfferIDHeader = new OMS.OfferIDHeader();
            OMS.OfferID oOfferID = new OMS.OfferID();


  while (reader.Read())
                {

 newOrders.Offers[i].Offer.Header.ID = reader["OfferHeaderID"].ToString();
}

Open in new window


Web services  Code

  public partial class OfferOrdered : PMObject {
        
        private OfferID offerField;

}


public partial class OfferOrdered : PMObject {
 [System.Xml.Serialization.XmlArrayAttribute(Order=9)]
        public OfferOrdered[] Offers {
            get {
                return this.offersField;
            }
            set {
                this.offersField = value;
                this.RaisePropertyChanged("Offers");
            }
        }
}
public partial class OfferIDHeader : PMObject {
 [System.Xml.Serialization.XmlElementAttribute(Order=1)]
        public string ID {
            get {
                return this.idField;
            }
            set {
                this.idField = value;
                this.RaisePropertyChanged("ID");
            }
        }
}
 public OfferIDHeader Header {
            get {
                return this.headerField;
            }
            set {
                this.headerField = value;
                this.RaisePropertyChanged("Header");
            }
        }
}

Open in new window


Any idea much appreciated. Just want to know why is keep recording last number in the all the array.

For example

if in the order having ID 500,800,900.
It will keep saving in the array 900 for all the array[0],array[1] and  array[2]



MAny Thanks
ASP.NETVisual Basic.NETC#Web Services.NET App Servers

Avatar of undefined
Last Comment
lankapala

8/22/2022 - Mon