public static bool EditUsersInfo(ENTITY.CusUsers u1) { string sql = "update CusUsers set Customername=@Customername,customerpwd=@customerpwd,Realname=@Realname,CustomerSfz=@CustomerSfz,address=@address,telphone=@telphone,IsCusAdmin=@IsCusAdmin,CusType=@CusType where customerid=@customerid"; SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@customerid", SqlDbType.Int), new SqlParameter("@Customername", SqlDbType.VarChar), new SqlParameter("@customerpwd", SqlDbType.VarChar), new SqlParameter("@Realname", SqlDbType.VarChar), new SqlParameter("@CustomerSfz", SqlDbType.VarChar), new SqlParameter("@address", SqlDbType.NVarChar), new SqlParameter("@telphone", SqlDbType.VarChar), new SqlParameter("@IsCusAdmin", SqlDbType.Int), new SqlParameter("@CusType", SqlDbType.Int) }; parm[0].Value = u1.customerid; parm[1].Value = u1.Customername; parm[2].Value = u1.customerpwd; parm[3].Value = u1.Realname; parm[4].Value = u1.CustomerSfz; parm[5].Value = u1.address; parm[6].Value = u1.telphone; parm[7].Value = u1.IsCusAdmin; parm[8].Value = u1.CusType; return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static ENTITY.CusUsers getSomeUserInfo(int userid) { string sql = "select * from CusUsers where customerid=" + userid; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.CusUsers tempUser = new ENTITY.CusUsers(); while (DataRead.Read()) { tempUser.customerid = Convert.ToInt32(DataRead["customerid"]); tempUser.Customername = DataRead["Customername"].ToString(); tempUser.customerpwd = DataRead["customerpwd"].ToString(); tempUser.Realname = DataRead["Realname"].ToString(); tempUser.CustomerSfz = DataRead["CustomerSfz"].ToString(); tempUser.address = DataRead["address"].ToString(); tempUser.telphone = DataRead["telphone"].ToString(); tempUser.IsCusAdmin = Convert.ToInt32(DataRead["IsCusAdmin"]); tempUser.CusType = Convert.ToInt32(DataRead["CusType"]); } return(tempUser); }
public static bool AddUsersInfo(ENTITY.CusUsers u1) { string sql = "insert into CusUsers(Customername,customerpwd ,Realname,CustomerSfz,address,telphone,IsCusAdmin,CusType) values(@Customername,@customerpwd,@Realname,@CustomerSfz,@address,@telphone,@IsCusAdmin,@CusType)"; SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@Customername", SqlDbType.VarChar), new SqlParameter("@customerpwd", SqlDbType.VarChar), new SqlParameter("@Realname", SqlDbType.VarChar), new SqlParameter("@CustomerSfz", SqlDbType.VarChar), new SqlParameter("@address", SqlDbType.NVarChar), new SqlParameter("@telphone", SqlDbType.VarChar), new SqlParameter("@IsCusAdmin", SqlDbType.Int), new SqlParameter("@CusType", SqlDbType.Int) }; parm[0].Value = u1.Customername; parm[1].Value = u1.customerpwd; parm[2].Value = u1.Realname; parm[3].Value = u1.CustomerSfz; parm[4].Value = u1.address; parm[5].Value = u1.telphone; parm[6].Value = u1.IsCusAdmin; parm[7].Value = u1.CusType; return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }