?
Solved

Help with creating a 3 tier web design

Posted on 2006-11-21
1
Medium Priority
?
276 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
boy8964 earned 2000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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 This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

770 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