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
Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

840 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