首次推送
This commit is contained in:
223
Mtxfw.shop/_Admin/admin_cardbind.aspx.cs
Normal file
223
Mtxfw.shop/_Admin/admin_cardbind.aspx.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace Mtxfw.WebSite._Admin
|
||||
{
|
||||
public partial class admin_cardbind : Mtxfw.Utility.AdminPage
|
||||
{
|
||||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
public Int32 icount=0;
|
||||
public String ResultCard = "";
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||||
{
|
||||
int ID = int.Parse(Request.QueryString["ID"]);
|
||||
ResultCard = ID.ToString();
|
||||
Mtxfw.Model.user_info model = daoUser.GetModel(ID);
|
||||
if (model != null)
|
||||
{
|
||||
Lit_Card.Text = model.UserName + "(" + model.RealName + ")";
|
||||
Hidd_Card.Value = ID.ToString();
|
||||
}
|
||||
}
|
||||
//ListBind.DataSource = daoUser.GetList("remembercard='" + ResultCard + "'");
|
||||
//ListBind.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Btn_Bind(object s,EventArgs ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||||
{
|
||||
int ID = int.Parse(Request.QueryString["ID"]);
|
||||
string MemberCard = "", UserName="";
|
||||
int IFStores = 0;
|
||||
Double umoney28 = 0;
|
||||
Mtxfw.Model.user_info model2 = daoUser.GetModel(ID);
|
||||
if (model2 != null)
|
||||
{
|
||||
UserName = model2.UserName;
|
||||
MemberCard = model2.MemberCard;
|
||||
IFStores = model2.IFStores;
|
||||
umoney28 = (model2.umoney28 - model2.umoney29);
|
||||
}
|
||||
String[] cList = Text_CardList.Text.Split(',');
|
||||
|
||||
Int32 i = 0, j = 0, k = 0, l = 0;
|
||||
foreach (String cStr in cList)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(cStr))
|
||||
{
|
||||
Mtxfw.Model.user_info umodel = daoUser.GetModel(cStr);
|
||||
if (umodel != null)
|
||||
{
|
||||
if (cStr == MemberCard)
|
||||
{
|
||||
l++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (umodel.uLevel6 == 2)
|
||||
{
|
||||
k++;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
string ContactIDS = "";
|
||||
if (ContactIDS == "")
|
||||
{
|
||||
ContactIDS = "," + ID.ToString() + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
ContactIDS = ContactIDS + ID.ToString() + ",";
|
||||
}
|
||||
daoUser.UpdateTJR(ID, ContactIDS, umodel.Id);
|
||||
daoUser.UpdateuLevel("uLevel6", 0, umodel.Id);
|
||||
if (umodel.uutype == "1")
|
||||
{
|
||||
|
||||
if (ID > 0)
|
||||
{
|
||||
Double money = umodel.umoney20 * 0.1;
|
||||
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = ID;
|
||||
mjl2.MemberId2 = umodel.Id;
|
||||
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, ID);
|
||||
|
||||
string strpContactID = daoUser.Getzd("ContactID", "UserState='正常' And Id=" + ID).ToString();
|
||||
if (strpContactID != "")
|
||||
{
|
||||
|
||||
int pContactID = Convert.ToInt32(strpContactID);
|
||||
if (pContactID > 0)
|
||||
{
|
||||
string 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 = umodel.Id;
|
||||
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 != "")
|
||||
{
|
||||
umoney28 = Convert.ToDouble(strumoney28);
|
||||
money = umodel.umoney20 * 0.02;
|
||||
mjl2 = new Model.user_Results_jl2();
|
||||
mjl2.MemberId = pContactID;
|
||||
mjl2.MemberId2 = umodel.Id;
|
||||
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
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
icount = i;
|
||||
ResultCard = ID.ToString();
|
||||
//ListBind.DataSource = daoUser.GetList("remembercard='" + Hidd_Card.Value + "'");
|
||||
//ListBind.DataBind();
|
||||
Lit_Message.Text = "绑定成功:<font color='red'>" + icount + "</font> 张卡";
|
||||
if (j != 0 || k != 0 || l != 0)
|
||||
{
|
||||
Lit_Message.Text += "<p>绑定失败:<font color='red'>" + (j + k + l) + "</font> 张卡,原因:可能卡号不存在或者卡号已被绑定";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Lit_Message.Text = "<font color='red'>绑定卡号发生错误,请检查格式!</font>";
|
||||
}
|
||||
}
|
||||
protected void Btn_charu(object s, EventArgs ex)
|
||||
{
|
||||
|
||||
|
||||
Int64 strStartCard = Int64.Parse(StartCard.Text);
|
||||
Int64 strEndCard = Int64.Parse(EndCard.Text);
|
||||
|
||||
for (Int64 i = strStartCard; i <= strEndCard; i++)
|
||||
{
|
||||
if (i == strEndCard)
|
||||
{
|
||||
Text_CardList.Text += i.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Text_CardList.Text += i.ToString() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user