Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var club = ClubLogic.GetCreateClubApplicationByUserID(userid);

            var sameNameClub = ClubLogic.GetClubInfo(tbFullName.Text);

            if (club != null)
            {
                if (club.FullName == tbFullName.Text)
                {
                    ClubLogic.UpdateApplyClub(club.ID.Value, tbFullName.Text, tbShortName.Text, tbSlogan.Text,
                                              tbDesc.Text, userid, username);
                }
                else
                {
                    if (sameNameClub != null)
                    {
                        var script = "alert('该球会名已被使用!');";
                        ClientScript.RegisterClientScriptBlock(typeof(string), "name_used", script, true);
                    }
                    else
                    {
                        ClubLogic.UpdateApplyClub(club.ID.Value, tbFullName.Text, tbShortName.Text, tbSlogan.Text,
                                                  tbDesc.Text, userid, username);
                    }
                }
            }
            else
            {
                if (sameNameClub != null)
                {
                    var script = "alert('该球会名已被使用!');";
                    ClientScript.RegisterClientScriptBlock(typeof(string), "name_used", script, true);
                }
                else
                {
                    ClubLogic.ApplyClub(tbFullName.Text, tbShortName.Text, tbSlogan.Text, tbDesc.Text, userid, username);
                }
            }

            var scriptSaved = "alert('申请已提交!'); window.location.href = window.location.href;";

            ClientScript.RegisterClientScriptBlock(typeof(string), "saved", scriptSaved, true);
        }