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

📄 productoption.aspx.cs

📁 一个网页的系统例子
💻 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 Common;
using DataAccessLibrary;

namespace FerrariSales.Page
{
	/// <summary>
	/// ProductOption 的摘要说明。
	/// </summary>
	public class ProductOption : BasePage
	{
		protected System.Web.UI.WebControls.Button btn_Return;
		protected System.Web.UI.WebControls.DataGrid optionList;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.SecurityCheck();

			if (!Page.IsPostBack)
			{
				//取得页面URL参数
				string productID = Request["id"];
				if (productID==null || productID=="")
				{
					this.Response.Redirect("Product.aspx");
					this.Response.End();
					return;
				}

				this.BaseOperation(productID);
				
				string strUrl = "javascript:window.location.href('Product.aspx?id=" + productID + "');return false;";
				this.btn_Return.Attributes.Add("OnClick",strUrl);
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.optionList.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.optionList_PageIndexChanged);
			this.optionList.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.optionList_ItemDataBound);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		/// <summary>
		/// 检索配置信息
		/// </summary>
		/// <param name="productID"></param>
		private void BaseOperation(string productID)
		{
			BisProductOption bisProductOption = new BisProductOption();
			DataTable table = bisProductOption.GetProductOption(productID);
			
			this.optionList.DataSource=table;
			this.optionList.DataBind();
		}

		/// <summary>
		/// 数据绑定事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void optionList_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if (e.Item.ItemIndex == -1)
			{
				return;
			}

			//DataSource
			DataRowView row = (DataRowView)e.Item.DataItem;

			//配置类型
			string OptionType = ConvertType.GetString(row["OptionType"]);
			if (OptionType == "1")
			{
				e.Item.Cells[4].Text = "基本配置";
			}
			else if (OptionType == "2")
			{
				e.Item.Cells[4].Text = "中国区标准";
			}
			else if (OptionType == "3")
			{
				e.Item.Cells[4].Text = "付费可选";
			}
			else
			{
				e.Item.Cells[4].Text = "";
			}

			//经销商价
			int OptionPriceDealer = ConvertType.GetInt(row["OptionPriceDealer"]);
			e.Item.Cells[5].Text = CommonFunc.ConvertMoneyToPageStyle(OptionPriceDealer);

			//市场价
			int OptionPriceNormal = ConvertType.GetInt(row["OptionPriceNormal"]);
			e.Item.Cells[6].Text = CommonFunc.ConvertMoneyToPageStyle(OptionPriceNormal);

			//颜色材料
			int count = ConvertType.GetInt(row["ColorMaterialCount"]);
			if (count > 0 )
			{
				e.Item.Cells[7].Text = "Y";
			}
			else
			{
				e.Item.Cells[7].Text = "";
			}	
		}

		private void optionList_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
		{
			this.optionList.CurrentPageIndex = e.NewPageIndex;
			this.optionList.DataBind();

		}

		


	}
}

⌨️ 快捷键说明

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