예제 #1
0
    protected void btnSignUp_Click(object sender, EventArgs e)
    {
        //create a new instance of the security class
        clsSecurity Sec      = new clsSecurity();
        clsCustomer customer = new clsCustomer();
        //try to sign up using the supplied credentials
        string Outcome  = Sec.SignUp(txtEMail.Text, txtPassword1.Text, txtPassword2.Text, false);
        string Outcome1 = "";

        //If the Valid result is OK
        if (Outcome == "An email has been sent to your account allowing you to activate the account")
        {
            //Valid the information for customer
            Outcome1 = customer.Valid(1, txtEMail.Text, txtFirstName.Text, txtLastName.Text, txtPostcode.Text, txtTelephone.Text, ddlTitle.SelectedValue);
            //If the Valid result is OK
            if (Outcome1 == "")
            {
                ////Get the AccountNo
                //int AccountNo = Sec.GetAccountNoByEmail(txtEMail.Text);
                //insert customer details and stroe the value for primary key
                int PrimaryKey = customer.Add(txtEMail.Text, txtFirstName.Text, txtLastName.Text, txtPostcode.Text, txtTelephone.Text, ddlTitle.SelectedValue);
                //put the value for primary key into tblAccount
                Sec.UpdateCustomerNo(txtEMail.Text, PrimaryKey);
            }
        }

        //report the outcome of the operation
        lblError.Text = Outcome + Outcome1;
        //store the object in the session objec for other pages to access
        Session["Sec"] = Sec;
    }