📄 deliverymethodselect.aspx.cs
字号:
#region 新增付款方式中DeliveryMethodSelect参考答案及页评分细则
/**********************************************************************************************************************
主题:新增付款方式中DeliveryMethodSelect页评分细则.
作者:
时间:
分值:24分
细则:
1、界面设计(新增付款方式显示).............................5分
2、CreateUrl()..............................................5分
3、LoadPaymentType()........................................6分
4、把付款方式加存入Session["ShoppingAddressSession"]........6分
5、OrderProcess.aspx页修改xml字符串.........................2分
* ********************************************************************************************************************/
#endregion
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 PetShop.Components;
using System.Data.SqlClient;
using System.Configuration;
using System.Reflection;
namespace PetShop.Web
{
/// <summary>
/// DeliverMethod 的摘要说明。
/// </summary>
public partial class DeliveryMethdodSelect : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid grdPaymentType;
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
// 检测购物篮状态
if (Session["ShoppingCartSession"] != null)
{
ShoppingCart cart = (ShoppingCart)Session["ShoppingCartSession"];
if (cart.Count == 0)
Response.Redirect("Cart.aspx");
}
else
{
Response.Redirect("Cart.aspx");
}
if(!IsPostBack)
{
LoadDeliveryMethod();
}
}
/// <summary>
///
/// </summary>
private void LoadDeliveryMethod()
{
grdDeliveryMethod.DataSource=new PetShop.Components.DeliveryMethod().GetAll();
grdDeliveryMethod.DataBind();
}
/// <summary>
///
/// </summary>
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnContinue.Click += new System.Web.UI.ImageClickEventHandler(this.btnContinue_Click);
}
#endregion
private void btnContinue_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string strdm=Request.Form["rdoDeliveryMethod"];
int intdm=-1;
if(strdm==null)
{
msg.Text="Please select the Delivery Method!";
msg.Visible=true;
}
else
{
msg.Visible=false;
intdm=Convert.ToInt32(strdm);
Hashtable adr = (Hashtable)Session["ShoppingAddressSession"];
if (adr == null)
{
// don't have one yet, go ahead and create it
adr = new Hashtable();
Session["ShoppingAddressSession"] = adr;
}
adr["DeliveryMethodID"]=intdm;
adr["AdditionalCharge"]=GetAdditionalCharge(intdm);
Response.Redirect("PaymentTypeSelect.aspx");
}
}
private double GetAdditionalCharge(int id)
{
return new PetShop.Components.DeliveryMethod().GetAdditionalCharge(id);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -