Solved

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

Posted on 2004-10-17
3
214 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

17 Experts available now in Live!

Get 1:1 Help Now