您目前尚未登陆,请选择【登陆】或【注册
首页->其他源码->学生管理信息系统+留言板>>EmpDetail.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:学生管理信息系统+留言板
当前文件:文件类型 StudentSys/EmpDetail.cs打开代码结构图
普通视图
		            
1namespace StudentSys 2{ 3 using System; 4 using System.Collections; 5 using System.ComponentModel; 6 using System.Data; 7 using System.Data.OleDb; 8 using System.Drawing; 9 using System.Web; 10 using System.Web.SessionState; 11 using System.Web.UI; 12 using System.Web.UI.WebControls; 13 using System.Web.UI.HtmlControls; 14 using StudentSys.Module; 15 16 public class EmpDetail : System.Web.UI.Page 17 18 { //该源码下载自www.51aspx.com(51_a_s_px.c_o_m) 19 20 //学生信息窗口定义控件的声名 21 protected CCUtility Utility; 22 23 //学生记录表单、变量等的声名 24 protected System.Web.UI.WebControls.Label Record_ValidationSummary; 25 protected System.Web.UI.HtmlControls.HtmlInputButton Record_cancel; 26 protected System.Web.UI.WebControls.Label Record_emp_id; 27 protected System.Web.UI.WebControls.Label Record_name; 28 protected System.Web.UI.WebControls.Label Record_emp_No; 29 protected System.Web.UI.WebControls.Label Record_title; 30 protected System.Web.UI.WebControls.Label Record_dep_id; 31 protected System.Web.UI.WebControls.Label Record_email; 32 protected System.Web.UI.WebControls.Label Record_work_phone; 33 protected System.Web.UI.WebControls.Label Record_cell_phone; 34 protected System.Web.UI.WebControls.Label Record_home_phone; 35 protected System.Web.UI.WebControls.Label Record_address; 36 protected System.Web.UI.WebControls.Label Record_picture; 37 38 //定义各表单事件保护字符串 39 protected string Record_FormAction="Default.aspx?"; 40 protected System.Web.UI.WebControls.Label RecordForm_Title; 41 protected System.Web.UI.HtmlControls.HtmlInputHidden p_Record_emp_id; 42 43//初始化事件 44 public EmpDetail() 45 { 46 this.Init += new System.EventHandler(Page_Init); 47 } 48//AdminMenu中的自定义包含控件结束 49 50 public void ValidateNumeric(object source, ServerValidateEventArgs args) { 51 try{ 52 Decimal temp=Decimal.Parse(args.Value); 53 args.IsValid=true; 54 }catch{ 55 args.IsValid=false; } 56 } 57 58//定义登录窗口显示控件过程 59//初始化页面过程,创建一个Utility实例,并调用其相应的各方法 60 protected void Page_Load(object sender, EventArgs e) 61 { 62 Utility=new CCUtility(this); 63 64 if (!IsPostBack){ 65 66 p_Record_emp_id.Value = Utility.GetParam("emp_id"); 67 Page_Show(sender, e); 68 } 69 } 70 71 //页面关闭过程 72 protected void Page_Unload(object sender, EventArgs e) 73 { 74 if(Utility!=null) Utility.DBClose(); 75 } 76 77 //窗口中控件定义事件处理过程 78 protected void Page_Init(object sender, EventArgs e) 79 { 80 InitializeComponent(); 81 } 82 private void InitializeComponent() 83 { 84 this.Record_cancel.ServerClick += new System.EventHandler(this.Record_Action); 85 this.Unload += new System.EventHandler(this.Page_Unload); 86 this.Load += new System.EventHandler(this.Page_Load); 87 } 88 89 //定义整体显示页面过程 90 protected void Page_Show(object sender, EventArgs e) 91 { 92 Record_Show(); 93 94 } 95 96 97 98// EmpDetail Show end 99//完成表单初始化 100 101 102 //学生信息显示过程 103 void Record_Show() 104 { 105 106 bool ActionInsert=true; 107 if (p_Record_emp_id.Value.Length > 0 ) 108 { 109 string sWhere = ""; 110 sWhere += "emp_id=" + CCUtility.ToSQL(p_Record_emp_id.Value, CCUtility.FIELD_TYPE_Number); 111 string sSQL = "select * from emps where " + sWhere; 112 OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection); 113 DataSet ds = new DataSet(); 114 DataRow row; 115 116 if (dsCommand.Fill(ds, 0, 1, "Record") > 0) 117 { 118 row = ds.Tables[0].Rows[0]; 119 //显示数据 120 Record_emp_id.Text =Server.HtmlEncode(CCUtility.GetValue(row, "emp_id").ToString()); 121 Record_name.Text =Server.HtmlEncode(CCUtility.GetValue(row, "name").ToString()); 122 Record_emp_No.Text =Server.HtmlEncode(CCUtility.GetValue(row, "emp_No").ToString()); 123 Record_title.Text =Server.HtmlEncode(CCUtility.GetValue(row, "title").ToString()); 124 Record_dep_id.Text =Server.HtmlEncode( Utility.Dlookup("deps", "name", "dep_id=" + CCUtility.ToSQL(CCUtility.GetValue(row, "dep_id"), CCUtility.FIELD_TYPE_Number)).ToString()); 125 Record_email.Text =CCUtility.GetValue(row, "email"); 126 Record_work_phone.Text =Server.HtmlEncode(CCUtility.GetValue(row, "work_phone").ToString()); 127 Record_cell_phone.Text =Server.HtmlEncode(CCUtility.GetValue(row, "cell_phone").ToString()); 128 Record_home_phone.Text =Server.HtmlEncode(CCUtility.GetValue(row, "home_phone").ToString()); 129 Record_address.Text =Server.HtmlEncode(CCUtility.GetValue(row, "address").ToString()); 130 Record_picture.Text =CCUtility.GetValue(row, "picture"); 131 ActionInsert=false; 132 } 133 } 134 if(ActionInsert) 135 { 136 String pValue; 137 pValue = Utility.GetParam("name"); 138 Record_name.Text = pValue; 139 pValue = Utility.GetParam("dep_id"); 140 if (pValue.Length>0){Record_dep_id.Text = Utility.Dlookup("deps", "name", "dep_id=" + pValue);} 141 pValue = Utility.GetParam("email"); 142 Record_email.Text = pValue; 143 } 144 145 //Email的超链接 146 Record_email.Text="<a href=\"mailto:" + Record_email.Text + "\">" + Record_email.Text + "</a>"; 147 Record_picture.Text="<img border=0 src=\"images/emps/" + Record_picture.Text + "\">"; 148 } 149 150 151 //单击返回按钮事件 152 void Record_Action(Object Src, EventArgs E) { 153 bool bResult=true; 154 if(((HtmlInputButton)Src).ID.IndexOf("cancel")>0) bResult=true; 155 if(bResult) 156 Response.Redirect(Record_FormAction+"dep_id=" + Server.UrlEncode(Utility.GetParam("dep_id")) + "&email=" + Server.UrlEncode(Utility.GetParam("email")) + "&name=" + Server.UrlEncode(Utility.GetParam("name")) + "&"); 157 } 158//事件结束 159 160 161 162 } 163}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:学生管理信息系统+留言板
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号