236 lines
11 KiB
C#
236 lines
11 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Text;
|
||
using System.Data;
|
||
namespace Mtxfw.VipSite
|
||
{
|
||
public partial class Admin_Member_zbjy_pp : Mtxfw.Utility.MemberBase
|
||
{
|
||
Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank();
|
||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
||
Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2();
|
||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||
Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
|
||
public string strTitle = "预约未匹配列表",strids="";
|
||
DAL.user_YZMs daoYZMs = new DAL.user_YZMs();
|
||
protected override void OnLoad(EventArgs e)
|
||
{
|
||
base.OnLoad(e);
|
||
if (!String.IsNullOrEmpty(Request.QueryString["ids"]))
|
||
{
|
||
strids = Request.QueryString["ids"].ToString();
|
||
}
|
||
if (!IsPostBack)
|
||
{
|
||
if (Session["IFPassword"] == null)
|
||
{
|
||
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_zbjy0.aspx");
|
||
}
|
||
if (IFStores != 1)
|
||
{
|
||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||
}
|
||
|
||
|
||
|
||
Page.Title = strTitle + " - " + GetWebName;
|
||
|
||
Data_Bind();
|
||
}
|
||
MyPager.PageChanged += delegate(object s, EventArgs ex)
|
||
{
|
||
Data_Bind();
|
||
};
|
||
|
||
}
|
||
|
||
protected void Data_Bind()
|
||
{
|
||
|
||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||
|
||
sb.Append("utype=12");
|
||
sb.Append(" and IFDelete=0");
|
||
sb.Append(" and seef=0 And b8=1 And b16=1");
|
||
if (strids != "")
|
||
{
|
||
sb.Append(" And id in(" + strids + ")");
|
||
}
|
||
string groupby = "";
|
||
string strOrder = "addtime desc";
|
||
|
||
int Start = 0;
|
||
int Limit = 0;
|
||
Int32 Recount = 0;
|
||
MyPager.PageSize = 100;
|
||
Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1);
|
||
Limit = MyPager.PageSize;
|
||
DataSet dss = daoResults.GetDataSet(groupby, strOrder, "*,(Select UserName From user_info b Where b.Id=MemberId) as MemberName,(Select realname From user_info b Where b.Id=MemberId) as realname,(Select uLevel8 From user_info b Where b.Id=MemberId) as uLevel8", "", sb.ToString(), Start, Limit, out Recount);
|
||
Mtxfw.Utility.Tools.ToBind(Repeater1, dss.Tables[1]);
|
||
MyPager.RecordCount = Recount;
|
||
if (MyPager.RecordCount == 0)
|
||
{
|
||
MyPager.Visible = false;
|
||
}
|
||
DataSet ds = daoResults.GetList1("sum(b0) as b0,sum(b2) as b2", sb.ToString());
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
string b0 = ds.Tables[0].Rows[0]["b0"].ToString();
|
||
if (b0 != "")
|
||
{
|
||
Label0.Text = Convert.ToDouble(b0).ToString("f2");
|
||
}
|
||
string b2 = ds.Tables[0].Rows[0]["b2"].ToString();
|
||
if (b2 != "")
|
||
{
|
||
Label1.Text = Convert.ToDouble(b2).ToString("f2");
|
||
}
|
||
}
|
||
ds.Clear();
|
||
}
|
||
protected void Run_Click(object s, System.EventArgs e)
|
||
{
|
||
string strSQL = "";
|
||
string strIds = "";
|
||
if (txtUserID.Text != "")
|
||
{
|
||
string[] strA = txtUserID.Text.Split('|');
|
||
foreach (string str in strA)
|
||
{
|
||
if (str != "")
|
||
{
|
||
string strid = daoUser.Getzd("id", "IFStores=0 and uLevel8=0 and UserName Like '%" + str + "%'").ToString();
|
||
if (strid != "")
|
||
{
|
||
if (strIds == "")
|
||
{
|
||
strIds = strid;
|
||
}
|
||
else
|
||
{
|
||
strIds += "," + strid;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
if (strIds != "")
|
||
{
|
||
strSQL = " and MemberId in(" + strIds + ")";
|
||
|
||
string[] astr = strids.Split(',');
|
||
bool b = true;
|
||
foreach (string Item in astr)
|
||
{
|
||
if (Item != "")
|
||
{
|
||
Int64 strID = Int64.Parse(Item);
|
||
|
||
Mtxfw.Model.user_Results rmodel = daoResults.GetModel(strID);
|
||
if (rmodel != null)
|
||
{
|
||
if (rmodel.IFDelete == 0 && rmodel.Seef == 0)
|
||
{
|
||
Int64 TResultId = rmodel.Id;
|
||
Int32 TMemberId = rmodel.MemberId;
|
||
Double Tb0 = rmodel.b0;
|
||
Double Tb1 = rmodel.b1;
|
||
Double Tb2 = rmodel.b2;
|
||
string Managers = rmodel.Managers;
|
||
Mtxfw.Model.user_info umodel = daoUser.GetModel(rmodel.MemberId);
|
||
if (umodel != null)
|
||
{
|
||
string TUserName = umodel.UserName;
|
||
string TRealName = umodel.RealName;
|
||
string TPhone = umodel.Phone;
|
||
DateTime dt = DateTime.Now;
|
||
|
||
strSQL += " and (Select c.uLevel8 from user_info c where c.id=a.MemberId)=0 and a.MemberId<>" + TMemberId;
|
||
|
||
DataSet ds0 = daoResults.GetList1(" top 1 a.id,a.MemberId,a.b0,a.b1,a.b2,a.addtime", "a.utype=12 And a.IFDelete=0 And a.b2=1 And a.b8=0 And a.b12=0 And a.b14=0" + strSQL + " Order By a.b0 asc,a.addtime Asc");
|
||
|
||
if (ds0.Tables[0].Rows.Count > 0)
|
||
{
|
||
Int64 JResultId = Convert.ToInt64(ds0.Tables[0].Rows[0]["id"]);
|
||
Int32 JMemberId = Convert.ToInt32(ds0.Tables[0].Rows[0]["MemberId"]);
|
||
Double Jb0 = Convert.ToDouble(Convert.ToDouble(ds0.Tables[0].Rows[0]["b0"]).ToString("f2"));
|
||
Double Jb1 = Convert.ToDouble(Convert.ToDouble(ds0.Tables[0].Rows[0]["b1"]).ToString("f2"));
|
||
Double Jb2 = Convert.ToDouble(Convert.ToDouble(ds0.Tables[0].Rows[0]["b2"]).ToString("f2"));
|
||
DateTime Jaddtime = Convert.ToDateTime(ds0.Tables[0].Rows[0]["addtime"]);
|
||
Mtxfw.Model.user_info umodel0 = daoUser.GetModel(JMemberId);
|
||
if (umodel0 != null)
|
||
{
|
||
Double money = Tb0;
|
||
|
||
string JUserName = umodel0.UserName;
|
||
string JRealName = umodel0.RealName;
|
||
string JPhone = umodel0.Phone;
|
||
daoResults.Updatejdtime(1, dt, Jaddtime, JMemberId, JResultId.ToString(), TResultId);
|
||
int yyq = Convert.ToInt32(config.webMoney69);
|
||
if (yyq == 0)
|
||
{
|
||
daoResults.Updatemoney("b11", 1, "id=" + TResultId);
|
||
}
|
||
else
|
||
{
|
||
daoResults.Updatemoney("b11", 0, "id=" + TResultId);
|
||
DateTime yyqdt = dt.AddMinutes(yyq);
|
||
if (config.webMoney70 == "hour")
|
||
{
|
||
yyqdt = dt.AddHours(yyq);
|
||
}
|
||
else if (config.webMoney70 == "day")
|
||
{
|
||
yyqdt = dt.AddDays(yyq);
|
||
}
|
||
daoResults.Updatepaytime(yyqdt, TResultId);
|
||
}
|
||
daoResults.Updatemoney("b5", 0, "id=" + TResultId);
|
||
daoResults.Updatemoney("b14", 1, "id=" + JResultId);//更新已匹配标志
|
||
if (Managers != "")
|
||
{
|
||
daoResults.UpdateSeef(1, dt, Convert.ToInt64(Managers));
|
||
}
|
||
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 = "手动匹配订单,ID:" + TResultId + ",买家为" + JUserName + "[" + JRealName + "],卖家为" + TUserName + "[" + TRealName + "],金额为" + Tb0.ToString();
|
||
logmodel.UType = 0;
|
||
new DAL.User_CZ_log().Add(logmodel);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
|
||
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('找不到比" + umodel.UserName + "卖出" + Tb0.ToString() + "更大或相等的预约单!');</script>");
|
||
}
|
||
ds0.Clear();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('匹配成功!');location.href='Admin_Member_zbjy_seef.aspx'</script>");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('找不到会员!');</script>");
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
} |