protected void Commit_Click(object sender, EventArgs e) { string DefaultStr = @"ctl00$MainContent$"; Dictionary<string, string> teamInfo = new Dictionary<string, string>(); teamInfo.Add("teamName", Request.Form[DefaultStr + "teamName"]); teamInfo.Add("Province", Request.Form[DefaultStr + "Province"]); TeamManage tm = new TeamManage(); if(tm.isTeamRepeat(teamInfo["teamName"],user)) { SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"队名已被使用或您已创建团队"; return; } string teamID = tm.SavaTeamInfo(teamInfo, user); if (!string.IsNullOrEmpty(teamID)) { //保存成功 //先清空显示错误数据 ErrorMessage.Text = string.Empty; SuccessMessage.Text = @"您创建的团队ID为'" + teamID + @"'"; } else { //业务逻辑错误,请联系技术人员 //先清空显示正确数据 SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"后台业务出现错误,请联系网站维护人员"; } }
public string creatTeam() { Dictionary<string, string> teamInfo = new Dictionary<string, string>(); string userid = Request["userid"]; string teamname = Request["teamName"]; string province = Request["provinceid"]; teamInfo.Add("teamName", teamname); teamInfo.Add("Province", province); TeamManage tm = new TeamManage(); if(!tm.deleteTeamMemberByUserid(userid)) { return @"出现逻辑错误"; } if (tm.isTeamRepeat(teamInfo["teamName"], userid)) { return @"已存在的队伍名称"; } string teamID = tm.SavaTeamInfo(teamInfo, userid); if(teamID != @"数据库操作失败") { return @"队伍ID为[" + teamID + @"],请牢记。" ; } else { return teamID; } }