コード例 #1
0
        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;
            }
        }
コード例 #2
0
        /// <summary>
        /// 删除注册信息
        /// 删除申请信息
        /// 删除引用关联(团队成员、团队)
        /// </summary>
        /// <returns></returns>
        public string deleteUser()
        {
            string userid = Request["usercode"];
            UserManage um = new UserManage();
            ApplyManage am = new ApplyManage();
            TeamManage tm = new TeamManage();
            bool judge = false;
            if(!tm.deleteTeamMemberByUserid(userid))
            {
                return @"无法删除该用户在团队的信息";
            }
            if(!tm.deleteTeamByTeamLeaderUsercode(userid))
            {
                return @"该用户是队伍创建者,需要先删除其队伍所有信息";
            }
            if(!am.DeleteApplyByUserID(userid))
            {
                return @"无法删除该用户的申请信息";
            }

            judge = um.DeleteUserByUserCode(userid);
            if(judge)
            {
                return  @"删除成功";
            }
            else
            {
                return  @"删除失败";
            }
        }