protected void Commit_Click(object sender, EventArgs e) { string DefaultStr = @"ctl00$MainContent$"; string teamID = Request.Form[DefaultStr + "teamID"].Trim(); string teamName = Request.Form[DefaultStr + "teamName"].Trim(); //Require check if (string.IsNullOrEmpty(teamID) && string.IsNullOrEmpty(teamName)) { SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"队伍ID和队伍名称请至少填写一个"; return; } TeamManage tm = new TeamManage(); if (tm.hasAlreadyJoined(user)) { SuccessMessage.Text = string.Empty; ErrorMessage.Text = "您已经加入到其它队伍了,无法再加入队伍"; return; } if (!tm.isTeamValid(teamID, teamName)) { SuccessMessage.Text = string.Empty; ErrorMessage.Text = "无效的队伍名称或ID,请检查"; return; } if (string.IsNullOrEmpty(teamID)) teamID = tm.queryTeamID(teamName); if (tm.joinTeam(teamID, user)) { SuccessMessage.Text = "加入队伍成功"; ErrorMessage.Text = string.Empty; } else { SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"后台业务出现错误,请联系网站维护人员"; } }
public string modifyUserTeam() { string sysid = Request["sysid"]; string teamid = Request["teamid"]; string teamname = Request["teamname"]; TeamManage tm = new TeamManage(); if (!tm.isTeamValid(teamid, teamname)) { return @"填入的队伍信息有误"; } if (string.IsNullOrEmpty(teamid)) teamid = tm.queryTeamID(teamname); if (tm.updateTeamMember(sysid, teamid)) return @"操作成功"; else return @"操作失败"; }