Solved

Help with creating a 3 tier web design

Posted on 2006-11-21
1
238 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now