protected void btnSave_Click(object sender, EventArgs e) { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member bll = new Cultural.BLL.Member(); try { member = bll.GetModel(int.Parse(id.Trim())); if (member != null) { member.Gender = ddlGender.SelectedItem.Text.Trim(); member.Phone = this.txtPhone.Text; member.Email = this.txtEmail.Text; member.Address = this.txtAddress.Text; member.JobName = this.txtJob.Text; member.Resume = this.txtResume.Text.Trim(); Cultural.BLL.Department dbll = new Cultural.BLL.Department(); Cultural.Model.Department depart = new Cultural.Model.Department(); List <Cultural.Model.Department> departList = dbll.GetModelList(string.Format(" DepartName = '{0}'", txtDepartID.Text.Trim())); depart = departList.Count > 0 ? departList[0] : null; int departID = 0; if (depart == null) { depart = new Cultural.Model.Department(); depart.DepartName = txtDepartID.Text.Trim(); dbll.Add(depart); departID = dbll.GetModelList(string.Format(" DepartName like '%{0}%'", txtDepartID.Text.Trim()))[0].DepartID; } else { departID = depart.DepartID; } member.DepartID = departID; member.Status = ddlType.SelectedValue; if (hidFilePath.Value != "") { member.PhotoURL = hidFilePath.Value; } bll.Update(member); Maticsoft.Common.MessageBox.Show(this.Page, "保存成功!"); BinInfo(int.Parse(id)); } } catch { Maticsoft.Common.MessageBox.Show(this.Page, "保存失败,请重试!"); } }
protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "MemDelete") { Cultural.Model.Member mem = new Cultural.Model.Member(); mem = bll.GetModel(int.Parse(e.CommandArgument.ToString())); if (Session[Common.Session_MemStatus].ToString() != "5" && mem.Status == "5") { CommonFun.Show(this.Page, "您无权删除超级管理员!"); } else { mem.Status = "7"; bll.Update(mem); BindData(); } } }
protected void btnConfirm_Click(object sender, EventArgs e) { if (Session[Common.Session_MemID] != null && Session[Common.Session_MemID].ToString() != "") { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member memBLL = new Cultural.BLL.Member(); member = memBLL.GetModel(Convert.ToInt32(Session[Common.Session_MemID])); if (member != null) { if (member.Password == txtOldPW.Text.Trim()) { if (txtNewPW.Text.Trim() == txtPWRe.Text.Trim()) { if (txtNewPW.Text.Trim().Length >= 3 && txtNewPW.Text.Trim().Length <= 20) { member.Password = txtNewPW.Text.Trim(); try { memBLL.Update(member); Maticsoft.Common.MessageBox.Show(this.Page, "修改成功!"); } catch { Maticsoft.Common.MessageBox.Show(this.Page, "网络出错!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "密码长度必须为3-20位!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "两次新密码不同!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "旧密码错误!请重试!"); } } } }