Solved

Help with setting up a employee attendance interface.....

Posted on 2004-09-10
28
230 Views
Last Modified: 2008-03-06
I am setting up an employee interface to keep track of start date, salary, hourly pay rate, vacation days, sick days (adding and subtracting), etc....  Can anyone point me into the right direction for some tutorial or something that will help out with this project?

Greatly appreciated...
0
Comment
Question by:mgcarney
  • 14
  • 11
28 Comments
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12045245
I am assuming that you are planning this to be a web-based application correct?

Is this going to be an Intranet site or an extranet site? (This choice will decide the type of security you will have)

I am also assuming that you plan to use a database to hold this information correct?

I am also assuming that the database is not created correct?

So First things first.
1. Create your database (ms-Access, MS-Sql, or MYSQL)

Let me know if my assumtions are correct and what type of database you wish to use then we will go from there.


0
 
LVL 1

Author Comment

by:mgcarney
ID: 12045516
Yes all of your assumptions are correct.
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12045529
sql database
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12045570
What program do you plan to develop this in?

Visual Studio,Front page, dreamweaver, or by hand?
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12045598
front page and also I have set up the input for the employees, but now I need to know how to query the database and pull all of the employees up on a page, and each name with a link to their own.
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12045644
I am assuming that you don't want employees to see each others information. So, we will need to have some type of log in.
Are your user all authenticaing to a windows domain? Or do you want them to fill out a login form. ?
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12045659
well the only person besides myself having access at all is the HR Manager....
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12045709
That being the case, you can always just set the securtiy on the folder in which the file is stored in.

Okay, let me process this I get back to you soon.
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12046017
Okay 1st step
build your database.

Run this in Quary Analyzer

CREATE TABLE [dbo].[Employee] (
      [Id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
      [Start_Date] [datetime] NULL ,
      [Salary] [money] NULL ,
      [Pay_Rate] [decimal](18, 0) NULL ,
      [Total_Vac_Days] [int] NULL ,
      [Used_Vac_Days] [int] NULL ,
      [Total_Sck_Days] [int] NULL ,
      [Used_Sck_Days] [int] NULL ,
      [First_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Middle_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Last_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Soc_Num] [varchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

You can make changes as needed.
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12046079
Step Two
Put a test record in your database. Just open it up and fill in a record.

Step Three. Set up Authentication - Becuase we are using windows security, All we need to do is make a change in our Web.Config File. So,
1. At the root of your web site, add a file called Web.Config
Place this block of text in your file.

<configuration>
      <system.web>
            <identity impersonate="true" />
            <authorization>
                  <allow roles="DomainName\DomainGroup" />
                  <deny users="*" />
            </authorization>
      </system.web>
</configuration>

2. Change the Allow Roles section to match your domain. This allows only the group you identify and denies all other users.
3.Remove Anonymus users from IIS.
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12046127
Step Three Test to make sure that your database and Web Server are going to function properly

1. create the page listed below.

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<Script runat="server">

Sub Page_Load
      Dim ConEmployees as SQLConnection
      Dim cmdSQL as SQLCommand
            
      ConEmployees = New SQLConnection ("Server=DatabaseServer;Database=DatabaseName;Integrated Security=SSPI")
      cmdSQL = New SQLCommand ("Select * from Employee",ConEmployees)
      ConEmployees.Open()
      dgrdEmployees.Datasource = cmdSQL.Executereader()
      dgrdEmployees.Databind()
      ConEmployees.Close()
End Sub

</Script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<asp:DataGrid
      ID="dgrdEmployees"
      Runat=Server />
</body>
</html>

2. change this line
ConEmployees = New SQLConnection ("Server=DatabaseServer;Database=DatabaseName;Integrated Security=SSPI")
to match the name of your database server and database name. The Integrated Security means that it uses windows authentication.

3. Browse out to your page and make sure you don't get any errors. You should see a table of you information.
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12046130
Let me know when you get this far
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Author Comment

by:mgcarney
ID: 12046676
OK done, but I am getting an access denied error
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12046723
Are the error coming from when you veiw the web page. is it an SQL error or is it a windows error.
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12046773
You are not authorized to view this page
You do not have permission to view this directory or page using the credentials that you supplied.
--------------------------------------------------------------------------------

Please try the following:

Contact the Web site administrator if you believe you should be able to view this directory or page.
Click the Refresh button to try again with different credentials.
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Authentication, Access Control, and About Custom Error Messages.  
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12046791
Server Error in '/' Application.
--------------------------------------------------------------------------------

Access is denied.
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

Error message 401.2.: You do not have permission to view this directory or page using the credentials you supplied. Contact the Web server's administrator for help.

0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12047290
It looks like you need to goto the folder that has your website. Rigth Click , goto properties, on the security Tab, Add the group you want to have access to this site.

Just a thought, are you hosting this site on your own server or is someone else hosting it?
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12047322
own server but I did that a very long time ago
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12047381
Try createing this page called test.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
test
</body>
</html>

See if you can browse out to it. or check to see if you get the permission error
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12047404
yep see it fine
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12047447
Double check to make sure your useer account has access to that folder, give yourself full control for now. Also add the following account.

ASP.NET Machine acocunt

Give that account
Read & Execute
List Folders
Read
Write

Then try the page again.
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12049853
OK done....now what?
0
 
LVL 1

Expert Comment

by:ktrimmer
ID: 12054521
Do you see a table of data from the .aspx page.?
0
 
LVL 1

Author Comment

by:mgcarney
ID: 12056455
yes I do
0
 
LVL 1

Accepted Solution

by:
ktrimmer earned 50 total points
ID: 12065806
Okay Replace the .net page I gave you above with this.  This only edits to of the fields but you should be able to look at the context and add the appropiate code for you database.

It appears to me that you might not be the strongest ASP.net Coder. Therefore let me make a few recomendations.
1. Buy a good book on ASP.Net and read it.
2. Think about switching to dreamweaver. It automates a lot of the coding for you and makes things a whole lot easier on you. It's not the web developers dream but it is a middle ground between front page and visual studio.net.

Here's that block of Code.

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<Script runat="server">
Dim ConEmployees as SQLConnection
Dim cmdSQL as SQLCommand
Dim strSQL as String
Sub Page_Load
      ConEmployees = New SQLConnection ("Server=PVweb01;Database=Test;Integrated Security=SSPI")

IF Not IsPostBack Then
      BindDataGrid
End IF
End Sub

Sub BindDatagrid
      cmdSQL = New SQLCommand ("Select * from Employee",ConEmployees)
      ConEmployees.Open()
      dgrdEmployees.Datasource = cmdSQL.Executereader()
      dgrdEmployees.Databind()
      ConEmployees.Close()
      
End Sub

Sub dgrdEmployees_EditCommand( S As object, e as DatagridCommandEventArgs )
dgrdEmployees.editItemIndex = e.item.Itemindex
BindDataGrid
End Sub

Sub dgrdEmployees_UpdateCommand (s as Object, e as DataGridCommandEventArgs )
Dim intIndex as Integer
Dim txtFirstName as textbox
Dim strFirstName as string
Dim txtLastName as textbox
Dim strLastName as String

Dim cmdSQL as SQLCommand

intIndex = dgrdEmployees.datakeys (e.Item.ItemIndex )
txtFirstName = e.item.cells( 1 ).Controls( 0 )
TxtLastname = e.item.cells( 0 ).Controls( 0 )
strFirstName  = txtFirstName.text
StrLastName = txtLastName.text

strSQL = "Update Employee Set First_Name=@FirstName, Last_Name=@LastName Where Id=@Index"
cmdSQL= New SQLCommand (strSQL, conEmployees )
cmdSQL.Parameters.add( "@FirstName", strFirstname )
CmdSql.Parameters.add( "@LastName", strLastName )
cmdSql.parameters.add( "@Index", intIndex )
ConEmployees.Open()
CmdSQL.ExecuteNonQuery ()
conEmployees.Close()
dgrdEmployees.EditItemIndex = -1
BindDatagrid
End sub

Sub dgrdEmployees_CancelCommand (s as object, e as datagridcommandeventargs )
      dgrdEmployees.editItemIndex = -1
      BindDatagrid
End Sub

</Script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form runat="server">
<asp:DataGrid
      ID="dgrdEmployees"
      Autogeneratecolumns="False"
      OnEditCommand="dgrdEmployees_EditCommand"
      OnupdateCommand="dgrdEmployees_UpdateCommand"
      OnCAncelCommand="dgrdEmployees_CancelCommand"
      DatakeyField="ID"
      Runat=Server>
      <Columns>
            <asp:boundColumn Datafield="Last_Name"
                  HeaderText="Last Name"/>
            <asp:BoundColumn DataField="First_Name"
                  HeaderText="First Name"/>
            <asp:EditCommandColumn
                  EditText="Edit"
                  UpdateText="Update"
                  CancelText="Cancel" />
      
      </Columns>
      
</Asp:Datagrid>
</form>
</body>
</html>
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now