Solved

Help with creating a 3 tier web design

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# MVC Insert Multiple Row into DB 2 93
Please explain purpose of GZIP 4 81
asp web application 3 54
Disable the weekends on datepicker control 6 50
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…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

738 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