You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
6.3 KiB
C#

2 months ago
using NetLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using TradeData;
using TradeModel;
using NetLibrary.OnlineTrade;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace TradeManage.Member
{
/// <summary>
/// HY_MemberService 的摘要说明
/// </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 HY_MemberService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
#region 查询礼物
[WebMethod(EnableSession = true)]
public JsonModel<List<HY_Gift>> GetListGift(int DeptId,int PlatType, int ShopId, int SScore, int EScore, int SNum, int ENum, string GiftName, string GiftInfo,int State, int PageIndex, int PageSize)
{
Pages.Login(this.Session);
var obj = new HY_MemberScore();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
RefParameterCollection Param = new RefParameterCollection();
if (DeptId > 0)
Param.Add("b.ShopId", "=", DeptId, DbType.Int32);
if (PlatType > 0)
Param.Add("b.PlatType", "=", PlatType, DbType.Int32);
if (ShopId>0)
Param.Add("a.ShopId", "=", ShopId, DbType.Int32);
if (SScore >= 0)
Param.Add("a.ChangeScore", ">=", SScore, DbType.Int32);
if (EScore >= 0)
Param.Add("a.ChangeScore", "<=", EScore, DbType.Int32);
if (SNum >= 0)
Param.Add("a.LeftNum", ">=", SNum, DbType.Int32);
if (ENum >= 0)
Param.Add("a.LeftNum", "<=", ENum, DbType.Int32);
if (State >= 0)
Param.Add("a.State", "=", State, DbType.Int32);
if (GiftName.Trim()!="")
Param.Add("a.GiftName", "like", GiftName.Trim(), DbType.String);
if (GiftInfo.Trim() != "")
{
GiftInfo = GiftInfo.Trim();
Param.Add("(a.GiftDesc", "like", GiftInfo, DbType.String);
Param.Add("a.UseRule", "like", GiftInfo, "or", ")", DbType.String);
}
JsonModel<List<HY_Gift>> resultModel = new JsonModel<List<HY_Gift>>();
int RowCount = 0;
string Sort = "GiftId desc";
resultModel.DataSource = obj.GetListHY_Gift(Param, PageIndex, PageSize, Sort, out RowCount);
resultModel.RowCount = RowCount;
if (resultModel.DataSource != null)
{
BaseService obj1 = new BaseService();
foreach (var md in resultModel.DataSource)
{
var list = obj1.GetListJC_Resource(md.ImageIds.Trim(','));
md.ImgList = list;
}
}
return resultModel;
}
#endregion
#region 保存礼物
[WebMethod(EnableSession = true)]
public int SaveGift(HY_Gift Model)
{
Pages.Login(this.Session);
var obj = new HY_MemberScore();
int UserId = Convert.ToInt32(Session["UserId"]);
if (Model.ImgList != null && Model.ImgList.Count>0)
{
Model.ImageUrl = Model.ImgList[0].FileUrl;
string imgids = "";
foreach (var md in Model.ImgList)
{
imgids += md.id + ",";
}
Model.ImageIds = imgids;
}
if (Model.GiftId==0)
{
Model.InDate = DateTime.Now;
Model.InUserId = UserId;
}
int a = obj.SaveGift(Model);
return a;
}
#endregion
#region 删除礼物
[WebMethod(EnableSession = true)]
public void DeleteGift(int GiftId)
{
Pages.Login(this.Session);
var obj = new HY_MemberScore();
obj.DeleteGift(GiftId);
}
#endregion
#region 查询会员
[WebMethod(EnableSession = true)]
public JsonModel<List<HY_Member>> GetListMember(int DeptId, int PlatType, int ShopId, int SScore, int EScore, string Name, string Info, int PageIndex, int PageSize)
{
Pages.Login(this.Session);
var obj = new HY_MemberScore();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
RefParameterCollection Param = new RefParameterCollection();
//if (DeptId > 0)
// Param.Add("b.ShopId", "=", DeptId, DbType.Int32);
//if (PlatType > 0)
// Param.Add("b.PlatType", "=", PlatType, DbType.Int32);
//if (ShopId > 0)
// Param.Add("a.ShopId", "=", ShopId, DbType.Int32);
//if (SScore >= 0)
// Param.Add("a.ChangeScore", ">=", SScore, DbType.Int32);
//if (EScore >= 0)
// Param.Add("a.ChangeScore", "<=", EScore, DbType.Int32);
//if (State >= 0)
// Param.Add("a.State", "=", State, DbType.Int32);
//if (GiftName.Trim() != "")
// Param.Add("a.GiftName", "like", GiftName.Trim(), DbType.String);
//if (GiftInfo.Trim() != "")
//{
// GiftInfo = GiftInfo.Trim();
// Param.Add("(a.GiftDesc", "like", GiftInfo, DbType.String);
// Param.Add("a.UseRule", "like", GiftInfo, "or", ")", DbType.String);
//}
JsonModel<List<HY_Member>> resultModel = new JsonModel<List<HY_Member>>();
int RowCount = 0;
string Sort = "MemberId desc";
resultModel.DataSource = obj.GetListHY_Member(Param, PageIndex, PageSize, Sort, out RowCount);
resultModel.RowCount = RowCount;
return resultModel;
}
#endregion
}
}