?
Solved

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

Posted on 2004-10-17
3
Medium Priority
?
234 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
[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
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
MikeMCSD earned 2000 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

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

777 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