private void ShowInfo(int userId) { hm.Model.users model = bll.GetModel(userId); this.lbluserId.Text = model.userId.ToString(); this.txtuserName.Text = model.userName; this.txtTrueName.Text = model.trueName; rblSex.SelectedValue = model.sex.ToString(); this.txttel.Text = model.tel; this.txtemail.Text = model.email; this.txtqq.Text = model.qq; }
public void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bll = new hm.BLL.users(); string strErr = ""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (this.txtTrueName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int userId = int.Parse(this.lbluserId.Text); string userName = this.txtuserName.Text; string trueName = this.txtTrueName.Text; int deptId = int.Parse(this.ddrDept.SelectedValue); string deptName = this.ddrDept.Items[ddrDept.SelectedIndex].Text; int roleId = int.Parse(this.ddrRole.SelectedValue); string roleName = this.ddrRole.Items[ddrRole.SelectedIndex].Text; int sex = int.Parse(this.rblSex.SelectedValue); string tel = this.txttel.Text; string email = this.txtemail.Text; string qq = this.txtqq.Text; DateTime addTime = DateTime.Now; DateTime lastLoginTime = DateTime.Now; int status = int.Parse(this.ddrStatus.SelectedValue); hm.Model.users model = bll.GetModel(userId); model.userName = userName; model.trueName = trueName; model.roleId = roleId; model.roleName = roleName; model.sex = sex; model.tel = tel; model.email = email; model.qq = qq; model.addTime = addTime; model.lastLoginTime = lastLoginTime; model.status = status; bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int userId = (Convert.ToInt32(Request.Params["id"])); hm.Model.users model = bll.GetModel(userId); ShowInfo(userId); } } }
private void ShowInfo(int userId) { hm.BLL.users bll = new hm.BLL.users(); hm.Model.users model = bll.GetModel(userId); this.lbluserId.Text = model.userId.ToString(); this.txtuserName.Text = model.userName; this.txtTrueName.Text = model.trueName; ddrRole.SelectedValue = model.roleId.ToString(); rblSex.SelectedValue = model.sex.ToString(); this.txttel.Text = model.tel; this.txtemail.Text = model.email; this.txtqq.Text = model.qq; ddrStatus.SelectedValue = model.status.ToString(); }
private void ShowInfo(int userId) { hm.BLL.users bll = new hm.BLL.users(); hm.Model.users model = bll.GetModel(userId); this.lbluserId.Text = model.userId.ToString(); this.lbluserName.Text = model.userName; this.lblpassword.Text = "******"; if (string.IsNullOrEmpty(model.roleName)) { this.lblroleName.Text = "用户"; } else { this.lblroleName.Text = model.roleName; } string sex = "男"; if ("0".Equals(model.sex.ToString())) { sex = "女"; } lbldeptName.Text = model.deptName; this.lblsex.Text = sex; this.lbltel.Text = model.tel; this.lblemail.Text = model.email; this.lblqq.Text = model.qq; this.lbladdTime.Text = model.addTime.ToString(); this.lbllastLoginTime.Text = model.lastLoginTime.ToString(); //this.lblstatus.Text = ClassHelper.GetSystemItemName(model.status.ToString());//(这个是读码表的,现在不存在码表) if (model.status.ToString() == "1") { this.lblstatus.Text = "正常"; } else { this.lblstatus.Text = "冻结"; } lblTrueName.Text = model.trueName; }
protected void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bll = new hm.BLL.users(); string strErr = ""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (this.txtTrueName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (this.txtpassword.Text.Trim().Length == 0) { strErr += "密码不能为空!\\n"; } if (this.ddrPlace.SelectedValue == "0") { strErr += "请选择所属区域!\\n"; } if (this.ddrRole.SelectedValue == "0") { strErr += "请选择角色!\\n"; } if (bll.GetList("userName='******'").Tables[0].Rows.Count > 0) { strErr += "用户名重复!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string userName = this.txtuserName.Text; string password = this.txtpassword.Text; string trueName = this.txtTrueName.Text; int placeId = int.Parse(this.ddrPlace.SelectedValue); string placeName = this.ddrPlace.Items[ddrPlace.SelectedIndex].Text.Replace("┣", "").Replace("╍", "").Replace("?", ""); int roleId = int.Parse(this.ddrRole.SelectedValue); string roleName = this.ddrRole.Items[ddrRole.SelectedIndex].Text; int sex = int.Parse(this.rblSex.SelectedValue); string tel = this.txttel.Text; string email = this.txtemail.Text; string qq = this.txtqq.Text; DateTime addTime = DateTime.Now; DateTime lastLoginTime = DateTime.Now; int status = int.Parse(this.ddrStatus.SelectedValue); hm.Model.users model = new hm.Model.users(); model.userName = userName; model.password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(password, ConfigHelper.GetConfigString("PassWordEncrypt")); model.trueName = trueName; model.deptId = placeId; model.deptName = placeName; model.roleId = roleId; model.roleName = roleName; model.sex = sex; model.tel = tel; model.email = email; model.qq = qq; model.addTime = addTime; model.lastLoginTime = lastLoginTime; model.status = status; //model.address = txtAddress.Text; if (this.ddrRole.Items[ddrRole.SelectedIndex].Text.Equals("管理员")) { model.isAdmin = 1; } model.score = 0; bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bll = new hm.BLL.users(); string strErr=""; if(this.txtuserName.Text.Trim().Length==0) { strErr+="用户名不能为空!\\n"; } if (this.txtTrueName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if(this.txtpassword.Text.Trim().Length==0) { strErr+="密码不能为空!\\n"; } if (this.ddrPlace.SelectedValue == "0") { strErr += "请选择所属区域!\\n"; } if (this.ddrRole.SelectedValue == "0") { strErr += "请选择角色!\\n"; } if (bll.GetList("userName='******'").Tables[0].Rows.Count > 0) { strErr += "用户名重复!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } string userName=this.txtuserName.Text; string password=this.txtpassword.Text; string trueName = this.txtTrueName.Text; int placeId = int.Parse(this.ddrPlace.SelectedValue); string placeName = this.ddrPlace.Items[ddrPlace.SelectedIndex].Text.Replace("┣", "").Replace("╍", "").Replace("?", ""); int roleId = int.Parse(this.ddrRole.SelectedValue); string roleName = this.ddrRole.Items[ddrRole.SelectedIndex].Text; int sex=int.Parse(this.rblSex.SelectedValue); string tel = this.txttel.Text; string email=this.txtemail.Text; string qq=this.txtqq.Text; DateTime addTime = DateTime.Now; DateTime lastLoginTime = DateTime.Now; int status = StatusHelpercs.User_Status_Normal; hm.Model.users model=new hm.Model.users(); model.userName=userName; model.password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(password, ConfigHelper.GetConfigString("PassWordEncrypt")); model.trueName = trueName; model.deptId = placeId; model.deptName = placeName; model.roleId=roleId; model.roleName=roleName; model.sex=sex; model.tel=tel; model.email=email; model.qq=qq; model.addTime=addTime; model.lastLoginTime=lastLoginTime; model.status=status; //model.address = txtAddress.Text; if (this.ddrRole.Items[ddrRole.SelectedIndex].Text.Equals("管理员")) { model.isAdmin = 1; } model.score = 0; bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public hm.Model.users GetModel(int userId) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 userId,userName,password,trueName,nickName,addressCode,address,avatar_small,avatar_big,deptId,deptName,roleId,roleName,sex,tel,email,qq,score,scoreFrozen,account,accountFrozen,regType,regFrom,addTime,lastLoginTime,loginCount,isAdmin,wxOpenId,status from users "); strSql.Append(" where userId=@userId"); SqlParameter[] parameters = { new SqlParameter("@userId", SqlDbType.Int,4) }; parameters[0].Value = userId; hm.Model.users model=new hm.Model.users(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { if(ds.Tables[0].Rows[0]["userId"]!=null && ds.Tables[0].Rows[0]["userId"].ToString()!="") { model.userId=int.Parse(ds.Tables[0].Rows[0]["userId"].ToString()); } if(ds.Tables[0].Rows[0]["userName"]!=null && ds.Tables[0].Rows[0]["userName"].ToString()!="") { model.userName=ds.Tables[0].Rows[0]["userName"].ToString(); } if(ds.Tables[0].Rows[0]["password"]!=null && ds.Tables[0].Rows[0]["password"].ToString()!="") { model.password=ds.Tables[0].Rows[0]["password"].ToString(); } if(ds.Tables[0].Rows[0]["trueName"]!=null && ds.Tables[0].Rows[0]["trueName"].ToString()!="") { model.trueName=ds.Tables[0].Rows[0]["trueName"].ToString(); } if(ds.Tables[0].Rows[0]["nickName"]!=null && ds.Tables[0].Rows[0]["nickName"].ToString()!="") { model.nickName=ds.Tables[0].Rows[0]["nickName"].ToString(); } if(ds.Tables[0].Rows[0]["addressCode"]!=null && ds.Tables[0].Rows[0]["addressCode"].ToString()!="") { model.addressCode=ds.Tables[0].Rows[0]["addressCode"].ToString(); } if(ds.Tables[0].Rows[0]["address"]!=null && ds.Tables[0].Rows[0]["address"].ToString()!="") { model.address=ds.Tables[0].Rows[0]["address"].ToString(); } if(ds.Tables[0].Rows[0]["avatar_small"]!=null && ds.Tables[0].Rows[0]["avatar_small"].ToString()!="") { model.avatar_small=ds.Tables[0].Rows[0]["avatar_small"].ToString(); } if(ds.Tables[0].Rows[0]["avatar_big"]!=null && ds.Tables[0].Rows[0]["avatar_big"].ToString()!="") { model.avatar_big=ds.Tables[0].Rows[0]["avatar_big"].ToString(); } if(ds.Tables[0].Rows[0]["deptId"]!=null && ds.Tables[0].Rows[0]["deptId"].ToString()!="") { model.deptId=int.Parse(ds.Tables[0].Rows[0]["deptId"].ToString()); } if(ds.Tables[0].Rows[0]["deptName"]!=null && ds.Tables[0].Rows[0]["deptName"].ToString()!="") { model.deptName=ds.Tables[0].Rows[0]["deptName"].ToString(); } if(ds.Tables[0].Rows[0]["roleId"]!=null && ds.Tables[0].Rows[0]["roleId"].ToString()!="") { model.roleId=int.Parse(ds.Tables[0].Rows[0]["roleId"].ToString()); } if(ds.Tables[0].Rows[0]["roleName"]!=null && ds.Tables[0].Rows[0]["roleName"].ToString()!="") { model.roleName=ds.Tables[0].Rows[0]["roleName"].ToString(); } if(ds.Tables[0].Rows[0]["sex"]!=null && ds.Tables[0].Rows[0]["sex"].ToString()!="") { model.sex=int.Parse(ds.Tables[0].Rows[0]["sex"].ToString()); } if(ds.Tables[0].Rows[0]["tel"]!=null && ds.Tables[0].Rows[0]["tel"].ToString()!="") { model.tel=ds.Tables[0].Rows[0]["tel"].ToString(); } if(ds.Tables[0].Rows[0]["email"]!=null && ds.Tables[0].Rows[0]["email"].ToString()!="") { model.email=ds.Tables[0].Rows[0]["email"].ToString(); } if(ds.Tables[0].Rows[0]["qq"]!=null && ds.Tables[0].Rows[0]["qq"].ToString()!="") { model.qq=ds.Tables[0].Rows[0]["qq"].ToString(); } if(ds.Tables[0].Rows[0]["score"]!=null && ds.Tables[0].Rows[0]["score"].ToString()!="") { model.score=int.Parse(ds.Tables[0].Rows[0]["score"].ToString()); } if(ds.Tables[0].Rows[0]["scoreFrozen"]!=null && ds.Tables[0].Rows[0]["scoreFrozen"].ToString()!="") { model.scoreFrozen=int.Parse(ds.Tables[0].Rows[0]["scoreFrozen"].ToString()); } if(ds.Tables[0].Rows[0]["account"]!=null && ds.Tables[0].Rows[0]["account"].ToString()!="") { model.account=decimal.Parse(ds.Tables[0].Rows[0]["account"].ToString()); } if(ds.Tables[0].Rows[0]["accountFrozen"]!=null && ds.Tables[0].Rows[0]["accountFrozen"].ToString()!="") { model.accountFrozen=decimal.Parse(ds.Tables[0].Rows[0]["accountFrozen"].ToString()); } if(ds.Tables[0].Rows[0]["regType"]!=null && ds.Tables[0].Rows[0]["regType"].ToString()!="") { model.regType=ds.Tables[0].Rows[0]["regType"].ToString(); } if(ds.Tables[0].Rows[0]["regFrom"]!=null && ds.Tables[0].Rows[0]["regFrom"].ToString()!="") { model.regFrom=ds.Tables[0].Rows[0]["regFrom"].ToString(); } if(ds.Tables[0].Rows[0]["addTime"]!=null && ds.Tables[0].Rows[0]["addTime"].ToString()!="") { model.addTime=DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString()); } if(ds.Tables[0].Rows[0]["lastLoginTime"]!=null && ds.Tables[0].Rows[0]["lastLoginTime"].ToString()!="") { model.lastLoginTime=DateTime.Parse(ds.Tables[0].Rows[0]["lastLoginTime"].ToString()); } if(ds.Tables[0].Rows[0]["loginCount"]!=null && ds.Tables[0].Rows[0]["loginCount"].ToString()!="") { model.loginCount=int.Parse(ds.Tables[0].Rows[0]["loginCount"].ToString()); } if(ds.Tables[0].Rows[0]["isAdmin"]!=null && ds.Tables[0].Rows[0]["isAdmin"].ToString()!="") { model.isAdmin=int.Parse(ds.Tables[0].Rows[0]["isAdmin"].ToString()); } if(ds.Tables[0].Rows[0]["wxOpenId"]!=null && ds.Tables[0].Rows[0]["wxOpenId"].ToString()!="") { model.wxOpenId=ds.Tables[0].Rows[0]["wxOpenId"].ToString(); } if(ds.Tables[0].Rows[0]["status"]!=null && ds.Tables[0].Rows[0]["status"].ToString()!="") { model.status=int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } return model; } else { return null; } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(hm.Model.users model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into users("); strSql.Append("userName,[password],trueName,nickName,address,deptId,deptName,roleId,roleName,sex,tel,email,qq,score,studyType,addTime,lastLoginTime,isAdmin,status)"); strSql.Append(" values ("); strSql.Append("@userName,@password,@trueName,@nickName,@address,@deptId,@deptName,@roleId,@roleName,@sex,@tel,@email,@qq,@score,@studyType,@addTime,@lastLoginTime,@isAdmin,@status)"); OleDbParameter[] parameters = { new OleDbParameter("@userName", OleDbType.VarChar, 100), new OleDbParameter("@password", OleDbType.VarChar, 100), new OleDbParameter("@trueName", OleDbType.VarChar, 100), new OleDbParameter("@nickName", OleDbType.VarChar, 100), new OleDbParameter("@address", OleDbType.VarChar, 100), new OleDbParameter("@deptId", OleDbType.Integer, 4), new OleDbParameter("@deptName", OleDbType.VarChar, 100), new OleDbParameter("@roleId", OleDbType.Integer, 4), new OleDbParameter("@roleName", OleDbType.VarChar, 100), new OleDbParameter("@sex", OleDbType.Integer, 4), new OleDbParameter("@tel", OleDbType.VarChar, 100), new OleDbParameter("@email", OleDbType.VarChar, 100), new OleDbParameter("@qq", OleDbType.VarChar, 100), new OleDbParameter("@score", OleDbType.Integer, 4), new OleDbParameter("@studyType", OleDbType.Integer, 4), new OleDbParameter("@addTime", OleDbType.Date), new OleDbParameter("@lastLoginTime", OleDbType.Date), new OleDbParameter("@isAdmin", OleDbType.Integer, 4), new OleDbParameter("@status", OleDbType.Integer, 4) }; parameters[0].Value = model.userName; parameters[1].Value = model.password; parameters[2].Value = model.trueName; parameters[3].Value = model.nickName; parameters[4].Value = model.address; parameters[5].Value = model.deptId; parameters[6].Value = model.deptName; parameters[7].Value = model.roleId; parameters[8].Value = model.roleName; parameters[9].Value = model.sex; parameters[10].Value = model.tel; parameters[11].Value = model.email; parameters[12].Value = model.qq; parameters[13].Value = model.score; parameters[14].Value = model.studyType; parameters[15].Value = model.addTime; parameters[16].Value = model.lastLoginTime; parameters[17].Value = model.isAdmin; parameters[18].Value = model.status; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public hm.Model.users GetModel(int userId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select userId,userName,password,trueName,nickName,address,deptId,deptName,roleId,roleName,sex,tel,email,qq,score,studyType,addTime,lastLoginTime,isAdmin,status from users "); strSql.Append(" where userId=@userId"); OleDbParameter[] parameters = { new OleDbParameter("@userId", OleDbType.Integer, 4) }; parameters[0].Value = userId; hm.Model.users model = new hm.Model.users(); DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["userId"] != null && ds.Tables[0].Rows[0]["userId"].ToString() != "") { model.userId = int.Parse(ds.Tables[0].Rows[0]["userId"].ToString()); } if (ds.Tables[0].Rows[0]["userName"] != null && ds.Tables[0].Rows[0]["userName"].ToString() != "") { model.userName = ds.Tables[0].Rows[0]["userName"].ToString(); } if (ds.Tables[0].Rows[0]["password"] != null && ds.Tables[0].Rows[0]["password"].ToString() != "") { model.password = ds.Tables[0].Rows[0]["password"].ToString(); } if (ds.Tables[0].Rows[0]["trueName"] != null && ds.Tables[0].Rows[0]["trueName"].ToString() != "") { model.trueName = ds.Tables[0].Rows[0]["trueName"].ToString(); } if (ds.Tables[0].Rows[0]["nickName"] != null && ds.Tables[0].Rows[0]["nickName"].ToString() != "") { model.nickName = ds.Tables[0].Rows[0]["nickName"].ToString(); } if (ds.Tables[0].Rows[0]["address"] != null && ds.Tables[0].Rows[0]["address"].ToString() != "") { model.address = ds.Tables[0].Rows[0]["address"].ToString(); } if (ds.Tables[0].Rows[0]["deptId"] != null && ds.Tables[0].Rows[0]["deptId"].ToString() != "") { model.deptId = int.Parse(ds.Tables[0].Rows[0]["deptId"].ToString()); } if (ds.Tables[0].Rows[0]["deptName"] != null && ds.Tables[0].Rows[0]["deptName"].ToString() != "") { model.deptName = ds.Tables[0].Rows[0]["deptName"].ToString(); } if (ds.Tables[0].Rows[0]["roleId"] != null && ds.Tables[0].Rows[0]["roleId"].ToString() != "") { model.roleId = int.Parse(ds.Tables[0].Rows[0]["roleId"].ToString()); } if (ds.Tables[0].Rows[0]["roleName"] != null && ds.Tables[0].Rows[0]["roleName"].ToString() != "") { model.roleName = ds.Tables[0].Rows[0]["roleName"].ToString(); } if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "") { model.sex = int.Parse(ds.Tables[0].Rows[0]["sex"].ToString()); } if (ds.Tables[0].Rows[0]["tel"] != null && ds.Tables[0].Rows[0]["tel"].ToString() != "") { model.tel = ds.Tables[0].Rows[0]["tel"].ToString(); } if (ds.Tables[0].Rows[0]["email"] != null && ds.Tables[0].Rows[0]["email"].ToString() != "") { model.email = ds.Tables[0].Rows[0]["email"].ToString(); } if (ds.Tables[0].Rows[0]["qq"] != null && ds.Tables[0].Rows[0]["qq"].ToString() != "") { model.qq = ds.Tables[0].Rows[0]["qq"].ToString(); } if (ds.Tables[0].Rows[0]["score"] != null && ds.Tables[0].Rows[0]["score"].ToString() != "") { model.score = int.Parse(ds.Tables[0].Rows[0]["score"].ToString()); } if (ds.Tables[0].Rows[0]["studyType"] != null && ds.Tables[0].Rows[0]["studyType"].ToString() != "") { model.studyType = int.Parse(ds.Tables[0].Rows[0]["studyType"].ToString()); } if (ds.Tables[0].Rows[0]["addTime"] != null && ds.Tables[0].Rows[0]["addTime"].ToString() != "") { model.addTime = DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString()); } if (ds.Tables[0].Rows[0]["lastLoginTime"] != null && ds.Tables[0].Rows[0]["lastLoginTime"].ToString() != "") { model.lastLoginTime = DateTime.Parse(ds.Tables[0].Rows[0]["lastLoginTime"].ToString()); } if (ds.Tables[0].Rows[0]["isAdmin"] != null && ds.Tables[0].Rows[0]["isAdmin"].ToString() != "") { model.isAdmin = int.Parse(ds.Tables[0].Rows[0]["isAdmin"].ToString()); } if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(hm.Model.users model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update users set "); strSql.Append("userName=@userName,"); strSql.Append("[password]=@password,"); strSql.Append("trueName=@trueName,"); strSql.Append("nickName=@nickName,"); strSql.Append("address=@address,"); strSql.Append("deptId=@deptId,"); strSql.Append("deptName=@deptName,"); strSql.Append("roleId=@roleId,"); strSql.Append("roleName=@roleName,"); strSql.Append("sex=@sex,"); strSql.Append("tel=@tel,"); strSql.Append("email=@email,"); strSql.Append("qq=@qq,"); strSql.Append("score=@score,"); strSql.Append("studyType=@studyType,"); strSql.Append("addTime=@addTime,"); strSql.Append("lastLoginTime=@lastLoginTime,"); strSql.Append("isAdmin=@isAdmin,"); strSql.Append("status=@status"); strSql.Append(" where userId=@userId"); OleDbParameter[] parameters = { new OleDbParameter("@userName", OleDbType.VarChar, 100), new OleDbParameter("@password", OleDbType.VarChar, 100), new OleDbParameter("@trueName", OleDbType.VarChar, 100), new OleDbParameter("@nickName", OleDbType.VarChar, 100), new OleDbParameter("@address", OleDbType.VarChar, 100), new OleDbParameter("@deptId", OleDbType.Integer, 4), new OleDbParameter("@deptName", OleDbType.VarChar, 100), new OleDbParameter("@roleId", OleDbType.Integer, 4), new OleDbParameter("@roleName", OleDbType.VarChar, 100), new OleDbParameter("@sex", OleDbType.Integer, 4), new OleDbParameter("@tel", OleDbType.VarChar, 100), new OleDbParameter("@email", OleDbType.VarChar, 100), new OleDbParameter("@qq", OleDbType.VarChar, 100), new OleDbParameter("@score", OleDbType.Integer, 4), new OleDbParameter("@studyType", OleDbType.Integer, 4), new OleDbParameter("@addTime", OleDbType.Date), new OleDbParameter("@lastLoginTime", OleDbType.Date), new OleDbParameter("@isAdmin", OleDbType.Integer, 4), new OleDbParameter("@status", OleDbType.Integer, 4), new OleDbParameter("@userId", OleDbType.Integer, 4) }; parameters[0].Value = model.userName; parameters[1].Value = model.password; parameters[2].Value = model.trueName; if (string.IsNullOrEmpty(model.nickName)) { model.nickName = " "; } parameters[3].Value = model.nickName; if (string.IsNullOrEmpty(model.address)) { model.address = " "; } parameters[4].Value = model.address; parameters[5].Value = model.deptId; parameters[6].Value = model.deptName; parameters[7].Value = model.roleId; parameters[8].Value = model.roleName; parameters[9].Value = model.sex; parameters[10].Value = model.tel; parameters[11].Value = model.email; parameters[12].Value = model.qq; parameters[13].Value = model.score; parameters[14].Value = model.studyType; parameters[15].Value = model.addTime; parameters[16].Value = model.lastLoginTime; parameters[17].Value = model.isAdmin; parameters[18].Value = model.status; parameters[19].Value = model.userId; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }