Sunday 15 August 2010

c# - Constructor with argument :Missing return int value -



c# - Constructor with argument :Missing return int value -

i have class contains many properties:

public class study { public int reportid { get; set; } public string sentdate { get; set; } public string photoname { get; set; } public string state { get; set; } public string patientname { get; set; } public string doctorname { get; set; } public string sex { get; set; } public int ispregnant { get; set; } public float weight { get; set; } public float height { get; set; } public int age { get; set; } public string info { get; set; } public string response { get; set; }

then implement 1 constructor argmuents :

public report(int id, string photoname, string sentdate, string state,string response) { this.reportid = id; this.photoname = photoname; this.sentdate = sentdate; this.state = state; this.response = response; }

finally implement method calls constructor :

public static list<report> getlistreportbyemail(string email) { datatable dt = sqlhelper.executedataset( new sqlconnection(tls.connstr), "spreportgetbyemail", email).tables[0]; list<report> tempitems = new list<report>(); if (dt.rows.count != 0) { foreach (datarow rw in dt.rows) { tempitems.add( new report( int.parse(rw["reportid"].tostring()), tls.getbasicurl() + "/zdnn000kjupload/__zd__medicalconsultation/" + rw["photoname"].tostring(), datetime.parse(rw["sentdate"].tostring()).tostring("dd/m/yyyy"), rw["state"].tostring(), rw["response"].tostring())); } homecoming tempitems; } else { homecoming null; } }

but when check return, in add-on of properties mentionned in constructor found properties type int or float value 0.

i need methods web services. when test web serives found properties mentionned in constructor ,but int , float not populated:

<report> <reportid>4</reportid> <sentdate>21/6/2014</sentdate> <photoname> http://localhost:2055/zdnn000kjupload/__zd__medicalconsultation/ </photoname> <state/> <ispregnant>0</ispregnant> <weight>0</weight> <height>0</height> <age>0</age> <response/> </report>

knowing stored procedure ok.

so can 1 help me transmit variables mentionned in constructor : don't need age,height,weight,ispregnant transmitted

thanks.

your constructor assigns following:

this.reportid = id; this.photoname = photoname; this.sentdate = sentdate; this.state = state; this.response = response;

why expect other properties (ispregnant, weight, height, age, etc.) populated well? not assigning properties value @ point.

c# asp.net xml

No comments:

Post a Comment