Example #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            PersonV2 c = new PersonV2();//keeping this called c instead of pv2 for ease of conversion

            c.FName        = txtFName.Text;
            c.MName        = txtMName.Text;
            c.LName        = txtLName.Text;
            c.StreetOne    = txtStreetOne.Text;
            c.StreetTwo    = txtStreetTwo.Text;
            c.City         = txtCity.Text;
            c.StateCode    = txtStateCode.Text;
            c.ZipCode      = txtZipCode.Text;
            c.PhoneNum     = txtPhoneNum.Text;
            c.EmailAddress = txtEmailAddress.Text;
            c.CellNum      = txtCellPhoneNum.Text;
            c.InstagramURL = txtInstagramURL.Text;

            /*Was previously taking advantage of polymorphism that a Customer without any customer
             * unique data was essentially a PersonV2 object with access to all its stuff so I
             * kept it Customer and treated it like a PV2 and passed it to PV2 feedback function*/

            //This code vastly shortened by moving error feedback to object
            if (c.Feedback.Contains("Error"))
            {
                lblErrorMsg.Text = c.Feedback;
                c.Feedback       = "";
            }
            //Successful submission code
            else
            {
                lblErrorMsg.Text  = "Input Errors: NONE";
                lblErrorMsg.Text += c.AddARecord();

                txtFName.Text        = "";
                txtMName.Text        = "";
                txtLName.Text        = "";
                txtStreetOne.Text    = "";
                txtStreetTwo.Text    = "";
                txtCity.Text         = "";
                txtStateCode.Text    = "";
                txtZipCode.Text      = "";
                txtPhoneNum.Text     = "";
                txtEmailAddress.Text = "";

                txtCellPhoneNum.Text = "";
                txtInstagramURL.Text = "";

                //            checkBoxDiscountMember.Checked = false;
                //            txtRewardsEarned.Text = "";
                //            txtTotalPurchases.Text = "";

                setFeedbackV2(c);
                people.Add(c);
            }
        }
Example #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        PersonV2 input = new PersonV2();

        if (Validator.gotBadWords(txtFName.Text) == false && Validator.IsitFilledin(txtFName.Text) == true)

        {
            input.PersonFirst = txtFName.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }


        if (Validator.gotBadWords(txtMName.Text) == false)

        {
            input.PersonMiddle = txtMName.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtLName.Text) == false && Validator.IsitFilledin(txtLName.Text) == true)

        {
            input.PersonLast = txtLName.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtStreet.Text) == false && Validator.IsitFilledin(txtStreet.Text) == true)

        {
            input.PersonStreet = txtStreet.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtCity.Text) == false && Validator.IsitFilledin(txtCity.Text) == true)

        {
            input.PersonCity = txtCity.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtState.Text) == false && Validator.IsitFilledin(txtState.Text) == true)

        {
            input.PersonState = txtState.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtZip.Text) == false && Validator.IsitFilledin(txtZip.Text) == true)

        {
            input.PersonZip = txtZip.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtNum.Text) == false && Validator.IsitFilledin(txtNum.Text) == true)

        {
            input.PersonNum = txtNum.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        if (Validator.gotBadWords(txtMail.Text) == false && Validator.IsitFilledin(txtMail.Text) == true)

        {
            input.PersonMail = txtMail.Text;
        }

        else
        {
            lblFeedback.Text = "Validation Failed Try again.";
            return;
        }

        lblFeedback.Text = input.AddARecord();
    }