system_work_sumup11.aspx.cs

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

CS
490
字号
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_work_sumup11 的摘要说明。
	/// </summary>
	public class system_work_sumup11 :  FormBase
	{
		protected System.Web.UI.WebControls.Label Lab_title;
		protected System.Web.UI.WebControls.DataGrid dbGridMain1;
		protected System.Web.UI.WebControls.Label labMessage1;
		protected System.Web.UI.WebControls.LinkButton linkbPrev1;
		protected System.Web.UI.WebControls.Label labPage1;
		protected System.Web.UI.WebControls.LinkButton linkbNext1;
		protected System.Web.UI.WebControls.LinkButton linkbJump1;
		protected System.Web.UI.WebControls.TextBox txtPageNum1;
		protected System.Web.UI.WebControls.Label labPage2;
		protected System.Web.UI.WebControls.RadioButton Radiobutton1;
		protected System.Web.UI.WebControls.RadioButton Radiobutton2;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.WebControls.Button Button4;
		protected System.Web.UI.WebControls.RadioButton rdoReceive;
		protected System.Web.UI.WebControls.RadioButton rdoSend;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.DropDownList listDep;
		
		protected COM_SystemWorkPlan COM_SystemWorkPlan=new COM_SystemWorkPlan();
		protected COM_DropDs COM_DropDs=new COM_DropDs();
		protected COM_NumToChina COM_NumToChina= new COM_NumToChina();
		private string s_pk="work_num";
		private int ColumnCount=6;//主表格固定列数量
		private string sUserName="";
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.ImageButton cbAdd;
		protected System.Web.UI.WebControls.ImageButton cbEdit;
		protected System.Web.UI.WebControls.ImageButton cbDelete;
		protected System.Web.UI.WebControls.ImageButton cbReturn;
		string[] str_FieldValue=new string[3];

		private void Page_Load(object sender, System.EventArgs e)
		{   
			sUserName=(string)Session["userid"];
			// 在此处放置用户代码以初始化页面
			this.o_str_FormName="system_work_sumup11";
			this.o_str_FormUrl="system_work_sumup11.aspx";
			this.o_str_InputFile1="system_work_sumup11_input1.aspx";
			this.o_str_InputFile2="system_work_sumup11_input2.aspx";  
			this.o_str_ModifyFile1="system_work_sumup11_edit1.aspx";
			this.o_str_DisplayFile1 = "system_work_sumup11_display1.aspx";
			this.o_str_FormStatusData=this.GetValueFromUserLog(this.o_str_FormName);

			if(!Page.IsPostBack)
			{
				Session["PageNum1"]=0;				
				Session["dv1"]=null;
				this.listDep.DataSource=this.COM_DropDs.DsDepartment("","");
				this.listDep.DataTextField="dep_name";
				this.listDep.DataValueField="dep_num";
				this.listDep.DataBind();
				this.listDep.SelectedIndex=0;
				if (this.o_str_FormStatusData!="W")
				{
					string[] arr_window_value=this.o_str_FormStatusData.Split(new char[]{','});
					Session["PageNum1"]=Int32.Parse(arr_window_value[0]);
					Session["redbutn"]=arr_window_value[1];
					Session["as_edit"]=arr_window_value[2];
					Session["as_delete"]=arr_window_value[3];
					//Response.Write(arr_window_value[1]);
					UserLogClose(this.o_str_FormName);//关闭记录
				}
				else
				{
					Session["as_edit"]="0";
					Session["as_delete"]="0";
				}
			}
			this.WhereInit();
			//this.o_ds_FormData=this.COM_SystemWorkPlan.DsMainListForAll(str_FieldValue);//生成填入dbGridMain1的数据集
					
			this.COM_SystemWorkPlan.DsView(ref this.o_ds_FormData,Session["userid"].ToString());
			this.DataRead(this.o_ds_FormData,"dv1");
//			foreach(DataRow row in this.o_ds_FormData.Tables[0].Rows)
//			{
//				if(row["view"].ToString()=="1")
//				{
//					Session[row["work_num"].ToString()]="True";
//				}
//			}
			
			FormInit();	//填充dbGridMain1数据	
		}

		#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.rdoReceive.CheckedChanged += new System.EventHandler(this.rdoReceive_CheckedChanged);
			this.rdoSend.CheckedChanged += new System.EventHandler(this.rdoSend_CheckedChanged);
			this.cbAdd.Click += new System.Web.UI.ImageClickEventHandler(this.cbAdd_Click);
			this.cbEdit.Click += new System.Web.UI.ImageClickEventHandler(this.cbEdit_Click);
			this.cbDelete.Click += new System.Web.UI.ImageClickEventHandler(this.cbDelete_Click);
			this.cbReturn.Click += new System.Web.UI.ImageClickEventHandler(this.cbReturn_Click);
			this.dbGridMain1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dbGridMain1_ItemCommand);
			this.dbGridMain1.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dbGridMain1_ItemDataBound);
			this.linkbJump1.Click += new System.EventHandler(this.linkbJump1_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		static string[] strView = {"<IMG alt=\"\" src=\"..\\images\\icon_folder_new.gif\">","<IMG alt=\"\" src=\"..\\images\\icon_folder.gif\">"};
		public static  string ViewImg(object view)
		{			
			int n = int.Parse(view.ToString());
			return strView[n];
		}

		private void FormInit()
		{
			DataView dvdata;
			if(Session["dv1"]!=null)
			{
				/*表格页数初始化*/
				//this.o_int_PageNum=(int)Session["PageNum1"];
				/*参数说明:主表格控件名称、表格列项目、项目数量、主键名称*/
				dvdata=(DataView)Session["dv1"];
				this.dbGridMain1.DataSource=dvdata;
				this.dbGridMain1.CurrentPageIndex=0;
				this.dbGridMain1.DataBind();
				if(((int)Session["PageNum1"]+1)>this.dbGridMain1.PageCount)
				{
					if((this.dbGridMain1.Items.Count%this.dbGridMain1.PageSize)==0)
					{
						Session["PageNum1"]= (int)Session["PageNum1"]-1;
					}
				}
				this.o_int_PageNum=(int)Session["PageNum1"];
				this.dbGridMain1.CurrentPageIndex=this.o_int_PageNum;
				this.dbGridMain1.DataBind();
				this.PageShow();
			}
			if(Session["as_edit"].ToString()=="1")
			{
				
				this.dbGridMain1.Columns[ColumnCount+1].Visible=true;
			}
			else
			{
				this.dbGridMain1.Columns[ColumnCount+1].Visible=false;
			}
			if(Session["as_delete"].ToString()=="1")
			{
				
				this.dbGridMain1.Columns[ColumnCount+2].Visible=true;
			}
			else
			{
				this.dbGridMain1.Columns[ColumnCount+2].Visible=false;
			}
		}

		private void WhereInit()
		{
			if(Session["redbutn"]!=null)
			{
				if(Session["redbutn"].ToString()=="True")
				{
					this.rdoReceive.Checked=true;
					this.rdoSend.Checked=false;
				}
				else
				{
					this.rdoSend.Checked=true;
					this.rdoReceive.Checked=false;
				}
			}
			if(this.rdoReceive.Checked)
			{
				DataSet ds=this.COMInterface.CreateDataSetFromSql("select under_res from system_account where acc_name='"+(string)Session["userid"]+"'");
				//DataGrid1.DataSource=ds;
			    //DataGrid1.DataBind();
				if(ds.Tables[0].Rows[0]["under_res"].ToString()=="[ALL]")
				{
					listDep.Visible=true;
					Label1.Visible=true;
					this.o_ds_FormData=this.COM_SystemWorkPlan.DsUnderWorkPlan("02",sUserName,listDep.SelectedItem.Value);
					//					str_FieldValue[0]="02";
					//					str_FieldValue[1]=sUserName;
					//					str_FieldValue[2]="";
					
				}
				else
				{
					this.o_ds_FormData=this.COM_SystemWorkPlan.DsUnderWorkPlan("02",sUserName,"");
				}

			}
			else
			{
				listDep.Visible=false;
				Label1.Visible=false;
				str_FieldValue[0]="02";
				str_FieldValue[1]="";
				str_FieldValue[2]=sUserName;
				this.o_ds_FormData=this.COM_SystemWorkPlan.DsMainListForAll(str_FieldValue);
				//DataGrid1.DataSource=this.o_ds_FormData;
				//DataGrid1.DataBind();
			}
		}

		private void SaveStatus()
		{
			this.o_str_FormStatusData=this.dbGridMain1.CurrentPageIndex.ToString()+","+this.rdoReceive.Checked.ToString()+","+(string)Session["as_edit"]+","+(string)Session["as_delete"];
			this.SaveFormStatus(this.o_str_FormName,this.o_str_FormStatusData);
		}

		private void PageShow()
		{
			if(dbGridMain1.PageCount>1)
			{

⌨️ 快捷键说明

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