forums_main_topic_edit.aspx.cs

来自「ASP.NET的一些开发实例,有论坛管理系统等」· CS 代码 · 共 261 行

CS
261
字号
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;

namespace WhiteForum.forums
{
	/// <summary>
	/// forums_main_topic_edit 的摘要说明。
	/// </summary>
	public class forums_main_topic_edit : BDStudioBase.FormBase
	{
		protected System.Web.UI.WebControls.TextBox In_TextBox8;

		protected COM_ForumTopics COM_ForumTopics=new COM_ForumTopics();
		private string m_num="88";
		private string sReturn="";
		private int i_RowCount=0;
		private int i_CurrentRow=0;
		private string sReceiveId="";
		protected System.Web.UI.WebControls.Label labCurrentRow;
		private string[] arr_ReceiveId;
		protected System.Web.UI.WebControls.Label labMessage1;
		protected System.Web.UI.WebControls.TextBox In_TextBox7;
		protected System.Web.UI.WebControls.TextBox In_TextBox6;
		protected System.Web.UI.WebControls.TextBox In_TextBox3;
		protected System.Web.UI.WebControls.DropDownList In_TextBox5;
		protected System.Web.UI.WebControls.DropDownList In_TextBox4;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.TextBox In_TextBox1;
		protected System.Web.UI.WebControls.TextBox In_TextBox2;
		protected System.Web.UI.WebControls.ImageButton ImageButton1;
		protected System.Web.UI.WebControls.ImageButton IB_ModifyReturn;
		protected System.Web.UI.WebControls.ImageButton IB_Return;
		protected System.Web.UI.WebControls.TextBox In_TextBox9;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.TextBox In_TextBox10;
		protected System.Web.UI.WebControls.TextBox In_TextBox11;
		private COM_DropDs drop=new COM_DropDs();
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			this.o_str_FormName = "forums_main_topic_edit";
			this.o_str_FormUrl = "forums_main_topic_edit.aspx";
			this.o_str_DisplayFile1 = "forums_main_topic_display.aspx";
			
			this.o_str_Pk1 = string.Empty;
			
			this.o_str_Pk1=this.Param_get("as_topicID");
			this.o_str_Pk2 =this.Param_get("type");
			//this.o_str_Pk1="4";
			//this.sReceiveId=this.Param_get("as_sendid");
			arr_ReceiveId=this.sReceiveId.Split(new char[]{','});

			if(!Page.IsPostBack)
			{
				this.In_TextBox4.DataSource=drop.DsInformation("TopicLevel");
				this.In_TextBox4.DataTextField = "i_title";
				this.In_TextBox4.DataValueField = "i_value";
				this.In_TextBox4.DataBind();
				this.In_TextBox5.DataSource=drop.DsInformation("TopicProperty");
				this.In_TextBox5.DataTextField = "i_title";
				this.In_TextBox5.DataValueField = "i_value";
				this.In_TextBox5.DataBind();
				this.In_TextBox8.Text=this.o_str_Pk1;
				//当前记录位置
				//i_CurrentRow=this.COMGfunction.GetNumFromArray(this.o_str_Pk1,arr_ReceiveId)+1;
				this.labCurrentRow.Text=i_CurrentRow.ToString();
				//填充标签内容
				//			   this.Out_label(m_num,"InputFace",this);
				FormInit(this.o_str_Pk1,"0");
			}
			ButtonInit();

		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
			this.IB_ModifyReturn.Click += new System.Web.UI.ImageClickEventHandler(this.IB_ModifyReturn_Click);
			this.IB_Return.Click += new System.Web.UI.ImageClickEventHandler(this.IB_Return_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
		private void FormInit(string s_pk,string SearchType)
		{
			string[] str_FieldValue = {m_num,"InputFace",s_pk};
			DataSet dsData=this.COM_ForumTopics.DsSelectSingleData(str_FieldValue,SearchType,ref sReturn);
			this.Put_IntextBox(m_num,"InputFace",dsData,this);
			//this.labMessage1.Text=sReturn;
		}
		
		private void DataSave(string EditType)
		{
			DataSet dsData=this.SetFaceDataToDataSet(m_num,"InputFace",this);
			//this.DataGrid1.DataSource=dsData;
			//this.DataGrid1.DataBind();
			string sReturn=string.Empty;
			this.COM_ForumTopics.EditData(dsData,EditType,ref sReturn);
			this.labMessage1.Text=sReturn;
		}

		//		private void buttonReturn_Click(object sender, System.EventArgs e)
		//		{
		//			this.ReturnToParent(this.o_str_FormName);
		//		}

		//		private void buttonModifyReturn_Click(object sender, System.EventArgs e)
		//		{
		//			DataSave("0");
		//			if (this.labMessage1.Text == "修改成功")
		//			{
		//				
		//				Response.Redirect("forums_main_topic_display.aspx?as_pk="+this.o_str_Pk1);
		//			}
		//		}

		//		private void buttonModifyContinue_Click(object sender, System.EventArgs e)
		//		{
		//			DataSave("0");
		//			if (this.labMessage1.Text == "修改成功")
		//			{
		//				i_CurrentRow=Int32.Parse(this.labCurrentRow.Text);
		//				i_CurrentRow++;
		//				if(i_CurrentRow<=0)
		//				{
		//					i_CurrentRow=1;
		//				}
		//				else
		//				{
		//					if(i_CurrentRow>=i_RowCount)
		//					{
		//						i_CurrentRow=i_RowCount;
		//					}
		//				}
		//				this.labCurrentRow.Text=i_CurrentRow.ToString();
		//
		//				FormInit(arr_ReceiveId[i_CurrentRow-1],"0");
		//			}
		//		}

		

		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Redirect("../forums/forums_main_public.aspx");
		}

		private void IB_Return_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Redirect("forums_main_topic_display.aspx?as_pk="+this.o_str_Pk1+"&type="+this.o_str_Pk2);
		}

		private void IM_Clear_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			this.In_TextBox1.Text="";
			this.In_TextBox2.Text="";
		}

		private void IB_ModifyReturn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			if((this.In_TextBox1.Text.Length>40)||(this.In_TextBox1.Text.Length<1))
			{
				this.Label2.Visible=true;
				return;
			}
			if(this.In_TextBox4.SelectedItem.Value!="01")
			{
				if(this.In_TextBox3.Text==string.Empty)
				{
					this.Label3.Visible=true;
					return;
				}
			}
			else
			{
				if(this.In_TextBox3.Text==string.Empty)
				{
					this.In_TextBox3.Text="[ALL]";
					this.In_TextBox9.Text="[ALL]";
				}
			}
			DataSave("0");
			if (this.labMessage1.Text == "修改成功")
			{
				
				Response.Redirect("forums_main_topic_display.aspx?as_pk="+this.o_str_Pk1+"&type="+this.o_str_Pk2);
			}
		}
		private void ButtonInit()
		{
			string thisPageUrl="forums/forums_main_topic_edit.aspx";
			string sqlquery="select * from system_module where m_type='3' and m_up=(select m_num from system_module where m_url='"+thisPageUrl+"')";
			DataSet DsmapRole=this.COMInterface.CreateDataSetFromSql(sqlquery);
			//DataGrid1.DataSource=DsmapRole;
			//DataGrid1.DataBind();
			foreach(DataRow mapRoleRow in DsmapRole.Tables[0].Rows)
			{
				TextBox textBox=null;
				DropDownList  dropDownList=null;
				string enableRole=mapRoleRow["enable_role"].ToString();
				string rolePoint=mapRoleRow["m_name"].ToString();
				//string type=this.TB.FindControl(rolePoint).GetType().ToString();
				//Response.Write(type);
				object obj=this.Page.FindControl(rolePoint);
				string type=obj.GetType().ToString();
				if(type=="System.Web.UI.WebControls.TextBox")
				{
					textBox=(TextBox)obj;
					textBox.Enabled=false;
				}
				if(type=="System.Web.UI.WebControls.DropDownList")
				{
					dropDownList=(DropDownList)obj;
					dropDownList.Enabled=false;
				}
				DataSet DsuserRole=(DataSet)Session["DsUserRole"];
				foreach(DataRow userRoleRow in DsuserRole.Tables[0].Rows)
				{
					if(enableRole.IndexOf(userRoleRow["role_num"].ToString())>-1)
					{
						
						if(type=="System.Web.UI.WebControls.TextBox")
						{
							textBox.Enabled=true;
						}
						else
						{
							dropDownList.Enabled=true;
						}
					}
				}
			}
		}
		
	}
}

⌨️ 快捷键说明

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