Exemplo n.º 1
0
    }//end update customer


    //add customer event
    protected void btnAddCustomer_Click(object sender, EventArgs e)
    {
        //getting form data
        string results = myBusinessLayer.InsertCustomer(txtFirstName.Text, txtLastName.Text, txtLine1.Text, txtLine2.Text, txtCity.Text, txtState.Text, txtPhone.Text);

        //sending form data to business layer
        updateForm(results);

    }//end add customer 
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        lblCurrentUser.Text = lblCurrentUser.Text;

        // Checks session credentials with database
        bool isUser = myBusinessLayer.CheckUsername(Session, txtUsername.Text);

        if (isUser)
        {
            // Updates data to results
            string results = myBusinessLayer.UpdateCustomer(txtUsername.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtLine1.Text, txtLine2.Text, txtCity.Text, txtState.Text, txtPhone.Text, Convert.ToInt32(customerID.Text));

            // Update the results for the updateForm method
            updateForm(results);

            lblProceed.Visible  = true;
            lblProceed.Text     = "Click the link below to proceed to the landing page.";
            lbtnProceed.Visible = true;
            lbtnProceed.Enabled = true;

            btnConfirm.Visible = false;
            btnConfirm.Enabled = false;
            btnCancel.Visible  = false;
            btnCancel.Enabled  = false;
        }

        else
        {
            // Add data to results
            myBusinessLayer.InsertCustomer(txtUsername.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtLine1.Text, txtLine2.Text, txtCity.Text, txtState.Text, txtPhone.Text, Convert.ToInt32(ID.Text));

            IDforUserID.Text = "0";
            ID.Text          = "0";

            // Add data to results
            myBusinessLayer.InsertUser(txtUsername.Text, txtPassword.Text, Convert.ToInt32(IDforUserID.Text));

            // Output message if no matching data is found
            Master.UserFeedBack.Text = "Welcome to the family, " + txtUsername.Text + "!";

            // Clear fields
            ClearInputs(Page.Controls);

            lblProceed.Visible  = true;
            lblProceed.Text     = "Click the link below to proceed to the landing page.";
            lbtnProceed.Visible = true;
            lbtnProceed.Enabled = true;

            btnConfirm.Visible = false;
            btnConfirm.Enabled = false;
            btnCancel.Visible  = false;
            btnCancel.Enabled  = false;
        }
    }