//add user event
    protected void btnAddUser_Click(object sender, EventArgs e)
    {
        string results = myBusinessLayer.InsertUser(txtUserName.Text, txtCity.Text, txtState.Text, txtFavoriteLanguage.Text, txtLeastFavoriteLanguage.Text, txtLastProgramDate.Text);

        updateForm(results);

    }
Exemplo n.º 2
0
    /// insertUser method
    // add a new user info to database
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        string results = myBusinessLayer.InsertUser(txtFirstName.Text, txtLastName.Text,
                                                    txtEmail.Text, txtPassword.Text, txtStreet.Text, txtCity.Text, txtState.Text);

        UpdateForm(results);
    }
    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;
        }
    }
Exemplo n.º 4
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        //Get Username Length
        int UsernameLength = txtUsername.Text.Length;
        //Get Password Length
        int PasswordLength = txtPassword.Text.Length;
        //Get Usernames from Database
        dsUsers          dsFindUser;
        string           tempPath         = Server.MapPath("~/App_Data/");
        clsBusinessLayer businessLayerObj = new clsBusinessLayer(tempPath);

        dsFindUser = businessLayerObj.FindUser(txtUsername.Text);

        //Check if username already exists
        if (dsFindUser.tblUsers.Rows.Count > 0)
        {
            Master.UserFeedBack.Text = "Username has already been used. Please try a different Username.";
        }
        //Check Username Length
        else if (UsernameLength < 5 || UsernameLength > 12)
        {
            Master.UserFeedBack.Text = "Username must be between 5 and 12 characters in length.";
        }
        //Check Password Length
        else if (PasswordLength < 6 || PasswordLength > 12)
        {
            Master.UserFeedBack.Text = "Passwords must be between 6 and 12 characters in length.";
        }
        else
        {
            Session["NewUser"]         = true;
            Session["SessionUsername"] = txtUsername.Text;
            myBusinessLayer.InsertUser(txtUsername.Text, txtPassword.Text);
            Response.Redirect("~/pgUserDetails.aspx");
        }
    }