positon_look.aspx.cs

来自「企业网站前台后台源程序,用于大中小型企业网站后台程序开发」· CS 代码 · 共 119 行

CS
119
字号
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 BLL;
using Socut.Data;
namespace Websystem.admin
{
	/// <summary>
	/// Positon_look 的摘要说明。
	/// </summary>
	public class Positon_look : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
		protected System.Web.UI.WebControls.TextBox TextBox4;
		protected System.Web.UI.WebControls.CheckBox CheckBox1;
		protected System.Web.UI.WebControls.CheckBox CheckBox2;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button1;
	
		protected int id=1;

		protected CData myData=new CData();
		protected DataSet ds=new DataSet();
		private void Page_Load(object sender, System.EventArgs e)
		{
			
			other ot = new other();
			if(ot.isDefined("id"))
			{
				try
				{
					id=Convert.ToInt32(Request.QueryString["id"].ToString().Trim().Replace("'",""));
				}
				catch
				{
					System.Web.HttpContext.Current.Response.Redirect("../error.aspx?message=该类别暂时锁定");
				}
			}
			if(!this.IsPostBack)
			load_positon();
		}
		//加载产品信息
		private void load_positon()
		{
		string	sql = "select * from BU_MERCHANDISE where id="+id;

			ds=myData.GetDataSet(sql,0,0,"bu");
			if(ds.Tables["bu"].Rows.Count>0)
			{
				this.TextBox1.Text=ds.Tables["bu"].Rows[0]["MERCHANDISE"].ToString();
				this.TextBox2.Text=ds.Tables["bu"].Rows[0]["MODEL"].ToString();
				this.TextBox3.Text=ds.Tables["bu"].Rows[0]["BEWRITE"].ToString();
				this.TextBox4.Text=ds.Tables["bu"].Rows[0]["EXPONENT"].ToString();
				this.CheckBox1.Checked=Convert.ToInt32(ds.Tables["bu"].Rows[0]["ISOPEN"].ToString())==1?true:false;
				this.CheckBox2.Checked=Convert.ToInt32(ds.Tables["bu"].Rows[0]["ISAVAILABILITY"].ToString())==1?true:false;

			}
		


		}



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

		}
		#endregion

		private void Button2_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("Positon_add_img.aspx?id="+id);
		}

		private void Button1_Click(object sender, System.EventArgs e)
		{
			string MERCHANDISE=this.TextBox1.Text.ToString().Trim().Replace("'","'");
			string MODEL=this.TextBox2.Text.ToString().Trim().Replace("'","'");
			string BEWRITE=this.TextBox3.Text.ToString().Trim().Replace("'","'");
			string EXPONENT=this.TextBox4.Text.ToString().Trim().Replace("'","'");
			int ISOPEN=this.CheckBox1.Checked?1:0;
			int ISAVAILABILITY=this.CheckBox2.Checked?1:0;

			string sql="update BU_MERCHANDISE set MERCHANDISE='"+MERCHANDISE+"',MODEL='"+MODEL+"',BEWRITE='"+BEWRITE+"',EXPONENT='"+EXPONENT+"',ISOPEN="+ISOPEN+",ISAVAILABILITY="+ISAVAILABILITY+" where id="+id;
myData.GetExecuteNonQuery(sql);
			Response.Redirect("Positon_list.aspx?TYPE=1");
		}
	}
}

⌨️ 快捷键说明

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