DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> js調用webservice中的方法實現思路及代碼
js調用webservice中的方法實現思路及代碼
編輯:關於JavaScript     
webservice代碼:
復制代碼 代碼如下:
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>
/// PageService 的摘要說明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class PageService : System.Web.Services.WebService
{
ArrayList al = new ArrayList();
public PageService()
{

//如果使用設計的組件,請取消注釋以下行
//InitializeComponent();
}
/// <summary>
/// 添加收藏
/// </summary>
/// <param name="fid">產品ID</param>
/// <param name="sid">用戶ID</param>
/// <param name="flag">標識(產品收藏、企業收藏、電子樣本收藏、圖庫收藏)</param>
/// <returns>返回收藏狀態</returns>
[WebMethod]
public int AddCollect(int fid,int sid,int flag)
{
IProductDataProvider ipdp = ProviderManager.Create<IProductDataProvider>();
IEnterpriseDataProvider iedp = ProviderManager.Create<IEnterpriseDataProvider>();
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)
{
EnterpriseCollect ec = new EnterpriseCollect();
ec.EnterpriseID = 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;
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved