Solved

3-tier architecture asp.net Multi domains dbase driven website

Posted on 2004-10-17
3
223 Views
Last Modified: 2012-08-13
Hi
i have posted before http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21127643.html about having multi domains pointing to the same website. I am an asp devolper but i am going to advice my staff to rebuild the whole application with asp.net.
The senario is like that.
I want to build 3-tier architecture for my application and i need to know that i am in the right way.
1- i will use stored procedures to store all the dbase realted issues.
2- i will use views in the dbase to get the recordsets for each domain (basically the same functions but each domain will get the results from the realted categories)
3- i am not sure how to get the business logic away from the presentaion
4- i do not know how to allow the .net to use different layouts with each domain. basically what is the techniques used.
5- the application should be multilangual , is that a complicated process with multi layouts.
i need detailed information and links to usefull resources.
Thanks in advance for all the help
0
Comment
Question by:mohmedsh
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
MikeMCSD earned 500 total points
ID: 12447685
THIS IS A SIMPLE PRESENTATION, BUSINESS, DATABASE 3-TIER EXAMPLE.
HERE I'M GETTING THE LIST OF CATEGORIES FROM THE SQL SERVER DATABASE:

PUT THIS IN YOUR Web.config, THIS IS THE GLOBAL CONNECTION TO THE DATABASE:

    <appSettings>
   <add key="ConnectionString"  
           value="server=localhost;Trusted_Connection=true;database=MY_DATABASE"/>
    </appSettings>

THIS IS THE .ASPX PAGE THAT WILL DISPLAY THE RESULTS (PRESENTATION)
I'M USING A DATALIST BECAUSE THEY HAVE A LOT OF FEATURES BUILT IN:

<asp:DataList Width="100%" id="list" runat="server" CellPadding="0">
<ItemTemplate>
<TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
<TBODY>
<TR>
<TD vAlign=top>
<A id="hyp2" runat="server" href='<%#  DataBinder.Eval(Container.DataItem, "Name") %>' style="cursor: pointer;">
<IMG height=60 width=60 src='images/catsec/<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>' border=0></A></TD></TR>
<TR>
<td align=left bgcolor=#f7f7f7>
<font class="PDesc"> <%# DataBinder.Eval(Container.DataItem, "description") %> </font>
</TD></TR>
</TBODY></TABLE>
</td></tr>
</TBODY></TABLE><br>
</ItemTemplate>
</asp:DataList>

IN THE CODE BEHIND FOR THAT PAGE, ASPX.VB, PUT:

'I'M GETTING PARAMETER FROM QUERY STRING TO PASS TO THE FUNCTION:
Dim departmentId As String = Request.QueryString("DepartmentID")

'I'M CALLING A FUNCTION TO FILL THE DATALIST WITH:
        list.DataSource = Catalog.GetCategoriesInDepartment(departmentId)
        list.DataBind()


BUSINESS LOGIC
MAKE A CLASS FILE CALLED Catalog.vb . . and put the function(s) in it:

Public Class Catalog

Public Shared Function GetCategoriesInDepartment(ByVal departmentId As String) As SqlDataReader
        Dim connection As New SqlConnection(connectionString)
        Dim command As New SqlCommand("GetCategoriesInDepartment", connection)
        command.CommandType = CommandType.StoredProcedure
        command.Parameters.Add("@DepartmentID", SqlDbType.Int, 4)
        command.Parameters("@DepartmentID").Value = departmentId
        Try
            connection.Open()
            ' Return an SqlDataReader to the calling function
            Return command.ExecuteReader(CommandBehavior.CloseConnection)
        Catch e As Exception
            connection.Close()
            Throw e
        End Try
    End Function

'ADD THIS ALSO, THIS IS THE CONNECTION STRING PROPERTY FOR THE DATABASE:

Private Shared ReadOnly Property connectionString() As String
        Get
            Return ConfigurationSettings.AppSettings("ConnectionString")
        End Get
    End Property

End Class


THIS IS THE STORED PROCEDURE THAT THE FUCTION USES:

CREATE PROCEDURE GetCategoriesInDepartment
      (@DepartmentID int)
AS

SELECT CategoryID, [Name], [Description], ImagePath
FROM Category
WHERE DepartmentID = @DepartmentID


THIS IS A SIMPLE EXAMPLE THAT SHOWS THE 3 LAYERS.
IF YOU HAVE ANY QUESTION JUST ASK.

0
 
LVL 16

Expert Comment

by:MikeMCSD
ID: 12452852
I highly recommed this book.  It explains the 3-tier approach.
It also gives a lot of tricks and techniques on ASP.NET.
Great book!


http://www.amazon.com/gp/product/customer-reviews/1590592549/ref=cm_cr_dp_2_1/102-3787577-5262502?%5Fencoding=UTF8&me=ATVPDKIKX0DER
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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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