Hai..Good evening Frnds...
I need 3-tier architecture & N-tier Architecture best examples and how we use in our projects... plz help me....
Thanks in Advance Dudes :)
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
selvi subramanianPosted Apr 3, 2014, 2:21 AM
2nd to create in the name of BAL
3rd u have to design a page
DAL code
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
///
/// Summary description for DAL
///
public class DAL
{
string s = ConfigurationManager.AppSettings["ss"].ToString();
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
public DAL()
{
//
// TODO: Add constructor logic here
//
}
public int inset(string FName, string Age, string Resume)
{
con = new SqlConnection(s);
con.Open();
try
{
string qr="insert into thretier(FName,Age,Resume) values ('" + FName + "','" + Age + "','" + Resume + "')";
cmd = new SqlCommand(qr,con);
return cmd.ExecuteNonQuery();
}
catch {
throw;
}
finally
{
cmd.Dispose();
con.Dispose();
con.Close();
}
}
public DataTable selcc()
{
con = new SqlConnection(s);
con.Open();
try
{
string qry="select * from thretier";
cmd=new SqlCommand(qry,con);
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataTable dt=new DataTable();
da.Fill(dt);
return dt;
}
catch(Exception)
{
throw;
}
finally
{
cmd.Dispose();
con.Dispose();
con.Close();
}
}
}
BAL code
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
///
/// Summary description for BAL
///
public class BAL
{
DAL ash=new DAL();
public BAL()
{
//
// TODO: Add constructor logic here
//
}
public int inset(string FName, string Age, string Resume)
{
try
{
return ash.inset(FName, Age, Resume);
}
catch
{
throw;
}
finally
{
ash = null;
}
}
public DataTable getdaa()
{
try
{
return ash.selcc();
}
catch
{
throw;
}
finally
{
}
}
}
3rd design
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
.style1
{
width: 100%;
}
.style2
{
width: 556px;
}
code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
BAL selv = new BAL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
aggg();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
aggg();
string Filena = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName.ToString());
string save = Server.MapPath("Resume") + "\\" + Filena;
if (FileUpload1.PostedFile != null)
{
FileUpload1.PostedFile.SaveAs(save);
}
string FName = txname.Text;
string Age = tage.Text;
string Resume = Filena.ToString();
int dash;
dash=selv.inset(FName,Age,Resume);
}
private void aggg()
{
ListItem li = new ListItem();
li.Text = "Select";
li.Value = "0";
ddag.Items.Add(li.ToString());
for (int i = 0; i <= 100; i++)
{
ddag.Items.Add(Convert.ToString(i));
}
}
}
Lalit RaghuvanshiPosted Apr 2, 2014, 12:34 PM
Sandeep Singh ShekhawatPosted May 20, 2013, 8:07 AM
http://www.dotnetfunda.com/articles/article71.aspx
Chintan RathodPosted May 20, 2013, 8:03 AM
3 tier architecture
N tier architecture
http://www.codeproject.com/Articles/434282/A-N-Tier-Architecture-Sample-with-ASP-NET-MVC3-WCF
Anurag SarkarPosted May 17, 2013, 11:54 AM