///// <summary> ///// 用户查询 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //protected void SearchButton_Click(object sender, EventArgs e) //{ // string strName = ""; // int strUserType =0; // string strSubClass =""; // Response.Redirect(string.Format("SysUserSearch.aspx?UserName={0}&UserTypeID={1}&SubClassID={2}", strName, strUserType, strSubClass)); //} protected void Add_Submit_Click(object sender, EventArgs e) { string strName = UserName.Text.ToString(); string strPwd = PassWord.Text.ToString(); string strRname = RealName.Text.ToString(); int typeid = int.Parse(TypeID.SelectedValue.ToString()); string subClass = SubClassID.SelectedValue.ToString(); if (subClass.Equals("-1")) { Jscript.AjaxAlert(this, "请 选择用户类型"); return; } int groupid = int.Parse(GroupID1.Value.ToString()); string strDept = Dept.Text.ToString(); string strQQ = QQ.Text.ToString(); string strTaobao = WangWang.Text.ToString(); string strTel = Tel.Text.ToString(); string strEmail = Email.Text.ToString(); string strDesc = Description.Text.ToString(); string strState = State.SelectedValue.ToString(); string strSex = Sex.SelectedValue.ToString(); Leyp.Model.User u = new Leyp.Model.User(); u.UserName = strName; u.Password = StrHelper.EncryptPassword(strPwd, StrHelper.PasswordType.MD5);//MD5加密 u.Description = strDesc; u.Email = strEmail; u.GroupID = groupid; u.TypeID = typeid; u.QQ = strQQ; u.RealName = strRname; u.Sex = strSex; u.State = strState; u.WangWang = strTaobao; u.Tel = strTel; u.Dept = strDept; u.BankAccount = BankAccount.Text.ToString(); u.Bankname = Bankname.Text.ToString(); u.Character = Character.Text.ToString(); u.CompanyInfo = CompanyInfo.Text.ToString(); u.CompanyName = CompanyName.Text.ToString(); u.Address = Address.Text.ToString(); u.SubClassID = int.Parse(SubClassID.SelectedValue.ToString()); u.LatelyLogin = ""; if (Leyp.SQLServerDAL.Factory.getUserDAL().insertNewUser(u)) { Panel1.Visible = false; HyperLink1.Visible = true; } else { Panel1.Visible = false; HyperLink1.Text = "添加失败!可能用户名已经存在!请重新注册"; HyperLink1.Visible = true; } }
/// <summary> /// 提交修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Add_Submit_Click(object sender, EventArgs e) { string strName = UserName.Text.ToString(); string strRname = RealName.Text.ToString(); int typeid; int subClass; string strState; int groupid; if (AuthorityBox.Checked)//如果选中要修改权限 { typeid = int.Parse(TypeID.SelectedValue.ToString()); subClass = int.Parse(SubClassID.SelectedValue.ToString()); strState = State.SelectedValue.ToString(); groupid = int.Parse(GroupID1.Value.ToString()); } else { typeid = int.Parse(usertypeLabel1.Text.ToString()); subClass = int.Parse(subclassLabel2.Text.ToString()); groupid = int.Parse(groupLabel3.Text.ToString()); strState = StateLabel4.Text.ToString(); } if (subClass.Equals("-1")) { Jscript.AjaxAlert(this, "请选择用户类型"); return; } string strDept = Dept.Text.ToString(); string strQQ = QQ.Text.ToString(); string strTaobao = WangWang.Text.ToString(); string strTel = Tel.Text.ToString(); string strEmail = Email.Text.ToString(); string strDesc = Description.Text.ToString(); string strSex = Sex.SelectedValue.ToString(); Leyp.Model.User u = new Leyp.Model.User(); u.UserName = strName; u.Description = strDesc; u.Email = strEmail; u.GroupID = groupid; u.TypeID = typeid; u.SubClassID = subClass; u.QQ = strQQ; u.RealName = strRname; u.Sex = strSex; u.State = strState; u.WangWang = strTaobao; u.Tel = strTel; u.Dept = strDept; if (Leyp.SQLServerDAL.Factory.getUserDAL().updateUser(u)) { Panel1.Visible = false; Panel0.Visible = false; Panel2.Visible = false; HyperLink1.Visible = true; } else { Panel1.Visible = false; Panel0.Visible = false; Panel2.Visible = false; HyperLink1.Text = "操作失败!请重操作"; HyperLink1.Visible = true; } }