📄 memberalllist.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using YXShop.BLL;
using YXShop.Model;
using YXShop.Common;
using YXShop.Web.Admin.Control;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Consumer
{
public partial class MemberAllList : System.Web.UI.Page
{
public PageSet ps;
#region 实例化
YXShop.BLL.MemberInfo data = new YXShop.BLL.MemberInfo();
YXShop.BLL.UserCommon datau = new YXShop.BLL.UserCommon();
YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
#endregion
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["Option"] != null && !Request.Form["Option"].Trim().Equals("")
&& Request.Form["ID"] != null && !Request.Form["ID"].Trim().Equals(""))
{
string types = Request.Form["Option"].Trim();
string id = Request.Form["ID"].Trim();
switch (Request.Form["Option"].Trim())
{
case "del":
this.del(id);
break;
case "locked":
this.Locks(id);
break;
case "Unlocked":
this.UnLocks(id);
break;
}
Response.End();
return;
}
AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Consumer.MemberAllList));
if (!IsPostBack)
{
YXShop.Model.MemberInfo model = new YXShop.Model.MemberInfo();
string ab = Convert.ToString(Page.Request.QueryString["pro_sz"]);
if (ab != null)
{
int userID = 0;
if (YXShop.Common.WebUtility.isNumeric(Request["Pro_ID"]))
{
userID = Convert.ToInt32(Request["Pro_ID"]);
}
int userState = -1;
if (YXShop.Common.WebUtility.isNumeric(Request["pro_sz"]))
{
if (!PowerTree.PowerPass.isPass("008001006", PowerTree.PowerPanel.PowerType.other))
{
bp = new BasePage();
bp.PageError("对不起,你没有修改会员状态的权限!", "../index.aspx");
}
userState = Convert.ToInt32(Request["pro_sz"]);
}
try
{
ucBll.Amend(userID, "UState", userState);//0为未审核,1审核通过(正常),2冻结
}
catch { }
finally
{
ListDataBind(1);
}
}
else
{
}
ListDataBind(1);
}
this.PageNavigator1.OnPageChange += new PageChangeHandler(PageNavigator1_PageChange);
}
#region 列表
protected void PageNavigator1_PageChange(object sender, int PageIndex)
{
ListDataBind(PageIndex);
}
private void ListDataBind(int PageIndex)
{
YXShop.BLL.MemberInfo data = new YXShop.BLL.MemberInfo();
int num = 20, i = 0, j = 0;
int userType = 0;
if (!PowerTree.PowerPass.isPass("008001000", PowerTree.PowerPanel.PowerType.look))
{
bp = new BasePage();
bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
}
if (YXShop.Common.WebUtility.isNumeric(Request.QueryString["UserType"]))
{
userType = Convert.ToInt32(Request.QueryString["UserType"]);
}
else
{
Response.Redirect("../index.aspx", true);
}
DataTable dt = data.GetAll(null, null, PageIndex, num, out i, out j);
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = PageIndex;
this.PageNavigator1.RecordCount = i;
dg1.DataSource = dt;
dg1.DataBind();
}
protected void DataList1_ItemCommand(object sender, GridViewRowEventArgs e)
{
}
#endregion
#region 计算有效期
protected string Period(DateTime Datestr)
{
string dateDiff = "0";
if (Convert.ToDateTime(Datestr) > System.DateTime.Now)
{
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(Datestr).Ticks);
TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
TimeSpan ts = ts1.Subtract(ts2).Duration();
dateDiff = ts.Days.ToString();
}
return dateDiff;
}
#endregion
#region 会员类型
protected string MembersType(int Ty)
{
string reStr = "";
if (Ty == 0)
{
reStr = "普通会员";
}
else if (Ty == 2)
{
reStr = "店铺会员";
}
else
{
reStr = "单位会员";
}
return reStr;
}
#endregion
protected string Users(int GroupId)
{
string str = "";
YXShop.BLL.MemberRand datab = new YXShop.BLL.MemberRand();
List<YXShop.Model.MemberRand> data = datab.GetId(GroupId);
if (data.Count > 0)
{
str = data[0].Rank_name;
}
return str;
}
#region 删除
private void del(string sid)
{
if (!PowerTree.PowerPass.isPass("008001003", PowerTree.PowerPanel.PowerType.del))
{
bp = new BasePage();
bp.PageError("对不起,你没有删除普通会员的权限!", "../index.aspx");
}
string[] id = sid.Split(',');
int ln = id.Length;
int n = 0;
for (int i = 0; i < id.Length; i++)
{
if (!id[i].Trim().Equals(""))
{
try
{
if (datau.Delect(Convert.ToInt32(id[i])) == 1)
{
data.Delete(Convert.ToInt32(id[i]));
datau.Delect(Convert.ToInt32(id[i]));
}
n++;
}
catch
{
continue;
}
}
}
Response.Write(n + "%成功删除" + n + "条信息!");
}
#endregion
#region 批量锁定
private void Locks(string sid)
{
string[] id = sid.Split(',');
int ln = id.Length;
int n = 0;
for (int i = 0; i < id.Length; i++)
{
if (!id[i].Trim().Equals(""))
{
try
{
datau.Amend(Convert.ToInt32(id[i]), "UState", 2);
n++;
}
catch
{
continue;
}
}
}
Response.Write(n + "%成功锁定" + n + "条信息!");
}
#endregion
#region 批量解锁定
private void UnLocks(string sid)
{
string[] id = sid.Split(',');
int ln = id.Length;
int n = 0;
for (int i = 0; i < id.Length; i++)
{
if (!id[i].Trim().Equals(""))
{
try
{
datau.Amend(Convert.ToInt32(id[i]), "UState", 1);
n++;
}
catch
{
continue;
}
}
}
Response.Write(n + "%成功解锁" + n + "条信息!");
}
#endregion
private void hymc()
{
//System.Web.UI.WebControls.CheckBox chkExport;
//int all = dg1.Rows.Count;
//int i;
//try
//{
// string strdm;
// strdm = "";
// for (i = 0; i < all; i++)
// {
// chkExport = (CheckBox)dg1.Rows[i].FindControl("chkItem");
// if (chkExport.Checked == true)
// {
// YXShop.BLL.MemberInfo dataCA = new YXShop.BLL.MemberInfo();
// string sID = dg1.DataKeys[i].Value.ToString();
// string strname = "";// dataCA.GetListByColumn("uUserId", sID)[0].uUserName;
// YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();
// List<YXShop.Model.UserCommon> ucList = ucBll.GetListByColumn("UID", Convert.ToInt32(sID));
// if (ucList.Count > 0)
// {
// strname = ucList[0].UserName;
// }
// string cdm1 = strname;
// if (strdm == "")
// {
// strdm = cdm1;
// }
// else
// {
// strdm = strdm + "," + cdm1;
// }
// Session["strnmxx"] = strdm;
// }
// }
//}
//catch (Exception eFS)
//{
// Response.Write(eFS.ToString());
// Response.End();
//}
}
protected void Button5_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("AddTerm.aspx");
}
protected void Button6_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("../EmailManage/EmailManage.aspx");
}
protected void Button10_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("Cashaward.aspx");
}
protected void Button11_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("AddTermReduce.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("MoveMember.aspx");
}
protected void Button4_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("PraisePoint.aspx");
}
protected void Button9_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("PraisePointReduce.aspx");
}
protected void Button13_Click(object sender, EventArgs e)
{
hymc();
HttpContext.Current.Response.Redirect("CashawardReduce.aspx");
}
#region 判断是否具有删除权限
/// <summary>
/// 判断是否具有删除权限
/// </summary>
/// <param name="powertype"></param>
/// <returns></returns>
public string GetPowerStr(string powertype)
{
string reStr = "";
switch (powertype)
{
case "del":
reStr = PowerTree.PowerPass.isPass("008001003", PowerTree.PowerPanel.PowerType.del) ? "t" : "f";
break;
}
return reStr;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -