private void button1_Click(object sender, EventArgs e) { string yhdm = this.textBox1.Text; if (yhdm != "") { LYC.BLL.User user = new LYC.BLL.User(); LYC.Model.UserInfo userinfo = new LYC.Model.UserInfo(); userinfo = user.getUser(yhdm); } }
public IList<UserInfo> GetUsers() { IList<UserInfo> users = new List<UserInfo>(); using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.ConnHIS, SQL3)) { while (rdr.Read()) { UserInfo user = new UserInfo(Convert.ToInt16(rdr["XTSB"]), rdr["YHDM"].ToString(), rdr["YHZM"].ToString(), rdr["YHMC"].ToString(), rdr["YHKL"].ToString()); users.Add(user); } return users; } }
private SqlParameter[] GetParms(UserInfo user) { SqlParameter[] parms = new SqlParameter[]{ new SqlParameter(PARM_XTSB,SqlDbType.SmallInt), new SqlParameter(PARM_YHDM,SqlDbType.VarChar,4), new SqlParameter(PARM_YHZM,SqlDbType.VarChar,20), new SqlParameter(PARM_YHMC,SqlDbType.VarChar,10), new SqlParameter(PARM_YHKL,SqlDbType.VarChar,10) }; parms[0].Value = user.Xtsb; parms[1].Value = user.Yhdm; parms[2].Value = user.Yhzm; parms[3].Value = user.Yhmc; parms[4].Value = user.Yhkl; return parms; }
public UserInfo GetUser(string yhdm) { UserInfo user = new UserInfo(); SqlParameter parm = new SqlParameter(); parm.ParameterName = PARM_YHDM; parm.Value = yhdm; parm.SqlDbType = SqlDbType.VarChar; parm.Size = 4; using (SqlDataReader rdr = SQLHelper.ExecuteReaderWithParm(SQLHelper.ConnHIS,SQL1,parm)) { if (rdr.Read()) { user = new UserInfo(Convert.ToInt16(rdr["XTSB"]), rdr["YHDM"].ToString(), rdr["YHZM"].ToString(), rdr["YHMC"].ToString(), rdr["YHKL"].ToString()); } } return user; }
public int AddUser(UserInfo user) { SqlParameter[] parms = GetParms(user); int val = SQLHelper.ExecuteNonQueryWithParms(SQLHelper.ConnHIS, SQL4, parms); return val; }