Files
g.hnyhua.cn/Mtxfw.shop/_Admin/admin_member_seef.aspx.cs

325 lines
16 KiB
C#
Raw Normal View History

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_seef : 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 == "管理中心")
{
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");
}
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 IFStores desc";
}
AspNetPager1.PageSize = 20;
AspNetPager1.RecordCount = daoUser.GetCount("uutype='1' And UserState='正常' And uLevel6=1" + sb.ToString());
Mtxfw.Utility.Tools.ToBind(Repeater1, daoUser.GetPager(AspNetPager1, "(select UserName from user_info b where b.Id=a.SuperiorsID)as UserName2,(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='1' And UserState='正常' And uLevel6=1" + 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)
{
if (strs == "1")
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(strID);
if (umodel != null)
{
if (umodel.uLevel6 == 1)
{
//审核通过
daoUser.UpdateuLevel("uLevel6", 0, strID);
if (umodel.IFStores > 0)
{
Double money = 0.00;
Double umoney28 = 0.00;
if (umodel.ContactID > 0)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
string UserName = "";
string strUserName = new DAL.user_info().Getzd("UserName", "UserState='正常' And ID=" + umodel.ContactID).ToString();
if (strUserName != "")
{
UserName = strUserName;
}
string strumoney28 = new DAL.user_info().Getzd("(umoney28-umoney29) as umoney28", "UserState='正常' And ID=" + umodel.ContactID).ToString();
if (strumoney28 != "")
{
umoney28 = Convert.ToDouble(strumoney28);
mjl2 = new Model.user_Results_jl2();
money = umodel.umoney20 * 0.1;
mjl2.MemberId = umodel.ContactID;
mjl2.MemberId2 = strID;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney28 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "绑定" + umodel.UserName + "增加" + money;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 0;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney28", money, umodel.ContactID);
}
string strpContactID = daoUser.Getzd("ContactID", "UserState='正常' And Id=" + umodel.ContactID).ToString();
if (strpContactID != "")
{
int pContactID = Convert.ToInt32(strpContactID);
if (pContactID > 0)
{
strumoney28 = new DAL.user_info().Getzd("(umoney28-umoney29) as umoney28", "UserState='正常' And ID=" + pContactID).ToString();
if (strumoney28 != "")
{
umoney28 = Convert.ToDouble(strumoney28);
money = umodel.umoney20 * 0.03;
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = pContactID;
mjl2.MemberId2 = strID;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney28 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = UserName + "绑定" + umodel.UserName + "增加" + money;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 0;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney28", money, pContactID);
}
strpContactID = daoUser.Getzd("ContactID", "UserState='正常' And Id=" + pContactID).ToString();
if (strpContactID != "")
{
pContactID = Convert.ToInt32(strpContactID);
if (pContactID > 0)
{
strumoney28 = new DAL.user_info().Getzd("(umoney28-umoney29) as umoney28", "UserState='正常' And ID=" + pContactID).ToString();
if (strumoney28 != "")
{
money = umodel.umoney20 * 0.02;
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = pContactID;
mjl2.MemberId2 = strID;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney28 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = UserName + "绑定" + umodel.UserName + "增加" + money;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 0;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney28", money, pContactID);
}
}
}
}
}
}
}
}
}
}
else if (strs == "2")
{
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);
}
else if (strs == "7")
{
daoUser.UpdateuLevel("IFStores", 4, strID);
}
}
}
Data_Bind();
}
}
}