Click here to Skip to main content
15,881,612 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir.

I am writing n tier application for regestration form for a student. I have sqlhelper class, business logic, one class named Class1, in this Class1 I wrote properties:

Class1:
-------
C#
string StudentName, Gender, FatherName, Address, CompletedClass, PreviousSchool, Howdoyouknow;

   public string Gender1
   {
       get { return Gender; }
       set { Gender = value; }
   }

   public string StudentName1
   {
       get { return StudentName; }
       set { StudentName = value; }
   }

   public string FatherName1
   {
       get { return FatherName; }
       set { FatherName = value; }
   }

   public string Address1
   {
       get { return Address; }
       set { Address = value; }
   }

   public string CompletedClass1
   {
       get { return CompletedClass; }
       set { CompletedClass = value; }
   }

   public string PreviousSchool1
   {
       get { return PreviousSchool; }
       set { PreviousSchool = value; }
   }

   public string Howdoyouknow1
   {
       get { return Howdoyouknow; }
       set { Howdoyouknow = value; }
   }

aspx.cs:
-----
C#
DataSet ds = new DataSet();

        Class1 cs = new Class1();
        cs.StudentName1 = TxtStudentName.Text;
        cs.Gender1 = RBGender.Text;
        cs.FatherName1 = TxtFatherName.Text;
        cs.Address1 = TxtAddress.Text;
        cs.CompletedClass1 = TxtCompletedClass.Text;
        cs.PreviousSchool1 = TxtPreviousSchool.Text;
        cs.Howdoyouknow1 = DDLSchool.Text;

Now, where to write the code for business logic and where do I call the SP?

Anybody knows?
Please help me.

Thanking you.
Posted
Updated 7-Jan-11 0:07am
v2

You first need to understand what n-tier architecture is and why do we use it?

I suggest you read the concept and then go through some tutorials available on the web on implementing n-tier architecture.

You can start here[^]. :thumbsup:
 
Share this answer
 
v2
Comments
Sandesh M Patil 7-Jan-11 6:05am    
Good link
sathish.jampala 7-Jan-11 8:08am    
thanks for ur quick reply
Ok. What you made here 'Class1' is an object model.

Create a class library - BusinessLogic
Create a class library - DataAccess

Now, from your UI, use the object model and pass on to BusinessLogic project class. This class is a Business logic class. Do the changes as per your need here.
Now, pass on the changed data from business logic class to dataAccess project class. In this class, use ADO.NET and pass on the needed values to Stored Procedure.

For getting back data, it will be transferred from DA to BL and then BL to UI layer.
 
Share this answer
 
Comments
Sandesh M Patil 7-Jan-11 6:06am    
Good answer
sathish.jampala 7-Jan-11 8:08am    
thanks for ur quick reply
Just more of a suggestion as your answer was sufficiently answered by the others.

Are you using dotNet 3.0 or higher? If so, you may wish to change the syntax of your properties to make use of Auto-Implemented Properties. They make the code much easier to read on simple read/write property values.

i.e.
C#
public string Gender1{ get; set; }
public string StudentName1{ get; set; }

would be easier to read, but contains the same functionality as
C#
 public string Gender1
{
    get { return Gender; }
    set { Gender = value; }
}
public string StudentName1
{
    get { return StudentName; }
    set { StudentName = value; }
}
 
Share this answer
 
Comments
Nuri Ismail 7-Jan-11 10:50am    
Good suggestion! +5
Here is some useful info
ASP.NET Quickstart Tutorials[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
Sandesh M Patil 7-Jan-11 6:06am    
good link
sathish.jampala 7-Jan-11 8:08am    
thanks for ur quick reply
Hope N-Tier Application[^]will give idea.
 
Share this answer
 
Comments
sathish.jampala 7-Jan-11 8:08am    
thanks for ur quick reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900