using System; using System.Collections.Generic; using System.Web; using System.Web.UI.WebControls; using System.Text; using System.Data; using System.Threading; namespace Mtxfw.VipSite { public partial class Admin_Member_Products_Orders1 : Mtxfw.Utility.MemberBase { Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results(); Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info(); Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info(); Mtxfw.Model.order_info model = new Mtxfw.Model.order_info(); Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info(); public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product(); public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); public int gtype = 0, t=0; public string strTitle = "发货订单汇总"; #region 判断页面是否刷新 private bool _refreshState; private bool _isRefresh; /// /// 判断页面是否刷新 /// 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_Products_Orders1.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("批发管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Page.Title = "发货订单汇总 - " + GetWebName; Data_Bind(); } MyPager.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected String GetProvince() { StringBuilder sb = new StringBuilder(); Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province(); System.Data.DataSet Ds = daoPro.GetCacheList("", "1=1 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) { sb.Append("\r\n"); } return sb.ToString(); } protected void Data_Bind() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); String MemberId = HttpUtility.UrlDecode(Request.QueryString["MemberId"]); String key = HttpUtility.UrlDecode(Request.QueryString["key"]); String state = HttpUtility.UrlDecode(Request.QueryString["state"]); //String ttype = HttpUtility.UrlDecode(Request.QueryString["ttype"]); String paytype = HttpUtility.UrlDecode(Request.QueryString["paytype"]); String peitype = HttpUtility.UrlDecode(Request.QueryString["peitype"]); String tem = HttpUtility.UrlDecode(Request.QueryString["tem"]); sb.Append(" and ttype=2 and ptype=0 and O_Payed='1' and (Select Count(id) From User_info b where b.id=UserId)>0 And O_Payed_Date<=DateAdd(day,-7,getdate())"); sb.Append(" and (O_Payed<>'6' and O_Payed<>'7')"); if (!String.IsNullOrEmpty(MemberId)) { sb.Append("and MemberId=" + MemberId); } if (!String.IsNullOrEmpty(key)) { sb.Append("and UserID in (select id from user_info b where b.IFStores=0 and (b.UserName like '%" + key + "%'))"); } string strOrder = " group by UserID Order By sum(ypznum) desc"; MyPager.PageSize = 100; int RecordCount = 0; DataSet dss = daoorder.GetCount0("gtype=" + gtype + " And IFDelete=0" + sb.ToString() + strOrder); RecordCount = dss.Tables[0].Rows.Count; MyPager.RecordCount = RecordCount; if (MyPager.RecordCount == 0) { MyPager.Visible = false; } Mtxfw.Utility.Tools.ToBind(Repeater1, daoorder.GetPager2(MyPager, "max(UserID) as ID,max(ttype) as ttype,max(utype) as utype,max(orderid) as orderid,max(ptype) as ptype,max(peitype) as peitype,max(O_SubmitDate) as O_SubmitDate,max(addtime) as addtime,max(O_Payed) as O_Payed,max(O_Payed_date) as O_Payed_date,max(O_Shipped) as O_Shipped,max(O_Shipped_date) as O_Shipped_date,max(O_received) as O_received,max(O_received_date) as O_received_date,max(kdcompay) as kdcompay,max(yundanhao) as yundanhao,max(Guests) as Guests,max(wlremarks) as wlremarks,max(Contactname) as Contactname,max(Contacttel) as Contacttel,max(Province) as Province,max(City) as City,max(County) as County,max(Address) as Address,max(Address0) as Address0,sum(ypznum) as Totalnum,sum(Totalprice) as Totalprice,max(refundstatus) as refundstatus,max(refund_channel) as refund_channel,max(user_received_account) as user_received_account,max(success_time) as success_time,max(O_Seef) as O_Seef,(select UserName from user_info c where c.ID=max(UserID)) as UserName,(select RealName from user_info c where c.ID=max(UserID)) as RealName", "gtype=" + gtype + " And IFDelete=0" + sb.ToString() + strOrder)); } } }