This is the implementation stage of the software development lifecycle where all the codes in the application are explained according to their functionality. I also want it to be noted that all the code are written in C# and ASP.NET. Explanation of MainQustionniare.aspx.cs code
1. To begin the coding of the application, I wrote a class called MainQuestionniare where user can select and answer the survey question also MainQuestionniare act as the main class that connect other classes together. Below is the code MainQuestionnaire class code as it was when no functionality code as been added.
public partial class MainQuestionniare : System.Web.UI.Page
2. In other to integrate the useful function in the MainQuestionnaire that are specified in the requirement analysis, the following C# library class along with other class that I have created were imported
using System. Web;
using System. Collections;
EXPLANATION OF THE IMPORTED CLASSES
The reason why the namespace were imported are not farfetched for instance the System.Linq namespace provides classes and interfaces that support queries and use Language-Integrated Query (LINQ) which has enable the MainQuestionniare class to query table that are located in the database While the data System.Ling namespace provide the class and interface that the MainQuestionnaire class uses in providing the communication between the browser where the user is answering the survey question and server which connect to the database to either request for information using HttpResquest on behalf of the user who is answering the survey question or send answer or information of the survey using HttpRespond . Furthermore the System.Web.UI.WebControls namespace provide all the class that the MainQuestionnaire class uses in providing web server controlled such as the ability to recognise the particular form controls like button, text boxes, and textArea, radio button which are selected in web pages design with html and send the requests to the database. Also because the user of the survey will be answering a series of questions which consist of so many form control such as text box, button, textArea System. Collection namespace was imported in the MainQuestionnaire class to ensure that all question answered in the survey web application are submitted to the database at once. More also Imported the QuestionniareProject.DataAccess namespace which I have previously created in the MainQuestionnaire because it contain different classes that handles select, update and insert of data into the database. Finally in order for the MainQuestionnaire class to locate the datasource and provide a connection between database and the website I import QuestionniareProject.Domain.
3. VARIABLE AND CONSTRUCTOR CODE
private AnswerDataRepository _questionChoiceRepository;
Conn = new Connection ();
_questionChoiceRepository = new AnswerDataRepository ();
EXPLANATION OF THE VARIABLE AND CONSTRUCTOR CODE
The code stated above contain the private specifier which signifiers that the questionChoiceRepository variable of class AnswerDataRespository will only be used in the MainQuestionniare .Also the Connection class object called conn enables the MainQuestionnaire class to make connection to a database called QuestionniareProjDBConnectionString which reside on the relational database management system. * This line of code called
Conn = new Connection();
_questionChoiceRepository = new AnswerDataRepository();
Is a constructor that enables the MainQuestionniare class to automatically load and used functions that reside in connection and answerDataRepository class.
NEXTBUTTON_CLICK METHOD CODES
Please join StudyMode to read the full document