Click here to Skip to main content
15,888,202 members
Articles / Web Development / ASP.NET
Article

SMS

Rate me:
Please Sign up or sign in to vote.
1.05/5 (23 votes)
8 Nov 20077 min read 31.3K   1.9K   23   9
Three Tier Architecture using C# and Asp.Net

Introduction

Its is application based on three tier arechtecure regarding to include object relation mapping

its become more powerfull and easy to use.

Background

its is very usefull regarding a application used in database processing

Using the code

DataACcess Class

using System;
using System.Data;
using System.Data.SqlClient ;
using Microsoft.ApplicationBlocks.Data ;
namespace JJ_DAC
{
public class DAC_JobSeeker
{
public DAC_JobSeeker()
{

}
private string Constr=new ConnectionString().constr;
public DataSet SelectResumeByID(string str)
{
SqlParameter[] param=new SqlParameter[1];
param[0]=new SqlParameter("@ResumeID",SqlDbType.Int);
param[0].Value =str.ToString();
try
{
DataSet ds=SqlHelper.ExecuteDataset(Constr,CommandType.StoredProcedure,"sp_Select_ResumeBYID",param);
if(ds!=null)
{
return ds;
}
else
{
return null;

}
}
catch
{
return null;
}

}
public string CreateResume(string[] arr)
{
SqlParameter[] param=new SqlParameter[16];
param[0]=new SqlParameter("@JobTypeID",SqlDbType.Int );
param[0].Value=arr[0].ToString();
param[1]=new SqlParameter("@AvailabilityID",SqlDbType.Int );
param[1].Value=arr[1].ToString();
param[2]=new SqlParameter("@StatusID",SqlDbType.Int);
param[2].Value=arr[2].ToString();
param[3]=new SqlParameter("@WorkLocationID",SqlDbType.Int );
param[3].Value=arr[3].ToString();
param[4]=new SqlParameter("@EducationalSummary",SqlDbType.VarChar);
param[4].Value=arr[4].ToString();
param[5]=new SqlParameter("@ExpectedSalary",SqlDbType.VarChar);
param[5].Value=arr[5].ToString();
param[6]=new SqlParameter("@CurrencyID",SqlDbType.Int );
param[6].Value=arr[6].ToString();
param[7]=new SqlParameter("@LastSalary",SqlDbType.VarChar );
param[7].Value=arr[7].ToString();
param[8]=new SqlParameter("@CareerObjectives",SqlDbType.VarChar );
param[8].Value=arr[8].ToString();
param[9]=new SqlParameter("@ShortIntro",SqlDbType.VarChar );
param[9].Value=arr[9].ToString();
param[10]=new SqlParameter("@Resume",SqlDbType.VarChar );
param[10].Value=arr[10].ToString();
param[11]=new SqlParameter("@IsPublic",SqlDbType.VarChar);
param[11].Value=arr[11].ToString();
param[12]=new SqlParameter("@HomaePage",SqlDbType.VarChar );
param[12].Value=arr[12].ToString();
param[13]=new SqlParameter("@IndustryID",SqlDbType.Int );
param[13].Value=arr[13].ToString();
param[14]=new SqlParameter("@AppID",SqlDbType.Int );
param[14].Value=arr[14].ToString();
param[15]=new SqlParameter("@ResumeTitle",SqlDbType.VarChar);
param[15].Value = arr[15].ToString();

try
{
int rows=SqlHelper.ExecuteNonQuery(Constr,CommandType.StoredProcedure,"sp_insert_Resume",param);
if(rows==1)
{
return "true";
}
else
{
return "false";

}
}
catch(Exception ex)
{
return "false"+ ex.Message + ex.ToString() ;
}

}
public string SaveJobSeeker(string[] arr)
{
SqlParameter[] param=new SqlParameter[11];
param[0]=new SqlParameter("@FirstName",SqlDbType.VarChar);
param[0].Value=arr[0].ToString();
param[1]=new SqlParameter("@FatherName",SqlDbType.VarChar);
param[1].Value=arr[1].ToString();
param[2]=new SqlParameter("@Address1",SqlDbType.VarChar);
param[2].Value=arr[2].ToString();
param[3]=new SqlParameter("@Address1",SqlDbType.VarChar);
param[3].Value=arr[3].ToString();
param[4]=new SqlParameter("@DateOFBirth",SqlDbType.DateTime );
param[4].Value=arr[4].ToString();
param[5]=new SqlParameter("@Natioinality",SqlDbType.VarChar );
param[5].Value=arr[5].ToString();
param[6]=new SqlParameter("@Religion",SqlDbType.VarChar);
param[6].Value=arr[6].ToString();
param[7]=new SqlParameter("@HomeNo",SqlDbType.VarChar);
param[7].Value=arr[7].ToString();
param[8]=new SqlParameter("@CellularNo",SqlDbType.VarChar);
param[8].Value=arr[8].ToString();
param[9]=new SqlParameter("@WorkNo",SqlDbType.VarChar);
param[9].Value=arr[9].ToString();
param[10]=new SqlParameter("@Religion",SqlDbType.VarChar);
param[10].Value=arr[10].ToString();

try
{
int rows=SqlHelper.ExecuteNonQuery(Constr,CommandType.StoredProcedure,"sp_insert_JobSeeker",param);
if(rows==1)
{
return "true";
}
else
{
return "false";

}
}
catch(Exception ex)
{
return "false" + ex.ToString();
}
}
public string UpdateResume(string[] arr)
{
SqlParameter[] param=new SqlParameter[17];
param[0]=new SqlParameter("@ResumeID",SqlDbType.Int );
param[0].Value=arr[0].ToString();
param[1]=new SqlParameter("@JobTypeID",SqlDbType.Int );
param[1].Value=arr[1].ToString();
param[2]=new SqlParameter("@AvailabilityID",SqlDbType.Int );
param[2].Value=arr[2].ToString();
param[3]=new SqlParameter("@StatusID",SqlDbType.VarChar);
param[3].Value=arr[3].ToString();
param[4]=new SqlParameter("@WorkLocationID",SqlDbType.Int );
param[4].Value=arr[4].ToString();
param[5]=new SqlParameter("@EducationalSummary",SqlDbType.VarChar);
param[5].Value=arr[5].ToString();
param[6]=new SqlParameter("@ExpectedSalary",SqlDbType.VarChar);
param[6].Value=arr[6].ToString();
param[7]=new SqlParameter("@CurrencyID",SqlDbType.Int );
param[7].Value=arr[7].ToString();
param[8]=new SqlParameter("@LastSalary",SqlDbType.VarChar );
param[8].Value=arr[8].ToString();
param[9]=new SqlParameter("@CareerObjectives",SqlDbType.VarChar );
param[9].Value=arr[9].ToString();
param[10]=new SqlParameter("@ShortIntro",SqlDbType.VarChar );
param[10].Value=arr[10].ToString();
param[11]=new SqlParameter("@Resume",SqlDbType.VarChar );
param[11].Value=arr[11].ToString();
param[12]=new SqlParameter("@IsPublic",SqlDbType.VarChar);
param[12].Value=arr[12].ToString();
param[13]=new SqlParameter("@HomaePage",SqlDbType.VarChar );
param[13].Value=arr[13].ToString();
param[14]=new SqlParameter("@IndustryID",SqlDbType.Int );
param[14].Value=arr[14].ToString();
param[15]=new SqlParameter("@AppID",SqlDbType.Int );
param[15].Value=arr[15].ToString();
param[16]=new SqlParameter("@ResumeTitle",SqlDbType.VarChar );
param[16].Value=arr[16].ToString();
try
{
int rows=SqlHelper.ExecuteNonQuery(Constr,CommandType.StoredProcedure,"sp_update_Resume",param);
if(rows==1)
{
return "true";
}
else
{
return "false";
}
}
catch(Exception ex)
{
return "false"+ ex.Message ;
}
}
public string UpdateJobSeeker(string[] arr)
{
SqlParameter[] param=new SqlParameter[13];
param[0]=new SqlParameter("@AppID",SqlDbType.Int);
param[0].Value=arr[0].ToString();
param[1]=new SqlParameter("@FirstName",SqlDbType.VarChar);
param[1].Value=arr[1].ToString();
param[2]=new SqlParameter("@FatherName",SqlDbType.VarChar);
param[2].Value=arr[2].ToString();
param[3]=new SqlParameter("@Address1",SqlDbType.VarChar);
param[3].Value=arr[3].ToString();
param[4]=new SqlParameter("@Address1",SqlDbType.VarChar);
param[4].Value=arr[4].ToString();
param[5]=new SqlParameter("@DateOFBirth",SqlDbType.DateTime );
param[5].Value=arr[5].ToString();
param[6]=new SqlParameter("@Natioinality",SqlDbType.VarChar );
param[6].Value=arr[6].ToString();
param[7]=new SqlParameter("@Religion",SqlDbType.VarChar);
param[7].Value=arr[7].ToString();
param[8]=new SqlParameter("@HomeNo",SqlDbType.VarChar);
param[8].Value=arr[8].ToString();
param[9]=new SqlParameter("@CellularNo",SqlDbType.VarChar);
param[9].Value=arr[9].ToString();
param[10]=new SqlParameter("@WorkNo",SqlDbType.VarChar);
param[10].Value=arr[10].ToString();
param[12]=new SqlParameter("@Photo",SqlDbType.VarChar);
param[12].Value=arr[12].ToString();
try
{
int rows=SqlHelper.ExecuteNonQuery(Constr,CommandType.StoredProcedure,"sp_Update_JobSeeker",param);
if(rows==1)
{
return "true";
}
else
{
return "false";

}
}
catch
{
return "false";
}
}
public DataSet SelectJobSeekerByID(int str)
{
SqlParameter[] param=new SqlParameter[1];
param[0]=new SqlParameter("@AppID",SqlDbType.Int);
param[0].Value =str.ToString();
try
{
DataSet ds=SqlHelper.ExecuteDataset(Constr,CommandType.StoredProcedure,"sp_SelectBYID_JobSeeker",param);
if(ds!=null)
{
return ds;
}
else
{
return null;

}
}
catch
{
return null;
}

}

}
}
using System;
using System.Data;
using JJ_DAC ;
namespace JJ_BL
{
public class BL_JobSeeker
{
public BL_JobSeeker()
{
}
private string _AppID;
private string _FirstName;
private string _FatherName;
private string _Address1;
private string _Address2;
private string _DateOfBirth;
private string _Nationality;
private string _Rel;
private string _HomeNo;
private string _CellularNo;
private string _WorkNo;
private string _Photo;
private string _IndustryID;
private string _StatusID;
private string _JobTypeID;
private string _AvailabilityID;
private string _Religion;
private string _WorkLocationID;
private string _ExperienceLevelID;
private string _EducationalLevelID;
private string _EducationSummary;
private string _ExpectedSalary;
private string _CurrencyID;
private string _LastSalary;
private string _CareerObjectives;
private string _ShortIntro;
private string _Resume;
private string _Ispublic;
private string _HomePage;
private string _ResumeTitle;
private string _ResumeID;
public string AppID
{
get{return _AppID ;}
set{_AppID=value ; }
}
public string FirstName
{
get{return _FirstName ;}
set{_FirstName =value ; }
}
public string FatherName
{
get{return _FatherName ;}
set{_FatherName =value ; }
}
public string Address1
{
get{return _Address1 ;}
set{_Address1 =value ; }
}
public string Address2
{
get{return _Address2 ;}
set{_Address2=value ; }
}
public string DateOfBirth
{
get{return _DateOfBirth ;}
set{_DateOfBirth =value ; }
}
public string Nationality
{
get{return _Nationality ;}
set{_Nationality =value ; }
}
public string Religion
{
get{return _Religion ;}
set{_Religion =value ; }
}
public string HomeNo
{
get{return _HomeNo ;}
set{_HomeNo =value ; }
}
public string CellularNo
{
get{return _CellularNo ;}
set{_CellularNo =value ; }
}
public string WorkNo
{
get{return _WorkNo ;}
set{_WorkNo =value ; }
}

public string Photo
{
get{return _Photo;}
set{_Photo =value ; }
}
public string IndustryID
{
get { return _IndustryID;}
set { _IndustryID=value; }
}
public string StatusID
{
get { return _StatusID ;}
set { _StatusID =value; }
}
public string JobTypeID
{
get { return _JobTypeID ;}
set { _JobTypeID =value; }
}
public string AvailabilityID
{
get { return _AvailabilityID ;}
set { _AvailabilityID =value; }
}
public string WorkLocationID
{
get { return _WorkLocationID ;}
set { _WorkLocationID =value; }
}
public string ExperienceLevelID
{
get { return _ExperienceLevelID ;}
set { _ExperienceLevelID =value; }
}
public string EducationalLevelID
{
get { return _EducationalLevelID ;}
set { _EducationalLevelID =value; }
}
public string EducationalSummary
{
get { return _EducationSummary ;}
set { _EducationSummary =value; }
}
public string ExpectedSalary
{
get { return _ExpectedSalary ;}
set { _ExpectedSalary =value; }
}
public string CurrncyID
{
get { return _CurrencyID ;}
set { _CurrencyID =value; }
}
public string LastSalary
{
get { return _LastSalary ;}
set { _LastSalary =value; }
}
public string CareerObjectives
{
get { return _CareerObjectives;}
set { _CareerObjectives=value; }
}
public string ShortIntro
{
get { return _ShortIntro;}
set { _ShortIntro=value; }
}
public string Resume
{
get { return _Resume;}
set { _Resume =value; }
}
public string Rel
{
get { return _Rel ;}
set { _Rel =value; }
}
public string ResumeTitle
{
get { return _ResumeTitle;}
set { _ResumeTitle =value; }
}
public string IsPublic
{
get { return _Ispublic ;}
set { _Ispublic =value; }
}
public string HomrPage
{
get { return _HomePage ;}
set {_HomePage=value; }
}
public string Status
{
get{return _StatusID;}
set{_StatusID=value ; }
}
public string ResumeID
{
get { return _ResumeID;}
set { _ResumeID =value; }
}


public string SaveJobSeeker()
{
string[] arr=new string[11];
arr[0]=FirstName;
arr[1]=FatherName;
arr[2]=Address1 ;
arr[3]=Address2 ;
arr[4]=DateOfBirth;
arr[5]=Nationality;
arr[6]=HomeNo;
arr[7]=CellularNo ;
arr[8]=WorkNo ;
arr[9]=Photo ;
arr[10]=Religion ;
DAC_JobSeeker objJobSeeker=new DAC_JobSeeker();
return objJobSeeker.SaveJobSeeker(arr);
}

public string CreateResume()
{
string[] arr=new string[16];
arr[0]=JobTypeID;
arr[1]=AvailabilityID ;
arr[2]=Status ;
arr[3]=WorkLocationID;
arr[4]=EducationalSummary ;
arr[5]=ExpectedSalary;
arr[6]=CurrncyID;
arr[7]=LastSalary;
arr[8]=CareerObjectives;
arr[9]=ShortIntro;
arr[10]=Resume;
arr[11]=IsPublic ;
arr[12]=HomrPage ;
arr[13]=IndustryID;
arr[14]=AppID ;
arr[15]=ResumeTitle;
DAC_JobSeeker objSeeker=new DAC_JobSeeker();
return objSeeker.CreateResume(arr);
}
public string UpdateJobSeeker()
{
string[] arr=new string[13];
arr[0]=AppID ;
arr[1]=FirstName;
arr[2]=FatherName;
arr[3]=Address1 ;
arr[4]=Address2 ;
arr[5]=DateOfBirth;
arr[6]=Nationality;
arr[7]=Rel;
arr[8]=HomeNo;
arr[9]=CellularNo ;
arr[10]=WorkNo ;
arr[12]=Photo ;

DAC_JobSeeker objJobSeeker=new DAC_JobSeeker();
return objJobSeeker.UpdateJobSeeker(arr);
}
public string UpdateResume()
{

string[] arr=new string[17];
arr[0]=ResumeID;
arr[1]=JobTypeID;
arr[2]=AvailabilityID ;
arr[3]=Status ;
arr[4]=WorkLocationID;
arr[5]=EducationalSummary ;
arr[6]=ExpectedSalary;
arr[7]=CurrncyID;
arr[8]=LastSalary;
arr[9]=CareerObjectives;
arr[10]=ShortIntro;
arr[11]=Resume;
arr[12]=IsPublic ;
arr[13]=HomrPage ;
arr[14]=IndustryID;
arr[15]=AppID ;
arr[16]=ResumeTitle;

DAC_JobSeeker objSeeker=new DAC_JobSeeker();
return objSeeker.UpdateResume(arr);
}


public DataSet SelectResumeBYID(string str)
{
DAC_JobSeeker objJobSeeker=new DAC_JobSeeker();
return objJobSeeker.SelectResumeByID(str);
}
public DataSet SelectJobSeekerByID(int str)
{
DAC_JobSeeker objJobSeeker=new DAC_JobSeeker();
return objJobSeeker.SelectJobSeekerByID(str) ;
}



}
}


Points of Interest

yes i learn how to map objects(Entity) to class and DB

History

i made and improvement using C# generic here

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) Axact Pvt Ltd
Pakistan Pakistan
Sr Software Engineer
Axact Pvt Ltd
Karachi Pakistan

Comments and Discussions

 
QuestionDatabase not restoring Pin
Prashant Vatsa21-Jan-12 17:08
Prashant Vatsa21-Jan-12 17:08 
GeneralMy vote of 1 Pin
Aoi Karasu 16-Nov-09 0:39
professional Aoi Karasu 16-Nov-09 0:39 
GeneralIts article poor as its language. Pin
Aoi Karasu 16-Nov-09 0:39
professional Aoi Karasu 16-Nov-09 0:39 
GeneralDb. Pin
rach_fran5-Mar-08 21:08
rach_fran5-Mar-08 21:08 
AnswerRe: Db. Pin
Mohammad Rizwan8-Apr-08 3:35
Mohammad Rizwan8-Apr-08 3:35 
simply paste it mdf and ldf file in Data Folder of SQL Then Refresh SQL Server Enterpeisr Manager

Mohammad Rizwan
(Sr Engineer Sofware Development)
Axact Pvt LTd

GeneralWTH Pin
Oslec21-Nov-07 4:16
Oslec21-Nov-07 4:16 
QuestionUm.... Content???? Pin
Tonster1019-Nov-07 10:58
Tonster1019-Nov-07 10:58 
AnswerRe: Um.... Content???? Pin
Colin Angus Mackay9-Nov-07 11:09
Colin Angus Mackay9-Nov-07 11:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.