Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This should be developed using C# programming language. And it contains a form. Add the following methods to either the code for this form or

This should be developed using C# programming language. And it contains a form.image text in transcribed

Add the following methods to either the code for this form or a separate XXValidation class:

XXCapitalize this takes a string parameter and returns a string. It should convert an incoming null string to an empty one, trim it of leading & trailing spaces, shift it to lower case and then capitalise each word in the string. Beware of 1-letter words.

XXPostalCodeValidation this takes a string and returns a Boolean. If the incoming string is null or an empty string, pass it. Otherwise, return true only if the strings entire content fits the Canadian postal pattern A2A 2A2 accept upper or lower case and with or without the single space.

XXPhoneNumberValidation this takes a string and returns a Boolean. If the incoming string is null or empty, pass it. Otherwise, return true only if the entire string fits the phone pattern 123-123-1234, with or without the dashes.

XXIsNumeric this takes a string and returns a Boolean. If the incoming string is null or empty, return false. Return true only if the string contains a number defined as: at least one digit, an optional leading dash and an optional single decimal place anywhere in the number.

Buttons:

Pre-Fill loads the form with data making it easier to test individual edits

Submit edits and reformats the fields (back onto the form).

All validation errors are displayed at once in a red label on the form or in a message box one line per error, focus to first field in error.

Close closes the form.

Perform the following validations (all fields are optional unless specified otherwise). All error messages are to be shown at once, one line per error, focus to first field in error.

The members first name and last name are required and cannot be just blanks.

If an email is provided, the postal information (street address, city and postal code) is optional. If email is not provided, the postal information is required. All four are fine, but not mandatory.

The province code, if provided, must be exactly two letters, not just two characters. Accept upper- and lower-case.

Use your XXPostalCodeValidation method to verify the postal code.

Use your XXPhoneNumberValidation method to verify the phone number.

The email must be a valid email pattern if provided. Theres a MailAddress class in the System.Net.Mail namespace that throws an exception when instantiated with an invalid email address. Theres also a plethora of indecipherable regular expressions out there.

Use your XXIsNumeric method to verify the fee, then ensure it is not less than zero.

Perform the following data conversions

Use your XXCapitalize method to capitalise the members and spouses names, the street address, and the city.

Derive Full Namefrom the members and spouses names (after capitalization). Consider these examples for Shania Twain andRussell Crowe:

If theres no spouse, its the members last and first names, with a comma:

Twain, Shania

If the spouses last name is not provided or is the same as the members:

Twain, Shania &Russell

If the spouses last name is different:

Twain, Shania &Crowe, Russell

Shift the province code to upper case.

Shift the postal code to upper case and insert a single space if there isnt one already.

Insert the dashes into the phone number, if they are not there already.

Shift the email to lower case (easier to use for comparisons).

Display the fee with two decimal places rounded, if necessary no commas or currency symbols.

Member Maintenance Full Name Members First Name Members Last Neme Spouse's First Name Spouse's Last Name Street Address City Province Code Postal Code Home Phone Emal Fee Pre-FillSubmitClose Member Maintenance Full Name Members First Name Members Last Neme Spouse's First Name Spouse's Last Name Street Address City Province Code Postal Code Home Phone Emal Fee Pre-FillSubmitClose

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions