Js webservice call is a more practical function. This article provides implementation ideas and code. If you are interested, do not miss it. I hope this article will help you with the webservice code:
The Code is as follows:
Using System;
Using System. Web;
Using System. Collections;
Using System. Web. Services;
Using System. Web. Services. Protocols;
Using System. Web. Script. Services;
Using StoreHouse. Common;
Using StoreHouse. IDAL;
Using StoreHouse. Model;
Using System. Data. SqlClient;
Using System. Data;
Using System. Xml;
Using System. Collections. Generic;
Using System. Runtime. InteropServices;
Using System. Net. NetworkInformation;
///
/// Summary of PageService
///
[WebService (Namespace = "http://tempuri.org/")]
[WebServiceBinding (ConformsTo = WsiProfiles. BasicProfile1_1)]
[ScriptService]
Public class PageService: System. Web. Services. WebService
{
ArrayList al = new ArrayList ();
Public PageService ()
{
// If you use the designed component, uncomment the following line
// InitializeComponent ();
}
///
/// Add to favorites
///
/// Product ID
/// User ID
/// Logo (product favorites, enterprise favorites, electronic sample favorites, Image Library favorites)
/// Back to favorites status
[WebMethod]
Public int AddCollect (int fid, int sid, int flag)
{
IProductDataProvider ipdp = ProviderManager. Create ();
IEnterpriseDataProvider iedp = ProviderManager. Create ();
If (flag = 1)
{
ProductCollect pc = new ProductCollect ();
Pc. ProductID = fid;
Pc. UserID = sid;
Pc. AddDatetime = DateTime. Now;
Pc. UpdateDatetime = DateTime. Now;
Return ipdp. AddProductCollect (pc );
}
Else if (flag = 2)
{
Incluisecollect ec = new incluisecollect ();
Ec. performaniseid = fid;
Ec. UserID = sid;
Ec. AddDatetime = DateTime. Now;
Ec. UpdateDatetime = DateTime. Now;
Return iedp. AddEnterpriseCollect (ec );
}
Else if (flag = 3)
{
EElecSampleCollect epesc = new EElecSampleCollect ();
Epesc. EElecSampleID = fid;
Epesc. UserID = sid;
Epesc. AddDatetime = DateTime. Now;
Epesc. UpdateDatetime = DateTime. Now;
Return ipdp. AddEElecSampleCollect (epesc );
}
Else if (flag = 4)
{
EPAtlasCollect epac = new EPAtlasCollect ();
Epac. EPAtlasID = fid;
Epac. UserID = sid;
Epac. AddDatetime = DateTime. Now;
Epac. UpdateDatetime = DateTime. Now;
Return ipdp. AddEPAtlasCollect (epac );
}
Return 000000;
}