📄 customerorderdetails.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
using PetShop.Components;
namespace PetShop.Web
{
/// <summary>
/// CustomerOrderDelimer 的摘要说明。
/// </summary>
public partial class CustomerOrderDelimer : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)
{
string strdatetime=Request.QueryString["strDT"];
string strnumber=Request.QueryString["strNM"];
string strstatus=Request.QueryString["strTS"];
this.lblDate.Text=strdatetime;
this.lblOrderID.Text=strnumber;
this.lblStatus.Text=strstatus;
Hashtable ad=(Hashtable)Session["UserID"];
Debug.Assert(ad!=null);
this.lblAccount.Text=ad["userID"].ToString();
PetShop.Components.Order order=new PetShop.Components.Order();
int orderid=Convert.ToInt32(Request.QueryString["strNM"]);
string strMethodName=order.GetDeliveryMethodName(orderid);
if(strMethodName=="Take away by yourself")
{
this.lblDeliveryMethod.Text=strMethodName;
this.lblshippingaddress.Visible=false;
this.lblbillingaddress.Visible=false;
this.Table2.Visible=false;
this.Table3.Visible=false;
}
else
{
this.lblDeliveryMethod.Text=strMethodName;
}
string Paymentid=Convert.ToString(order.GetPaymentType(orderid));
if(Paymentid=="1")
{
this.lblPaymentType.Text="Credit";
this.lblCheck.Visible=false;
this.lblCheckNumber.Visible=false;
}
else if(Paymentid=="2")
{
this.lblPaymentType.Text="Check";
this.lblCardType.Visible=false;
this.lblCardNumber.Visible=false;
this.lblCardDate.Visible=false;
this.lblCreditCard.Visible=false;
}
else if(Paymentid=="3")
{
this.lblPaymentType.Text="Cash";
this.lblCheck.Visible=false;
this.lblCheckNumber.Visible=false;
this.lblCardType.Visible=false;
this.lblCardNumber.Visible=false;
this.lblCardDate.Visible=false;
this.lblCreditCard.Visible=false;
}
if(strMethodName=="Take away by yourself")
{
this.dataGrid.Columns[1].FooterText=string.Format("{0:c}","0.0");
}
if(strMethodName=="Direct delivery")
{
this.dataGrid.Columns[1].FooterText=string.Format("{0:c}","5.0");
}
else
{
this.dataGrid.Columns[1].FooterText=string.Format("{0:c}","10.0");
}
//int orderid=Convert.ToInt32(Request.QueryString["strNM"]);
string Userid;
string StoreName;
string Shiptofirstname;
string Shiptolastname;
string Shipaddr1;
string Shipaddr2;
string Shipcity;
string Shipstate;
string Shippostalcode;
string Billtofirstname;
string Billtolastname;
string Billaddr1;
string Billaddr2;
string Billcity;
string Billstate;
string Billpstalcode;
string CardType;
string Cardnumber;
string CardDate;
string CheckNumber;
decimal totalPrice;
order.GetOrderDetils(orderid,out Userid,out StoreName,out Shiptofirstname,out Shiptolastname,out Shipaddr1,
out Shipaddr2,out Shipcity,out Shipstate,out Shippostalcode,out Billtofirstname,out Billtolastname,out Billaddr1, out Billaddr2,
out Billcity,out Billstate,out Billpstalcode,out CardType,out Cardnumber, out CardDate,out CheckNumber,out totalPrice);
this.lblfirstname.Text=Shiptofirstname.ToString();
this.lbllastname.Text=Shiptolastname;
this.lblstreetaddress.Text=Shipaddr1;
this.lbladdress.Text=Shipaddr2;
this.lblCity.Text=Shipcity;
this.lblState.Text=Shipstate;
//this.lblCountry.Text=
//this.lblTelephone.Text=
this.lblFirst.Text=Billtofirstname;
this.lblLast.Text=Billtolastname;
this.lblStreet.Text=Billaddr1;
this.lblStreet1.Text=Billaddr2;
this.lblCiyt.Text=Billcity;
this.lblStaet.Text=Billstate;
//this.lblContyt.Text=
this.lblCardType.Text=CardType;
this.lblCardNumber.Text=Cardnumber;
this.lblCardDate.Text=CardDate;
this.lblCheckNumber.Text=CheckNumber;
//banding
this.dataGrid.DataSource=order.GetLineItem(orderid);
this.dataGrid.DataBind();
PetShop.Components.DeliveryMethod dm=new PetShop.Components.DeliveryMethod();
Hashtable adr = (Hashtable)Session["ShoppingAddressSession"];
if (adr==null)
{
adr=new Hashtable();
}
int id=Convert.ToInt32(adr["DeliveryMethodID"]);
ShoppingCart cart = (ShoppingCart)Session["ShoppingCartSession"];
Debug.Assert(adr!=null);
// decimal dAdditionalCharge;
// dAdditionalCharge=Convert.ToDecimal(dm.GetAdditionalCharge(id));
// this.dataGrid.Columns[1].FooterText=dAdditionalCharge.ToString("c");
// decimal AllPrice;
// AllPrice=dAdditionalCharge + Convert.ToDecimal(cart.Total);
// this.dataGrid.Columns[3].FooterText=AllPrice.ToString("c");
// decimal totalPrice=0M;
// for (int i=this.dataGrid.Items.Count-1;i>=0;i--)
// {
// decimal Price;
// DataGridItem dataItem1=this.dataGrid.Items[i];
// Price=decimal.Parse(dataItem1.Cells[2].Text);
// totalPrice+=Price;
// }
this.dataGrid.Columns[4].FooterText=totalPrice.ToString("c");
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -