Asp.net源码专业站
首页->商务办公->Asp.net2.0值班管理系统源码>>DutyDepartmentMain.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net2.0值班管理系统源码
当前文件:文件类型 DutySystem/DutyDepartmentMain.aspx.cs[2K,2009-6-12 11:41:29]打开代码结构图
普通视图
		            
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; 11 12public partial class DutyDepartmentMain : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 if (!this.IsPostBack) 17 { 18 bindDepartment(); 19 } 20 } 21 22 private void bindDepartment() 23 { 24 if (DepartmentDao.dsDepartment() == null || (DepartmentDao.dsDepartment()).Tables[0].Rows.Count == 0) 25 { 26 this.Label1.Visible = true; 27 this.GridView1.Visible = false; 28 } 29 else 30 { 31 this.GridView1.Visible = true; 32 this.GridView1.DataSource = DepartmentDao.dsDepartment(); 33 this.GridView1.DataBind(); 34 } 35 } 36 protected void Button1_Click(object sender, EventArgs e) 37 { 38 if (string.IsNullOrEmpty(this.TextBox1.Text)) 39 { 40 this.Label2.Text = "名称不能留空!"; 41 } 42 else if (string.IsNullOrEmpty(this.TextBox2.Text)) 43 { 44 this.Label2.Text = "编号不能留空!"; 45 } 46 else 47 { 48 DepartmentPo dp = new DepartmentPo(); 49 dp.DepartName = this.TextBox1.Text; 50 dp.DepartId = this.TextBox2.Text; 51 DepartmentDao.insertDepartment(dp); 52 this.Label2.Text = ""; 53 this.TextBox1.Text = ""; 54 this.TextBox2.Text = ""; 55 bindDepartment(); 56 } 57 58 } 59 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) 60 { 61 this.GridView1.EditIndex = e.NewEditIndex; 62 bindDepartment(); 63 64 } 65 protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) 66 { 67 this.GridView1.EditIndex = -1; 68 bindDepartment(); 69 } 70 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) 71 { 72 string name = ((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text; 73 string id = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text; 74 75 int keyId = Int32.Parse(this.GridView1.DataKeys[e.RowIndex].Value.ToString()); 76 DepartmentPo dp = new DepartmentPo(); 77 dp.DepartId = id; 78 dp.DepartName = name; 79 DepartmentDao.updateDepartment(dp,keyId); 80 this.GridView1.EditIndex = -1; 81 bindDepartment(); 82 83 } 84 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) 85 { 86 //删除 87 int keyId = Int32.Parse(this.GridView1.DataKeys[e.RowIndex].Value.ToString()); 88 DepartmentDao.deleteDepart(keyId); 89 bindDepartment(); 90 } 91} 92
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net2.0值班管理系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146