It is possible to send an instance of a class to a webmethod on a webserver isn't it. (The class is actually created on the webserver).
I ask because I have a populated class instance which I'm trying to send back to the webserver, however when the instance arrives at the webmethod, it has been emptied (a fresh instance has been created)??
Some code that may help explain:
private void miIssue_Click(object sender, EventArgs e)
{
string r = sC.updatePickItem(batch, deptID, issued, pL);
}
//The creation of the webserver class I want to pass
[Serializable]
public class PickingList
{
List<PickingDetails> pD = new List<PickingDetails>();
public bool found { get; set; }
public PickingDetails[] pickingDetail
{
get { return pD.ToArray(); }
set { }
}
public void addPickingDetail(PickingDetails pI)
{
pD.Add(pI);
}
}
[Serializable]
public class PickingDetails
{
public string warehouse { get; set; }
public string stockCode { get; set; }
}
//The webmethod I'm connecting to
[WebMethod]
public string updatePickItem(string batch, string deptID, bool issued, PickingList pL )
{
try
{
if (!issued)
issued = issueStockToWIP(rows, batch, deptID, pL);
}
catch (Exception e)
{ return e.ToString(); }
}