当前位置:首页 > 人事管理系统毕业设计论文
成都学院(成都大学)学士学位论文(设计)
FormsAuthentication.HashPasswordForStoringInConfigFile(txtuserpwd.Text, \); string sql = \
emp_id,emp_name,emp_sex,emp_age,emp_birth,dep_id,emp_job,emp_resume,emp_user,emp_pwd,emp_type,emp_img from Employee where emp_user='\ + user + \ + pwd + \; SqlDataReader dr = DB.getDataReader(sql, cn); if (AuthCode1.IsMatch) {
if (dr.Read()) {
HttpCookie cookies;
cookies = new HttpCookie(\); cookies.Values.Add(\,
HttpUtility.UrlEncode(this.txtusername.Text.Trim())); cookies.Values.Add(\,
HttpUtility.UrlEncode(dr[\].ToString()));
cookies.Expires = DateTime.Now.AddHours(24);//1天有效24小时 Response.Cookies.Set(cookies);//存储!~ dr.Close(); dr.Dispose();
DB.DisposeConnection(cn);
Response.Redirect(\); } else {
dr.Close(); dr.Dispose();
DB.DisposeConnection(cn);
Common.ShowMessage(Page, \登陆失败,请检查用户名及密码是否正确!\, \); } } else {
dr.Close(); dr.Dispose();
DB.DisposeConnection(cn);
Common.ShowMessage(Page, \验证码错误\, \);
} 4.3.2 部门管理
在这个功能模块中,管理员可以对公司部门信息的添加、删除、修改、查看。如图4-2所示。
24
成都学院(成都大学)学士学位论文(设计)
图 4-2 部门管理窗体
功能实现:
1.档案管理窗体加载时,检索部门信息的所有信息,并将其绑定到DataGridView控件上,并且动态的将所有的部门名称添加到DataGridView空间中。
2.单击编辑的时候,可以对修改部门信息,这个功能是在DataGridView的RowEditing事件里写的,主要代码如下:
gvProduct.EditIndex = e.NewEditIndex;
this.PageBind(Convert.ToInt32(this.lblNowPage.Text));
3.单击删除的时候,就可以删除一条部门信息,这个是在DataGridView控件中RowCommand事件里写的,主要代码如下: if (e.CommandName == \) {
string id = e.CommandArgument.ToString();
string sql = \ + id + \; int i = int.Parse(DB.ExecuteSql(sql).ToString());
25
成都学院(成都大学)学士学位论文(设计)
if (i > 0) {
gvProduct.EditIndex = -1;
this.PageBind(Convert.ToInt32(this.lblNowPage.Text)); } else {
Common.ShowMessage(Page, \删除失败!程序出现异常!\, \); this.PageBind(Convert.ToInt32(this.lblNowPage.Text)); }
}
4.还可心对DataGridView控件进行全选、反选、多选删除操作。可以一下删除多条记录,主要代码如下: ///
///
protected void checkAll_CheckedChanged(object sender, EventArgs e) {
for (int i = 0; i <= gvProduct.Rows.Count - 1; i++) {
CheckBox checkbox = (CheckBox)gvProduct.Rows[i].FindControl(\); if (checkAll.Checked == true) {
checkbox.Checked = true; }
26
成都学院(成都大学)学士学位论文(设计)
else {
checkbox.Checked = false; } }
this.checkOther.Checked = false; }
///
///
protected void checkOther_CheckedChanged(object sender, EventArgs e) {
for (int i = 0; i <= gvProduct.Rows.Count - 1; i++) {
CheckBox checkbox = (CheckBox)gvProduct.Rows[i].FindControl(\); if (checkbox.Checked == false) {
checkbox.Checked = true; } else {
checkbox.Checked = false; } }
this.checkAll.Checked = false;
}
27
共分享92篇相关文档