团购网站系统说明书(7)

2020-02-20 22:55

using Silverlight_Log.Web;

namespace Silverlight_Log.Web {

[ServiceContract(Namespace = \)]

[AspNetCompatibilityRequirements(RequirementsMode AspNetCompatibilityRequirementsMode.Allowed)]

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]

public class Service1 {

private string filePath;

public Service1() {

filePath = HttpContext.Current.Server.MapPath(\); }

[OperationContract]

public void UploadFile(string fileName, byte[] data) {

string file = Path.Combine(filePath, Path.GetFileName(fileName)); using (FileStream fs = new FileStream(file, FileMode.Create)) {

fs.Write(data, 0, (int)data.Length); } }

[OperationContract]

public string[] GetFileList() {

string[] files = Directory.GetFiles(filePath); for (int i = 0; i < files.Count(); i++) files[i] = Path.GetFileName(files[i]); return files; }

[OperationContract]

public List GetProductData() {

List list = new List();

using (tgNetEntities3 en = new tgNetEntities3()) {

=

31

foreach (var e in en.tgNetPrd) {

Product prd = new Product();

prd._pname = e.pname; prd._parea = e.parea; prd._pdisc = e.pdisc;

prd._pDnTime = (DateTime)e.pDnTime; prd._photoPath = e.photoPath; prd._pnum = (int)e.pnum; prd._prc = (decimal)e.prc; prd._premark = e.premark; prd._psize = e.psize; prd._ptgnum = (int)e.ptgnum; prd._ptype = e.ptype;

prd._pUpTime = (DateTime)e.pUpTime; prd._tgprc = (decimal)e.tgprc; prd._pictName = e.pictName;

list.Add(prd); }

return list; } }

[OperationContract]

public void AddProduct(Product e,int g) {

using (tgNetEntities3 en = new tgNetEntities3()) {

tgNetPrd prd = new tgNetPrd(); prd.parea = e._parea; prd.pdisc = e._pdisc; prd.pDnTime = e._pDnTime; prd.photoPath = e._photoPath; prd.pictName = e._pictName;// prd.pname = e._pname; // prd.pnum = e._pnum; prd.prc = (float)e._prc; prd.premark = e._premark; prd.psize = e._psize;

32

prd.ptgnum = e._ptgnum; prd.ptype = e._ptype; prd.pUpTime = e._pUpTime; prd.tgprc = (float)e._tgprc; prd.sellerID = g;

en.AddTotgNetPrd(prd); en.SaveChanges(); } }

[OperationContract]

public BuyerType GetBuyerData(int i) {

using (tgNetEntities3 en = new tgNetEntities3()) {

int j = en.tgNetBLogInfo.Where(n => n.buyerID == i).Count(); if (j != 0) {

var sel = en.tgNetBLogInfo.Where(n => n.buyerID == i).First(); BuyerType st = new BuyerType(); st._bphone = sel.bphone; st._brealname = sel.brealname; st._uemail = sel.uemail; return st; } else {

return null; } } }

[OperationContract]

public List GetSellData() {

List list = new List(); using (tgNetEntities3 en = new tgNetEntities3()) {

foreach (var e in en.tgNetSLogInfo) {

SellerType st = new SellerType();

33

st._sBankID = e.sBankID; st._sBankName = e.sBankName; st._sellerID = e.sellerID; st._sID = e.sID; st._uemail = e.uemail; st._upsw = e.upsw; st._sname = e.sname; st._sunm = e.sunm; st._sphone = e.sphone; st._srealname = e.srealname;

list.Add(st); }

return list; } }

[OperationContract]

public void AddSeller(SellerType e) {

using (tgNetEntities3 en = new tgNetEntities3()) {

tgNetSLogInfo st = new tgNetSLogInfo(); st.sBankID = e._sBankID; st.sBankName = e._sBankName; st.sellerID = e._sellerID; st.sID = e._sID; st.uemail = e._uemail; st.upsw = e._upsw; st.sname = e._sname; st.sunm = e._sunm; st.sphone = e._sphone; st.srealname = e._srealname; en.AddTotgNetSLogInfo(st); //en.AddToBuyerInf(st); en.SaveChanges(); } }

[OperationContract]

public void AddBuyer(BuyerType e) {

using (tgNetEntities3 en = new tgNetEntities3()) {

tgNetBLogInfo st = new tgNetBLogInfo(); st.bname = e._bname;

34

st.bphone = e._bphone; st.brealname = e._brealname; st.buyerID = e._buyerID; st.uemail = e._uemail; st.upsw = e._upsw; st.bgrade = 10000;

en.AddTotgNetBLogInfo(st); //en.AddToBuyerInf(st); en.SaveChanges(); } }

[OperationContract]

public bool BuyerLog(BuyerType b) {

using (tgNetEntities3 en = new tgNetEntities3()) {

int sel = en.tgNetBLogInfo.Where(n => n.uemail == b._uemail).Where(n => n.upsw == b._upsw).Count(); if (sel == 0) {

return false; } else {

return true; } } }

[OperationContract]

public bool SellerLog(SellerType b) {

using (tgNetEntities3 en = new tgNetEntities3()) {

int sel = en.tgNetSLogInfo.Where(n => n.uemail == b._uemail).Where(n => n.upsw == b._upsw).Count(); if (sel == 0) {

return false; } else {

return true; } }

35


团购网站系统说明书(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:一些美语常用到的口头语 Microsoft Word 文档(6)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: