• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

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

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
mgcarney
Asked:
mgcarney
  • 14
  • 11
1 Solution
 
ktrimmerCommented:
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
 
mgcarneyAuthor Commented:
Yes all of your assumptions are correct.
0
 
mgcarneyAuthor Commented:
sql database
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
ktrimmerCommented:
What program do you plan to develop this in?

Visual Studio,Front page, dreamweaver, or by hand?
0
 
mgcarneyAuthor Commented:
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
 
ktrimmerCommented:
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
 
mgcarneyAuthor Commented:
well the only person besides myself having access at all is the HR Manager....
0
 
ktrimmerCommented:
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
 
ktrimmerCommented:
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
 
ktrimmerCommented:
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
 
ktrimmerCommented:
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
 
ktrimmerCommented:
Let me know when you get this far
0
 
mgcarneyAuthor Commented:
OK done, but I am getting an access denied error
0
 
ktrimmerCommented:
Are the error coming from when you veiw the web page. is it an SQL error or is it a windows error.
0
 
mgcarneyAuthor Commented:
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
 
mgcarneyAuthor Commented:
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
 
ktrimmerCommented:
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
 
mgcarneyAuthor Commented:
own server but I did that a very long time ago
0
 
ktrimmerCommented:
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
 
mgcarneyAuthor Commented:
yep see it fine
0
 
ktrimmerCommented:
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
 
mgcarneyAuthor Commented:
OK done....now what?
0
 
ktrimmerCommented:
Do you see a table of data from the .aspx page.?
0
 
mgcarneyAuthor Commented:
yes I do
0
 
ktrimmerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 14
  • 11
Tackle projects and never again get stuck behind a technical roadblock.
Join Now