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

204 lines
9.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Mtxfw.VipSite
{
public partial class Admin_Member_appdeclaration2 : Mtxfw.Utility.MemberBase
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_proxy daoproxy = new Mtxfw.DAL.user_proxy();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2();
private static Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
public int gtype = 0;
#region
private bool _refreshState;
private bool _isRefresh;
/// <summary>
/// 判断页面是否刷新
/// </summary>
public bool IsRefresh
{
get
{
return _isRefresh;
}
}
protected override void LoadViewState(object savedState)
{
object[] allStates = (object[])savedState;
base.LoadViewState(allStates[0]);
_refreshState = (bool)allStates[1];
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
}
protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] allStates = new object[2];
allStates[0] = base.SaveViewState();
allStates[1] = !_refreshState;
return allStates;
}
#endregion
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string hostname = Request.Url.Host;
if (!IsPostBack)
{
if (Session["IFPassword"] == null)
{
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_appdeclaration2.aspx");
}
if (IFStores != 1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
if (MemberJS.IndexOf("提货点列表") == -1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
Data_Bind();
Page.Title = "提货点列表 - " + GetWebName;
}
MyPager.PageChanged += delegate(object s, EventArgs ex)
{
Data_Bind();
};
}
protected void Data_Bind()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
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"];
sb.Append("gtype=" + gtype + " and TType=0");
strOrder = " Order By addtime desc";
if (!String.IsNullOrEmpty(province))
{
if (province!="-1")
{
sb.Append(" and Agenprovince='" + province + "'");
}
}
if (!String.IsNullOrEmpty(city))
{
if (city != "-1")
{
sb.Append(" and Agencity='" + city + "'");
}
}
if (!String.IsNullOrEmpty(county))
{
if (county != "-1")
{
sb.Append(" and Agencounty='" + county + "'");
}
}
if (!String.IsNullOrEmpty(key))
{
key = key.Trim();
sb.Append(" and ((select UserName from user_info b where b.Id=a.MemberId) like '%" + key + "%' or (select realname from user_info b where b.Id=a.MemberId) like '%" + key + "%')");
}
MyPager.PageSize = 50;
MyPager.RecordCount = daoproxy.GetCount(sb.ToString());
if (MyPager.RecordCount == 0)
{
MyPager.Visible = false;
}
Mtxfw.Utility.Tools.ToBind(Repeater1, daoproxy.GetPager(MyPager, "(select UserName from user_info b where b.Id=a.MemberId) as UserName,(select realname from user_info b where b.Id=a.MemberId) as realname,(select count(b.id) from order_info b where b.ttype=8 and b.IFDelete=0 and b.o_payed=4 and b.peitype=1 and b.ZTMemberId=a.MemberId) as ordercount,(select count(b.id) from order_info b where b.ttype=8 and b.IFDelete=0 and b.o_payed=1 and b.peitype=1 and b.ZTMemberId=a.MemberId) as ordercount0,(Select umoney30 From user_info b Where b.Id=a.MemberId) as umoney30,(Select umoney32 From user_info b Where b.Id=a.MemberId) as umoney32,", sb.ToString() + strOrder));
}
protected void Run_Click(object s, System.EventArgs e)
{
if (IsRefresh == false)
{
string sids = "";
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")
{
Mtxfw.Model.user_proxy pmodel = daoproxy.GetModel(strID);
if (pmodel != null)
{
if (pmodel.seef == 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(pmodel.MemberId);
if (umodel != null)
{
daoUser.UpdateuLevel("uLevel53", 2, umodel.Id);
pmodel.seef = 1;
daoproxy.Updateseef(pmodel);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = Card;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "审核提货点,用户名:" + umodel.UserName;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
}
}
if (strs == "1")
{
Mtxfw.Model.user_proxy pmodel = daoproxy.GetModel(strID);
if (pmodel != null)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(pmodel.MemberId);
if (umodel != null)
{
daoUser.UpdateuLevel("uLevel53", 0, umodel.Id);
daoproxy.Delete(pmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = Card;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "删除提货点,用户名:" + umodel.UserName;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else
{
daoproxy.Delete(pmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = Card;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "删除提货点";
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
}
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
}
}