//未预选界面的“预选”功能 public void Chooseing(string teaid, string xxid) { DataTable member = SQLDBhelper.ExecuteDataTable(string.Format("select captainname,captainid,memberonename,memberoneid,membertwoname,membertwoid,memberthreename,memberthreeid from team where teamnumber='{0}'", xxid)); SqlDataReader readteaname = SQLDBhelper.ExecuteReader(string.Format("select name from teapasswordtable where account='{0}'", teaid)); readteaname.Read(); SqlDataReader t = SQLDBhelper.ExecuteReader(string.Format(" select * from will where stuid='{0}'and (firstwill='{1}' or secondwill='{2}' or thirdwill='{3}')", xxid, teaid, teaid, teaid)); if (t.Read()) { DataTable will1 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where stuid='{0}'and firstwill='{1}'", xxid, teaid)); DataTable will2 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where stuid='{0}'and secondwill='{1}'", xxid, teaid)); DataTable will3 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where stuid='{0}'and thirdwill='{1}'", xxid, teaid)); if (will1.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess1 = '1' where stuid='{0}'and firstwill='{1}'", xxid, teaid)); //插入到ischoose表 SQLDBhelper.ExecuteNonQuery(string.Format("insert into ischoose(stuid,stuname,teaid,teaname) values('{0}','{1}','{2}','{3}')", member.Rows[0]["captainid"].ToString(), member.Rows[0]["captainname"].ToString(), teaid, readteaname[0].ToString())); } else if (will2.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess2 = '1' where stuid='{0}'and secondwill='{1}'", xxid, teaid)); SQLDBhelper.ExecuteNonQuery(string.Format("insert into ischoose(stuid,stuname,teaid,teaname) values('{0}','{1}','{2}','{3}')", member.Rows[0]["captainid"].ToString(), member.Rows[0]["captainname"].ToString(), teaid, readteaname[0].ToString())); } else if (will3.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess3 = '1' where stuid='{0}'and thirdwill='{1}'", xxid, teaid)); SQLDBhelper.ExecuteNonQuery(string.Format("insert into ischoose(stuid,stuname,teaid,teaname) values('{0}','{1}','{2}','{3}')", member.Rows[0]["captainid"].ToString(), member.Rows[0]["captainname"].ToString(), teaid, readteaname[0].ToString())); } } }
//修改密码 public bool Update(Model.User model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update teapasswordtable set "); strSql.Append("password=@Password"); strSql.Append(" where account=@UserName "); SqlParameter[] parameters = { new SqlParameter("@Password", SqlDbType.VarChar, 30), new SqlParameter("@UserName", SqlDbType.VarChar, 11) }; parameters[0].Value = model.Password; parameters[1].Value = model.UserName; int rows = SQLDBhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters); if (rows == 1) { return(true); } else { return(false); } }
//预选界面的"退选功能" public void WithdrawalTeam(string id, string teaid) { //先删除ischoose表数据 SQLDBhelper.ExecuteNonQuery(string.Format("delete from ischoose where stuid='{0}' and teaid='{1}'", id, teaid)); //再更新will表中的isaccess DataTable will1 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where isaccess1='1' and stuid='{0}'and firstwill='{1}'", id, teaid)); DataTable will2 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where isaccess2='1' and stuid='{0}'and secondwill='{1}'", id, teaid)); DataTable will3 = SQLDBhelper.ExecuteDataTable(string.Format("select * from will where isaccess3='1' and stuid='{0}'and thirdwill='{1}'", id, teaid)); if (will1.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess1='0' where stuid='{0}' and firstwill='{1}'", id, teaid)); } else if (will2.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess2='0' where stuid='{0}' and secondwill='{1}'", id, teaid)); } else if (will3.Rows.Count != 0) { SQLDBhelper.ExecuteNonQuery(string.Format("update will set isaccess3='0' where stuid='{0}' and thirdwill='{1}'", id, teaid)); } }
public void update(string Name, string Sex, string academy, string Major, string Grade, string Class, string Phone, string Email, string introduce, string ID) { SQLDBhelper.ExecuteNonQuery(string.Format("update stupasswordtable set name='{0}', sex='{1}', academy='{2}', major='{3}', grade='{4}', class='{5}', phone='{6}' , email='{7}' , introduce='{8}' where id='{9}'", Name, Sex, academy, Major, Grade, Class, Phone, Email, introduce, ID)); }
public void add(string Account, string Password, string Name, string Sex, string ID, string Grade, string Major, string Class, string Phone, string Email, string introduce, string academy, string groupID) { SQLDBhelper.ExecuteNonQuery(string.Format("insert into stupasswordtable values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", Account, Password, Name, Sex, ID, Grade, Major, Class, Phone, Email, introduce, academy, groupID)); }
//public DataTable select(string com1, string com2) //{ // DataTable table = SQLDBhelper.ExecuteQuery("select * from stupasswordtable where grade='" + com1 + "' and major='" + com2 + "' "); // return table; //} public void delect(string xxid) { SQLDBhelper.ExecuteNonQuery(string.Format("delete from stupasswordtable where id='{0}'", xxid)); }
public void update(string Name, string Sex, string Grade, string academy, string position, string research, string Phone, string Email, int number, int groupnumber, string Major, string ID) { SQLDBhelper.ExecuteNonQuery(string.Format("update teapasswordtable set name='{0}', sex='{1}', grade='{2}',academy='{3}', position='{4}', research='{5}', phone='{6}' , email='{7}' , number='{8}' , groupnumber='{9}', major='{10}' where id='{11}'", Name, Sex, Grade, academy, position, research, Phone, Email, number, groupnumber, Major, ID)); }
public void add(string Account, string Password, string Name, string Sex, string ID, string position, int number, int groupnumber, string Phone, string Email, string academy, string research, string Grade, string Major) { SQLDBhelper.ExecuteNonQuery(string.Format("insert into teapasswordtable values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')", Account, Password, Name, Sex, ID, position, number, groupnumber, Phone, Email, academy, research, Grade, Major)); }
public void time2(string d1, string d2, string d3, string d4) { SQLDBhelper.ExecuteNonQuery(string.Format("update time set time1='{0}',time2='{1}',time3='{2}',time4='{3}'", d1, d2, d3, d4)); }