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

📄 system_accattention11_input1.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_accattention11_input1 的摘要说明。
	/// </summary>
	public class system_accattention11_input1 : FormBase
	{
		protected System.Web.UI.WebControls.Label Label02;
		protected System.Web.UI.WebControls.Label Out_Label1;
		protected System.Web.UI.WebControls.TextBox txtAccoName;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.TextBox txtAccoEmp;
		protected System.Web.UI.WebControls.TextBox txtAccoNum;
		protected System.Web.UI.WebControls.Table tableSche;
		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;

		DataSet dsForAll;
		DataSet dsInfor;
		protected COM_DropDs drop=new COM_DropDs();
		protected COM_SystemAccount  COM_SystemAccount=new  COM_SystemAccount();
		protected Gfunction Gfunction=new Gfunction();
		string sRole="";
		string[] sFieldName={"acc_num","acc_res"};
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			this.o_str_FormName="system_accattention11_input1";
			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_res");
			}
			// 在此处放置用户代码以初始化页面
			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);
					//Response.Write(arr_Role[i]);
					CheckBox chk = (CheckBox)this.tableSche.FindControl("chk_"+arr_Role[i]);
					chk.Checked=true;
				}
			}
		}

		#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 TableInit()
		{
			TableRow tRow;
			TableCell tCell;
			string[] fieldValue={};
			dsForAll=this.COM_SystemAccount.DsMainListForAll(fieldValue);
			//			DataGrid1.DataSource=dsForAll;
			//			DataGrid1.DataBind();
			dsInfor=drop.DsDepartment("","");
			foreach(DataRow rowInfor in dsInfor.Tables[0].Rows)
			{
				//生成标题
				tRow= new TableRow();
				tRow.CssClass="txt_box3";
				tCell=new TableCell();
				tCell.Text=rowInfor["dep_name"].ToString();
				tCell.ColumnSpan=4;
				tRow.Cells.Add(tCell);
				tableSche.Rows.Add(tRow);
				//生成行
				DataRow[] mathRow=dsForAll.Tables[0].Select("dep_num='"+rowInfor["dep_num"].ToString()+"'",null,DataViewRowState.CurrentRows);
				int i=0;
				int k=0;
				foreach(DataRow currRow in mathRow)
				{
					if(k<=mathRow.Length)
					{
						if(i==0||i==4)
						{
							tRow= new TableRow();
							tRow.Height=20;
							tRow.CssClass="dbtable_title";
							tableSche.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["acc_emp"].ToString();
							chk.ID="chk_"+currRow["acc_name"].ToString();
							tCell.HorizontalAlign=HorizontalAlign.Left;
							chk.Width=new Unit(150);
							tCell.Controls.Add(chk);
							tRow.Cells.Add(tCell);
							i++;
							k++;
						}
					}
				}
			}
		}
		





		private void cbSaveReturn_Click(object sender, System.EventArgs e)
		{
			string str_data="";
			foreach(DataRow row in dsForAll.Tables[0].Rows)
			{
				CheckBox chk = (CheckBox)this.tableSche.FindControl("chk_"+row["acc_name"].ToString());
				if((chk!=null)&(chk.Checked==true))
				{
					this.Gfunction.StringAdd(ref str_data,"","["+row["acc_name"].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;
			this.labMessage1.Visible=true;
		}
		private void cbReturn_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("system_accattention11.aspx");
		}
	}
}

⌨️ 快捷键说明

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