コード例 #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ln = LastNameTextBox.Text.Trim();
        fn = FirstNameTextBox.Text.Trim();
        string action = rblAction.SelectedValue;                       // Action  = Signup or Cancel

        carpool = cbCarpool.Checked?"Yes":"No";                        // Carpool = No or Yes
        tgender = rblgender.SelectedValue;

        if (carpool.Trim() == "No")
        {
            carpool = "";
        }

/*            if (invalidMember(ln, fn))
 *          {
 *              errorCode = 5;
 *          }
 */
        if (IsAccessControlOn)
        {
            if (!AccessControl.IsValidMember(ln, fn, tbAccessCode.Text))
            {
                errorCode = 6;
            }
        }
        SaveUserInfo(fn, ln, tgender, carpool);
        int gender = rblgender.SelectedIndex + 1;

        lblAction.Text    = "";
        lblAction.Visible = false;

        linkbuttonSR.Visible = false;
        spcRule = "";
        int n = 0;

        if (SRCBKL.Items.Count > 0)
        {
            for (int i = 1; i < SRCBKL.Items.Count; i++)
            {
                if (SRCBKL.Items[i].Selected)
                {
                    spcRule += SRCBKL.Items[i].Value;
                    n++;
                }
            }
        }
        if (n > 2)
        {
            errorCode = 4;
        }

        string eid      = eventID;
        string gln      = "";
        string gfn      = "";
        int    ggender  = 0;
        string ghcp     = tbGHcp.Text;
        int    guestID  = 0;
        int    PlayerID = MrSignup.GetPlayerID(ln, fn, gender);


        if (cbGuestRule.Checked)
        {
            gln       = tbGLN.Text.Trim();
            gfn       = tbGFN.Text.Trim();
            ggender   = rblGgender.SelectedIndex + 1;
            guestID   = MrSignup.GetGuestID(gln, gfn, ghcp, ggender);
            errorCode = MrSignup.ValidateGuestPlaying(eid, guestID, PlayerID);
        }
        if (errorCode == 0)
        {
            string errmsg = MrSignup.AddToList(eid, PlayerID, action, carpool, gender, spcRule, guestID);
//				lblAction.Text = string.Format("Your {0} for this event was successful.",action);
            lblAction.Text = errmsg;
//				lblAction.ForeColor = System.Drawing.Color.DarkGreen;
            lblAction.ForeColor = System.Drawing.Color.Firebrick;
            lblAction.Font.Bold = true;
            lblAction.Visible   = true;
//                LinkButton1.Visible = false;
        }
        if (errorCode == 1)
        {
            lblAction.Text      = "Partner already playing.  Signup is unsuccessful.";
            lblAction.ForeColor = System.Drawing.Color.Firebrick;
            lblAction.Visible   = true;
//                LinkButton1.Visible = false;
        }
        if (errorCode == 2)
        {
            lblAction.Text      = "Partner has played once.  Signup unsuccessful.";
            lblAction.ForeColor = System.Drawing.Color.Firebrick;
            lblAction.Visible   = true;
//                LinkButton1.Visible = false;
        }
        if (errorCode == 4)
        {
            lblAction.Text      = "Select no more than one Special Rule.  Signup unsuccessful.";
            lblAction.ForeColor = System.Drawing.Color.Firebrick;
            lblAction.Visible   = true;
        }
        if (errorCode == 6)
        {
            lblAction.Text      = "Invalid Access Code.  Please try again";
            lblAction.ForeColor = System.Drawing.Color.Firebrick;
            lblAction.Visible   = true;
        }

        getPlayersList(eventID);

        resetSignupForm();
        if (errorCode == 0)
        {
//                Server.Transfer("Default.aspx");
        }
    }