N层注册申请 [英] N tier application for registration

查看:69
本文介绍了N层注册申请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生.

我正在为学生编写孕期申请表.我有sqlhelper类,业务逻辑,一个名为Class1的类,在此Class1中我编写了属性:

类别1:
-------

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:
-------

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:
-----


aspx.cs:
-----

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;


现在,在哪里编写业务逻辑代码以及在何处调用SP?

有人知道吗?
请帮帮我.

谢谢.


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

Anybody knows?
Please help me.

Thanking you.

推荐答案

您首先需要了解什么是n层体系结构,以及为什么要使用它?

我建议您阅读该概念,然后遍历Web上有关实现n层体系结构的一些教程.

您可以开始
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:


好.您在此处所做的"Class1"是一个对象模型.

创建一个类库-BusinessLogic
创建一个类库-DataAccess

现在,从您的UI,使用对象模型并传递给BusinessLogic项目类.此类是业务逻辑类.根据您的需要进行更改.
现在,将更改后的数据从业务逻辑类传递到dataAccess项目类.在此类中,使用ADO.NET并将所需的值传递给存储过程.

为了取回数据,数据将从DA传输到BL,然后从BL传输到UI层.
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.


仅是一个建议,因为您的答案已被其他人充分回答.

您是否使用dotNet 3.0或更高版本?如果是这样,您可能希望更改属性的语法以使用自动实现的属性.它们使代码更易于在简单的读取/写入属性值上读取.


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.
public string Gender1{ get; set; }
public string StudentName1{ get; set; }


会更易于阅读,但包含与
相同的功能


would be easier to read, but contains the same functionality as

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


这篇关于N层注册申请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆