positon_sort_admin_mod.aspx.cs

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

CS
148
字号
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_sort_admin_mod 的摘要说明。
	/// </summary>
	public class Positon_sort_admin_mod : System.Web.UI.Page
	{
		protected MagicAjax.UI.Controls.AjaxPanel AjaxPanel1;
		protected System.Web.UI.WebControls.Button Button1;	
		protected int type_id=1;
		protected DataSet ds=new DataSet();
		protected System.Web.UI.WebControls.RadioButton RadioButton1;
		protected System.Web.UI.WebControls.RadioButton RadioButton2;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.Button Button2;
		protected CData myData=new CData();
		private void Page_Load(object sender, System.EventArgs e)
		{
			other ot = new other();
			ot.chk_user();
			if(ot.isDefined("TYPE"))
			{
				try
				{
					type_id=Convert.ToInt32(Request.QueryString["TYPE"].ToString().Trim().Replace("'",""));
				}
				catch
				{
					System.Web.HttpContext.Current.Response.Redirect("../error.aspx?message=该类别暂时锁定");
				}
			}
//			Response.Write(type_id.ToString());
			load_type();
		}
		private void load_type()
		{

			string sql="select top 1 text from THESORT where id="+type_id;
			ds=myData.GetDataSet(sql,0,0,"THESORT");
			if(ds.Tables["THESORT"].Rows.Count>0)
			{

				this.TextBox1.Text=ds.Tables["THESORT"].Rows[0][0].ToString();
			}
			else
			{
				System.Web.HttpContext.Current.Response.Redirect("../error.aspx?message=该类别暂时锁定");
			}


		}


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

		}
		#endregion

		private void RadioButton1_CheckedChanged(object sender, System.EventArgs e)
		{
		load_type();
		}

		private void RadioButton2_CheckedChanged(object sender, System.EventArgs e)
		{
			this.TextBox1.Text="";
		}

		private void RadioButton3_CheckedChanged(object sender, System.EventArgs e)
		{
				}

		private void Button2_Click(object sender, System.EventArgs e)
		{
		string sql="delete from THESORT where id="+type_id;
			try
			{
				myData.GetExecuteNonQuery(sql);
			}
			catch
			{

				System.Web.HttpContext.Current.Response.Redirect("../error.aspx?message=该类别暂时锁定");
	

			}
Response.Write("<script >parent.location.href='Positon_sort_admin.aspx'</script>");

	
		}

		private void Button1_Click(object sender, System.EventArgs e)
		{string sql="";
			string title=Request.Form["TextBox1"].ToString().Trim().Replace("'","");
			if(this.RadioButton1.Checked)
			{
sql="update THESORT set [text]='"+title+"' where id="+type_id;

			}
			else
			{
				sql="select id from THESORT where parentId="+type_id;
				ds=myData.GetDataSet(sql,0,0,"aa");
				int a=(type_id)*10+ds.Tables["aa"].Rows.Count+1;
sql="insert into THESORT (id,parentId,[text],data,url,target) values ("+a+","+type_id+",'"+title+"','type="+a+"','Positon_list.aspx','list')";


			}
				myData.GetExecuteNonQuery(sql);
			
			Response.Write("<script >parent.location.href='Positon_sort_admin.aspx'</script>");

		}
	}
}

⌨️ 快捷键说明

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