protected void btnSave_Click(object sender, EventArgs e) { Cultural.BLL.Member bll = new Cultural.BLL.Member(); string strErr = ""; if (this.txtStaffName.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (this.txtLoginID.Text.Trim().Length == 0) { strErr += "注册名不能为空!\\n"; } if (this.txtPassword.Text.Trim().Length == 0) { strErr += "密码不能为空!\\n"; } if (this.txtPassConfirm.Text.Trim().Length == 0) { strErr += "必须确认密码!\\n"; } if (this.txtPassConfirm.Text.Trim() != this.txtPassword.Text.Trim()) { strErr += "两次密码不同!\\n"; } if (bll.GetList(string.Format(" LoginID = '{0}' ", txtLoginID.Text.Trim())).Tables[0].Rows.Count > 0) { strErr += "登录名已被使用!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string LoginID = this.txtLoginID.Text; string Password = this.txtPassword.Text; string StaffName = this.txtStaffName.Text; string Gender = ddlGender.SelectedItem.Text.Trim(); string Phone = this.txtPhone.Text; string Email = this.txtEmail.Text; string Address = this.txtAddress.Text; string Job = this.txtJob.Text; string 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.GetMaxId() - 1; } else { departID = depart.DepartID; } Cultural.Model.Member member = new Cultural.Model.Member(); member.LoginID = LoginID; member.Password = Password; member.MembName = StaffName; member.Gender = Gender; member.Phone = Phone; member.Email = Email; member.Address = Address; member.JobName = Job; member.DepartID = departID; member.RegTime = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0')); member.Status = "6"; member.PhotoURL = ""; member.Resume = resume; bll.Add(member); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "注册成功,请等待管理员审核!", "../login.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtStaffName.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string LoginID = this.txtLoginID.Text; string Password = this.txtPassword.Text; string StaffName = this.txtStaffName.Text; string Gender = ddlGender.SelectedItem.Text.Trim(); string Phone = this.txtPhone.Text; string Email = this.txtEmail.Text; string Address = this.txtAddress.Text; string Job = this.txtJob.Text; string 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.GetMaxId() - 1; } else { departID = depart.DepartID; } string Roles = ddlType.SelectedItem.Value.Trim(); Cultural.Model.Member member = new Cultural.Model.Member(); member.LoginID = LoginID; member.Password = Password; member.MembName = StaffName; member.Gender = Gender; member.Phone = Phone; member.Email = Email; member.Address = Address; member.JobName = Job; member.DepartID = departID; member.RegTime = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0')); member.Status = Roles; member.PhotoURL = string.Format("{0}-{1}.jpg", member.RegTime, member.MembName); member.Resume = resume; Cultural.BLL.Member bll = new Cultural.BLL.Member(); bll.Add(member); int id = bll.GetMaxId() - 1; if (id != null) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "ShowSingle.aspx?id=" + id.ToString()); } }