You are on page 1of 54

ON

.NET

PROGRAMMING

( DEVELOPED JOBS SITE ON ASP.NET USING C#)

Prepared by
Kunal Verma

INDEX

S. NO. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Preface

CONTENTS

PAGE NO 3 4 5 6 7 9 19 22 30 34 41 44 54 55

Acknowledgement About the Organization Introduction to ASP.NET Introduction to Visual Studio 2008 Introduction to C# JSSK ( Jobs Site Starter Kit) Project Coding ScreenShots Conclusion Reference

PREFACE

The knowledge of any subject is incomplete until it is done practically. Computer Science and Information technology particularly requires a thorough knowledge of practical training for a comprehensive understanding. The progress is certainly based on the discovery of the new facts. The science of Computers has grown tremendously over the last few decades and day-by-day new technologies are being added to this ever-growing vast field.

INTRODUCTION TO ASP.NET
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages. What is ASP.net? This tutorial written and contributed by Mitchell Harper. Please see footnote for more info. You've probably heard the word ASP.net fairly often these days, especially on developer sites and news. This article will explain what the fuss is all about. ASP.NET is not just the next version of ASP; it is the next era of web development. ASP.NET allows you to use a full featured programming language such as C# (pronounced C-Sharp) or VB.NET to build web applications easily.

ASP.NET still renders HTML Unfortunately, the Internet still has bandwidth limitations and not every person is running the same web browser. These issues make it necessary to stick with HTML as our mark-up language of choice. This means that web pages won't look quite as amazing as a fully fledged application running under Windows, but with a bit of skill and creative flair, you can make some rather amazing web applications with ASP.NET. ASP.NET processes all code on the server (in a similar way to a normal application). When the ASP.NET code has been processed, the server returns the resultant HTML to the client. If the client supports JavaScript, then the server will use it to make the clients browser experience quicker and easier. Even with HTML being the limiting factor here, ASP.NET still manages to bring true OOP (Object Oriented Programming) to the Internet. OOP on the Internet Object Oriented Programming makes it possible to build extremely large applications, while still keeping your code clean and structured. Now with ASP.NET, we can do the same on the web. Traditional ASP uses HTML and VBScript (or Jscript) to process and render pages, but because VBScript is a scripting language, you were forced to write spaghetti code (VBScript was entwined in the HTML and ended up rather messy in larger applications). ASP.NET separates code from display, and you can even have pages with no ASP.NET code in them at all. By adding references in your HTML (called controls), you can tell ASP.NET that you want a button here, some text there, and then in your code, you can manipulate what these controls look like, what they display, how big they are, etc. Controls can do more than just display information. You can add

events to controls, so that when a visitor clicks on a button, for example, ASP.NET executes a function of your choice. Web Services One great feature of ASP.NET is Web Services. Web services mean that you can literally have several pieces of your application on different servers all around the world, and the entire application will work perfectly and seamlessly. Web services can even work with normal .NET Windows applications. For example: A lot of people would like to have a stock ticker on their web site, but not many people want to manually type in all changes to the prices. If one company (a stock broker) creates a web service and updates the stock prices periodically, then all of those people wanting the prices can use this web service to log in, run a function which grabs the current price for a chosen company, and return it. Web services can be used for so many things: news, currency exchange, login verification.. the ways in which they can be used are limited to your imagination! Great XML Support ASP.NET makes it simple to use XML for data storage, configuration and manipulation. The tools which are built into ASP.NET for working with XML are very easy to use. XML is excellent for storing information that rarely changes, because you can just cache that information in the computers memory after it has been initially extracted.

Class Library ASP.NET includes an enormous class library which was built by Microsoft. Because this class library is so large, it encapsulates a a huge number of common functions. For example, if you wanted to retrieve data from a database and display that data in a simple grid control through classic ASP, then you'd have to write quite a lot of code. In ASP.NET, you don't write any code to display the data: you just write the code to bind the data to an object called a DataGrid (which can be done in just a couple of lines). Then, you just have to create a reference on your page to where that DataGrid should go. The DataGrid will be rendered as a table, and will contain all of the data extracted from the database. Microsoft has created an amazingly well designed MSDN library for ASP.NET and all of the other .NET languages. It includes a full class library containing information and examples on every class, function, method, and property accessible through ASP.NET. The MSDN library also includes some tutorials and examples to get you started. It may take you a while to get used to the format and layout of the MSDN ASP.NET library, however, once you do, you will find it's an invaluable resource to aid you throughout your ASP.NET learning experience. The .NET MSDN library can be found athttp://msdn.microsoft.com/net/ Complete Compatibility One of the most important goals of .NET was to allow developers to write an ASP.NET application using multiple

programming languages. As long as each ASP.NET page contains only one programming language, you can mix and match different pages using different languages and they will work together seamlessly. This means you can now have a team of developers with half programming in C#, and the other half in VB.NET, with no need to worry about language incompatibilities, etc. A cool little side-affect of all this is that all the programming languages look very similar, and differ only by their language syntax. Take the following code snippets for example. They both do exactly the same thing but the first is written in C#, and the second in VB.NET. The C# version: void Page_Load(Object S, EventArgs E) { myLabel.Text = "Hello world!!"; </script> The VB.NET version: Sub Page_Load(S As Object, E As EventArgs) myLabel.Text = "Hello world!!" End Sub </script> If you take either of the code examples shown above and add the following HTML to them, then they would both run perfectly inside of an ASP.NET page: <head> <title>"Hello World" example!</title> </head> <body> <asp:Label id="myLabel" runat="server" />

</body> </html>

Introduction to Visual Studio 2008


Microsoft Visual Studio is an Integrated Development Environment (IDE) from Microsoft. It can be used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft Windows, Windows Mobile, Windows CE, .NET

Framework, .NET Compact Framework and Microsoft Silverlight. Visual Studio includes a code editor supporting IntelliSense as well as code refactoring. The integrated debugger works both as a source-level debugger and a machinelevel debugger. Other built-in tools include a forms designer for building GUI applications, web designer, class designer, and database schema designer. It allows plug-ins to be added that enhance the functionality at almost every level - including adding support for source control systems (like Subversion and Visual SourceSafe) to adding new toolsets like editors and visual designers for domainspecific languages or toolsets for other aspects of the software development lifecycle (like the Team Foundation Server client: Team Explorer).

Introduction
Visual Studio functions as the code editing area, form designer, code validator, compiler and library browser for a software development project. It supports languages by means of language services, which allow any programming language to be supported (to varying degrees) by the code

editor and debugger, provided a language-specific service has been authored. Basic Use There are several levels of hierarchy in the Visual Studio file saving scheme. Solutions Comprised of one or more projects. Typically most solutions start with one project and incorporate more as the application progresses and becomes more sophisticated. Project Incorporates one or more Items that all describe actions for a certain operation (i.e. GUI and related logic in one project, SQL server project to handle data interchange, and custom class project from another language to handle ImageList population).

New project Form A window with any number of controls (such as text boxes buttons, list boxes, etc.)

Resource A file that incorporates any data that the project might need (Often things like images, icons, settings, etc) Open the IDE and select Create: Project... or File>New Project from the menu. In the New Project Dialog Select Windows Forms Applications and change the name to Hello_World. Form1.vb is the first Windows Form created by the IDE. On the right side of the screen is the Properties window with all of the Form properties displayed in alphabetical format. On the left side of the screen are two pop out tabs, Server Explorer and Toolbox. Server Explorer allows you to view services, event logs performance counters (most useful with software that writes values to the event log or require services to run. The toolbox contains controls and structure that will be used to populate forms. Probably 90% of the time you will be using controls in the Common Controls section of the toolbox. These include buttons, check boxes, list boxes, combo boxes, labels, etc. Any one of these items may be drug onto the blank form and dropped there, and then customized (mostly appearance) from the properties window, and have logic code written in the code window to support it's operation.

THE C# LANGUAGE:C# (pronounced C-sharp) is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java. C# is designed to work with Microsofts .Net platform. Microsofts aim is to facilitate the exchange of information and services over the Web, and to enable developers to build highly portable applications. C# simplifies programming through its use of Extensible Markup Language (XML) and Simple Object Access Protocol (SOAP) which allow access to a programming object or method without requiring the programmer to write additional code for each step. Because programmers can build on existing code, rather than repeatedly duplicating it, C# is expected to make it faster and less expensive to get new products and services to market. Microsoft is collaborating with ECMA, the international standards body, to create a standard for C#. International Standards Organization (ISO) recognition for C# would encourage other companies to develop their own versions of the language. Companies that are already using C# include Apex Software, Bunka Orient, Component Source, devSoft, FarPoint Technologies, LEAD Technologies, ProtoView, and Seagate Software.

C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. It will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++. Visual C# .NET is Microsofts C# development tool. It includes an interactive development environment, visual designers for building Windows and Web applications, a compiler, and a debugger. Visual C# .NET is part of a suite of products, called Visual Studio .NET, that also includes Visual Basic .NET, Visual C++ .NET, and the JScript scripting language. All of these languages provide access to the Microsoft .NET Framework, which includes a common execution engine and a rich class library. The.NET Framework defines a Common Language Specification (CLS), a sort of lingua franca that ensures seamless interoperability between CLS-compliant languages and class libraries. For C# developers, this means that even though C# is a new language, it has complete access to the same rich class libraries that are used by seasoned tools such as Visual Basic .NET and Visual C++ .NET. C# itself does not include a class library. Close examination of program is illuminating: The using System; directive references a namespace called System that is provided by the Microsoft .NET Framework class library. This namespace contains the Console class referred to in the Main method. Namespaces provide a hierarchical means of organizing the elements of one or more programs. A using directive enables unqualified use of the types that are members of the namespace. The hello, world program uses

Console.WriteLine as shorthand for System.Console.WriteLine. (For the sake of brevity, most examples in this specification omit the using System; directive.) The Main method is a member of the class Hello. It has the static modifier, and so it is a method on the class Hello rather than on instances of this class. The entry point for an applicationthe method that is called to begin executionis always a static method named Main. The hello, world output is produced using a class library. The language does not itself provide a class library. Instead, it uses a class library that is also used by Visual Basic .NET and Visual C++ .NET. For C and C++ developers, it is interesting to note a few things that do notappear in the hello, world program. The program does not use a global method for Main. Methods and variables are not supported at the global level; such elements are always contained within type declarations (e.g., class and struct declarations). The program does not use either :: or -> operators. The :: is not an operator at all, and the -> operator is used in only a small fraction of programs those that employ unsafe code (Error! Reference source not found.). The separator . is used in compound names such as Console.WriteLine. The program does not contain forward declarations. Forward declarations are never needed, as declaration order is not significant.

The program does not use #include to import program text. Dependencies among programs are handled symbolically rather than textually. This approach eliminates barriers between applications written using different languages. For example, the Console class need not be written in C#. Types C# supports two kinds of types: value types and reference types. Value types include simple types (e.g., char, int, and float), enum types, and struct types. Reference types include class types, interface types, delegate types, and array types. Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to objects. With reference types, it is possible for two variables to reference the same object, and thus possible for operations on one variable to affect the object referenced by the other variable. With value types, the variables each have their own copy of the data, and it is not possible for operations on one to affect the other. The example class Class1 { public int Value = 0; } class Test { static void Main() { int val1 = 0; int val2 = val1; val2 = 123;

Class1 ref1 = new Class1(); Class1 ref2 = ref1; ref2.Value = 123; Console.WriteLine(Values: {0}, {1}, val1, val2); Console.WriteLine(Refs: {0}, {1}, ref1.Value, ref2.Value); } } shows this difference. The output produced is Values: 0, 123 Refs: 123, 123 The assignment to the local variable val1 does not impact the local variable val2 because both local variables are of a value type (the type int) and each local variable of a value type has its own storage. In contrast, the assignment ref2.Value = 123; affects the object that both ref1 and ref2 reference. The lines Console.WriteLine(Values: {0}, {1}, val1, val2); Console.WriteLine(Refs: {0}, {1}, ref1.Value, ref2.Value); deserve further comment, as they demonstrate some of the string formatting behavior of Console.WriteLine, which takes a variable number of arguments. The first argument is a string, which may contain numbered placeholders like {0} and {1}. Each placeholder refers to a trailing argument with {0} referring to the second argument, {1} referring to the third argument, and so on. Before the output is sent to the console, each placeholder is replaced with the formatted value of its corresponding argument.

Developers can define new value types through enum and struct declarations, and can define new reference types via class, interface, and delegate declarations. The example public enum Color { Red, Blue, Green } public struct Point { public int x, y; } public interface IBase { void F(); } public interface IDerived: IBase { void G(); } public class A { protected virtual void H() { Console.WriteLine(A.H); } } public class B: A, IDerived { public void F() { Console.WriteLine(B.F, implementation of IDerived.F); }

public void G() { Console.WriteLine(B.G, implementation of IDerived.G); } override protected void H() { Console.WriteLine(B.H, override of A.H); } } public delegate void EmptyDelegate();

PROJECT
Jobs Site Starter Kit (JSSK) Introduction Jobs Site Starter Kit is a web application that provides a platform for candidates seeking job and the employers to share their needs.

The candidates seeking job (referred as job seekers now onwards) can perform following operations:

Register with the web site. Post their resume. Modify their resume. Search for job postings. Browse searched job postings. Add job posting to their favorites list. Add frequently used searches to their favorites list.

The employers can perform following operations:


Register with the web site. Enter profile of their company. Post one or more job postings. Modify the job postings. Search the resume database. Browse searched resumes. Add resumes to their favorites list.

ASP.NET 3.5 Feature utilization in JSSK JSSK is developed using ASP.NET 3.5 and uses following features:

Completely based on n-tier architecture Forms based authentication User management via Membership providers Role based security Profiles

Themes Master pages New data source controls - ObjectDataSource Data bound controls GridView and DetailsView Login controls Login, PasswordRecovery, LoginName and LoginStatus Web parts for customization User controls for reusing code and markup ASP.NET AJAX client script extensions Calling web services via ASP.NET AJAX UpdatePanel and UpdateProgress controls AJAX Control Toolkit

User and Roles By default there are three roles in the system:

admin jobseeker employer

Following are the users and their roles that are already defined in the system for testing purpose. User ID ravi Password Role Purpose

pass$word employer This user is an employer. Can post job openings and

search resumes. This user is a job seeker. Can post pass$word jobseeker resume and search job openings. This is an administrative user. Can add system parameters such as Experience and Educational Levels.

alok

admin

pass$word admin

Registering as a Job Seeker In order to register as a Job Seeker follow these steps:

Start the web site Select Register option from left hand menu User registration wizard will appear

Enter registration details such as First Name, Last Name, User ID and so on On the last step register as Job Seeker

Registering as an Employer

Start the web site Select Register option from left hand menu User registration wizard will appear Enter registration details such as First Name, Last Name, User ID and so on On the last step register as Employer

Using Navigation Options Once you sign in to the system as a Job Seeker or Employer, you can access respective options from the navigation menus. You can access only the options belonging to your role (jobseeker or employer) Job Seeker Options Post Resumes This option allows job seekers to post their resumes. One candidate can store only one resume in the database. Search Jobs Using Search Jobs option job seekers can search for available job opportunities from the database.

My Favorites When you search for jobs the results can be stored as your favorites jobs in the database. In addition you can also save the search criteria as your favorite search criteria. Employer Options Post Jobs Using this option employers can post job opportunities in the database. These opportunities can be searched by the job seekers. Search Resumes Employers can search available resume database through this option. Company Profile Employers can also specify the profile on the company. My Favorites When you search for resumes the search results can be saved as your favorites in the database.

Administrative Options Education Levels Using this option administrator can add/edit/delete education levels. Experience Levels Using this option administrator can add/edit/delete experience levels. Publishing your Site When you are ready to share your Web site with others, you can copy it to your Web server. You need to know the File Transfer Protocol (FTP) address of your server, and if required, the user name and password you use. In the Website menu, click Copy Web Site. The Copy Web Site tool displays the files from your Web site under Source Web Site. 2. In the Connect to box, click Connect to .... 3. In the Open Web Site dialog box, click the FTP Sites tab. 4.Type the FTP address of your server, and if required, the user name and password that your hosting site has provided. The FTP URL usually has a format like this:
1.

ftp://ftp.servername/foldername

5.

6.

7.

Click Open. The files on the Web server are displayed under Remote Web Site. Note: If you have trouble connecting to the server, contact the server administrator. In the Move Files list, click All source files to remote Web site. Click the Copy Web Site button. The files from your Personal Web Site are copied to the server

The coding starts with using namespaces

Why do we add Script Manager?

Building this page is easy. First, you need to add the ScriptManager control to the page. Like all controls that use ASP.NET AJAX, the UpdatePanel works in conjunction with the ScriptManager. If you dont have it in your page, the UpdatePanel wont work the ScriptManager needs to appear before the UpdatePanel, because the rendered page must have the JavaScript script block in place before the UpdatePanel can use it. Its a good idea to always place the ScriptManager at the top of the page. Next, you need to add the content to the page. The animated

Q How to view webpage in different Browsers?

If you have a web page that looks dramatically different in Internet Explorer than it does in Firefox, the

culprit may be a missing or invalid doctype. Common idiosyncrasies that appear in web pages that dont have doctypes include varying text sizes and varying margin space between elements.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

What is AJAX? These applications refresh themselves quickly and flicker-free, and sometimes include slick new features like animation and drag and drop. Notable examples include web-based email applications like Gmail and mapping tools like Google Maps. Ajax is programming shorthand for a set of techniques that create more responsive, dynamic pages. One of the hallmarks of Ajax is the ability to refresh part of the page while leaving the rest untouched.

CODE:The MasterPage of my Site:See How ASP is added to HTML components

MasterPage.master file:<%@ Master Language="C#" CodeFile="MasterPage.master.cs" Inherits="MasterPage_master" %>

<%@ Register TagPrefix="uc3" TagName="LatestJobs" Src="UserControls/LatestJobs.ascx" %> <%@ Register TagPrefix="uc2" TagName="Statistics" Src="UserControls/Statistics.ascx" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %> <%@ Register src="UserControls/AJAXNavigation.ascx" tagname="AJAXNavigation" tagprefix="uc4" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <table width="100%" border=0 cellpadding=5 cellspacing=0> <tr> <td colspan=3 class="pagetop"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"> </asp:ScriptManager> <table width=100% border=0> <tr> <td><asp:HyperLink ID="HyperLink1" Runat="server" ImageUrl="~/Images/logo.gif" NavigateUrl="~/default.aspx"></asp:HyperLink></td> <td valign="bottom" align="right"> <asp:LoginName ID="LoginName1" Runat="server" SkinID="FormLabel" FormatString="Welcome {0} !" Font-Bold="True" /> [<asp:LoginStatus ID="LoginStatus1" Runat="server" LogoutPageUrl="~/default.aspx" LogoutAction="Redirect" />] </td> </tr> </table> </td> </tr> <tr> <td valign="top" width="20%" class="pageleft" height="600px" align="center"> <br />

<uc4:AJAXNavigation ID="AJAXNavigation1" runat="server" /> </td> <td valign="top" width="60%"> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"><br /> </asp:contentplaceholder> </td> <td valign="top" width="20%" class="pageright" align="center">&nbsp;<br /> <uc2:statistics id="Statistics1" runat="server"></uc2:statistics><br /> <uc3:LatestJobs ID="LatestJobs1" Runat="server" /> </td> </tr> <tr> <td colspan=3 class="pagebottom" align="center"> &nbsp;<br /> Copyright (C) your copyright here. (C) your copyright here.<br /> <br /> <asp:HyperLink ID="lnkAds" Runat="server">Want to advertise with us?</asp:HyperLink> | <asp:HyperLink ID="lnkWebmaster" Runat="server">Problems with the site?</asp:HyperLink> <br /> <br /> </td> </tr> </table> </form> </body> </html>

MasterPage.master

Graphical Layout:-

MasterPage.master.cs:- (C # code )
using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;

public partial class MasterPage_master : MasterPage { protected void Page_Load(object sender, EventArgs e) { Page.Title = ConfigurationManager.AppSettings["pagetitle"]; HyperLink1.ImageUrl = "~/images/" + ConfigurationManager.AppSettings["sitelogo"]; lnkAds.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["advertiseemail"]; lnkWebmaster.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["webmasteremail"]; } }

Employer Folder:AddEditPosting.aspx:-

<%@ Page Language="C#" CodeFile="AddEditPosting.aspx.cs" Inherits="AddEditPosting_aspx" MasterPageFile="~/MasterPage.master" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server"> <div style="text-align: center"> <div align="center"> <asp:Label ID="Label14" Runat="server" Text="Add / Edit Job Posting" SkinID="FormHeading"></asp:Label> </div> <br /> <asp:HyperLink ID="HyperLink2" Runat="server" NavigateUrl="~/employer/jobpostings.aspx" ImageUrl="~/Images/JobPostings.gif"></asp:HyperLink><br /> <asp:Label ID="Label6" runat="server" Text="(All the fields are mandatory)"></asp:Label> <br /> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <asp:DetailsView ID="DetailsView1" Runat="server" AutoGenerateRows="False" CellPadding="5" DataKeyNames="JobPostingID" DataSourceID="ObjectDataSource1" GridLines="None" HorizontalAlign="Center"

OnDataBound="DetailsView1_DataBound" OnItemDeleted="DetailsView1_ItemDeleted" OnItemInserting="DetailsView1_ItemInserting" OnItemUpdating="DetailsView1_ItemUpdating" Width="100%"> <rowstyle horizontalalign="Left" /> <fieldheaderstyle horizontalalign="Right" Wrap="false" /> <fields> <asp:boundfield DataField="JobPostingID" HeaderText="Job Posting ID :" InsertVisible="False" ReadOnly="True" SortExpression="JobPostingID"><headerstyle cssclass="dataentryformlabel" wrap="False" /><itemstyle cssclass="dataentryformlabel" wrap="False" /></asp:boundfield> <asp:boundfield DataField="Title" HeaderText="Title :" SortExpression="Title"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:templatefield HeaderText="Contact Person :" SortExpression="ContactPerson"><edititemtemplate><asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ContactPerson") %>'> </asp:TextBox></edititemtemplate><insertitemtemplate><asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ContactPerson") %>'> </asp:TextBox></insertitemtemplate><itemtemplate><asp:Label ID="Label6" Runat="server" Text='<%# Bind("ContactPerson") %>'></asp:Label></itemtemplate><headerstyle cssclass="dataentryformlabel" wrap="False" /><itemstyle wrap="False" /></asp:templatefield> <asp:boundfield DataField="Department" HeaderText="Department :" SortExpression="Department"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:boundfield DataField="JobCode" HeaderText="Job Code :" SortExpression="JobCode"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:templatefield HeaderText="Country :" SortExpression="CountryID"><edititemtemplate>&nbsp;<asp:DropDownList ID="ddlCountryUpdate" Runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource3" DataTextField="CountryName" DataValueField="CountryID" OnSelectedIndexChanged="ddlCountryUpdate_SelectedIndexChanged" SelectedValue='<%# Bind("CountryID") %>'></asp:DropDownList></edititemtemplate><insertitemtemplate>&nbsp;<asp:Drop DownList ID="ddlCountryInsert" Runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource3" DataTextField="CountryName" DataValueField="CountryID" OnSelectedIndexChanged="ddlCountryInsert_SelectedIndexChanged"

SelectedValue='<%# Bind("CountryID") %>'></asp:DropDownList></insertitemtemplate><itemtemplate><asp:Label ID="Label2" Runat="server" Text='<%# JobSiteStarterKit.BOL.Country.GetCountryName((int)Eval("CountryID")) %>'> </asp:Label></itemtemplate><headerstyle cssclass="dataentryformlabel" /></asp:templatefield> <asp:templatefield HeaderText="State :" SortExpression="StateID"><edititemtemplate><asp:DropDownList ID="ddlStateUpdate" Runat="server" DataSourceID="ObjectDataSource2" DataTextField="StateName"

DataValueField="StateID"></asp:DropDownList></edititemtemplate><insertitemtem plate><asp:DropDownList ID="ddlStateInsert" Runat="server" DataSourceID="ObjectDataSource2" DataTextField="StateName"

DataValueField="StateID"></asp:DropDownList></insertitemtemplate><itemtemplate ><asp:Label ID="Label1" Runat="server" Text='<%# JobSiteStarterKit.BOL.State.GetStateName((int)Eval("StateID")) %>'> </asp:Label></itemtemplate><headerstyle cssclass="dataentryformlabel" /></asp:templatefield> <asp:boundfield DataField="City" HeaderText="City :" SortExpression="City"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:templatefield HeaderText="Education Level :"

SortExpression="EducationLevelID"><edititemtemplate>&nbsp;<asp:DropDownList ID="ddlEduLevelUpdate" Runat="server" DataSourceID="ObjectDataSource4" DataTextField="EducationLevelName" DataValueField="EducationLevelID" SelectedValue='<%# Bind("EducationLevelID") %>'></asp:DropDownList></edititemtemplate><insertitemtemplate>&nbsp;<asp:Drop DownList ID="ddlEduLevelInsert" Runat="server" DataSourceID="ObjectDataSource4" DataTextField="EducationLevelName" DataValueField="EducationLevelID" SelectedValue='<%# Bind("EducationLevelID") %>'></asp:DropDownList></insertitemtemplate><itemtemplate><asp:Label ID="Label3" Runat="server" Text='<%# JobSiteStarterKit.BOL.EducationLevel.GetEducationLevelName((int)Eval("Educati onLevelID")) %>'> </asp:Label></itemtemplate><headerstyle

cssclass="dataentryformlabel" wrap="False" /><itemstyle wrap="False" /></asp:templatefield> <asp:templatefield HeaderText="Job Type :" SortExpression="JobTypeID"><edititemtemplate>&nbsp;<asp:DropDownList ID="ddlJobTypeUpdate" Runat="server" DataSourceID="ObjectDataSource5" DataTextField="JobTypeName" DataValueField="JobTypeID" SelectedValue='<%# Bind("JobTypeID") %>'></asp:DropDownList></edititemtemplate><insertitemtemplate>&nbsp;<asp:Drop DownList ID="ddlJobTypeInsert" Runat="server" DataSourceID="ObjectDataSource5" DataTextField="JobTypeName" DataValueField="JobTypeID" SelectedValue='<%# Bind("JobTypeID") %>'></asp:DropDownList></insertitemtemplate><itemtemplate><asp:Label ID="Label4" Runat="server" Text='<%# JobSiteStarterKit.BOL.JobType.GetJobTypeName((int)Eval("JobTypeID")) %>'> </asp:Label></itemtemplate><headerstyle cssclass="dataentryformlabel" /></asp:templatefield> <asp:boundfield DataField="MinSalary" HeaderText="Min Salary :" SortExpression="MinSalary"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:boundfield DataField="MaxSalary" HeaderText="Max Salary :" SortExpression="MaxSalary"><headerstyle cssclass="dataentryformlabel" /></asp:boundfield> <asp:templatefield HeaderText="Description :" SortExpression="Description"><edititemtemplate><asp:TextBox ID="TextBox1" Runat="server" Rows="5" Text='<%# Bind("Description") %>' TextMode="MultiLine" Width="98%"> </asp:TextBox></edititemtemplate><insertitemtemplate><asp:TextBox ID="TextBox1" Runat="server" Rows="5" Text='<%# Bind("Description") %>' TextMode="MultiLine"> </asp:TextBox></insertitemtemplate><itemtemplate> <asp:Label ID="Label5" Runat="server" Text='<%# (Server.HtmlEncode(Eval("Description").ToString())).Replace("\r\n","<br>") %>'></asp:Label></itemtemplate><headerstyle cssclass="dataentryformlabel" verticalalign="Top" /></asp:templatefield> <asp:commandfield ButtonType="Image" ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" CancelImageUrl="~/Images/CancelButton.gif" DeleteImageUrl="~/Images/DeleteButton.gif" EditImageUrl="~/Images/EditButton.gif" InsertImageUrl="~/Images/SaveButton.gif" NewImageUrl="~/Images/AddButton.gif" UpdateImageUrl="~/Images/SaveButton.gif"><controlstyle cssclass="dataentryformbutton" /><footerstyle horizontalalign="Center" /> <itemstyle horizontalalign="Center" />

</asp:commandfield> </fields> <headerstyle horizontalalign="Right" /> <insertrowstyle horizontalalign="Left" /> <editrowstyle horizontalalign="Left" /> </asp:DetailsView> </contenttemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"> <progresstemplate> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/progress.gif" /> </progresstemplate> </asp:UpdateProgress> <br /> <br /> <asp:HyperLink ID="HyperLink1" Runat="server" NavigateUrl="~/employer/jobpostings.aspx">Go to Listing Page</asp:HyperLink> <br /> <br /> <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="JobSiteStarterKit.BOL.JobPosting" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetPosting" UpdateMethod="Update" DataObjectTypeName="JobSiteStarterKit.BOL.JobPosting"> <DeleteParameters> <asp:Parameter Name="original_JobPostingID" Type="Int32" /> </DeleteParameters> <SelectParameters> <asp:QueryStringParameter Name="id" QueryStringField="id" Type="Int32"></asp:QueryStringParameter> </SelectParameters> </asp:ObjectDataSource><br /> <asp:ObjectDataSource ID="ObjectDataSource2" Runat="server" TypeName="JobSiteStarterKit.BOL.State" SelectMethod="GetStates"> <SelectParameters> <asp:Parameter Type="Int32" Name="countryid"></asp:Parameter> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ObjectDataSource3" Runat="server" TypeName="JobSiteStarterKit.BOL.Country" SelectMethod="SelectCountries"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ObjectDataSource4" Runat="server" SelectMethod="GetEducationLevels" TypeName="JobSiteStarterKit.BOL.EducationLevel"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ObjectDataSource5" Runat="server" SelectMethod="GetJobTypes" TypeName="JobSiteStarterKit.BOL.JobType"> </asp:ObjectDataSource> </div> </asp:Content>

AddEditPosting.aspx.cs
using using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; JobSiteStarterKit.BOL;

public partial class AddEditPosting_aspx : Page { protected void Page_Load(object sender, EventArgs e) {

if (! Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrolename"])) { Response.Redirect("~/customerrorpages/NotAuthorized.aspx"); } if (!Page.IsPostBack) { if (Company.GetCompany(User.Identity.Name) == null) { Response.Redirect("~/customerrorpages/profilenotfound.aspx"); } if (Request.QueryString["id"] == null) { DetailsView1.DefaultMode = DetailsViewMode.Insert; } else { DetailsView1.DefaultMode = DetailsViewMode.ReadOnly; }

} } protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e) {

DropDownList ddl; ddl = (DropDownList)DetailsView1.FindControl("ddlStateInsert"); e.Values["StateID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlCountryInsert"); e.Values["CountryID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlEduLevelInsert"); e.Values["EducationLevelID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlJobTypeInsert"); e.Values["JobTypeID"] = ddl.SelectedValue; e.Values["PostedBy"] = Profile.UserName; e.Values["CompanyID"]=Profile.Employer.CompanyID.ToString(); e.Values["PostingDate"]= DateTime.Today.ToString("MM/dd/yyyy"); } protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { DropDownList ddl; ddl = (DropDownList)DetailsView1.FindControl("ddlStateUpdate"); e.NewValues["StateID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlCountryUpdate"); e.NewValues["CountryID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlEduLevelUpdate");

e.NewValues["EducationLevelID"] = ddl.SelectedValue; ddl = (DropDownList)DetailsView1.FindControl("ddlJobTypeUpdate"); e.NewValues["JobTypeID"] = ddl.SelectedValue; e.NewValues["PostedBy"] = Profile.UserName; e.NewValues["CompanyID"] = Profile.Employer.CompanyID.ToString(); e.NewValues["PostingDate"] = DateTime.Today.ToString("MM/dd/yyyy"); } protected void DetailsView1_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { Response.Redirect("~/employer/jobpostings.aspx"); } protected void ddlCountryUpdate_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl; ddl = (DropDownList)sender; ObjectDataSource2.SelectParameters["countryid"].DefaultValue = ddl.SelectedValue; ObjectDataSource2.Select(); } protected void ddlCountryInsert_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl; ddl = (DropDownList)sender; ObjectDataSource2.SelectParameters["countryid"].DefaultValue = ddl.SelectedValue; ObjectDataSource2.Select(); } protected void DetailsView1_DataBound(object sender, EventArgs e) { DropDownList ddl; ddl = (DropDownList)DetailsView1.FindControl("ddlCountryUpdate"); if (ddl != null) { ObjectDataSource2.SelectParameters["countryid"].DefaultValue = ddl.SelectedValue; ObjectDataSource2.Select(); } } }

JobPosting.aspx :<%@ Page Language="C#" CodeFile="jobpostings.aspx.cs" Inherits="postinglist_aspx" MasterPageFile="~/MasterPage.master" %>

<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server"> <div align="center"> <asp:Label ID="Label14" Runat="server" Text="List of Job Postings" SkinID="FormHeading"></asp:Label> <br /> <br /> <asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/Images/AddJobPosting.gif" NavigateUrl="~/employer/AddEditPosting.aspx">HyperLi nk</asp:HyperLink> <br /> </div> <br /> <asp:GridView ID="GridView1" Runat="server" DataSourceID="ObjectDataSource1" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" DataKeyNames="PostingID" Width="100%"> <Columns> <asp:BoundField HeaderText="Title" DataField="Title"></asp:BoundField> <asp:BoundField HeaderText="Job Code" DataField="JobCode"></asp:BoundField> <asp:BoundField HeaderText="Location" DataField="City"></asp:BoundField> <asp:BoundField HeaderText="Posted On" DataField="PostingDate" DataFormatString="{0:MM/dd/yyyy}"></asp:BoundField> <asp:ButtonField ButtonType="Image" ImageUrl="~/Images/ShowDetails.gif"> <ItemStyle Wrap="False"></ItemStyle> </asp:ButtonField> </Columns> </asp:GridView><br /> &nbsp;<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="JobSiteStarterKit.BOL.JobPosting" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetPostings" UpdateMethod="Update" DataObjectTypeName="JobSiteStarterKit.BOL.JobPosting "> <DeleteParameters>

<asp:Parameter Type="Int32" Name="id"></asp:Parameter> </DeleteParameters> <UpdateParameters> <asp:Parameter Type="Int32" Name="JobPostingID"></asp:Parameter> <asp:Parameter Type="Int32" Name="CompanyID"></asp:Parameter> <asp:Parameter Type="String" Name="ContactPerson"></asp:Parameter> <asp:Parameter Type="String" Name="Title"></asp:Parameter> <asp:Parameter Type="String" Name="Department"></asp:Parameter> <asp:Parameter Type="String" Name="JobCode"></asp:Parameter> <asp:Parameter Type="String" Name="City"></asp:Parameter> <asp:Parameter Type="Int32" Name="StateID"></asp:Parameter> <asp:Parameter Type="Int32" Name="CountryID"></asp:Parameter> <asp:Parameter Type="Int32" Name="EducationLevelID"></asp:Parameter> <asp:Parameter Type="Int32" Name="JobTypeID"></asp:Parameter> <asp:Parameter Type="Decimal" Name="MinSalary"></asp:Parameter> <asp:Parameter Type="Decimal" Name="MaxSalary"></asp:Parameter> <asp:Parameter Type="String" Name="Description"></asp:Parameter> <asp:Parameter Type="DateTime" Name="PostingDate"></asp:Parameter> <asp:Parameter Type="String" Name="PostedBy"></asp:Parameter> </UpdateParameters> <SelectParameters> <asp:ProfileParameter Name="username" Type="String" PropertyName="UserName"></asp:ProfileParameter> </SelectParameters> <InsertParameters> <asp:Parameter Type="Int32" Name="JobPostingID"></asp:Parameter> <asp:Parameter Type="Int32" Name="CompanyID"></asp:Parameter>

<asp:Parameter Type="String" Name="ContactPerson"></asp:Parameter> <asp:Parameter Type="String" Name="Title"></asp:Parameter> <asp:Parameter Type="String" Name="Department"></asp:Parameter> <asp:Parameter Type="String" Name="JobCode"></asp:Parameter> <asp:Parameter Type="String" Name="City"></asp:Parameter> <asp:Parameter Type="Int32" Name="StateID"></asp:Parameter> <asp:Parameter Type="Int32" Name="CountryID"></asp:Parameter> <asp:Parameter Type="Int32" Name="EducationLevelID"></asp:Parameter> <asp:Parameter Type="Int32" Name="JobTypeID"></asp:Parameter> <asp:Parameter Type="Decimal" Name="MinSalary"></asp:Parameter> <asp:Parameter Type="Decimal" Name="MaxSalary"></asp:Parameter> <asp:Parameter Type="String" Name="Description"></asp:Parameter> <asp:Parameter Type="DateTime" Name="PostingDate"></asp:Parameter> <asp:Parameter Type="String" Name="PostedBy"></asp:Parameter> </InsertParameters> </asp:ObjectDataSource></asp:Content>

JobPosting Page:-

JobPosting.aspx.cs:using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;

public partial class postinglist_aspx : Page { protected void Page_Load(object sender, EventArgs e) { if (! Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrol ename"])) { Response.Redirect("~/customerrorpages/NotAuthorized. aspx"); } }

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edit") { Response.Redirect("~/employer/addeditposting.aspx? id=" + e.CommandArgument); } } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton b = (ImageButton)e.Row.Cells[4].Controls[0]; b.CommandName = "edit"; b.CommandArgument = GridView1.DataKeys[e.Row.RowIndex].Value.ToString(); } } }

MyFavourites.aspx:-

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="MyFavorites.aspx.cs" Inherits="MyFavorites_aspx" Title="Untitled Page" %> <%@ Register Src="../UserControls/DisplayModeController.ascx" TagName="DisplayModeController" TagPrefix="uc4" %> <%@ Register Src="../UserControls/MyJobs.ascx" TagName="MyJobs" TagPrefix="uc3" %> <%@ Register Src="../UserControls/MySearches.ascx" TagName="MySearches" TagPrefix="uc2" %> <%@ Register TagPrefix="uc1" TagName="MyResumes" Src="../UserControls/MyResumes.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server"> <div align="center"> <asp:Label ID="Label14" Runat="server" SkinID="FormHeading" Text="My Favorites"></asp:Label> <br /> <asp:WebPartManager ID="WebPartManager1" runat="server"> </asp:WebPartManager> <br /> <uc4:DisplayModeController ID="DisplayModeController1" runat="server" /> <br /> <asp:CatalogZone ID="CatalogZone1" runat="server" HeaderText="" VerbButtonType="Link"> <ZoneTemplate> <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" Title="Available Web Parts" /> </ZoneTemplate> </asp:CatalogZone> </div> <br /> <table style="width: 100%"> <tr> <td style="width: 100%"> <asp:WebPartZone HeaderText="My Resumes" ID="WebPartZone1" runat="server" WebPartVerbRenderMode="TitleBar" ShowTitleIcons="False" Width="100%"> <minimizeverb text="Collapse" ImageUrl="~/Images/CollapseButton.gif" /> <restoreverb text="Expand" ImageUrl="~/Images/ExpandButton.gif" /> <closeverb imageurl="~/Images/CloseButton.gif" /> <ZoneTemplate>

<uc1:MyResumes ID="MyResumes1" Runat="server" title="My Resumes" /> </ZoneTemplate> </asp:WebPartZone> </td> </tr> </table> <br /> <br /> </asp:Content>

MyFavourites.aspx.cs:using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;

public partial class MyFavorites_aspx : Page { protected void Page_Load(object sender, EventArgs e) { if (! Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrol ename"])) { Response.Redirect("~/customerrorpages/NotAuthorized. aspx"); } } }

Viewresume.aspx:using using using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; JobSiteStarterKit.BOL; ASP;

public partial class viewresume_aspx : Page { protected void Page_Load(object sender, EventArgs e) { if (! Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrol ename"])) { Response.Redirect("~/customerrorpages/NotAuthorized. aspx"); } Resume r = Resume.GetResume(int.Parse(Request.QueryString["id"])); ProfileCommon p = Profile.GetProfile(r.UserName); lblName.Text = "Full Name : " + p.FirstName + " " + p.LastName; lblEducation.Text = "Education Level : " + EducationLevel.GetEducationLevelName(r.EducationLevelID); lblExperience.Text = "Experience Level : " + ExperienceLevel.GetExperienceLevelName(r.ExperienceLevelID); lblCoveringLetter.Text = r.CoveringLetterText.Replace("\r\n", "<br>"); lblResume.Text = r.ResumeText.Replace("\r\n","<br>"); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Response.Redirect("~/employer/resumesearch.aspx"); }

protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { MyResume r = new MyResume(); r.ResumeID = int.Parse(Request.QueryString["id"]); r.UserName = Profile.UserName; MyResume.Insert(r); } }

CONCLUSION
In this project, the software Microsoft Visual Studio 2008 has been made full use of. This software enables us to write the source code in many languages like Visual Basic , C# , Visual C++ etc,. During this project work we learned many things about Visual Studio 2008 and its many features . We also understood the working of TCP/IP and UDP protocols .

REFERENCES

1. www.wikipedia.org 2. www.google.com 3. Black Book,Microsoft Visual Studio 2008 4. TanenBaum, Computer Networks 5. Forouzen , Computer Networks

You might also like