How js calls webservice methods and code _ javascript tips-js tutorial

Source: Internet
Author: User
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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.