您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->人事管理系统(课程设计)源码>>WebFiles/Employee/Add_employee.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:人事管理系统(课程设计)源码
当前文件:文件类型 Mispersonal/WebFiles/Employee/Add_employee.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12public partial class WebFiles_Employee_Add_employee : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 if (!IsPostBack) 17 { 18 this.tb_birth.Attributes.Add("onfocus", "javascript:calendar()"); 19 Image1.ImageUrl = "~/WebFiles/Images/" + picurl.SelectedValue + ".GIF"; 20 21 string connstr = ConfigurationManager.ConnectionStrings["Mispersonalconn"].ConnectionString; 22 SqlConnection Sqlconn = new SqlConnection(connstr); 23 DataSet ds = new DataSet(); 24 string Agreerstr = "select D_ID,D_Name from Tb_department order by D_ID desc"; 25 SqlDataAdapter SqlAgreer = new SqlDataAdapter(Agreerstr, Sqlconn); 26 SqlAgreer.Fill(ds, "Agreer"); 27 Agreer.DataSource = ds.Tables["Agreer"].DefaultView; 28 Agreer.DataTextField = "D_Name"; 29 Agreer.DataValueField = "D_ID"; 30 Agreer.DataBind(); 31 Sqlconn.Close(); 32 } 33 } 34 35 36 protected void add_Click(object sender, EventArgs e) 37 { 38 if (tb_id.Text.Trim() == "") 39 { 40 Response.Write("<script>alert('员工编号不能为空')</script>"); 41 return; 42 } 43 //if (tb_name.Text.Trim() == "") 44 // { 45 // Response.Write("<script>alert('员工姓名不能为空')</script>"); 46 // return; 47 // } 48 if (tb_birth.Text.Trim() == "") 49 { 50 Response.Write("<script>alert('出生年月不能为空')</script>"); 51 return; 52 } 53 54 if (tb_tel.Text.Trim() == "") 55 { 56 Response.Write("<script>alert('联系电话不能为空')</script>"); 57 return; 58 } 59 if (tb_address.Text.Trim() == "") 60 { 61 Response.Write("<script>alert('联系地址不能为空')</script>"); 62 return; 63 } 64 Employ Registor = new Employ(); 65 string pic= "~/WebFiles/Images/" + picurl.SelectedValue + ".GIF"; 66 Registor.Insert(tb_id.Text.Trim(),tb_name.Text.Trim(),sex.SelectedValue,tb_birth.Text.Trim(),tb_tel.Text.Trim(),tb_address.Text.Trim(),Agreer.SelectedValue,tb_intro.Text.Trim(),pic); 67 Response.Redirect("~/WebFiles/Employee/List_employee.aspx"); 68 } 69 70 protected void cancel_Click(object sender, EventArgs e) 71 { 72 tb_id.Text = ""; 73 tb_name.Text = ""; 74 tb_birth.Text = ""; 75 tb_tel.Text= ""; 76 tb_address.Text = ""; 77 tb_intro.Text = ""; 78 79 } 80} 81
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:人事管理系统(课程设计)源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号