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

228 lines
8.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Mtxfw.shop._Admin
{
public partial class admin_member_card : Mtxfw.Utility.AdminPage
{
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
public Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
public Mtxfw.DAL.Admin admin = new Mtxfw.DAL.Admin();
public string CityID = "-1", CountyID = "-1";
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
Data_Bind();
Sheng_Bind();
}
AspNetPager1.PageChanged += delegate(object s, EventArgs ex)
{
Data_Bind();
};
}
protected void Data_Bind()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String morn = HttpUtility.UrlDecode(Request.QueryString["morn"]);
String state = HttpUtility.UrlDecode(Request.QueryString["state"]);
String key = HttpUtility.UrlDecode(Request.QueryString["key"]);
String Province = Request.QueryString["Province"];
String City = Request.QueryString["City"];
String County = Request.QueryString["County"];
String strOrder = Request.QueryString["Order"];
if (!String.IsNullOrEmpty(Province) && Province != "-1")
{
sb.Append("and Province='" + Province + "' ");
Drop_Province.SelectedValue = Province;
}
if (!String.IsNullOrEmpty(City) && City != "-1")
{
sb.Append("and City='" + City + "' ");
CityID = City;
}
if (!String.IsNullOrEmpty(County) && County != "-1")
{
sb.Append("and County='" + County + "' ");
CountyID = County;
}
/*if (!String.IsNullOrEmpty(state) && state != "0")
{
sb.Append("and UserState='" + state + "'");
Drop_State.Text = state;
}*/
string fiold = string.Empty;
if (morn == "普通会员" || morn == "VIP会员" || morn == "运营中心" || morn == "一级管理中心" || morn == "二级管理中心")
{
if (morn == "普通会员")
{
sb.Append("and IFStores=0");
}
else if (morn == "VIP会员")
{
sb.Append("and IFStores=1");
}
else if (morn == "运营中心")
{
sb.Append("and IFStores=2");
}
else if (morn == "一级管理中心")
{
sb.Append("and IFStores=3");
}
else if (morn == "二级管理中心")
{
sb.Append("and IFStores=4");
}
if (!String.IsNullOrEmpty(key))
{
fiold = "UserName";
sb.Append("and " + fiold + " like '%" + key + "%'");
}
}
else
{
if (!String.IsNullOrEmpty(key))
{
if (morn == "会员卡号")
{
fiold = "MemberCard";
sb.Append("and " + fiold + " like '%" + key + "%'");
}
else if (morn == "用户名")
{
fiold = "UserName";
sb.Append("and " + fiold + " like '%" + key + "%'");
}
else if (morn == "推荐人")
{
fiold = "UserName";
sb.Append(" and ContactID in(select id from user_info b where b." + fiold + " like '%" + key + "%')");
}
else
{
fiold = "RealName";
sb.Append("and " + fiold + " like '%" + key + "%'");
}
Drop_MorN.Text = morn;
}
}
if (!String.IsNullOrEmpty(strOrder) && strOrder != "-1")
{
Drop_Order.SelectedValue = strOrder;
if (strOrder == "0")
{
strOrder = " Order By ID desc";
}
else if (strOrder == "1")
{
strOrder = " Order By RegTime desc";
}
else if (strOrder == "2")
{
strOrder = " Order By umoney12 desc";
}
else if (strOrder == "3")
{
strOrder = " Order By umoney17 desc";
}
else if (strOrder == "4")
{
strOrder = " Order By umoney19 desc";
}
}
else
{
strOrder = " Order By uLevel6 asc,ID desc";
}
AspNetPager1.PageSize = 20;
AspNetPager1.RecordCount = daoUser.GetCount("uutype='2' And (UserState='正常' or UserState='已锁定')" + sb.ToString());
Mtxfw.Utility.Tools.ToBind(Repeater1, daoUser.GetPager(AspNetPager1, "(select count(id) from user_info b where b.ContactID=a.ID and b.UserState='正常' And b.uLevel10=1)as BindCardCount,(select UserName from user_info b where b.Id=a.ContactID)as UserName3,(select realname from user_info b where b.Id=a.ContactID)as realname3,", "uutype='2' And (UserState='正常' or UserState='已锁定')" + sb.ToString() + strOrder));
}
protected String GetRCard(string val)
{
return !String.IsNullOrEmpty(val) ? "<font color='green'>" + val + "</font>" : "<font color='red'>未绑定</font>";
}
protected void Sheng_Bind()
{
Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("1=1 ");
System.Data.DataSet Ds = daoPro.GetCacheList("", sb.ToString() + "Order by Id Asc", "Province");
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
foreach (System.Data.DataRow Dr in Dt.Rows)
{
Drop_Province.Items.Add(new ListItem(Dr["ProvinceName"].ToString(), Dr["ProvinceID"].ToString()));
}
}
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)
{
TextBox Seef = new TextBox();
Seef = (TextBox)Item.FindControl("TextBox_Seef");
if (strs == "0" && Seef.Text == "未审核")
{
//审核通过
daoUser.UpdatePassword("UserState", "正常", strID);
}
else if (strs == "1")
{
daoUser.UpdatePassword("UserState", "已锁定", strID);
}
else if (strs == "2" && strID!=1)
{
daoUser.Delete(strID);
}
else if (strs == "3")
{
daoUser.UpdateuLevel("IFStores", 0, strID);
}
else if (strs == "4")
{
daoUser.UpdateuLevel("IFStores", 1, strID);
}
else if (strs == "5")
{
daoUser.UpdateuLevel("IFStores", 2, strID);
}
else if (strs == "6")
{
daoUser.UpdateuLevel("IFStores", 3, strID);
//daoUser.UpdateMoney2("umoney19", 0, strID);
}
else if (strs == "7")
{
daoUser.UpdateuLevel("IFStores", 4, strID);
//daoUser.UpdateMoney2("umoney19", 0, strID);
}
}
}
Data_Bind();
}
}
}