Solved

Help with creating a 3 tier web design

Posted on 2006-11-21
1
260 Views
Last Modified: 2011-08-18
Hi
can any please complete the code below so that I can try and understand how to create a 3 tier web design.

 ============== Presention layer index.aspx==============================

<asp:FormView ID="frmCustomerDetails" Caption="Customer Details" runat="server">
    <ItemTemplate>
    <%# Eval("YourName") %>
    </ItemTemplate>
    </asp:FormView>

 ============== Code behind index.aspx.cs==============================

protected void Page_Load(object sender, EventArgs e)
        {
       
                try
            {
            FormsIdentity objLoginTicket;
            objLoginTicket = (FormsIdentity)User.Identity;
            IntReturnOrderNumber = Convert.ToInt32(objLoginTicket.Ticket.UserData);
            frmCustomerDetails.DataSource =
            frmCustomerDetails.DataBind()

I DO NOT KNOW HOW TO PASS THE VALUE OF IntReturnOrderNumber INTO THE BUSINESS LAYER

============== Business layer customerdetailsBL.cs ==============================

Not sure what goes here

============== Database layer customerdetailsDB.cs ==============================
public CustomerDetailsBL GetCustomerDetails(int IntReturnOrderNumber)
            {
            SqlConnection Conn = new SqlConnection(getdbConnection);
            SqlCommand Cmd = new SqlCommand("sp_xxxxx", Conn);
            Cmd.CommandType = CommandType.StoredProcedure;
            Cmd.Parameters.Add(new SqlParameter("@CustomerID", SqlDbType.Int, 4));
            Cmd.Parameters["@CustomerID"].Value = IntReturnOrderNumber;

            try
                {
                Conn.Open();
                SqlDataReader Rdr = Cmd.ExecuteReader(CommandBehavior.SingleRow);
                Rdr.Read();
                CustomerDetailsBL CustDtl = new CustomerDetailsBL(
                   (int)Rdr["OrderNumber"],
                    (string)Rdr["UserName"],
                     (string)Rdr["PassWord"],
                      (string)Rdr["YourName"],
                       (string)Rdr["JobTitle"],
                        (string)Rdr["CompanyName"],
                         (string)Rdr["CompanyAddress"],
                          (string)Rdr["CompanyCityTown"],
                           (string)Rdr["CompanyCountyState"],
                            (string)Rdr["CompanyPostCodeZipCode"],
                             (string)Rdr["CompanyCountry"],
                              (string)Rdr["CompanyPhone"]);
                Rdr.Close();
                return CustDtl;
                }
            catch (SqlException)
                {
                throw new ApplicationException("Sorry an error has occured");
                }
            finally
                {
                Conn.Close();
                Conn.Dispose();
                }
            }

Any help would be appreciated
George


0
Comment
Question by:LearningCSharpSQL
1 Comment
 
LVL 4

Accepted Solution

by:
boy8964 earned 500 total points
ID: 17993370
I think you are little bit confuse with 3-tiers application.

Should do this:

1. Create seperate projects for each layer.
2. from Presention layer, create an object of bussiness layer
3. the class in bussiness layer process data and then create ao object of data access layer
4. class in data access layer insert data into database.

this is logic 3-tiers application.

However, we can also do phsical 3-tiers application as well - it is out of this topic.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question