Traditional Culture Encyclopedia - Weather forecast - Asp.net c # develops external WebService service and obtains data.

Asp.net c # develops external WebService service and obtains data.

Use? System;

Use? System. Assemble. Generics;

Use? System. Web

Use? System. Network service;

Namespace? test

{

///? & lt summary & gt

///? WebService? Summary description

///? & lt/summary & gt;

[WebService (namespace? =? " http://tempuri . org/"]

【WebServiceBinding(ConformsTo? =? WsiProfiles。 BasicProfile 1_ 1)]

[system. component model . toolbox item(false)]

Public? Class? WebService? :? System. network service

{

//Analog database

Private? Static electricity List & lt users & gt? User? =? New? List & lt users & gt ();

Static electricity Web service ()

{

//Initialize analog data

Users. Add (new? User ()? {? Data? =? Date and time. What about now? id? =? 1,? Baccino? =? "u 100 1", bar code? =? “c 12”,? Score? =? 95? });

Users. Add (new? User ()? {? Data? =? Date and time. Now. AddDays(- 1),? id? =? 1,? Baccino? =? "u 1002", bar code? =? “c 12”,? Score? =? 96? });

Users. Add (new? User ()? {? Data? =? Date and time. Now AddDays( 1),? id? =? 1,? Baccino? =? "u 1003", bar code? =? “c 12”,? Score? =? 97? });

Users. Add (new? User ()? {? Data? =? Date and time. What about now? id? =? 1,? Baccino? =? "u 1004", bar code? =? “c 12”,? Score? =? 98? });

Users. Add (new? User ()? {? Data? =? Date and time. What about now? id? =? 1,? Baccino? =? "u 1005", bar code? =? “c 13”,? Score? =? 99? });

Users. Add (new? User ()? {? Data? =? Date and time. What about now? id? =? 1,? Baccino? =? "u 1006", bar code? =? “c 13”,? Score? =? 100? });

}

[Network method]

Public? List & lt users & gt? Query (date and time? d 1,? Date and time? d2,? int? id,? String? batchNo,? String? Bar code)

{

List & lt users & gt? The result? =? null

What if? (! String. IsNullOrEmpty (bar code))

{

The result? =? Users. FindAll(f? = & gt? F.barcode.Equals (barcode));

}

other

{

What if? (! String. IsNullOrEmpty(batchNo))

{

The result? =? Users. FindAll(f? = & gt? f . batch no . equals(batch no));

}

other

{

The result? =? Users. FindAll(f? = & gt? f.id? ==? id? & amp& amp? f.data? & gt? d 1? & amp& amp? f.data? & lt? D2);

}

}

Return? Results;

}

}

Public? Class? user

{

Public? Date and time? Data? {? get? Settings; ? }

Public? int? id? {? get? Settings; ? }

Public? String? Baccino? {? get? Settings; ? }

Public? String? Bar code? {? get? Settings; ? }

Public? int? Score? {? get? Settings; ? }

}

}