1
public struct Attendance
{
    public int siteId { get; set; }
    public string siteName { get; set; }
    public string Remarks { get; set; }
    public string Result { get; set; }
};

public List<Attendance> InsertAttendanceDetails(string SessionId, List<object> attendance)
{
    List<Attendance> lrv = new List<Attendance>();
    SqlCommand cmd = new SqlCommand();
    SqlHelper dbHelper = new SqlHelper(connectionString);
    ReturnValues rv = new ReturnValues();


    if (SessionId != null)
    {
        foreach (Attendance att in attendance)
        {                

        }
    }

    return lrv;
}

i am unable to read this List passing as parameter to my web method and want to get values from this List. Object can be class and List coming in XML format from android application

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
  • 1
    Unable in what way? This question needs a little more information to be salvaged into something we can answer, otherwise it will get closed off. – Adam Houldsworth Mar 14 '14 at 10:07
  • Please provide some link or sample code to read multiple values from List and insert into Attendance is my class contains – user3418613 Mar 14 '14 at 10:13
  • I'm sorry, but that doesn't make much sense. What is in your `List`? We could make guesses, but they might be wrong. – Adam Houldsworth Mar 14 '14 at 10:14
  • please provide some link or sample code to get values from List and insert into List – user3418613 Mar 14 '14 at 10:14
  • `List` can contain **anything**. What are you putting into it? Knowing this, I can tell you how to get the thing out. – Adam Houldsworth Mar 14 '14 at 10:15
  • You have a list of objects, not a list of Attendances - you can't for example cast List to List. I think this will solve your issue: http://stackoverflow.com/questions/1817300/convert-listderivedclass-to-listbaseclass. – PugFugly Mar 14 '14 at 10:17
  • I am passing List to android application and that application inserting multiple values in it. I just want to get those values and in my case object is Attendance Class... – user3418613 Mar 21 '14 at 08:55
  • in List i am passing Attendance class.. – user3418613 Mar 24 '14 at 06:40

3 Answers3

0

Try to change List<object> on List<Attendance>

Vasily
  • 51
  • 2
0

Is your code actually getting built? Anyways, Not sure if this is the problem, but assuming that the object that is getting passed can be type casted into type Attendance.

Consider the following code. Not very sure if this will solve your problem though. If this is not what you need then please let us know the type that will be coming in the List<object> so that we can provide a solution accordingly.

public List<Attendance> InsertAttendanceDetails(string SessionId, List<object> attendance)
{
    List<Attendance> lrv = new List<Attendance>();
    SqlCommand cmd = new SqlCommand();
    SqlHelper dbHelper = new SqlHelper(connectionString);
    ReturnValues rv = new ReturnValues();


    if (SessionId != null)
    {
        foreach (var att in attendance)
        {
            lrv.Add((Attendance)att);
        }
    }

    return lrv;
}

Hope this helps.

samar
  • 5,021
  • 9
  • 47
  • 71
  • What exactly is the error you are getting? or what exactly is the output you are expecting? – samar Mar 21 '14 at 04:30
  • actually I just want to take bulk of data from android application so i am giving List in my case Object means Attendance Class and android application can send me multiple values from that list i just need to read that. – user3418613 Mar 21 '14 at 08:47
0

Ksoap: Cannot Serialize exception when passing user defined class as parameter to web method. Check this link...

Community
  • 1
  • 1