Sunday 16 May 2010

User Instructions

Admin Page InstructionsAdmin Username: Admin 1 and Password: admin_1. This will redirect the user to the Admin page. Here you can search for Staff members, view reports and change your password.

To perform a search click on the ‘Search' link. The user will then be transferred to the search page. From here they can select the relevant search criteria. Once they click on the Search button the Result page will appear.

The Results Page is a static page. If the user wishes to do another search they can select the ‘New Search’ link. If they would like to go back to the ‘Admin’ page. They can select the ‘Back’ link.

To change a password click on the 'Change password' link on the Admin page, and then enter the necessary details of your account.

To view the Staff report click on the staff report link in the Admin page.

Staff Page InstructionsStaff Username: Staff 1 and password: staff_1. This should redirect the user to the staff page.

To perform a search the user should click on 'Search' link. This has the same layout as the Admin search page.

The Result page is also the same as the Admin result page. The structure of the Search and Result page is the same as the Admin page i.e. The Staff are allowed to click on the ‘New search’ link and if the Staff clicks on ‘Back’ they are redirected to the Staff page.

To change a password click on the 'Change password' link on the Staff page, and then enter the necessary details of your account.

Note all Users can logout while on any page is displayed. They can also go back to the Start Page i.e. Staff page or Admin page depending on user. By clicking on the back link just below the website title.Login

The login page allows people to sign up as new users. To do this they need to click on the ‘Sign Up’ link. The user must then follow the steps.

A password recovery options is also available this will allow the user to recover their password if they cannot remember it. To do this they must click on the ‘Forgotten Password?’ link.

Login Controls

Select "Website" on toolbar, "ASP.NET Configuration", "Security" tab, "Select Authentication Type", select from "Internet (website log in)" or "Local Network (intranet)". I selected Internet.

"Security" tab, "Create User", add details, such as username & password, apply a role.
Close "ASP.NET Configuration" screen.

Right Click project folder, "Add New Item", "Web Form". Name it "Login", Drag-Drop a Login control from "Toolbox" onto page.
"Auto Format" to change colour, or make "Template" to change specific text
"Properties" of Login box, "DestinationPageURL", select "Despatch Page". This will determine whether the user is an "Admin" user or "Staff" user. If the user is "Admin" he will be transferred to the "Default" page. However, if it is a "Staff" user the "Staff" Page will appear.

Enter the code below into the page load event of Despatch page to do this click on the plus sign next to the Despatch page and select the Despatch.aspx.cs page which will be below it:


{
if (User.Identity.IsAuthenticated == false)
{
Server.Transfer("login.aspx");
}
if (Roles.IsUserInRole("Staff") == true)
Server.Transfer("StaffPage.aspx");// Load this page

Server.Transfer("Default.aspx");// Otherwise load this page
}
}

Run application by clicking on "Play".

Inline Editing

The following would not be good for lots of data fields on-screen, as it would be necessary to scroll vertically.

Open the "Global.asax" page.
In the first "routes.Add..." paragraph, reverse "{table}/{action}.aspx" to"{action}/{table}.aspx".

Uncomment the first "routes.Add..." paragraph out up until the brackets after "Model = model"

Uncomment next 2 "routes.Add..." paragraphs up until the brackets after "Model = model"

By doing this the "List View" and "Detail View" will be on the same web page.

Table Specific Routing

In "Global.asax" page, uncomment all 3 "routes.Add..." paragraphs

In the first "routes.Add..." section, change: ("{action}/{table}.aspx") to("{action}/Products.aspx")

Any other table name can be used, I have chosen to use"Products".
Locate Model = model - place a comma to the end.

So it should look like this -Model = model,
On the next line add - Table="Products"
The paragraphs work in hierarchy therefore, the top line of code is read first.

Advantages of Dynamic Data

  • Dynamic data allows you to edit and insert data into the database on a web site.
  • Separate data from web form - so singular adjustments can be made.
  • A standard user interface for almost any data can be created.

Dynamic Data

Open a new "Dynamic Data Website"

Right Click "App Data", "Add Existing Item", select database file.

Right Click the Project Folder, "Add New Item", "LINQ to SQL Classes" give same filename as database file (eg"Northwind"), place in "App Folder"

"Server Explorer", expand 'databasename'.mdf, under "Tables", drag items onto page.
Then"Save All".

In "Solution Explorer", open ".designer.cs" page, copy "public partial class" name ( "NorthwindDataContext").

Open "Global.asax" page, locate line starting with:
"//model.RegisterContext"

Uncomment the code by deleting the forward slashes i.e. "//".

Paste class name over "YourDataContextType".

Change "ScaffoldAllTables" from "false" to "true".

Run the page by clicking on the "Play" button.

SQL Database

Right Click on App_Code

Add a "New Item" to the website project, select "SQL Server Database"

Right Click, "Add New Table"

"Identity" property of field = "Yes" to increase ID number by 1
"Show Table Data" under "Server Explorer" screen allows data entry

Grid/Form View Control:

Drag/drop grid view on .aspx design page from "Data" section of "Toolbox"

Connect to database (source), select "Database", then select from drop down list, then select headers, under "Advanced" tick both boxes, then "Finish".

Enable "Paging". Splits data over pages. Expand limit in "Properties" when grid selected ("PageSize"). "Mode" thuis changes numeric values to symbols.

Enable "Sorting"allows headings to become hyperlinks for organising data

"Edit Columns" on "Grid View Tasks". Changes column names.

Create a new page, drag/drop "Form View" from "Data" section of "Toolbox".

Choose "Data Source", select "Database", "Connection String", select headings & tick "Advanced" options, then "Finish".

Select form, choose "Auto Format" to add some colour.

"Edit Templates" = edit different states of form eg when in "Edit" mode or in "Insert" mode
Paging can again be enabled & edited.