⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paymenttypeselect.aspx.cs

📁 PetShop实现的是一个网上购物的系统功能
💻 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 PaymentTypeSelect : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DataGrid grdDeliveryMethod;
	
		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)
			{
				LoadPaymentType();
			}
		}

		private void LoadPaymentType()
		{
			DataTable dt=new PetShop.Components.PaymentType().GetPaymentType();		
			grdPaymentType.DataSource=dt;
			grdPaymentType.DataBind();	
		}

		#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 strpt=Request.Form["rdoPaymentType"];
			if(strpt==null)
			{
				msg.Text="Please select payment type!";
				msg.Visible=true;
			}
			else
			{
				msg.Visible=false;
				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["PaymentType"]=strpt;
				Response.Redirect(CreateUrl(strpt));			
			}
		}	
		private string CreateUrl(string strpt)
		{
			string url="";
			if(strpt==PaymentTypes.Credit.ToString())
			{
				url="OrderBilling.aspx";
			}
			else if(strpt==PaymentTypes.Check.ToString())
			{
				url="OrderCheck.aspx";
			}
			else
			{
				url="OrderCash.aspx";
			}
			return url;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -