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

📄 system_accorole11_input2.aspx.cs

📁 ASP.NET的一些开发实例,有论坛管理系统等
💻 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;

namespace BDStudioBase.syssoft
{
	/// <summary>
	/// system_accorole11_input2 的摘要说明。
	/// </summary>
	public class system_accorole11_input2 :FormBase
	{
		protected System.Web.UI.WebControls.Label Label02;
		protected System.Web.UI.WebControls.Label Out_Label1;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Table tableRole;
		protected System.Web.UI.WebControls.Label labMessage1;
		protected System.Web.UI.WebControls.Button cbSaveReturn;
		protected System.Web.UI.WebControls.Button cbReturn;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.TextBox txtAccoNum;
		protected System.Web.UI.WebControls.TextBox txtAccoEmp;
		protected System.Web.UI.WebControls.TextBox txtAccoName;	

		DataSet dsForAll;
		DataSet dsInfor;
		COM_DropDs drop=new COM_DropDs();
		
		protected COM_SystemAccount  COM_SystemAccount=new  COM_SystemAccount();
		protected COM_SystemRole  COM_SystemRole=new COM_SystemRole();
		protected Gfunction Gfunction=new Gfunction();
		string sRole="";
		string[] sFieldName={"acc_num","role_num"};

		private void Page_Load(object sender, System.EventArgs e)
		{
			this.o_str_FormName="system_accorole11_input2";
			if (this.Param_check(this.o_str_FormName)==1)//该页是否需要接收值
			{
				this.txtAccoNum.Text=this.Param_get("acc_num");
				this.txtAccoName.Text=this.Param_get("acc_name");
				this.txtAccoEmp.Text=this.Param_get("acc_emp");
				sRole=this.Param_get("acc_role");
			}
			// 在此处放置用户代码以初始化页面
			TableInit();
			if(sRole!=""&&sRole!=null)
			{
				string[] arr_Role=this.sRole.Split(new char[]{','});
				for(int i=0;i<arr_Role.Length;i++)
				{
					arr_Role[i]=arr_Role[i].Substring(1,arr_Role[i].Length-2);
					CheckBox chk = (CheckBox)this.tableRole.FindControl("chk_"+arr_Role[i]);
					chk.Checked=true;
				}
			}
		}

		private void TableInit()
		{
			TableRow tRow;
			TableCell tCell;
			string[] fieldValue={};
			dsForAll=COM_SystemRole.DsMainListForAll(fieldValue);
//			DataGrid1.DataSource=dsForAll;
//			DataGrid1.DataBind();
			dsInfor=drop.DsInformation("RoleType");
			foreach(DataRow rowInfor in dsInfor.Tables[0].Rows)
			{
				//生成标题
				tRow= new TableRow();
				tRow.CssClass="txt_box3";
				tCell=new TableCell();
				tCell.Text=rowInfor["i_title"].ToString();
				tCell.ColumnSpan=4;
				tRow.Cells.Add(tCell);
				tableRole.Rows.Add(tRow);
				//生成行
				DataRow[] mathRow=dsForAll.Tables[0].Select("role_type='"+rowInfor["i_value"].ToString()+"'",null,DataViewRowState.CurrentRows);
				int i=0;
				int k=0;
				foreach(DataRow currRow in mathRow)
				{
					//Response.Write(mathRow.Length);
					if(k<=mathRow.Length)
					{
						if(i==0||i==4)
						{
							tRow= new TableRow();
							tRow.Height=20;
							tRow.CssClass="dbtable_title";
							tableRole.Rows.Add(tRow);
							if(i==4)
							{
								i=0;
							}
						}
						if(i<4)
						{
							tCell = new TableCell();
							System.Web.UI.WebControls.CheckBox chk = new System.Web.UI.WebControls.CheckBox();
							chk.Text=currRow["role_name"].ToString();
							chk.ID="chk_"+currRow["role_num"].ToString();
							chk.Width=new Unit(150);
							tCell.Controls.Add(chk);
							tCell.HorizontalAlign=HorizontalAlign.Left;
							tRow.Cells.Add(tCell);
							i++;
							k++;
						}
						/*if((k==mathRow.Length)&&(k%4!=0))
						{
							//tableRole.Rows.Add(tRow);
						}*/
					}
				}
			}
		}
		



		#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.cbSaveReturn.Click += new System.EventHandler(this.cbSaveReturn_Click);
			this.cbReturn.Click += new System.EventHandler(this.cbReturn_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void cbSaveReturn_Click(object sender, System.EventArgs e)
		{
			string str_data="";
			foreach(DataRow row in dsForAll.Tables[0].Rows)
			{
				CheckBox chk = (CheckBox)this.tableRole.FindControl("chk_"+row["role_num"].ToString());
				if((chk!=null)&(chk.Checked==true))
				{
					this.Gfunction.StringAdd(ref str_data,"","["+row["role_num"].ToString()+"]",",");
				}
			}
			DataSet dsData=new DataSet();
			DataTable dtData=new DataTable();
			DataRow dr;
			for(int i=0;i<sFieldName.Length;i++)
			{
				dtData.Columns.Add(new DataColumn(sFieldName[i],typeof(string)));
			}

			dr=dtData.NewRow();
			dr[sFieldName[0]]=this.txtAccoNum.Text;
			dr[sFieldName[1]]=str_data;

			dtData.Rows.Add(dr);
			dsData.Tables.Add(dtData);
//			DataGrid1.DataSource=dsData;
//			DataGrid1.DataBind();
			string sReturn = string.Empty;
			this.COM_SystemAccount.EditData(dsData,"0",ref sReturn);
			this.labMessage1.Text = sReturn;
		}

		private void cbReturn_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("system_accorole11.aspx");
		}
	}
}

⌨️ 快捷键说明

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