Files
KJD/KJDService/KJD_WebService/ShopService.asmx.cs
T

272 lines
7.4 KiB
C#

using KJD_Web.BLL;
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
namespace KJD_Web
{
/// <summary>
/// ShopService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class ShopService : System.Web.Services.WebService
{
private string GetRequestJsonString()
{
Context.Response.ContentType = "text/html;charset=utf-8";
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
{
// 还原数据流
byte[] b = new byte[s.Length];
s.Read(b, 0, (int)s.Length);
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
if (string.IsNullOrEmpty(jsonText))
{
var qs = HttpContext.Current.Request.QueryString;
if (qs != null && qs.Keys.Count > 0)
{
jsonText = "{";
foreach (var key in qs.Keys)
{
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
}
jsonText = jsonText.TrimEnd(';') + "}";
}
}
return jsonText;
}
}
[WebMethod]
public void get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().GetShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_one_login_name_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().GetOneLoginNameShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().AddShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().DelShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().MdyShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_shop_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().MdyCookieAndLoginStatus(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_shop_ads_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().MdyAdsCookieAndLoginStatus(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().GetShop(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void sub_sa_get_select_prod_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().SubSaGetSelectProdShop(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void update_add_prod_remaining()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().UpdateAddProdRemaining(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().MdyShop(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().AddShop(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().DelShop(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().SetShopSubSa(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_shop_card_code_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().GetShopCardCodeList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void create_shop_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().CreateShopCardCode(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void del_shop_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().DelShopCardCode(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
///ActiveJitCardCode
[WebMethod]
public void active_jit_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().ActiveJitCardCode(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}