Asp.net源码专业站
首页->商务办公->Asp.net2.0值班管理系统源码>>DutyListMain.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net2.0值班管理系统源码
当前文件:文件类型 DutySystem/DutyListMain.aspx.cs[4K,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 DutyListMain : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 17 if (!this.IsPostBack) 18 { 19 bindDepartDrop(); 20 bindUserDrop(); 21 22 bindDutyData(); 23 24 } 25 } 26 27 private void bindDutyData() 28 { 29 if (DutyDao.dsDuty() == null || (DutyDao.dsDuty()).Tables[0].Rows.Count == 0) 30 { 31 this.Label1.Visible = true; 32 this.GridView1.Visible = false; 33 } 34 else 35 { 36 this.Label1.Visible = false; 37 this.GridView1.Visible = true; 38 this.GridView1.DataSource = DutyDao.dsDuty(); 39 this.GridView1.DataBind(); 40 } 41 } 42 43 private void bindDepartDrop() 44 { 45 DataTable dt = DepartmentDao.dsDepartment().Tables[0]; 46 this.DropDownList1.DataSource = dt; 47 this.DropDownList1.DataTextField = dt.Columns[1].ToString(); 48 this.DropDownList1.DataValueField = dt.Columns[0].ToString(); 49 this.DropDownList1.DataBind(); 50 this.DropDownList1.Items.Insert(0, new ListItem("请选择", "0")); 51 } 52 53 private void bindUserDrop() 54 { 55 56 } 57 protected void Button1_Click(object sender, EventArgs e) 58 { 59 if(!this.Calendar1.Visible) 60 this.Calendar1.Visible = true; 61 else 62 this.Calendar1.Visible = false; 63 } 64 protected void Calendar1_SelectionChanged(object sender, EventArgs e) 65 { 66 this.TextBox1.Text = this.Calendar1.SelectedDate.ToShortDateString(); 67 this.Calendar1.Visible = false; 68 } 69 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 70 { 71 if (this.DropDownList1.SelectedIndex != 0) 72 { 73 this.DropDownList2.Items.Clear(); 74 this.DropDownList2.DataSource = StaffDao.dsStaff(int.Parse(this.DropDownList1.SelectedValue.ToString())).Tables[0]; 75 this.DropDownList2.DataTextField = StaffDao.dsStaff(int.Parse(this.DropDownList1.SelectedValue.ToString())).Tables[0].Columns[1].ToString(); 76 this.DropDownList2.DataValueField = StaffDao.dsStaff(int.Parse(this.DropDownList1.SelectedValue.ToString())).Tables[0].Columns[0].ToString(); 77 this.DropDownList2.DataBind(); 78 } 79 80 } 81 protected void Button4_Click(object sender, EventArgs e) 82 { 83 if (!this.Calendar2.Visible) 84 this.Calendar2.Visible = true; 85 else 86 this.Calendar2.Visible = false; 87 } 88 protected void Calendar2_SelectionChanged(object sender, EventArgs e) 89 { 90 this.TextBox3.Text = this.Calendar2.SelectedDate.ToShortDateString(); 91 this.Calendar2.Visible = false; 92 } 93 protected void Button2_Click(object sender, EventArgs e) 94 { 95 if (this.DropDownList1.SelectedIndex == 0) 96 { 97 this.Label2.Text = "请选择部门!"; 98 99 } 100 else if (this.DropDownList2.SelectedIndex == -1) 101 { 102 this.Label2.Text = "请选择人员!"; 103 } 104 else if (string.IsNullOrEmpty(this.TextBox1.Text)) 105 { 106 this.Label2.Text = "请选择开始时间!"; 107 } 108 else if (string.IsNullOrEmpty(this.TextBox3.Text)) 109 { 110 this.Label2.Text = "请选择结束时间!"; 111 } 112 else if ((DateTime.Parse(this.TextBox1.Text)).CompareTo(DateTime.Parse(this.TextBox3.Text)) == 1) 113 { 114 this.Label2.Text = "开始时间不应大于结束时间"; 115 } 116 else 117 { 118 int departId = int.Parse(this.DropDownList1.SelectedValue.ToString()); 119 int userId = int.Parse(this.DropDownList2.SelectedValue.ToString()); 120 121 DateTime begin = DateTime.Parse(this.TextBox1.Text); 122 DateTime end = DateTime.Parse(this.TextBox3.Text); 123 124 string comment = this.TextBox2.Text; 125 126 DutyPO dp = new DutyPO(); 127 dp.DepartId = departId; 128 dp.StaffId = userId; 129 dp.DutyDateBegin = begin; 130 dp.DutyDateEnd = end; 131 dp.DutyComment = comment; 132 DutyDao.insertDuty(dp); 133 bindDutyData(); 134 this.Label2.Text = ""; 135 } 136 137 } 138} 139
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net2.0值班管理系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146