Look, if the there is a problem, I wrote it call data read cycle at least three times
Public string getOneRoomOnePriceListByPage (int houseid, int the bid=0, int uid=0, int HouseTypeID=0, int pageindex=1, int pagesize=10)
{
Int erro=1;
JObject jOb=new JObject ();
ArrayList List=new ArrayList ();
Int totalCount=0;
The DataTable dt=AppWXsource. GetOneRoomOnePriceListPageByHouseID (houseid);
DataRow [] drArr=null;
If (dt!=null& & Dt. Rows. Count> 0)
{
Erro=1;
If (the bid==0 & amp; & Uid==0 & amp; & HouseTypeID==0)
DrArr=dt. Select (" HouseID="+ HouseID);//query
Else if (the bid!=0 & amp; & Uid==0 & amp; & HouseTypeID==0)
DrArr=dt. Select (" BuildingID="+ bid);//query
Else if (the bid!=0 & amp; & Uid!=0 & amp; & HouseTypeID==0)
DrArr=dt. Select (" UnitID="+ uid +" and BuildingID="+ bid);//query
Else if (the bid!=0 & amp; & Uid!=0 & amp; & HouseTypeID!=0)
DrArr=dt. Select (" HouseTypeID="+ HouseTypeID +" and UnitID="+ uid +" and BuildingID="+ bid);//query
If (drArr==null | | drArr. Length<=0)
{
JOb. The Add (new JProperty (" total ", totalCount);
JOb. The Add (new JProperty (" list ", a list));
Return JsonDo. JobjectToJson (jOb, erro, "there is no such record");
}
TotalCount=drArr. Length;//the total number of
Int pagenum=1;
Int lastnum=0;
Pagenum=pagesize * (pageindex - 1);
If ((pagenum + pagesize) & gt; TotalCount)
Lastnum=totalCount;
The else
Lastnum=pagenum + pagesize;
For (int I=pagenum; I & lt; Lastnum; I++)
{
DataRow rs=drArr [I];
//room number, room number family ID
Int RoomID=(int), rs (" RoomID ");
String RoomNum="";
String Rooms="";
String Halls="";
String Floors="";
The DataTable Rtd=new DAL. AppWX. Room () getRoomAndHouseTypeInfoByRoomID (RoomID);
If (Rtd!=null& & Rtd. Rows. Count> 0)
{
RoomNum=Rtd. Rows [0] [r]. "RoomNum" ToString ();
Rooms=Rtd. Rows [0] [r]. "Rooms" ToString ();
Halls=Rtd. Rows [0] [r]. "Halls" ToString ();
Floors=Rtd. Rows [0] [r]. "Floors" ToString ();
}
JObject jObj=new JObject ();
JObj. Add (new JProperty (" SourceID ", rs (" SourceID ")));
JObj. Add (new JProperty (" RoomNum RoomNum));
Var SourceTag=rs [r]. "SourceTag" ToString ();
If (SourceTag!="")
{
SourceTag=SourceTag. TrimEnd (', ');
SourceTag=new BLL. Source (). GetOneHouseAllTagsName (SourceTag. The Trim ());
}
JObj. Add (new JProperty (" SourceTag SourceTag));
//read model data
String Tid=rs [r]. "HouseTypeID" ToString ();
String typeinfo="";
Typeinfo=Rooms + + Halls "housing" + "hall";
JObj. Add (new JProperty (" housetypes, typeinfo));
JObj. Add (new JProperty (" CoveredArea ", rs (" CoveredArea ")));
JObj. Add (new JProperty (" Floors ", Floors));
Float a=0;
Float b=0;
Float totprice=0;
Float oneprice=0;
Try
{
A=float. Parse (rs) [r]. "SourcePrice" ToString ());
B=float. Parse (rs) [r]. "CoveredArea" ToString ());
Int pricetype=int. Parse (rs) [r]. "pricetype" ToString ());
If (pricetype==2)//2 for the unit price
{
Totprice=a * b;
Oneprice=a;
}
The else
{
Totprice=a;
Oneprice=a/b;
}
}
Catch
{
//
}
//housing first figure
String SourceImg="";
Int SourceID=int. Parse (rs) [r]. "SourceID" ToString ());
The DataTable dtImg=AppWXsource. GetSourceImg (SourceID);
If (dtImg. Rows. Count & gt; 0)
{
SourceImg=ImageUrl + dtImg. Rows [0] [r]. "ThumbnailName" ToString ();
}
The else
{
//if the housing picture is empty, it is door model figure to be obtained
Int houseTypeID=Common. Util. ConvertInt32 (rs [" houseTypeID "], 0).
The DataTable dtHouseTypeImg=new DAL. House () GetPhotoByHouseType (houseTypeID);
If (dtHouseTypeImg!=null & amp; & DtHouseTypeImg. Rows. Count & gt; 0)
{
SourceImg=ImageUrl + dtHouseTypeImg. Rows [0] [r]. "ThumbnailName" ToString ();
}
}
JObj. Add (new JProperty (" SourceImg SourceImg));
JObj. Add (new JProperty (" oneprice oneprice));
JObj. Add (new JProperty (" totprice totprice));
JObj. Add (new JProperty (" IsOnline, rs (" IsOnline ")));
JObj. Add (new JProperty (" IsSold, rs (" IsSold ")));
JObj. Add (new JProperty (" HouseTypeID ", rs (" HouseTypeID ")));
What/how much/how many building unit room number
The DataTable dtS=AppWXsource. GetHouseNameBuildingNameUnitNameRoomNum (RoomID);
If (dtS) Rows) Count & gt; 0)
{
JObj. Add (new JProperty (" HouseName ", dtS. Rows [0] [" HouseName "]));
JObj. Add (new JProperty (" BuildingName ", dtS. Rows [0] [" BuildingName "]));
JObj. Add (new JProperty (" UnitName ", dtS. Rows [0] [" UnitName "]));
}
List. The Add (jObj);
}
}
JOb. The Add (new JProperty (" total ", totalCount);
JOb. The Add (new JProperty (" list ", a list));
Return JsonDo. JobjectToJson (jOb, erro);
}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnull