The Requirements that were sent by Radha garu were as follows -
1. First Requirement:
- there is an employees database table with the following columns - EmpID, FirstName, LastName, DOB, DOJ, Skillset, Address
- We have to create a Search page where the user can search by specifying the fields - To start with, the first assignment was to just search by Skillset
2. Second Requirement:
- make sure that the date fields (DOB, DOJ) not have the time component
- change the query to a stored proc (i.e. call a stored proc in the code instead of directly specifying the select statement as a string;
3. Third Requirement:
- allow user to specify other fields also as parameters for Searching
4. Fourth Requirement:
- Allow paging and sorting for the previous page
- Create a Login page (and associated table in database etc)
- Encrypt the password / Hash the password - DBA also should not be able to view user's password (by doing a 'select * from ....')
5. Fifth Requirement: (that I added and it is progress currently)
- Display another link at the top in Login.aspx to go to MoreUserDetails.aspx; The fields in this page should be - Nickname (textbox), Sex(RadioButton), Favorite Color(Dropdown); Validation controls should be set for these also;Only a logged in user can go enter details in that page; If a non-logged-in user reaches that page, then a message is displayed "Please login first...." and a link to Login.aspx is displayed....(Perhaps it would be good to disable the Panel consisting of the controls when a non-logged-in user reaches the page); A logged-in user should be able to see their details in this page if they have had entered at some previous time....If they have not entered this data before, then they should be able to enter the details
---------------------------------------------------------------------------
1. First Requirement -
Work done proceeded as follows -
- table in database was created ; to do this, it was necessary to understand if all the fields were Required or not - i.e. if fields were going to allow Null or not.. ; creating a Identity column (for empId) was also done - constraints specification was understood
- the select statement will use the 'like' operator, so 'like' operator and '%' were explained; string concatenation also was needed to be explained since we construct the 'select statement' as a string in C# code and assign it to CommandText property; Breakpoint & Use-of-F10-key were also explained (since debugging needed to done to ensure that the 'select statement string' was being built properly
- GridView and the statements to assign the 'select statement's results' to GridView have to be covered; hence SqlCommand, SqlConnection, ExecuteReader (dr.Read() method), ExecuteNonQuery (optional) had to be covered
Second Requirement -
Work done proceeded as follows -
Date fields, DOB & DOJ, are changed from DateTime types to varchar(10) types
Query was converted to stored proc; Assigning a default value to a SP parameter was explained; Then practice was done in SQL Server Management Studio on calling the SP in different ways (with all parameters , or with only the parameters with no default value assigned etc); C# code to call a stored proc and add SqlParameters was also explained;
Third Requirement -
Work done proceeded as follows -
First adding just one extra field was done to Search page, that of Salary.. The SP was modified accordingly.. SP was written first without using Dynamic SQL, i..e each incoming parameter was checked and then the appropriate select statement would be executed.. (This is there in Nikhila's screenshots).... Then, it was made to understand that this way writing the SP would not Scale for more number of parameters... So Dynamic SQL concept was introduced and then used for the 2 parameters first, Skillset and Salary.. After this was successful, other fields were also added to the UI and the SP also modified accordingly
Fourth Requirement -
Work done proceeded as follows -
To allow Paging and Sorting, EnablePaging and EnableSorting were set to True; but the date columns, since they are now varchar and appear in mm-dd-yyyy format, their columns do not get sorted properly.... So while returning their values in select statement, their values were changed to the format yyyy-mm-dd, so that sorting works peoperly...
A Login.aspx page was built.. But for this to work, first a Register.aspx page was built. The Register.aspx page had similar fields as that of ASP.Net Login controls - UserName, Password, Confirm Password, Email, Secret Question, Secret Answer...Except Secret Question and Answer, others are required fields..... On successfully Registering, all the fields would disappear and a message would appear at the top saying 'user registered successfully' and link displayed to go to Login page.... To store data into database, Insert command was used..but to use it, ExecuteNonQuery was introduced... Also, there was a check done to see if there was already a user with the same user name (since 2 users should not have the same username).... Also, validation controls were used to perform various checks...Regular Expressions were introduced and then an intensive exercise of about 20 examples was done... Regular Expressions were used to validate UserName, Password, Email fields. Ultimately, the default regex for email, that is provided by vs.net, was used since it was becoming too complicated... (This served to demonstrate that vs.net already provides some regex for most commonly used strings)....RequiredFieldValidator and CompareValidator were the other validation controls that were used in addition to RegularExpressionValidator.....
Then, on successful login, all the controls were then made invisible and a message assigned to a label (lblMessage) which was placed below all these controls.. But that resulted in the message 'user registered successfully' being displayed in the middle of the page....It does not look good.... Then DIV and Panel controls were explained and it was explained that when DIV and PANEL controls become invisible, other block controls shift up.... This was demonstrated with both DIV and PANEL....
BTW, in addition to displaying the message "User Registered Successfully", a link to go to the Login page is also displayed..
(One interesting point is that, for Confirm Password field, if a Compare Validator was placed to the Left of the RequiredFieldValidator, then the RequiredFieldValidator's error message would be displayed slightly to the right...Hence it was decided to remove RequiredFieldValidator altogether since CompareValidator would be enough for the job)
Login Page also had RequiredFieldValidators....and when user would successfully log in, a message was displayed at the bottom that "user logged in successfully"...
Fifth Requirement -
Word is proceeding as follows -
A new database table was created called AdditionalUserDetails whose primary key is UserName and has foreign key relation to Account table created in Register.aspx page... Session variable is introduced to allow storing User Name on a successful login.
At the beginning of the MoreUserDetails.aspx page, this Session variable is checked and user is asked to go to Login.aspx page if he/she is not logged in yet; If a logged-in user reaches the page, the Session variable will have been set, so it can be used to - (a). if the user has not previously filled this form, then a blank form should be displayed and then Session variable should be used to fill into AdditionalUserDetails table... (b) if user has previously filled this form, then the Session variable should be used to retrieve the user's info and the fields in this page should be populated...
No comments:
Post a Comment