protected void btnAdd_Click(object sender, EventArgs e) { HEemployeeData model = new HEemployeeData(); HEemployeeBB eemployeeBB = new HEemployeeBB(); try { if (this.State == "1") { if (eemployeeBB.Exists(this.empNo.Text)) { this.lblMsg.Text = "Ա������Ѿ����ڣ�����������"; return; } this.SetModel(ref model); model.password = MD5Encrypt.GetMD5("123456"); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; model.isDel = false; this.IdValue = eemployeeBB.AddRecord(model); } else if (this.State == "2") { if (eemployeeBB.Exists(this.IdValue, this.empNo.Text)) { this.lblMsg.Text = "Ա������Ѿ����ڣ�����������"; return; } model = eemployeeBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; eemployeeBB.ModifyRecord(model); //ͬ��session��Ա��Ϣ if (this.currentUser.empNo == model.empNo) { Session["UserData"] = model; } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { eemployeeBB.Dispose(); } if (this.btnReturn.Enabled) { Response.Redirect("HEemployeeList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"���������ijɹ�!\");", true); } }