private void Update() { Power.UserModel model = new Power.UserModel(); model.ID = int.Parse(Request.QueryString["ID"].ToString()); model.AccountNO = txtAccountNO.Text; model.AcountName = txtAccountName.Text; model.BIRTHDAY = txtBirthday.Text.Equals("") ? DateTime.Parse("1900-01-01") : DateTime.Parse(txtBirthday.Text); model.BYNAME = txtByName.Text; model.DEPT_ID = int.Parse(this.deptName.SelectedValue); model.GroupID = int.Parse(ddlGroup.Value); model.MOBIL_NO = txtMobilNo.Text; model.MOBIL_NO_HIDDEN = ckbHidden.Checked; model.Remark = txtRemark.Text; model.Sex = ddlSex.Value.Equals("0"); model.TrueName = txtTrueName.Text; int iReturn = service.Update_Account(model); if (iReturn > 0) Response.Write("<script>alert('修改成功!');</script>"); else Response.Write("<script>alert('修改失败,请与管理员联系!');</script>"); }
private void Insert() { if(!txtNewAccount.Value.Equals(txtAccountName.Text)) { CheckExist(); } if (hidEnable.Value.Equals("1")) { Power.UserModel model = new Power.UserModel(); model.AccountNO = txtAccountNO.Text; model.AcountName = txtAccountName.Text; model.BIRTHDAY = txtBirthday.Text.Equals("") ? DateTime.Parse("1900-01-01") : DateTime.Parse(txtBirthday.Text); model.BYNAME = txtByName.Text; model.DEPT_ID =int.Parse(this.deptName.SelectedValue); model.GroupID = int.Parse(ddlGroup.Value); model.MOBIL_NO = txtMobilNo.Text; model.MOBIL_NO_HIDDEN = ckbHidden.Checked; model.Remark = txtRemark.Text; model.Sex = ddlSex.Value.Equals("0"); model.TrueName = txtTrueName.Text; model.Password = DESEncrypt.EncryptMD5(txtPassWord.Text); int iReturn = service.Insert_Account(model); if (iReturn > 0) { Response.Write("<script>alert('新建成功!');</script>"); Response.Write("<script>location=location.href;</script>"); } else Response.Write("<script>alert('新建失败,请与管理员联系!');</script>"); } }