本文介绍了在数据库中注册一种用户需要帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在州级C#ASP.NET表单学校管理中创建一个Web应用程序。

MASTER ADMIN注册MUNICIPALITY ADMINS,MUNICIPALITY ADMIN注册SCHOOL ADMIN,最后学校管理员注册学校的方向,学科,课程,教师和学生。

提到应用程序来管理小学和中学。

直到现在我注册了所有类型的用户,即MASTER ADMIN,MUNICIPALITY ADMIN,SCHOOL ADMIN。

还有学校,方向,学科和课程。

到目前为止所有工作都很好,但是当我试图注册TEASCHERS和学生时问题就存在了。

表PERSON具有以下属性:

I'm creating an web application in C# ASP.NET form school management in an state level.
The MASTER ADMIN registers the MUNICIPALITY ADMINS, the MUNICIPALITY ADMIN registers the SCHOOL ADMIN and in the end the SCHOOL ADMIN registers school ORIENTATIONS, SUBJECTS, CLASSES, TEACHERS and STUDENTS.
The application is mentioned to manage the primary and secondary schools.
Till now I registered all kind of users that are MASTER ADMIN, MUNICIPALITY ADMIN, SCHOOL ADMIN.
Also SCHOOLS, ORIENTATIONS, SUBJECTS and CLASSES.
All works good till now, but the problem exists while I'm trying to register TEASCHERS and STUDENTS.
The table PERSON has the following attributes:

CREATE TABLE [dbo].[PERSON](
	[ID_Person] [int] IDENTITY(1,1) NOT NULL,
	[FirstName] [nvarchar](20) NOT NULL,
	[LastName] [nvarchar](20) NOT NULL,
	[Sex] [nvarchar](10) NOT NULL,
	[DateOfBirth] [date] NOT NULL,
	[PlaceOfBirth] [nvarchar](30) NOT NULL,
	[ID_Role] [int] NOT NULL,
	[ID_Identification] [int] NOT NULL,
	[ID_Municipality] [int] NOT NULL,





表MUNICIPALITY



The table MUNICIPALITY

CREATE TABLE [dbo].[MUNICIPALITY](
	[ID_Municipality] [int] IDENTITY(1,1) NOT NULL,
	[Municipality] [nvarchar](20) NOT NULL,



表格SCHOOL


The table SCHOOL

CREATE TABLE [dbo].[SCHOOL](
	[ID_School] [int] IDENTITY(1,1) NOT NULL,
	[SchoolName] [nvarchar](50) NOT NULL,
	[AcademicYear] [nvarchar](15) NOT NULL,
	[Address] [nvarchar](50) NOT NULL,
	[ID_Person] [int] NOT NULL,
	[ID_Municipality] [int] NOT NULL,
 CONSTRAINT [PK_SCHOOL] PRIMARY KEY CLUSTERED 



表ORIENTATIO


The table ORIENTATIO

CREATE TABLE [dbo].[ORIENTATION](
	[ID_Orientation] [int] IDENTITY(1,1) NOT NULL,
	[ID_School] [int] NOT NULL,
	[OrientationName] [nvarchar](50) NULL,
 CONSTRAINT [PK_ORIENTATION] PRIMARY KEY CLUSTERED



Th e表标识


The Table IDENTIFICATION

CREATE TABLE [dbo].[IDENTIFICATION](
	[ID_Identification] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [nvarchar](20) NOT NULL,
	[Password] [nvarchar](20) NOT NULL,
	[ID_Role] [int] NOT NULL,
	[RegistrationDate] [date] NULL,
	[Status] [bit] NULL,
 CONSTRAINT [PK_IDENTIFICATION] PRIMARY KEY CLUSTERED 



和表格ROLE


and table ROLE

CREATE TABLE [dbo].[ROLE](
	[ID_Role] [int] IDENTITY(1,1) NOT NULL,
	[RoleName] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_ROLE] PRIMARY KEY CLUSTERED 





希望你不要对这些表格感到困惑,但是当我尝试注册一个老师时,它必须有一个来自学校的参考,例如来自表SCHOOL的列ID_School,问题是MASTER ADMIN和MUNICIPALITY ADMIN不属于SCHOOL,所以如果我在表PERSON中添加另一个名为ID_School的列,则所有用户必须属于一所学校。

我的问题是:

如何在我的系统中添加一个教师并引用一个特定的学校?

我是否必须在TABLE和PERSON表之间添加另一个表格或如何解决这个问题。

在阅读本主题时,请提前感谢您的耐心。


干杯。



Hopefully you are not confused on those tables, but when I try to register a teacher, it must have a reference from school like column ID_School from table SCHOOL, and the problem is that MASTER ADMIN and MUNICIPALITY ADMIN are not part of SCHOOL so if I add another column named ID_School in table PERSON all of users must belong to one school.
My question is:
How to add a TEACHER in my system and to refer to a specific school?
Do I have to add another table between tables SCHOOL and PERSON or how to solve this.
Thank you in advance for your patience while reading this topic.

Cheers.

推荐答案

CREATE TABLE [dbo].[TEACHER](
	[ID_Teacher] [int] NOT NULL,
	[ID_School] [int] NOT NULL,
 CONSTRAINT [ID_Teacher] PRIMARY KEY CLUSTERED



ID_Teacher本身就是佛与PERSON表的ID_Person列统一关键关系。



希望这会有所帮助。


ID_Teacher having itself a foreign key relation with ID_Person column of PERSON table.

Hope this helps.


这篇关于在数据库中注册一种用户需要帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 15:54