283 lines
12 KiB
C#
283 lines
12 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_togoods : 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();
|
|
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
|
protected String strTitle = "订单", strUrl = "", strAddress="";
|
|
public int gtype = 0;
|
|
protected int s = 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_togoods.aspx");
|
|
}
|
|
if (IFStores != 1)
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
|
}
|
|
if (MemberJS.IndexOf("订单记录") == -1)
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
|
}
|
|
if (!String.IsNullOrEmpty(Request.QueryString["s"]))
|
|
{
|
|
s = int.Parse(Request.QueryString["s"].ToString());
|
|
strUrl += "&s=" + s;
|
|
}
|
|
if (s == 0)
|
|
{
|
|
strTitle = "注册订单";
|
|
}
|
|
else if (s == 1)
|
|
{
|
|
strTitle = "购买订单";
|
|
}
|
|
else if (s == 2)
|
|
{
|
|
strTitle = "兑换订单";
|
|
}
|
|
Page.Title = strTitle + "记录 - " + GetWebName;
|
|
|
|
Data_Bind();
|
|
}
|
|
MyPager.PageChanged += delegate(object s, EventArgs ex)
|
|
{
|
|
Data_Bind();
|
|
};
|
|
}
|
|
|
|
protected void Data_Bind()
|
|
{
|
|
if (!String.IsNullOrEmpty(Request.QueryString["s"]))
|
|
{
|
|
s = int.Parse(Request.QueryString["s"].ToString());
|
|
}
|
|
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
//sb.Append(" and MemberId=" + Card);
|
|
String SJ = Request.QueryString["SJ"];
|
|
String SJ2 = Request.QueryString["SJ2"];
|
|
String FHZXID = Request.QueryString["FHZXID"];
|
|
string strsql = "gtype=" + gtype + " and (utype=17 Or utype=18 Or utype=19)";
|
|
if (s == 0)
|
|
{
|
|
strsql = "utype=17";
|
|
}
|
|
else if (s == 1)
|
|
{
|
|
strsql = "utype=18";
|
|
}
|
|
else if (s == 2)
|
|
{
|
|
strsql = "utype=19";
|
|
}
|
|
if (!String.IsNullOrEmpty(SJ) && !String.IsNullOrEmpty(SJ2))
|
|
{
|
|
sb.Append("and (addtime between '" + SJ + " 00:00:00' and '" + SJ2 + " 23:59:59') ");
|
|
}
|
|
if (!String.IsNullOrEmpty(FHZXID))
|
|
{
|
|
strUrl += "&FHZXID=" + FHZXID;
|
|
sb.Append("and UserId=" + FHZXID + "");
|
|
Mtxfw.Model.user_info umodel = daoUser.GetModel(int.Parse(FHZXID));
|
|
if (umodel != null)
|
|
{
|
|
strTitle = umodel.UserName + "的全部订单";
|
|
}
|
|
strAddress = "<tr><td colspan=\"8\">店铺信息: ";
|
|
strAddress += umodel.RealName + " " + umodel.Phone + " " + CAddress(umodel.Province, umodel.City, umodel.County, umodel.MailingAddress);
|
|
strAddress += "</td></tr>";
|
|
}
|
|
string strOrder = " Order By addtime desc";
|
|
MyPager.PageSize = 20;
|
|
MyPager.RecordCount = daoResults.GetCount(strsql + " And IFDelete=0" + sb.ToString());
|
|
Mtxfw.Utility.Tools.ToBind(Repeater1, daoResults.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 phone From user_info b Where b.Id=a.MemberId) as phone,(Select province From user_info b Where b.Id=a.MemberId) as province,(Select city From user_info b Where b.Id=a.MemberId) as city,(Select county From user_info b Where b.Id=a.MemberId) as county,(Select mailingaddress From user_info b Where b.Id=a.MemberId) as address,", strsql + " And IFDelete=0" + sb.ToString() + strOrder));
|
|
}
|
|
protected void Run_Click(object s, System.EventArgs e)
|
|
{
|
|
string strErr = "";
|
|
CheckBox Check = new CheckBox();
|
|
string strs = seclect_Drop.SelectedItem.Value;
|
|
foreach (RepeaterItem Item in Repeater1.Items)
|
|
{
|
|
//在行中查找到该单选框
|
|
Check = (CheckBox)Item.FindControl("checka");
|
|
Int64 strID = Int64.Parse(Check.CssClass);
|
|
if (Check.Checked == true)
|
|
{
|
|
if (strs == "0")
|
|
{
|
|
Mtxfw.Model.user_Results mr = daoResults.GetModel(strID);
|
|
if (mr != null)
|
|
{
|
|
if (mr.Seef != 1)
|
|
{
|
|
|
|
daoResults.UpdateSeef(1, DateTime.Now, strID);
|
|
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 = "发货操作,账户:" + new DAL.user_info().Getzd("UserName", "id=" + mr.MemberId) + "订单时间" + mr.addtime;
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
}
|
|
}
|
|
else if (strs == "1")
|
|
{
|
|
Mtxfw.Model.user_Results mr = daoResults.GetModel(strID);
|
|
if (mr != null)
|
|
{
|
|
if (mr.Seef != 0)
|
|
{
|
|
daoResults.UpdateSeef(0, DateTime.Now, strID);
|
|
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 = "取消发货操作,账户:" + new DAL.user_info().Getzd("UserName", "id=" + mr.MemberId) + "订单时间" + mr.addtime;
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
}
|
|
}
|
|
else if (strs == "2")
|
|
{
|
|
Mtxfw.Model.user_Results mr = daoResults.GetModel(strID);
|
|
if (mr != null)
|
|
{
|
|
if (mr.IFDelete == 0)
|
|
{
|
|
|
|
daoResults.UpdateIFDelete(1, DateTime.Now.ToString(), strID);
|
|
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 = "删除订单操作,账户:" + new DAL.user_info().Getzd("UserName", "id=" + mr.MemberId) + "订单时间" + mr.addtime;
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Data_Bind();
|
|
if (strs == "2")
|
|
{
|
|
if (strErr != "")
|
|
{
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('" + strErr + "')</script>");
|
|
}
|
|
}
|
|
}
|
|
public static string CAddress(string Province, string City, string County, string address)
|
|
{
|
|
string str = "";
|
|
string strProvince = "", strCity = "", strCounty = "", straddress = "";
|
|
if (Province != "" && Province != "-1")
|
|
{
|
|
strProvince = new DAL.province().GetProvince(Province);
|
|
}
|
|
if (City != "" && City != "-1")
|
|
{
|
|
strCity = new DAL.city().GetCity(City);
|
|
}
|
|
if (County != "" && County != "-1")
|
|
{
|
|
strCounty = new DAL.county().GetCounty(County);
|
|
}
|
|
|
|
straddress = address;
|
|
if (straddress != "")
|
|
{
|
|
if (strProvince != "")
|
|
{
|
|
straddress = straddress.Replace(strProvince, "");
|
|
}
|
|
if (strCity != "")
|
|
{
|
|
straddress = straddress.Replace(strCity, "");
|
|
}
|
|
if (strCounty != "")
|
|
{
|
|
straddress = straddress.Replace(strCounty, "");
|
|
}
|
|
}
|
|
str += " " + strProvince + strCity + strCounty + straddress;
|
|
return str;
|
|
}
|
|
public static string CGoods(string strgoods)
|
|
{
|
|
string str = "";
|
|
string[] agoods = strgoods.Split(',');
|
|
for (int i = 0; i < agoods.Length; i++)
|
|
{
|
|
string good = agoods[i];
|
|
if (good != "")
|
|
{
|
|
string[] ag = good.Split('|');
|
|
Mtxfw.Model.user_Goods model = new DAL.user_Goods().GetModel(Convert.ToInt32(ag[0]));
|
|
if (model != null)
|
|
{
|
|
str += "<li><a href=\"/Member_goods_view.aspx?ID=" + model.Id + "\" title=\"" + model.GoodsName + "\"><img src=\"" + Mtxfw.Utility.Common.GetCoverPic(model.GoodsPic, "40x40", "cut") + "\" width=\"40\" height=\"40\" /></a>";
|
|
str += "<br>" + Convert.ToInt32(ag[1]) + "</li>";
|
|
}
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
}
|
|
} |