0% found this document useful (0 votes)
61 views7 pages

Projects PDF

Uploaded by

Rajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views7 pages

Projects PDF

Uploaded by

Rajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

projects

MasterPage.master :

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs"


Inherits="MasterPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color:aquamarine;color:brown; height:50px;">
<center><h1>Employee Management System</h1></center>
</div>
<div style="height:60px;">
<!--Menu items goes here-->

<asp:Menu ID="Menu1" runat="server" Orientation="Vertical" ForeColor="black"


Font-Size="Medium">
<Items>
<asp:MenuItem Text="Home" NavigateUrl="~/Home.aspx"></asp:MenuItem>
<asp:MenuItem Text="Employee" NavigateUrl="~/MasterPage.master">
<asp:MenuItem Text="Add Employee" NavigateUrl="~/AddEmp.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Edit Employee" NavigateUrl="~/EditEmp.aspx">
</asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Login" NavigateUrl="~/Login.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<div style="width:100%;height:450px;">
<div style="width:68%;float:left;">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server"></asp:ContentPlaceHolder>
</div>
<div style="width:30%;float:right;">
<!--ad rotator goes here-->
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer ID="Timer1" runat="server" Interval="2000"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>

<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/Add.xml"
Height="500" Width="400"></asp:AdRotator>
</ContentTemplate>

</asp:UpdatePanel>

</div>
</div>
<div style="width:100%;height:20px;">
<center><h5>All Rights Reserved</h5></center>
</div>
</form>
</body>
</html>

Add.xml :

<?xml version="1.0" encoding="utf-8" ?>


<Advertisements>

<Ad>
<ImageUrl>~/img/1.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<AlternateText>Google</AlternateText>
<Impression>50</Impression>
</Ad>

<Ad>
<ImageUrl>~/img/2.jpg</ImageUrl>
<NavigateUrl>http://www.Yahoo.com</NavigateUrl>
<AlternateText>Google</AlternateText>
<Impression>50</Impression>
</Ad>

<Ad>
<ImageUrl>~/img/3.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<AlternateText>Google</AlternateText>
<Impression>50</Impression>
</Ad>

</Advertisements>

AddEmp.aspx :

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"


CodeFile="AddEmp.aspx.cs" Inherits="AddEmp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<center>
EmpName : <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /><br />
Gender : <asp:RadioButton ID="RadioButton1" runat="server" Text="Male" GroupName="Gender"
/>
<asp:RadioButton ID="RadioButton2" runat="server" Text="Female" GroupName="Gender"
/><br /><br />
Department : <asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>BCA</asp:ListItem>
<asp:ListItem>MCA</asp:ListItem>
<asp:ListItem>BBA</asp:ListItem>
<asp:ListItem>MBA</asp:ListItem>
</asp:DropDownList><br /><br />
DOB : <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar><br /><br />
Salary : <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /><br />
<asp:Button ID="Button1" runat="server" Text="AddEmp" OnClick="Button1_Click" />
</center>
</asp:Content>

AddEmp.aspx.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class AddEmp : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStrings"].ConnectionString);

protected void Page_Load(object sender, EventArgs e)


{

protected void Button1_Click(object sender, EventArgs e)


{
String Gender = "";
if (RadioButton1.Checked)
{
Gender = RadioButton1.Text;
}
else if (RadioButton2.Checked)
{
Gender = RadioButton2.Text;
}

SqlCommand cmd = new SqlCommand("insert into emp


values(@EmpName,@Gender,@Department,@DOB,@Salary)", con);
cmd.Parameters.AddWithValue("@EmpName", TextBox1.Text);
cmd.Parameters.AddWithValue("Gender", Gender);
cmd.Parameters.AddWithValue("@Department", DropDownList1.Text);
cmd.Parameters.AddWithValue("@DOB", Calendar1.SelectedDate.ToShortDateString());
cmd.Parameters.AddWithValue("@Salary", TextBox2.Text);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Response.Write("Inserted");

}
}

EditEmp.aspx :

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"


CodeFile="EditEmp.aspx.cs" Inherits="EditEmp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True"
SortExpression="Id" />
<asp:BoundField DataField="Empname" HeaderText="Empname" SortExpression="Empname"
/>
<asp:BoundField DataField="gender" HeaderText="gender" SortExpression="gender" />
<asp:BoundField DataField="department" HeaderText="department"
SortExpression="department" />
<asp:BoundField DataField="dob" HeaderText="dob" SortExpression="dob" />
<asp:BoundField DataField="salary" HeaderText="salary" SortExpression="salary" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionStrings %>" DeleteCommand="DELETE FROM [emp] WHERE [Id] =
@Id" InsertCommand="INSERT INTO [emp] ([Empname], [gender], [department], [dob], [salary])
VALUES (@Empname, @gender, @department, @dob, @salary)" SelectCommand="SELECT * FROM
[emp]" UpdateCommand="UPDATE [emp] SET [Empname] = @Empname, [gender] = @gender,
[department] = @department, [dob] = @dob, [salary] = @salary WHERE [Id] = @Id">
<DeleteParameters>
<asp:Parameter Name="Id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Empname" Type="String" />
<asp:Parameter Name="gender" Type="String" />
<asp:Parameter Name="department" Type="String" />
<asp:Parameter Name="dob" Type="String" />
<asp:Parameter Name="salary" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Empname" Type="String" />
<asp:Parameter Name="gender" Type="String" />
<asp:Parameter Name="department" Type="String" />
<asp:Parameter Name="dob" Type="String" />
<asp:Parameter Name="salary" Type="String" />
<asp:Parameter Name="Id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>

Home.aspx :

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"


CodeFile="Home.aspx.vb" Inherits="_16SCSCA11003_Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>

Login.aspx :

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"


CodeFile="Login.aspx.cs" Inherits="Login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<center>
Username:<asp:textbox runat="server" id="txtusername"></asp:textbox><br />
Password:<asp:textbox runat="server" id="txtpwd"></asp:textbox><br />
<asp:Button runat="server" Text="Login" Id="btnlogin" OnClick="btnlogin_Click"></asp:Button>
</center>
</asp:Content>

Login.aspx.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class Login : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStrings"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{

protected void btnlogin_Click(object sender, EventArgs e)


{
SqlDataAdapter adpt = new SqlDataAdapter("select * from emp where(EmpName='"
+txtusername.Text+ "')",con);
DataTable dt = new DataTable();
adpt.Fill(dt);
if(dt.Rows.Count>0)
{
Response.Redirect("Home.aspx");
}
else
{
Response.Write("Invalid Username");
}
}
}

You might also like