SlideShare a Scribd company logo
CIS407AWk2iLab/Default.aspx
Greetings and Salutations. I will master ASP.NET in this
course.
CIS407AWk2iLab/Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
CIS407AWk2iLab/frmMain.aspx
Academy of Computing and Information Technology
Annual Salary Calculator
Personnel
CIS407AWk2iLab/frmMain.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmMain : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
CIS407AWk2iLab/frmPersonnel.aspx
Academy of Computing and Information Technology
CIS407AWk2iLab/frmPersonnel.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmPersonnel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender,
EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
}
CIS407AWk2iLab/frmPersonnelVerified.aspx
Academy of Computing and Information Technology
CIS407AWk2iLab/frmPersonnelVerified.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmPersonnelVerified : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtVerifiedInfo.Text = Request["txtFirstName"] +
"n" + Request["txtLastName"] +
"n" + Request["txtPayRate"] +
"n" + Request["txtStartDate"] +
"n" + Request["txtEndDate"];
}
}
CIS407AWk2iLab/frmSalaryCalculator.aspx
Academy of Computing and Information Technology
CIS407AWk2iLab/frmSalaryCalculator.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmSalaryCalculator : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCalculateSalary_Click(object sender,
EventArgs e)
{
double AnnualHours =
Double.Parse(txtAnnualHours.Text);
double PayRate = Double.Parse(txtPayRate.Text);
double AnnualSalary = AnnualHours * PayRate;
lblAnnualSalary.Text = "Annual Salary is $" +
AnnualSalary.ToString("N");
}
}
CIS407AWk2iLab/Images/calculator.jpg
CIS407AWk2iLab/Images/CIS407A_iLab_ACITLogo.jpg
CIS407AWk2iLab/Images/computer monkey.jpg
CIS407AWk2iLab/Images/editemployees.jpg
CIS407AWk2iLab/Images/employees.jpg
CIS407AWk2iLab/Images/manageusers.jpg
CIS407AWk2iLab/Images/newemployee.jpg
CIS407AWk2iLab/Images/personnel.png
CIS407AWk2iLab/Images/search.jpg
CIS407AWk2iLab/Images/userActivity.jpg
CIS407AWk2iLab/Web.config
CIS407AWk2iLab/Web.Debug.config
iLabwk3.docx
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 Doc
Sharing 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 Doc Sharing!) 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.
Property
Value
Label – Text
User Activity
GridView – (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 CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx

Lampstack (1)
Lampstack (1)Lampstack (1)
Lampstack (1)
ShivamKumar773
 
Database By Salman Mushtaq
Database By Salman MushtaqDatabase By Salman Mushtaq
Database By Salman Mushtaq
Salman Mushtaq
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
oazabir
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
Clinton Dreisbach
 
Android sql examples
Android sql examplesAndroid sql examples
Android sql examples
Aravindharamanan S
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
Rebecca Peltz
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
Sébastien Levert
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XS
Blackvard
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
Narayana Reddy
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
Narayana Reddy
 
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
ravi yadav
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
laxmi.katkar
 
Salesforce and sap integration
Salesforce and sap integrationSalesforce and sap integration
Salesforce and sap integration
Karanraj Sankaranarayanan
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
Sarvesh Kushwaha
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
Joshua Long
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
prathap kumar
 
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
perryk1
 
exa_cer_g23
exa_cer_g23exa_cer_g23
exa_cer_g23
Agustin Zazueta
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 

Similar to CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx (20)

Lampstack (1)
Lampstack (1)Lampstack (1)
Lampstack (1)
 
Database By Salman Mushtaq
Database By Salman MushtaqDatabase By Salman Mushtaq
Database By Salman Mushtaq
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Android sql examples
Android sql examplesAndroid sql examples
Android sql examples
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XS
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
 
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
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 
Salesforce and sap integration
Salesforce and sap integrationSalesforce and sap integration
Salesforce and sap integration
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
 
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
 
exa_cer_g23
exa_cer_g23exa_cer_g23
exa_cer_g23
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
 

More from clarebernice

Consider the vision for a successful Southwest Transit marketing tea.docx
Consider the vision for a successful Southwest Transit marketing tea.docxConsider the vision for a successful Southwest Transit marketing tea.docx
Consider the vision for a successful Southwest Transit marketing tea.docx
clarebernice
 
Consider the various ways to create effective communication in teams.docx
Consider the various ways to create effective communication in teams.docxConsider the various ways to create effective communication in teams.docx
Consider the various ways to create effective communication in teams.docx
clarebernice
 
consider the unique and varied forms of slaveryenslavement in Afric.docx
consider the unique and varied forms of slaveryenslavement in Afric.docxconsider the unique and varied forms of slaveryenslavement in Afric.docx
consider the unique and varied forms of slaveryenslavement in Afric.docx
clarebernice
 
Consider the types of digital technology advances that exist and how.docx
Consider the types of digital technology advances that exist and how.docxConsider the types of digital technology advances that exist and how.docx
Consider the types of digital technology advances that exist and how.docx
clarebernice
 
Consider the two following statements Photosynthesis and cellular .docx
Consider the two following statements Photosynthesis and cellular .docxConsider the two following statements Photosynthesis and cellular .docx
Consider the two following statements Photosynthesis and cellular .docx
clarebernice
 
Consider the study on Ethnography you described last week, Remind us.docx
Consider the study on Ethnography you described last week, Remind us.docxConsider the study on Ethnography you described last week, Remind us.docx
Consider the study on Ethnography you described last week, Remind us.docx
clarebernice
 
Consider the role of HR in a rapidly-changing world. What cha.docx
Consider the role of HR in a rapidly-changing world. What cha.docxConsider the role of HR in a rapidly-changing world. What cha.docx
Consider the role of HR in a rapidly-changing world. What cha.docx
clarebernice
 
Consider the scenarios involving the unwilling moral agents of J.docx
Consider the scenarios involving the unwilling moral agents of J.docxConsider the scenarios involving the unwilling moral agents of J.docx
Consider the scenarios involving the unwilling moral agents of J.docx
clarebernice
 
Consider the scenario below.A toxic waste dump company wants to .docx
Consider the scenario below.A toxic waste dump company wants to .docxConsider the scenario below.A toxic waste dump company wants to .docx
Consider the scenario below.A toxic waste dump company wants to .docx
clarebernice
 
Consider the role of interest groups in the policy-making process, w.docx
Consider the role of interest groups in the policy-making process, w.docxConsider the role of interest groups in the policy-making process, w.docx
Consider the role of interest groups in the policy-making process, w.docx
clarebernice
 
Consider the role of stakeholders in addressing a health problem a.docx
Consider the role of stakeholders in addressing a health problem a.docxConsider the role of stakeholders in addressing a health problem a.docx
Consider the role of stakeholders in addressing a health problem a.docx
clarebernice
 
Consider the quote by Adam Fuss in this module in which he describes.docx
Consider the quote by Adam Fuss in this module in which he describes.docxConsider the quote by Adam Fuss in this module in which he describes.docx
Consider the quote by Adam Fuss in this module in which he describes.docx
clarebernice
 
Consider the obstacles that Phoenix Jackson had to overcome on h.docx
Consider the obstacles that Phoenix Jackson had to overcome on h.docxConsider the obstacles that Phoenix Jackson had to overcome on h.docx
Consider the obstacles that Phoenix Jackson had to overcome on h.docx
clarebernice
 
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docxConsider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
clarebernice
 
Consider the music business as a supply network. How has music d.docx
Consider the music business as a supply network. How has music d.docxConsider the music business as a supply network. How has music d.docx
Consider the music business as a supply network. How has music d.docx
clarebernice
 
Consider the mean of a cluster of objects from a binary transact.docx
Consider the mean of a cluster of objects from a binary transact.docxConsider the mean of a cluster of objects from a binary transact.docx
Consider the mean of a cluster of objects from a binary transact.docx
clarebernice
 
Consider the importance of using a variety of assessments in the.docx
Consider the importance of using a variety of assessments in the.docxConsider the importance of using a variety of assessments in the.docx
Consider the importance of using a variety of assessments in the.docx
clarebernice
 
Consider the importance of visuals in connecting with an audienc.docx
Consider the importance of visuals in connecting with an audienc.docxConsider the importance of visuals in connecting with an audienc.docx
Consider the importance of visuals in connecting with an audienc.docx
clarebernice
 
Consider the imagery you created in your mind as you interacted with.docx
Consider the imagery you created in your mind as you interacted with.docxConsider the imagery you created in your mind as you interacted with.docx
Consider the imagery you created in your mind as you interacted with.docx
clarebernice
 
Consider the followingContrast Soviet and post-Soviet migration.docx
Consider the followingContrast Soviet and post-Soviet migration.docxConsider the followingContrast Soviet and post-Soviet migration.docx
Consider the followingContrast Soviet and post-Soviet migration.docx
clarebernice
 

More from clarebernice (20)

Consider the vision for a successful Southwest Transit marketing tea.docx
Consider the vision for a successful Southwest Transit marketing tea.docxConsider the vision for a successful Southwest Transit marketing tea.docx
Consider the vision for a successful Southwest Transit marketing tea.docx
 
Consider the various ways to create effective communication in teams.docx
Consider the various ways to create effective communication in teams.docxConsider the various ways to create effective communication in teams.docx
Consider the various ways to create effective communication in teams.docx
 
consider the unique and varied forms of slaveryenslavement in Afric.docx
consider the unique and varied forms of slaveryenslavement in Afric.docxconsider the unique and varied forms of slaveryenslavement in Afric.docx
consider the unique and varied forms of slaveryenslavement in Afric.docx
 
Consider the types of digital technology advances that exist and how.docx
Consider the types of digital technology advances that exist and how.docxConsider the types of digital technology advances that exist and how.docx
Consider the types of digital technology advances that exist and how.docx
 
Consider the two following statements Photosynthesis and cellular .docx
Consider the two following statements Photosynthesis and cellular .docxConsider the two following statements Photosynthesis and cellular .docx
Consider the two following statements Photosynthesis and cellular .docx
 
Consider the study on Ethnography you described last week, Remind us.docx
Consider the study on Ethnography you described last week, Remind us.docxConsider the study on Ethnography you described last week, Remind us.docx
Consider the study on Ethnography you described last week, Remind us.docx
 
Consider the role of HR in a rapidly-changing world. What cha.docx
Consider the role of HR in a rapidly-changing world. What cha.docxConsider the role of HR in a rapidly-changing world. What cha.docx
Consider the role of HR in a rapidly-changing world. What cha.docx
 
Consider the scenarios involving the unwilling moral agents of J.docx
Consider the scenarios involving the unwilling moral agents of J.docxConsider the scenarios involving the unwilling moral agents of J.docx
Consider the scenarios involving the unwilling moral agents of J.docx
 
Consider the scenario below.A toxic waste dump company wants to .docx
Consider the scenario below.A toxic waste dump company wants to .docxConsider the scenario below.A toxic waste dump company wants to .docx
Consider the scenario below.A toxic waste dump company wants to .docx
 
Consider the role of interest groups in the policy-making process, w.docx
Consider the role of interest groups in the policy-making process, w.docxConsider the role of interest groups in the policy-making process, w.docx
Consider the role of interest groups in the policy-making process, w.docx
 
Consider the role of stakeholders in addressing a health problem a.docx
Consider the role of stakeholders in addressing a health problem a.docxConsider the role of stakeholders in addressing a health problem a.docx
Consider the role of stakeholders in addressing a health problem a.docx
 
Consider the quote by Adam Fuss in this module in which he describes.docx
Consider the quote by Adam Fuss in this module in which he describes.docxConsider the quote by Adam Fuss in this module in which he describes.docx
Consider the quote by Adam Fuss in this module in which he describes.docx
 
Consider the obstacles that Phoenix Jackson had to overcome on h.docx
Consider the obstacles that Phoenix Jackson had to overcome on h.docxConsider the obstacles that Phoenix Jackson had to overcome on h.docx
Consider the obstacles that Phoenix Jackson had to overcome on h.docx
 
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docxConsider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
Consider the nurse leader’s role in achieving the IHI Quadruple Ai.docx
 
Consider the music business as a supply network. How has music d.docx
Consider the music business as a supply network. How has music d.docxConsider the music business as a supply network. How has music d.docx
Consider the music business as a supply network. How has music d.docx
 
Consider the mean of a cluster of objects from a binary transact.docx
Consider the mean of a cluster of objects from a binary transact.docxConsider the mean of a cluster of objects from a binary transact.docx
Consider the mean of a cluster of objects from a binary transact.docx
 
Consider the importance of using a variety of assessments in the.docx
Consider the importance of using a variety of assessments in the.docxConsider the importance of using a variety of assessments in the.docx
Consider the importance of using a variety of assessments in the.docx
 
Consider the importance of visuals in connecting with an audienc.docx
Consider the importance of visuals in connecting with an audienc.docxConsider the importance of visuals in connecting with an audienc.docx
Consider the importance of visuals in connecting with an audienc.docx
 
Consider the imagery you created in your mind as you interacted with.docx
Consider the imagery you created in your mind as you interacted with.docxConsider the imagery you created in your mind as you interacted with.docx
Consider the imagery you created in your mind as you interacted with.docx
 
Consider the followingContrast Soviet and post-Soviet migration.docx
Consider the followingContrast Soviet and post-Soviet migration.docxConsider the followingContrast Soviet and post-Soviet migration.docx
Consider the followingContrast Soviet and post-Soviet migration.docx
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 

CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx

  • 1. CIS407AWk2iLab/Default.aspx Greetings and Salutations. I will master ASP.NET in this course. CIS407AWk2iLab/Default.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }
  • 2. CIS407AWk2iLab/frmMain.aspx Academy of Computing and Information Technology Annual Salary Calculator Personnel CIS407AWk2iLab/frmMain.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web;
  • 3. using System.Web.UI; using System.Web.UI.WebControls; public partial class frmMain : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } CIS407AWk2iLab/frmPersonnel.aspx Academy of Computing and Information Technology
  • 5. using System.Web.UI.WebControls; public partial class frmPersonnel : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void TextBox2_TextChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { } } CIS407AWk2iLab/frmPersonnelVerified.aspx
  • 6. Academy of Computing and Information Technology CIS407AWk2iLab/frmPersonnelVerified.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class frmPersonnelVerified : System.Web.UI.Page {
  • 7. protected void Page_Load(object sender, EventArgs e) { txtVerifiedInfo.Text = Request["txtFirstName"] + "n" + Request["txtLastName"] + "n" + Request["txtPayRate"] + "n" + Request["txtStartDate"] + "n" + Request["txtEndDate"]; } } CIS407AWk2iLab/frmSalaryCalculator.aspx Academy of Computing and Information Technology
  • 8. CIS407AWk2iLab/frmSalaryCalculator.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class frmSalaryCalculator : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e)
  • 9. { } protected void btnCalculateSalary_Click(object sender, EventArgs e) { double AnnualHours = Double.Parse(txtAnnualHours.Text); double PayRate = Double.Parse(txtPayRate.Text); double AnnualSalary = AnnualHours * PayRate; lblAnnualSalary.Text = "Annual Salary is $" + AnnualSalary.ToString("N"); } } CIS407AWk2iLab/Images/calculator.jpg CIS407AWk2iLab/Images/CIS407A_iLab_ACITLogo.jpg CIS407AWk2iLab/Images/computer monkey.jpg CIS407AWk2iLab/Images/editemployees.jpg CIS407AWk2iLab/Images/employees.jpg
  • 10. CIS407AWk2iLab/Images/manageusers.jpg CIS407AWk2iLab/Images/newemployee.jpg CIS407AWk2iLab/Images/personnel.png CIS407AWk2iLab/Images/search.jpg CIS407AWk2iLab/Images/userActivity.jpg CIS407AWk2iLab/Web.config CIS407AWk2iLab/Web.Debug.config iLabwk3.docx 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 Doc Sharing 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
  • 11. 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.
  • 12. 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 Doc Sharing!) 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.)
  • 13. 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.
  • 14. 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);
  • 15. // 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();
  • 16. 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;
  • 17. } 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. Property Value Label – Text User Activity GridView – (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"));
  • 18. // 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