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

📄 moas1103.aspx.cs

📁 很具有学习参考价值的OA办公自动化系统,完整源码.OAde
💻 CS
📖 第 1 页 / 共 2 页
字号:
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 MOAS
{
	/// <summary>
	/// MOAS1103 的摘要说明。
	/// </summary>
	public class MOAS1103 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Table Table2;
		protected System.Web.UI.WebControls.Table Table3;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.Table Table4;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button10;
	
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.TextBox TextBox4;
		protected System.Web.UI.WebControls.TextBox TextBox5;
		protected System.Web.UI.WebControls.TextBox TextBox6;
		protected System.Web.UI.WebControls.TextBox TextBox7;
		protected System.Web.UI.WebControls.TextBox TextBox8;
		protected System.Web.UI.WebControls.TextBox TextBox9;
		//		protected System.Web.UI.WebControls.TextBox TextBox11;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.DropDownList DropDownList2;
		protected System.Web.UI.WebControls.DropDownList DropDownList4;
		protected System.Web.UI.HtmlControls.HtmlInputText TextBox1;
		protected System.Web.UI.HtmlControls.HtmlTable Table5;
		protected System.Web.UI.HtmlControls.HtmlInputButton Button4;
		protected System.Web.UI.HtmlControls.HtmlInputButton Button5;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.HtmlControls.HtmlSelect Select1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(!Page.IsPostBack)
			{
				binding();
				Page.RegisterStartupScript("focus", "<script language=javascript>document.getElementById('TextBox1').focus();</script>");
			}			
			SearchId();
			
		}

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

		}
		#endregion
		
	
	//判断是否是从别的画面传来user_id
		private void SearchId()
		{
			try
			{
				if(Session["strTransUseridFrom11041"].ToString()!="")
				{
						string id=Session["strTransUseridFrom11041"].ToString();
						string strSqlid="select * from USERS where id="+id+"";
						CCoSearchFromDatabase search= new CCoSearchFromDatabase();
						string[,] userInfo=search.getList(strSqlid);
					if(userInfo!=null)
					{
                        TextBox1.Value=Session["strTransUseridFrom11041"].ToString();
						string sex=Session["strTransUseridFrom11041"].ToString().Substring(5,2);
						if(sex!="01"&&sex!="02")
						{
							DropDownList4.Items.FindByValue("01").Selected=true;
						}
						else
						{
							DropDownList4.Items.FindByValue(sex).Selected=true;
						}
						DropDownList4.Items.FindByValue(sex).Selected=true;
						if(userInfo[0,12].ToString()=="0")
						{
							Select1.SelectedIndex=2;   //离职人员
						}
						else
						{
							Select1.SelectedIndex=1;
						}
						TextBox2.Text=userInfo[0,1].Replace(" ","");   
						TextBox3.Text=userInfo[0,3]; 
						DropDownList1.Items.FindByValue(userInfo[0,4]).Selected=true;
						DropDownList2.Items.FindByValue(userInfo[0,5]).Selected=true;
						TextBox4.Text=userInfo[0,6].Replace(" ","");   
						TextBox5.Text=userInfo[0,7].Replace(" ","");   
						TextBox6.Text=userInfo[0,8].Replace(" ","");//ip
						TextBox7.Text=userInfo[0,9];
						TextBox8.Text=userInfo[0,10];
						TextBox9.Text=userInfo[0,11];
					}
//					else
//					{
//					
//					}
				}
				Session.Add("strTransUseridFrom11041","");
			}
			catch(Exception ex)
			{
				HttpContext.Current.Response.Redirect("ErrorMessage.aspx?message="+ex.Message+"");  //有异常.抛出异常画面..
				
			}
		}

		//为下拉列表赋值
		private void binding()
		{
			try
			{
				
				string s="SELECT ID, NO, VALUE FROM CODEMASTER WHERE (ID = 'C002')";
				CCoSearchFromDatabase dsc=new CCoSearchFromDatabase();
				DropDownList1.DataSource=dsc.getDataSet(s);
//				DropDownList1.DataTextField="VALUE";
//				DropDownList1.DataValueField="NO";
//				DropDownList1.DataBind();

				string s1="SELECT ID, NO, VALUE FROM CODEMASTER WHERE (ID = 'C009')";
				CCoSearchFromDatabase dsc1=new CCoSearchFromDatabase();
				DropDownList2.DataSource=dsc1.getDataSet(s1);
//				DropDownList2.DataTextField="VALUE";
//				DropDownList2.DataValueField="NO";
//				DropDownList2.DataBind();

				string s2="SELECT ID, NO, VALUE FROM CODEMASTER WHERE (ID = 'C010')";
				CCoSearchFromDatabase dsc2=new CCoSearchFromDatabase();
				Select1.DataSource=dsc2.getDataSet(s2);
//				Select1.DataTextField="VALUE";
//				Select1.DataValueField="NO";
//				Select1.DataBind();   
				
				DropDownList4.Items.Add(new ListItem("男", "01"));
			    DropDownList4.Items.Add(new ListItem("女", "02"));  
				if(dsc.getDataSet(s)!=null&&dsc1.getDataSet(s1)!=null&&dsc2.getDataSet(s2)!=null)
				{
									DropDownList1.DataTextField="VALUE";
									DropDownList1.DataValueField="NO";
									DropDownList1.DataBind();
									DropDownList2.DataTextField="VALUE";
									DropDownList2.DataValueField="NO";
									DropDownList2.DataBind();
									Select1.DataTextField="VALUE";
									Select1.DataValueField="NO";
									Select1.DataBind();   
				}
				else
				{
					HttpContext.Current.Response.Redirect("ErrorMessage.aspx?message=程序出现错误,请检查与数据库的连接是否正确!");
				}
				
			}
			catch(Exception ex)
			{
				HttpContext.Current.Response.Redirect("ErrorMessage.aspx?message="+ex.Message+"");  //有异常.抛出异常画面..
				
			}

		}
		//打开MOAS1104.1.aspx画面。。
		private void Button4_ServerClick(object sender, System.EventArgs e)
		{
			Session.Add("strTransHuanmianId","1103");
           
			Response.Redirect("MOAS1104.1.aspx?status="+Select1.SelectedIndex+"");
		}
		//检索按钮,,按职员id 检索。得到该id 的所有信息
		private void Button5_ServerClick(object sender, System.EventArgs e)
		{
			
			DropDownList1.Items.Clear();
			DropDownList2.Items.Clear();
			binding();
			    string[] str={"用户ID",""+TextBox1.Value+""};
			    string[] str1={"用户ID",""+TextBox1.Value+"",""+TextBox1.MaxLength+""};
			    Compare cmp=new Compare();
			    if(cmp.CompareNull(str)==true&&cmp.CompareNumber(str)&&cmp.CompareLength(str1))
			    {
						try
						{
							string id="'"+TextBox1.Value+"'";
							string strSqlid="select * from USERS where id="+id+"";
							CCoSearchFromDatabase search= new CCoSearchFromDatabase();
							string[,] userInfo=search.getList(strSqlid);
							if(userInfo!=null)
							{
								DropDownList1.Items.Clear();
							    DropDownList2.Items.Clear();
                                DropDownList4.Items.Clear();
								binding();
								string sex=TextBox1.Value.Substring(5,2);
								if(sex!="01"&&sex!="02")
								{
									DropDownList4.Items.FindByValue("01").Selected=true;
								}
								else
								{
									DropDownList4.Items.FindByValue(sex).Selected=true;
								}
								DropDownList4.Items.FindByValue(sex).Selected=true;
								if(userInfo[0,12].ToString()=="0")
								{
									Select1.SelectedIndex=2;   //离职人员
								}
								else
								{
									Select1.SelectedIndex=1;
								}
								TextBox2.Text=userInfo[0,1].Replace(" ","");   
								TextBox3.Text=userInfo[0,3]; 
								DropDownList1.Items.FindByValue(userInfo[0,4]).Selected=true;
								DropDownList2.Items.FindByValue(userInfo[0,5]).Selected=true;
								TextBox4.Text=userInfo[0,6].Replace(" ","");   
								TextBox5.Text=userInfo[0,7].Replace(" ","");   
								TextBox6.Text=userInfo[0,8].Replace(" ","");//ip
								TextBox7.Text=userInfo[0,9];
								TextBox8.Text=userInfo[0,10];
								TextBox9.Text=userInfo[0,11];
							}
							else

⌨️ 快捷键说明

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