Recently, our professor stated that our presentation layer should consist of mostly method calls and that most of our code should be done in the business object and data access layers. My question is does this usually include the code for user input? What I mean is this; I have a form that consists of multiple text boxes so that the user can input values for different things. The user then clicks a button and the information is saved in a database.
The button even method looks like this:
//event handler for data input
public static void btnEnterAbRipperXInfo_Click(object sender, EventArgs e)
{
//convert text box data into int datatype and assign to variable
inAndouts = int.Parse(txtInAndOuts.Text);
forwardBicycles = int.Parse(txtForwardBicycles.Text);
reverseBicycles = int.Parse(txtReverseBicycles.Text);
crunchyFrog = int.Parse(txtCrunchyFrog.Text);
crossLegWideLegSitups = int.Parse(txtCrossLegWideLegSitups.Text);
fiferScissors = int.Parse(txtFiferScissors.Text);
hipRockNRaise = int.Parse(txtHipRockNRaise.Text);
pulseUpsHeelsToHeaven = int.Parse(txtPulseUpsHeelsToHeaven.Text);
vUpRollUpCombos = int.Parse(txtVUpRollUpCombos.Text);
obliqueVUps = int.Parse(txtObliqueVUps.Text);
legClimbs = int.Parse(txtLegClimbs.Text);
masonTwists = int.Parse(txtMasonTwists.Text);
}
Should the code within the above button event method actually go into a business object or data access class instead of the presentation layer class?
This is not homework. I am creating a 90 day exercise program for my son outside of my programming class. I can also use it as a portfolio for when I graduate, therefore, I want to ensure that I am following standard practices.
The BOL takes care of specific business checks / cases that need to be sanitized before going to the DAL (data access layer). The DAL just takes the inputs from the BOL and passes them down to the database.
If your textbox values don't need any type of business logic you can pass them to the BOL to freely pass them to the DAL.
From the looks of your code there is no checking / validation needed. Although it may seem redundant, just to be consistent with your project, you can still pass them to the BOL. In essence your BOL won't act upon these values - it will merely take these values and pass it up to the DAL.