using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace Mtxfw.shop
{
public partial class Member_Orders_List : Mtxfw.Utility.MemberBase
{
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
protected string ShowPage = "", ShowConent = "", strcurrend1 = "", strcurrend2 = "", strcurrend3 = "", strcurrend4 = "", strcurrend5 = "";
protected Double UserMoney = 0.00;
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
if (Request.QueryString["s"] != null)
{
if (Request.QueryString["s"].ToString() == "0")
{
strcurrend2 = "class=\"currend\"";
}
else if (Request.QueryString["s"].ToString() == "1")
{
strcurrend3 = "class=\"currend\"";
}
else if (Request.QueryString["s"].ToString() == "-1")
{
strcurrend4 = "class=\"currend\"";
}
else
{
strcurrend1 = "class=\"currend\"";
}
}
else
{
strcurrend1 = "class=\"currend\"";
}
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(Card);
if (ModelUser != null)
{
UserMoney = ModelUser.umoney14;
}
myDataBind();
Page.Title = "我的订单 - " + GetWebName;
}
}
private void myDataBind()
{
int pagecount = 20;
int intPage = 1;
string state = "-2", key="";
if (Request.QueryString["page"] != null)
{
intPage = Convert.ToInt32(Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["page"].ToString()));
}
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("UserID='" + Card + "' And IFDelete=0");
if (Request.QueryString["key"] != null)
{
key = Request.QueryString["key"].ToString();
}
if (Request.QueryString["s"] != null)
{
state = Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["s"].ToString());
}
if (state != "-2")
{
sb.Append(" and O_Payed='" + state + "'");
}
if (!String.IsNullOrEmpty(key))
{
sb.Append(" and orderid like '%" + Mtxfw.Utility.Tools.SafeSQL(key) + "%'");
}
DataSet ds = daoorder.GetList("", sb.ToString() + " Order by ID desc");
int strcount = ds.Tables[0].Rows.Count;
if (strcount > 0)
{
int n = 0;
if (strcount % pagecount == 0)
{
n = strcount / pagecount;
}
else
{
n = strcount / pagecount + 1;
}
for (int k = 1; k <= n; k++)
{
if (intPage == k)
{
if (n == 1)
{
ShowPage = "";
}
else
{
string stru = "/Member_Orders_List.aspx";
if (Request.QueryString != null)
{
string strq = Request.QueryString.ToString();
if (strq != "")
{
if (strq.IndexOf("Page=") != -1)
{
stru += "?" + strq.Substring(0, strq.IndexOf("Page="));
}
else
{
stru += "?" + strq + "&";
}
}
else
{
stru += "?";
}
}
else
{
stru += "?";
}
if (k == 1)
{
ShowPage = "首页 上一页 下一页 尾页 第[ 1 ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
}
else if (k == n)
{
ShowPage = "首页 上一页 下一页 尾页 第[ " + k + " ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
}
else
{
ShowPage = "首页 上一页 下一页 尾页 第[ " + k + " ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
}
}
for (int j = pagecount * (k - 1); j < pagecount * k; j++)
{
if (j >= ds.Tables[0].Rows.Count)
{
break;
}
string utype = ds.Tables[0].Rows[j]["utype"].ToString();
string O_Id = ds.Tables[0].Rows[j]["id"].ToString();
string orderid = ds.Tables[0].Rows[j]["orderid"].ToString();
string ProductID = ds.Tables[0].Rows[j]["pid"].ToString();
string strUrl = "/view-" + ProductID + ".html";
string Contactname = ds.Tables[0].Rows[j]["Contactname"].ToString();
string O_TotalNum = ds.Tables[0].Rows[j]["Totalnum"].ToString();
string O_TotalMoney = Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice"]).ToString("f2");
string O_TotalMoney2 = O_TotalMoney;
if (Convert.ToDouble(Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2")) > 0.00)
{
O_TotalMoney += " 使用积分:" + Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2");
O_TotalMoney2 += "
使用积分:" + Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2");
}
string O_Payed = ds.Tables[0].Rows[j]["O_Payed"].ToString();
string O_Payed_Date = ds.Tables[0].Rows[j]["O_Payed_Date"].ToString();
string O_Shipped = ds.Tables[0].Rows[j]["O_Shipped"].ToString();
string O_received = ds.Tables[0].Rows[j]["O_received"].ToString();
string O_Return = ds.Tables[0].Rows[j]["O_Return"].ToString();
string O_Returned = ds.Tables[0].Rows[j]["O_Returned"].ToString();
string O_recReturn = ds.Tables[0].Rows[j]["O_recReturn"].ToString();
string O_SubmitDate = ds.Tables[0].Rows[j]["O_SubmitDate"].ToString().Replace(" ", "
");
string O_SubmitDate2 = ds.Tables[0].Rows[j]["O_SubmitDate"].ToString();
string[] strStatus = Mtxfw.Utility.Common.GetOrderStatus(utype, O_Id, O_SubmitDate, O_Payed, O_Payed_Date, 0);
string strutype = Mtxfw.Utility.Common.cutype(utype);
ShowConent += "