SlideShare a Scribd company logo
1 of 16
Previous weeks work has been uploaded as well as any other
pieces needed.
Deliverables
All files are located in the subdirectory of the project. The
project should function as specified: When you visit the
Personnel form page (frmPersonnel.aspx), a record should be
saved in the tblUserActivity table with the IP address, form
name accessed (frmPersonnel), and the date accessed. When you
click the View Activity button, you should see at least one
record with this information. When the user goes to the
frmPersonnel web form and enters data, the following business
rules are to be enforced.
Fields may not be empty or filled with spaces. If any field is
empty, turn that field background color to yellow and add
to/create an error message to be shown in the error label.
The end date must be greater than the start date. If the end date
is less than the start date turn both date fields yellow and add
to/create an error message to be shown in the error label.
If all fields validate properly, then the session state items
should be set properly and the user should see the
frmPersonnelVerified form with all the values displayed. You
will also add a new item to frmMain that will take the user to
the new frmUserActivity form you added. Add the proper link
and a hyperlinked image to allow the user to select this new
option. Once you have verified that everything works, save your
website, zip up all files, and submit it.
STEP 1: Step Title
1. Open Microsoft Visual Studio.NET.
2. Open the PayrollSystem website by clicking on it in the
Recent Projects list, or by pulling down the File menu, selecting
Open Website, navigating to the folder where you previously
saved the PayrollSystem, and clicking Open.
3. Download the PayrollSystem_DB.accdb file from the Files
section and save it on your local computer. (Note: your
operating system may lock or block the file. Once you have
copied it locally, right click on the file and select Properties and
then Unblock if available). Then add it to the PayrollSystem
website as follows: In Visual Studio, in the
Solution
Explorer click Website, Add Existing Item, then navigate to the
PayrollSystem_DB.accdb file you downloaded, and click the
Add button.
Make sure you select file types, which include *.accdb, *.accdb,
etc. Otherwise, you will not be able to see the database file to
select.
4. Now we need to create a new connection to the
PayrollSystem_DB.accdb. To begin, click View Server
Explorer.
5. When the Server Explorer toolbox appears, click the Connect
to Database button.
6. When the Add Connection dialog appears, click the Change
button. In the Change Data Source dialog, select MS Access
Database File; Uncheck Always use this Selection; then click
OK.
Press Continue to get the following screen.
7. Click the Browse button to navigate to the
PayrollSystem_DB.accdb file in your website folder, then click
Open. (NOTE: Be sure you select the PayrollSystem_DB.accdb
file in your PayrollSystem website folder, not the one you
originally downloaded from the Files section). Click Test
Connection. You should receive a message that the test
connection succeeded. Click OK to acknowledge the message,
then click OK again to close the Add Connection dialog.
8. The PayrollSystemDB.accdb should be added to the Server
Explorer. Expand the database, then expand the Tables entry
under the database until you see tblUserActivity. Leave the
Server Explorer window open for now as you will be returning
to it in a moment.
9. Create a new dataset by selecting Website-> Add New Item.
Under Templates, select the Dataset item. Enter
dsUserActivity.xsd for the name. Click Add.
10. If the following message appears, select Yes. You want to
make this dataset available to your entire website.
11. If the TableAdapter Configuration Wizard dialog appears,
click Cancel. (We will be configuring a Data Adapter for this
dataset later in C# code, so we do not need to run this wizard.)
12. Drag-and-drop the tblUserActivity table from the Server
Explorer window into the dsUserActivity dataset in the editor
window.
NOTE: If you see a message that says your connection uses a
local data file that is not in the current project, that indicates
you did not select the correct PayrollSystem_DB.accdb file
when you created your data connection. To fix this problem,
click No, then right-click on PayrollSystemDB.accdb in the
Server Explorer window and choose Modify Connection. Click
the Browse button, navigate to the PayrollSystemDB.accdb file
that is in your PayrollSystem website folder, and click Open.
Test the connection, then click OK.
Click the Save icon on the toolbar to save the
dsUserActivity.xsd dataset.
(You can now close the Server Explorer window if you wish.)
13. Create a new class to contain the C# code that will access
this dataset. To do so, click Website, Add New Item. In the Add
New Item dialog, select the Class template, and enter
clsDataLayer for the name. Make sure the Language is set to
Visual C#. Click Add.
14. If the following message appears, select Yes. You want to
make this class available to everything in your solution.
15. Add the following to the top of your class, below any other
using statements created for you by Visual Studio.
Add to top of class
// Add your comments here
using System.Data.OleDb;
using System.Net;
using System.Data;
16. Add the following three functions inside the squiggly braces
for the public class clsDataLayer class, above the beginning of
the public clsDataLayer() constructor and save the class.
Class
// This function gets the user activity from the tblUserActivity
public static dsUserActivity GetUserActivity(string Database)
{
// Add your comments here
dsUserActivity DS;
OleDbConnection sqlConn;
OleDbDataAdapter sqlDA;
// Add your comments here
sqlConn = new
OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;"
+ "Data Source=" + Database);
// Add your comments here
sqlDA = new OleDbDataAdapter("select * from
tblUserActivity", sqlConn);
// Add your comments here
DS = new dsUserActivity();
// Add your comments here
sqlDA.Fill(DS.tblUserActivity);
// Add your comments here
return DS;
}
// This function saves the user activity
public static void SaveUserActivity(string Database, string
FormAccessed)
{
// Add your comments here
OleDbConnection conn = new
OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;"
+
"Data Source=" + Database);
conn.Open();
OleDbCommand command = conn.CreateCommand();
string strSQL;
strSQL = "Insert into tblUserActivity (UserIP, FormAccessed)
values ('" +
GetIP4Address() + "', '" + FormAccessed + "')";
command.CommandType = CommandType.Text;
command.CommandText = strSQL;
command.ExecuteNonQuery();
conn.Close();
}
// This function gets the IP Address
public static string GetIP4Address()
{
string IP4Address = string.Empty ;
foreach (IPAddress IPA in
Dns.GetHostAddresses(HttpContext.Current.Request.UserHostA
ddress)) {
if (IPA.AddressFamily.ToString() == "InterNetwork") {
IP4Address = IPA.ToString();
break;
}
}
if (IP4Address != string.Empty) {
return IP4Address;
}
foreach (IPAddress IPA in
Dns.GetHostAddresses(Dns.GetHostName())) {
if (IPA.AddressFamily.ToString() == "InterNetwork") {
IP4Address = IPA.ToString();
break;
}
}
return IP4Address;
}
STEP 2: frmUserActivity, frmPersonnel, frmMain
17. Create a new web form called frmUserActivity. Switch to
Design Mode and add the ACIT logo to the page as an
ImageButton and link it back to frmMain. Below the image
button add a panel. To the panel, add a Label and GridView
(found under the Toolbox, Data tab) having the following
properties.
PropertyValueLabel – TextUser ActivityGridView –
(ID)grdUserActivity
18. Go to the Page_Load method by double clicking an empty
space on the page and add the following code.
Page_Load method for frmUserActivity.aspx
if (!Page.IsPostBack) {
// Declares the DataSet
dsUserActivity myDataSet = new dsUserActivity();
// Fill the dataset with what is returned from the function
myDataSet =
clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_
DB.accdb"));
// Sets the DataGrid to the DataSource based on the table
grdUserActivity.DataSource =
myDataSet.Tables["tblUserActivity"];
// Binds the DataGrid
grdUserActivity.DataBind();
}
19. Open the frmMain form, add a new link button and image
button to point to the new frmUserActivity. Find an image to
use for the image button and add the new option as View User
Activity.
20. Go to the frmMain Page_Load and add the following code.
frmMain.aspx Page_Load code
// Add your comments here
clsDataLayer.SaveUserActivity(Server.MapPath("PayrollSystem
_DB.accdb"), "frmPersonnel");
21. In the

More Related Content

Similar to Previous weeks work has been uploaded as well as any other pieces ne.docx

Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7helpido9
 
systems labOnce the Application has started up and you are at the .docx
systems labOnce the Application has started up and you are at the .docxsystems labOnce the Application has started up and you are at the .docx
systems labOnce the Application has started up and you are at the .docxperryk1
 
Once the Application has started up and you are at the Start Page, s.docx
Once the Application has started up and you are at the Start Page, s.docxOnce the Application has started up and you are at the Start Page, s.docx
Once the Application has started up and you are at the Start Page, s.docxarnit1
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XSBlackvard
 
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...WithTheBest
 
Oracle ADF 11g Skinning Tutorial
Oracle ADF 11g Skinning TutorialOracle ADF 11g Skinning Tutorial
Oracle ADF 11g Skinning TutorialRakesh Gujjarlapudi
 
Database By Salman Mushtaq
Database By Salman MushtaqDatabase By Salman Mushtaq
Database By Salman MushtaqSalman Mushtaq
 
OBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsOBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsDharmaraj Borse
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studioAravindharamanan S
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studioAravindharamanan S
 
Events Registration System Part 1
Events Registration System Part 1Events Registration System Part 1
Events Registration System Part 1Adolfo Nasol
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureprathap kumar
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesDavid Voyles
 
New Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP ConnectorsNew Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP Connectorsrtretola
 
Activity 9 Working with AWS CloudTrail.pdf
Activity 9 Working with AWS CloudTrail.pdfActivity 9 Working with AWS CloudTrail.pdf
Activity 9 Working with AWS CloudTrail.pdfstirlingvwriters
 
Web application to keep track of time spent on projects
Web application to keep track of time spent on projectsWeb application to keep track of time spent on projects
Web application to keep track of time spent on projectsravi yadav
 

Similar to Previous weeks work has been uploaded as well as any other pieces ne.docx (20)

Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7
 
systems labOnce the Application has started up and you are at the .docx
systems labOnce the Application has started up and you are at the .docxsystems labOnce the Application has started up and you are at the .docx
systems labOnce the Application has started up and you are at the .docx
 
Once the Application has started up and you are at the Start Page, s.docx
Once the Application has started up and you are at the Start Page, s.docxOnce the Application has started up and you are at the Start Page, s.docx
Once the Application has started up and you are at the Start Page, s.docx
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XS
 
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...
Line Graph Analysis using R Script for Intel Edison - IoT Foundation Data - N...
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Oracle ADF 11g Skinning Tutorial
Oracle ADF 11g Skinning TutorialOracle ADF 11g Skinning Tutorial
Oracle ADF 11g Skinning Tutorial
 
Database By Salman Mushtaq
Database By Salman MushtaqDatabase By Salman Mushtaq
Database By Salman Mushtaq
 
OBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsOBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation Steps
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
zMSC Lab.pdf
zMSC Lab.pdfzMSC Lab.pdf
zMSC Lab.pdf
 
Events Registration System Part 1
Events Registration System Part 1Events Registration System Part 1
Events Registration System Part 1
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
 
Homestead Weather workshop
Homestead Weather workshopHomestead Weather workshop
Homestead Weather workshop
 
New Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP ConnectorsNew Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP Connectors
 
Activity 9 Working with AWS CloudTrail.pdf
Activity 9 Working with AWS CloudTrail.pdfActivity 9 Working with AWS CloudTrail.pdf
Activity 9 Working with AWS CloudTrail.pdf
 
Web application to keep track of time spent on projects
Web application to keep track of time spent on projectsWeb application to keep track of time spent on projects
Web application to keep track of time spent on projects
 

More from keilenettie

Write a 350-to 700-word paper in which you investigate the interre.docx
Write a 350-to 700-word paper in which you investigate the interre.docxWrite a 350-to 700-word paper in which you investigate the interre.docx
Write a 350-to 700-word paper in which you investigate the interre.docxkeilenettie
 
Write a 4+ page, double-spaced essay regardingExplain the importa.docx
Write a 4+ page, double-spaced essay regardingExplain the importa.docxWrite a 4+ page, double-spaced essay regardingExplain the importa.docx
Write a 4+ page, double-spaced essay regardingExplain the importa.docxkeilenettie
 
Write a 350-word paper and be prepared to present in class discussin.docx
Write a 350-word paper and be prepared to present in class discussin.docxWrite a 350-word paper and be prepared to present in class discussin.docx
Write a 350-word paper and be prepared to present in class discussin.docxkeilenettie
 
Write a 300-word summary that addresses the following criteriaDef.docx
Write a 300-word summary that addresses the following criteriaDef.docxWrite a 300-word summary that addresses the following criteriaDef.docx
Write a 300-word summary that addresses the following criteriaDef.docxkeilenettie
 
Write a 4 page paper in which you1.Assess the types of chan.docx
Write a 4 page paper in which you1.Assess the types of chan.docxWrite a 4 page paper in which you1.Assess the types of chan.docx
Write a 4 page paper in which you1.Assess the types of chan.docxkeilenettie
 
Write a 350-to 700-word paper in which you investigate the inter.docx
Write a 350-to 700-word paper in which you investigate the inter.docxWrite a 350-to 700-word paper in which you investigate the inter.docx
Write a 350-to 700-word paper in which you investigate the inter.docxkeilenettie
 
Write a 350- to 700-word paper in which you do the followingExp.docx
Write a 350- to 700-word paper in which you do the followingExp.docxWrite a 350- to 700-word paper in which you do the followingExp.docx
Write a 350- to 700-word paper in which you do the followingExp.docxkeilenettie
 
Write a 350- to 700-word summary in which you do the followingI.docx
Write a 350- to 700-word summary in which you do the followingI.docxWrite a 350- to 700-word summary in which you do the followingI.docx
Write a 350- to 700-word summary in which you do the followingI.docxkeilenettie
 
write a 3-4 page paper that includes the followingA brief descr.docx
write a 3-4 page paper that includes the followingA brief descr.docxwrite a 3-4 page paper that includes the followingA brief descr.docx
write a 3-4 page paper that includes the followingA brief descr.docxkeilenettie
 
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docx
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docxWrite a 3-4 page apa formatted paper discribing Spacial light spectr.docx
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docxkeilenettie
 
Write a 3-4-page APA fomat paper explaining how elements of social n.docx
Write a 3-4-page APA fomat paper explaining how elements of social n.docxWrite a 3-4-page APA fomat paper explaining how elements of social n.docx
Write a 3-4-page APA fomat paper explaining how elements of social n.docxkeilenettie
 
Write a 3-4 page paper (APA) that addreses your views on the followi.docx
Write a 3-4 page paper (APA) that addreses your views on the followi.docxWrite a 3-4 page paper (APA) that addreses your views on the followi.docx
Write a 3-4 page paper (APA) that addreses your views on the followi.docxkeilenettie
 
Write a 3- to 5-page paper in which you do the followingDescrib.docx
Write a 3- to 5-page paper in which you do the followingDescrib.docxWrite a 3- to 5-page paper in which you do the followingDescrib.docx
Write a 3- to 5-page paper in which you do the followingDescrib.docxkeilenettie
 
Write a 3 page paper, double-spaced that addresses the followingE.docx
Write a 3 page paper, double-spaced that addresses the followingE.docxWrite a 3 page paper, double-spaced that addresses the followingE.docx
Write a 3 page paper, double-spaced that addresses the followingE.docxkeilenettie
 
Write a 3- to 4-page double spaced paper discussing the following.docx
Write a 3- to 4-page double spaced paper discussing the following.docxWrite a 3- to 4-page double spaced paper discussing the following.docx
Write a 3- to 4-page double spaced paper discussing the following.docxkeilenettie
 
Write a 3+ page, double-spaced essay regarding Albert Bandura.docx
Write a 3+ page, double-spaced essay regarding Albert Bandura.docxWrite a 3+ page, double-spaced essay regarding Albert Bandura.docx
Write a 3+ page, double-spaced essay regarding Albert Bandura.docxkeilenettie
 
Write a 3+ page, double-spaced essay regarding How can managers.docx
Write a 3+ page, double-spaced essay regarding How can managers.docxWrite a 3+ page, double-spaced essay regarding How can managers.docx
Write a 3+ page, double-spaced essay regarding How can managers.docxkeilenettie
 
Write a 3+ page, double-spaced essay regardingCompare and con.docx
Write a 3+ page, double-spaced essay regardingCompare and con.docxWrite a 3+ page, double-spaced essay regardingCompare and con.docx
Write a 3+ page, double-spaced essay regardingCompare and con.docxkeilenettie
 
Write a 260 -word summary about how individuals or groups attack S.docx
Write a 260 -word summary about how individuals or groups attack S.docxWrite a 260 -word summary about how individuals or groups attack S.docx
Write a 260 -word summary about how individuals or groups attack S.docxkeilenettie
 
Write a 200- to 350-word paragraph answering the following questio.docx
Write a 200- to 350-word paragraph answering the following questio.docxWrite a 200- to 350-word paragraph answering the following questio.docx
Write a 200- to 350-word paragraph answering the following questio.docxkeilenettie
 

More from keilenettie (20)

Write a 350-to 700-word paper in which you investigate the interre.docx
Write a 350-to 700-word paper in which you investigate the interre.docxWrite a 350-to 700-word paper in which you investigate the interre.docx
Write a 350-to 700-word paper in which you investigate the interre.docx
 
Write a 4+ page, double-spaced essay regardingExplain the importa.docx
Write a 4+ page, double-spaced essay regardingExplain the importa.docxWrite a 4+ page, double-spaced essay regardingExplain the importa.docx
Write a 4+ page, double-spaced essay regardingExplain the importa.docx
 
Write a 350-word paper and be prepared to present in class discussin.docx
Write a 350-word paper and be prepared to present in class discussin.docxWrite a 350-word paper and be prepared to present in class discussin.docx
Write a 350-word paper and be prepared to present in class discussin.docx
 
Write a 300-word summary that addresses the following criteriaDef.docx
Write a 300-word summary that addresses the following criteriaDef.docxWrite a 300-word summary that addresses the following criteriaDef.docx
Write a 300-word summary that addresses the following criteriaDef.docx
 
Write a 4 page paper in which you1.Assess the types of chan.docx
Write a 4 page paper in which you1.Assess the types of chan.docxWrite a 4 page paper in which you1.Assess the types of chan.docx
Write a 4 page paper in which you1.Assess the types of chan.docx
 
Write a 350-to 700-word paper in which you investigate the inter.docx
Write a 350-to 700-word paper in which you investigate the inter.docxWrite a 350-to 700-word paper in which you investigate the inter.docx
Write a 350-to 700-word paper in which you investigate the inter.docx
 
Write a 350- to 700-word paper in which you do the followingExp.docx
Write a 350- to 700-word paper in which you do the followingExp.docxWrite a 350- to 700-word paper in which you do the followingExp.docx
Write a 350- to 700-word paper in which you do the followingExp.docx
 
Write a 350- to 700-word summary in which you do the followingI.docx
Write a 350- to 700-word summary in which you do the followingI.docxWrite a 350- to 700-word summary in which you do the followingI.docx
Write a 350- to 700-word summary in which you do the followingI.docx
 
write a 3-4 page paper that includes the followingA brief descr.docx
write a 3-4 page paper that includes the followingA brief descr.docxwrite a 3-4 page paper that includes the followingA brief descr.docx
write a 3-4 page paper that includes the followingA brief descr.docx
 
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docx
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docxWrite a 3-4 page apa formatted paper discribing Spacial light spectr.docx
Write a 3-4 page apa formatted paper discribing Spacial light spectr.docx
 
Write a 3-4-page APA fomat paper explaining how elements of social n.docx
Write a 3-4-page APA fomat paper explaining how elements of social n.docxWrite a 3-4-page APA fomat paper explaining how elements of social n.docx
Write a 3-4-page APA fomat paper explaining how elements of social n.docx
 
Write a 3-4 page paper (APA) that addreses your views on the followi.docx
Write a 3-4 page paper (APA) that addreses your views on the followi.docxWrite a 3-4 page paper (APA) that addreses your views on the followi.docx
Write a 3-4 page paper (APA) that addreses your views on the followi.docx
 
Write a 3- to 5-page paper in which you do the followingDescrib.docx
Write a 3- to 5-page paper in which you do the followingDescrib.docxWrite a 3- to 5-page paper in which you do the followingDescrib.docx
Write a 3- to 5-page paper in which you do the followingDescrib.docx
 
Write a 3 page paper, double-spaced that addresses the followingE.docx
Write a 3 page paper, double-spaced that addresses the followingE.docxWrite a 3 page paper, double-spaced that addresses the followingE.docx
Write a 3 page paper, double-spaced that addresses the followingE.docx
 
Write a 3- to 4-page double spaced paper discussing the following.docx
Write a 3- to 4-page double spaced paper discussing the following.docxWrite a 3- to 4-page double spaced paper discussing the following.docx
Write a 3- to 4-page double spaced paper discussing the following.docx
 
Write a 3+ page, double-spaced essay regarding Albert Bandura.docx
Write a 3+ page, double-spaced essay regarding Albert Bandura.docxWrite a 3+ page, double-spaced essay regarding Albert Bandura.docx
Write a 3+ page, double-spaced essay regarding Albert Bandura.docx
 
Write a 3+ page, double-spaced essay regarding How can managers.docx
Write a 3+ page, double-spaced essay regarding How can managers.docxWrite a 3+ page, double-spaced essay regarding How can managers.docx
Write a 3+ page, double-spaced essay regarding How can managers.docx
 
Write a 3+ page, double-spaced essay regardingCompare and con.docx
Write a 3+ page, double-spaced essay regardingCompare and con.docxWrite a 3+ page, double-spaced essay regardingCompare and con.docx
Write a 3+ page, double-spaced essay regardingCompare and con.docx
 
Write a 260 -word summary about how individuals or groups attack S.docx
Write a 260 -word summary about how individuals or groups attack S.docxWrite a 260 -word summary about how individuals or groups attack S.docx
Write a 260 -word summary about how individuals or groups attack S.docx
 
Write a 200- to 350-word paragraph answering the following questio.docx
Write a 200- to 350-word paragraph answering the following questio.docxWrite a 200- to 350-word paragraph answering the following questio.docx
Write a 200- to 350-word paragraph answering the following questio.docx
 

Recently uploaded

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 

Previous weeks work has been uploaded as well as any other pieces ne.docx

  • 1. Previous weeks work has been uploaded as well as any other pieces needed. Deliverables All files are located in the subdirectory of the project. The project should function as specified: When you visit the Personnel form page (frmPersonnel.aspx), a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the View Activity button, you should see at least one record with this information. When the user goes to the frmPersonnel web form and enters data, the following business rules are to be enforced. Fields may not be empty or filled with spaces. If any field is empty, turn that field background color to yellow and add to/create an error message to be shown in the error label. The end date must be greater than the start date. If the end date is less than the start date turn both date fields yellow and add to/create an error message to be shown in the error label. If all fields validate properly, then the session state items should be set properly and the user should see the frmPersonnelVerified form with all the values displayed. You will also add a new item to frmMain that will take the user to the new frmUserActivity form you added. Add the proper link and a hyperlinked image to allow the user to select this new option. Once you have verified that everything works, save your website, zip up all files, and submit it.
  • 2. STEP 1: Step Title 1. Open Microsoft Visual Studio.NET. 2. Open the PayrollSystem website by clicking on it in the Recent Projects list, or by pulling down the File menu, selecting Open Website, navigating to the folder where you previously saved the PayrollSystem, and clicking Open. 3. Download the PayrollSystem_DB.accdb file from the Files section and save it on your local computer. (Note: your operating system may lock or block the file. Once you have copied it locally, right click on the file and select Properties and then Unblock if available). Then add it to the PayrollSystem website as follows: In Visual Studio, in the Solution Explorer click Website, Add Existing Item, then navigate to the PayrollSystem_DB.accdb file you downloaded, and click the Add button. Make sure you select file types, which include *.accdb, *.accdb, etc. Otherwise, you will not be able to see the database file to select. 4. Now we need to create a new connection to the
  • 3. PayrollSystem_DB.accdb. To begin, click View Server Explorer. 5. When the Server Explorer toolbox appears, click the Connect to Database button. 6. When the Add Connection dialog appears, click the Change button. In the Change Data Source dialog, select MS Access Database File; Uncheck Always use this Selection; then click OK. Press Continue to get the following screen. 7. Click the Browse button to navigate to the PayrollSystem_DB.accdb file in your website folder, then click Open. (NOTE: Be sure you select the PayrollSystem_DB.accdb file in your PayrollSystem website folder, not the one you originally downloaded from the Files section). Click Test Connection. You should receive a message that the test connection succeeded. Click OK to acknowledge the message, then click OK again to close the Add Connection dialog.
  • 4. 8. The PayrollSystemDB.accdb should be added to the Server Explorer. Expand the database, then expand the Tables entry under the database until you see tblUserActivity. Leave the Server Explorer window open for now as you will be returning to it in a moment. 9. Create a new dataset by selecting Website-> Add New Item. Under Templates, select the Dataset item. Enter dsUserActivity.xsd for the name. Click Add. 10. If the following message appears, select Yes. You want to make this dataset available to your entire website. 11. If the TableAdapter Configuration Wizard dialog appears, click Cancel. (We will be configuring a Data Adapter for this dataset later in C# code, so we do not need to run this wizard.) 12. Drag-and-drop the tblUserActivity table from the Server Explorer window into the dsUserActivity dataset in the editor window.
  • 5. NOTE: If you see a message that says your connection uses a local data file that is not in the current project, that indicates you did not select the correct PayrollSystem_DB.accdb file when you created your data connection. To fix this problem, click No, then right-click on PayrollSystemDB.accdb in the Server Explorer window and choose Modify Connection. Click the Browse button, navigate to the PayrollSystemDB.accdb file that is in your PayrollSystem website folder, and click Open. Test the connection, then click OK. Click the Save icon on the toolbar to save the dsUserActivity.xsd dataset. (You can now close the Server Explorer window if you wish.) 13. Create a new class to contain the C# code that will access this dataset. To do so, click Website, Add New Item. In the Add New Item dialog, select the Class template, and enter clsDataLayer for the name. Make sure the Language is set to Visual C#. Click Add. 14. If the following message appears, select Yes. You want to make this class available to everything in your solution.
  • 6. 15. Add the following to the top of your class, below any other using statements created for you by Visual Studio. Add to top of class // Add your comments here using System.Data.OleDb; using System.Net; using System.Data; 16. Add the following three functions inside the squiggly braces for the public class clsDataLayer class, above the beginning of the public clsDataLayer() constructor and save the class. Class // This function gets the user activity from the tblUserActivity
  • 7. public static dsUserActivity GetUserActivity(string Database) { // Add your comments here dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Add your comments here sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;"
  • 8. + "Data Source=" + Database); // Add your comments here sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Add your comments here DS = new dsUserActivity(); // Add your comments here sqlDA.Fill(DS.tblUserActivity); // Add your comments here
  • 9. return DS; } // This function saves the user activity public static void SaveUserActivity(string Database, string FormAccessed) { // Add your comments here OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database);
  • 10. conn.Open(); OleDbCommand command = conn.CreateCommand(); string strSQL; strSQL = "Insert into tblUserActivity (UserIP, FormAccessed) values ('" + GetIP4Address() + "', '" + FormAccessed + "')"; command.CommandType = CommandType.Text; command.CommandText = strSQL; command.ExecuteNonQuery();
  • 11. conn.Close(); } // This function gets the IP Address public static string GetIP4Address() { string IP4Address = string.Empty ; foreach (IPAddress IPA in Dns.GetHostAddresses(HttpContext.Current.Request.UserHostA ddress)) {
  • 12. if (IPA.AddressFamily.ToString() == "InterNetwork") { IP4Address = IPA.ToString(); break; } } if (IP4Address != string.Empty) { return IP4Address; }
  • 13. foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName())) { if (IPA.AddressFamily.ToString() == "InterNetwork") { IP4Address = IPA.ToString(); break; } } return IP4Address; }
  • 14. STEP 2: frmUserActivity, frmPersonnel, frmMain 17. Create a new web form called frmUserActivity. Switch to Design Mode and add the ACIT logo to the page as an ImageButton and link it back to frmMain. Below the image button add a panel. To the panel, add a Label and GridView (found under the Toolbox, Data tab) having the following properties. PropertyValueLabel – TextUser ActivityGridView – (ID)grdUserActivity 18. Go to the Page_Load method by double clicking an empty space on the page and add the following code. Page_Load method for frmUserActivity.aspx if (!Page.IsPostBack) { // Declares the DataSet dsUserActivity myDataSet = new dsUserActivity();
  • 15. // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_ DB.accdb")); // Sets the DataGrid to the DataSource based on the table grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); }
  • 16. 19. Open the frmMain form, add a new link button and image button to point to the new frmUserActivity. Find an image to use for the image button and add the new option as View User Activity. 20. Go to the frmMain Page_Load and add the following code. frmMain.aspx Page_Load code // Add your comments here clsDataLayer.SaveUserActivity(Server.MapPath("PayrollSystem _DB.accdb"), "frmPersonnel"); 21. In the