首页 > web前端 > js教程 > 正文

js调用webservice中的方法实现思路及代码_javascript技巧

WBOY
发布: 2016-05-16 17:41:36
原创
1195 人浏览过

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;

///
/// 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()
{

//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
///
/// 添加收藏
///

/// 产品ID
/// 用户ID
/// 标识(产品收藏、企业收藏、电子样本收藏、图库收藏)
/// 返回收藏状态
[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)
{
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;
}
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板