Files
g.hnyhua.cn/Mtxfw.shop/Member_favorite_List.aspx.cs
2026-02-07 15:48:27 +08:00

93 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace Mtxfw.shop
{
public partial class Member_favorite_List : Mtxfw.Utility.MemberBase
{
Mtxfw.DAL.user_favorite daofavorite = new Mtxfw.DAL.user_favorite();
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
protected string strcurrend1 = "", strcurrend2 = "", strcurrend3 = "", strcurrend4 = "", strcurrend5 = "";
protected Double UserMoney = 0.00;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
if (Request.QueryString["s"] != null)
{
if (Request.QueryString["s"].ToString() == "0")
{
strcurrend2 = "class=\"currend\"";
}
else if (Request.QueryString["s"].ToString() == "1")
{
strcurrend3 = "class=\"currend\"";
}
else if (Request.QueryString["s"].ToString() == "-1")
{
strcurrend4 = "class=\"currend\"";
}
else
{
strcurrend1 = "class=\"currend\"";
}
}
else
{
strcurrend1 = "class=\"currend\"";
}
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(Card);
if (ModelUser != null)
{
UserMoney = ModelUser.umoney14;
}
myDataBind();
Page.Title = "我的收藏 - " + GetWebName;
}
}
private void myDataBind()
{
int intPage = 1;
if (Request.QueryString["page"] != null)
{
intPage = Convert.ToInt32(Request.QueryString["page"].ToString());
}
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(" and MemberId=" + Card + "");
MyPager.PageSize = 20;
MyPager.RecordCount = daofavorite.GetCount("ttype=0" + sb.ToString());
Mtxfw.Utility.Tools.ToBind(Repeater1, daofavorite.GetPager(MyPager, "(select top 1 P_NAME from P_Product as b where b.P_Id=ProductID) as bName,", "ttype=0" + sb.ToString() + " Order by ID desc"));
}
protected void Run_Click(object s, System.EventArgs e)
{
CheckBox Check = new CheckBox();
string strs = seclect_Drop.SelectedItem.Value;
foreach (RepeaterItem Item in Repeater1.Items)
{
//在行中查找到该单选框
Check = (CheckBox)Item.FindControl("checka");
int strID = int.Parse(Check.CssClass);
if (Check.Checked == true)
{
if (strs == "0")
{
if (daofavorite.GetCount("MemberId=" + Card + " And ProductID=" + strID) > 0)
{
daofavorite.Delete(strID);
new DAL.P_Product().Update(strID, "P_SCOrders", "-1");
}
}
}
}
myDataBind();
}
}
}