Автоматизация учебного процесса в высших учебных заведениях
Анализ автоматизируемых при разработке учебных планов с нормативными документами. Определение целевого сегмента пользователей. Разработка структуры базы данных и отчетных документов. Дизайн интерфейса. Процесс подготовки образовательных программ.
Рубрика | Программирование, компьютеры и кибернетика |
Вид | дипломная работа |
Язык | русский |
Дата добавления | 19.01.2017 |
Размер файла | 1,5 M |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
fChangePZK->ShowModal();
delete fChangePZK;
ShowPZ();
}
void __fastcall TfFGOS::ToolButton8Click(TObject *Sender)
{
TfChangePZK *fChangePZK = new TfChangePZK(Application);
fChangePZK->Caption = "Профессиональные компетенции";
fChangePZK->prof_id = proftypes->KeyValue;
fChangePZK->spec_id = specialities->KeyValue;
fChangePZK->PZ = false;
fChangePZK->ShowModal();
ShowPK();
if (fChangePZK->inserted)
dm->qPK->Locate("id", fChangePZK->ins_id, TLocateOptions() << loCaseInsensitive);
delete fChangePZK;
}
void __fastcall TfFGOS::ToolButton10Click(TObject *Sender)
{
TfChangePZK *fChangePZK = new TfChangePZK(Application);
fChangePZK->Caption = "Профессиональные компетенции";
fChangePZK->name_->Text = DBGridEh3->DataSource->DataSet->FieldByName("name")->AsString;
fChangePZK->ID = DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger;
fChangePZK->prof_id = proftypes->KeyValue;
fChangePZK->spec_id = specialities->KeyValue;
fChangePZK->PZ = false;
fChangePZK->ShowModal();
delete fChangePZK;
ShowPK();
}
void TfFGOS::InsertFromBuffer(AnsiString value, bool PZ)
{
if (value != "") {
try {
dm->qCommonProc->Close();
if (PZ)
dm->qCommonProc->ProcedureName = "ChangePZ";
else
dm->qCommonProc->ProcedureName = "ChangePK";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@name"] = value;
dm->qCommonProc->Parameters->ParamValues["@id"] = 0;
dm->qCommonProc->Parameters->ParamValues["@proftype_id"] = proftypes->KeyValue;
dm->qCommonProc->Parameters->ParamValues["@speciality_id"] = specialities->KeyValue;
dm->qCommonProc->ExecProc();
int ins_id = dm->qCommonProc->Parameters->ParamValues["@ins_id"];
dm->qCommonProc->Close();
if (PZ) {
ShowPZ();
dm->qPZ->Locate("id", ins_id, TLocateOptions() << loCaseInsensitive);
}
else {
ShowPK();
dm->qPK->Locate("id", ins_id, TLocateOptions() << loCaseInsensitive);
}
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
void __fastcall TfFGOS::ToolButton9Click(TObject *Sender)
{
GetFromBuffer(false);
}
Main.cpp
#include <vcl.h>
#pragma hdrstop
#include "main.h"
#include "Specialities.h"
#include "ProfessionTypes.h"
#include "Departments.h"
#include "FGOS.h"
#include "PS.h"
#include "DataModule.h"
#include "Connection.h"
#pragma package(smart_init)
#pragma link "DBCtrlsEh"
#pragma link "DBGridEh"
#pragma link "DBGridEhGrouping"
#pragma link "DBLookupEh"
//#pragma link "GridsEh"
#pragma link "GridsEh"
#pragma link "DataDriverEh"
#pragma link "MemTableDataEh"
#pragma link "MemTableEh"
#pragma link "frxClass"
#pragma link "frxADOComponents"
#pragma link "frxExportRTF"
#pragma link "frxExportPDF"
#pragma link "frxExportRTF"
#pragma link "frxExportXLS"
#pragma resource "*.dfm"
TfMain *fMain;
fastcall TfMain::TfMain(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TfMain::N3Click(TObject *Sender)
{
TfSpeciality *fSpeciality = new TfSpeciality(this);
fSpeciality->ShowModal();
delete fSpeciality;
}
void __fastcall TfMain::Rfa1Click(TObject *Sender)
{
TfDepartments *fDepartments = new TfDepartments(this);
fDepartments->ShowModal();
delete fDepartments;
}
void __fastcall TfMain::N4Click(TObject *Sender)
{
TfProfessionTypes *fProfessionTypes = new TfProfessionTypes(this);
fProfessionTypes->ShowModal();
delete fProfessionTypes;
}
void __fastcall TfMain::N6Click(TObject *Sender)
{
TfFGOS *fFGOS = new TfFGOS(this);
fFGOS->ShowModal();
delete fFGOS;
}
void __fastcall TfMain::N7Click(TObject *Sender)
{
TfPS *fPS = new TfPS(Application);
fPS->ShowModal();
delete fPS;
}
void TfMain::ShowFGOS()
{
if (this->Active) {
//выводим таблицу ФГОС. Профзадачи. если введено что-то в поле фильтра, фильтруем
//если нет, выводим все
dm->qPZ->Close();
dsPZ->DataSet = dm->qPZ;
dm->qPZ->Parameters->ParamValues["proftype_id"] = proftypes->KeyValue;
dm->qPZ->Parameters->ParamValues["speciality_id"] = specialities->KeyValue;
dm->qPZ->Parameters->ParamValues["fltr"] = "%" + filtr1->Text.Trim() + "%";
dm->qPZ->Open();
//то же и с профкомпетенциями
dm->qPK->Close();
dm->qPK->Parameters->ParamValues["proftype_id"] = proftypes->KeyValue;
dm->qPK->Parameters->ParamValues["speciality_id"] = specialities->KeyValue;
dm->qPK->Parameters->ParamValues["fltr"] = "%" + filtr2->Text.Trim() + "%";
dsPK->DataSet = dm->qPK;
dm->qPK->Open();
}
void __fastcall TfMain::RadioGroup1Click(TObject *Sender)
{
ShowFGOS();
ShowPS();
}
void __fastcall TfMain::depsChange(TObject *Sender)
{
ShowFGOS();
ShowProfessions();
ShowSpecialities();
ShowPS();
}
void __fastcall TfMain::specialitiesChange(TObject *Sender)
{
ShowFGOS();
ShowProfessions();
ShowPS();
}
void __fastcall TfMain::proftypesChange(TObject *Sender)
{
ShowFGOS();
ShowProfessions();
ShowPS();
}
void TfMain::ShowProfTypes()
{
proftypes->ListSource->DataSet->Active = true;
}
void TfMain::ShowDepartments()
{
deps->ListSource->DataSet->Active = false;
deps->ListSource->DataSet->Active = true;
}
void TfMain::ShowSpecialities()
{
specialities->ListSource->DataSet->Active = false;
dm->qSpeciality->Parameters->ParamValues["id"] = deps->KeyValue;
specialities->ListSource->DataSet->Active = true;
}
void TfMain::ShowProfessions()
{
dm->qProfessions->Close();
dm->qProfessions->Parameters->ParamValues["id"] = proftypes->KeyValue;
dm->qProfessions->Parameters->ParamValues["s_id"] = specialities->KeyValue;
dm->qProfessions->Open();
}
void __fastcall TfMain::FormActivate(TObject *Sender)
{
ShowDepartments();
ShowProfTypes();
table1_click = table3_click = Now();
}
void TfMain::ShowPS()
{
if (this->Active) {
mtPS_tree->Active = false;
qPS_tree->Close();
qPS_tree->Parameters->ParamValues["id"] = prof->KeyValue;
qPS_tree->Open();
mtPS_tree->Active = true;
}
}
void __fastcall TfMain::profChange(TObject *Sender)
{
ShowPS();
}
void __fastcall TfMain::filtr1Change(TObject *Sender)
{
ShowFGOS();
}
void __fastcall TfMain::DBGridEh1KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
//если была нажата клавиша insert
if (Key == VK_INSERT) {
//если соответствия еще нет - добавляем
//если связки нет - добавим ее в базу
int reply = CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger, 1);
if (reply == 0)
dm->qCommonProc->ProcedureName = "ChangeClassifier";
//если есть - удаляем
else
dm->qCommonProc->ProcedureName = "Delete_PZ_TF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id_main"] = DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger;
dm->qCommonProc->Parameters->ParamValues["@id_dep"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
if (DBGridEh2->DataSource->DataSet->FieldByName("parent_id")->AsInteger == NULL)
//если выбрана ОТФ
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 1;
else
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 0;
if (reply == 0)
dm->qCommonProc->Parameters->ParamValues["@is_pz"] = 1;
dm->qCommonProc->ExecProc();
//перерисуем таблицу профзадач в соответствии с новыми связками
DBGridEh1->Repaint();
}
}
void __fastcall TfMain::DBGridEh2CellClick(TColumnEh *Column)
{
DBGridEh1->Repaint();
DBGridEh3->Repaint();
}
int TfMain::CheckDependancy(int main_id, int dep_id, int ispz)
//main_id - id ТФ или ОТФ, т.е. ид мз средней таблицы
//dep_id - ПК или ПЗ
{
dm->qCommonProc->Close();
dm->qCommonProc->ProcedureName = "CheckDependancies";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id_main"] = main_id;
dm->qCommonProc->Parameters->ParamValues["@id_dep"] = dep_id;
if (DBGridEh2->DataSource->DataSet->FieldByName("parent_id")->AsInteger == NULL)
//если выбрана ОТФ
dm->qCommonProc->Parameters->ParamValues["@isotf"] = 1;
else
dm->qCommonProc->Parameters->ParamValues["@isotf"] = 0;
dm->qCommonProc->Parameters->ParamValues["@ispz"] = ispz;
dm->qCommonProc->ExecProc();
return dm->qCommonProc->Parameters->ParamValues["@reply"];
}
void __fastcall TfMain::DBGridEh3KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_INSERT) {
//если соответствия еще нет - добавляем
int reply = CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger, 0);
if (reply == 0)
dm->qCommonProc->ProcedureName = "ChangeClassifier";
else
dm->qCommonProc->ProcedureName = "Delete_PK_TF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id_main"] = DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger;
dm->qCommonProc->Parameters->ParamValues["@id_dep"] = DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger;
if (DBGridEh2->DataSource->DataSet->FieldByName("parent_id")->AsInteger == NULL)
//если выбрана ОТФ
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 1;
else
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 0;
if (reply == 0)
dm->qCommonProc->Parameters->ParamValues["@is_pz"] = 0;
dm->qCommonProc->ExecProc();
DBGridEh3->Repaint();
}
}
void __fastcall TfMain::filtr2Change(TObject *Sender)
{
ShowFGOS();
}
void __fastcall TfMain::FormCreate(TObject *Sender)
{
TfConnect *fConnect = new TfConnect(Application);
fConnect->ShowModal();
if (Application->Terminated)
Close();
}
void __fastcall TfMain::FormClose(TObject *Sender, TCloseAction &Action)
{
dm->ADOConnection1->Connected = false;
}
void __fastcall TfMain::DBGridEh1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumnEh *Column,
Gridseh::TGridDrawState State)
{
if ((!DBGridEh1->DataSource->DataSet->IsEmpty()) && (prof->Text != "")) {
//проверим, есть ли связка с текущей ячейкой
//если такая есть - раскрашиваем ячейку в голубой цвет
if (CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger, 1) == 1)
DBGridEh1->Canvas->Brush->Color = TColor(clSkyBlue);
DBGridEh1->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
}
void __fastcall TfMain::DBGridEh3DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumnEh *Column,
Gridseh::TGridDrawState State)
{
if ((!DBGridEh3->DataSource->DataSet->IsEmpty()) && (prof->Text != "")) {
if (CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger, 0) == 1)
DBGridEh3->Canvas->Brush->Color = TColor(clMoneyGreen);
DBGridEh3->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
}
void __fastcall TfMain::N11Click(TObject *Sender)
{
frxReport1->LoadFromFile(ExtractFileDir(Application->ExeName) + "\\reports\\prof_komp.fr3", true);
frxReport1->Variables->Variables["@ptype_id"] = proftypes->KeyValue;
frxReport1->Variables->Variables["@spec_id"] = specialities->KeyValue;
frxReport1->ShowReport();
}
void __fastcall TfMain::N10Click(TObject *Sender)
{
frxReport1->LoadFromFile(ExtractFileDir(Application->ExeName) + "\\reports\\prof_tasks.fr3", true);
frxReport1->Variables->Variables["@ptype_id"] = proftypes->KeyValue;
frxReport1->Variables->Variables["@spec_id"] = specialities->KeyValue;
frxReport1->ShowReport();
}
void __fastcall TfMain::DBGridEh1CellClick(TColumnEh *Column)
{
table1_click = Now();
DBGridEh2->Repaint();
}
void __fastcall TfMain::DBGridEh3CellClick(TColumnEh *Column)
{
table3_click = Now();
DBGridEh2->Repaint();
}
void __fastcall TfMain::DBGridEh2KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_INSERT) {
int id_main = DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger;
int id_dep, ispz;
if (table1_click > table3_click) {
id_dep = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
ispz = 1;
}
else {
id_dep = DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger;
ispz = 0;
}
int reply = CheckDependancy(id_main, id_dep, ispz);
if (reply == 0)
dm->qCommonProc->ProcedureName = "ChangeClassifier";
else
dm->qCommonProc->ProcedureName = "Delete_PK_TF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id_main"] = id_main;
dm->qCommonProc->Parameters->ParamValues["@id_dep"] = id_dep;
if (DBGridEh2->DataSource->DataSet->FieldByName("parent_id")->AsInteger == NULL)
//если выбрана ОТФ
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 1;
else
dm->qCommonProc->Parameters->ParamValues["@is_otf"] = 0;
if (reply == 0)
dm->qCommonProc->Parameters->ParamValues["@is_pz"] = ispz;
dm->qCommonProc->ExecProc();
DBGridEh2->Repaint();
}
}
void __fastcall TfMain::DBGridEh2DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumnEh *Column,
Gridseh::TGridDrawState State)
{
if ((!DBGridEh2->DataSource->DataSet->IsEmpty()) && (prof->Text != "")) {
//если есть связь и с ПЗ и с ПК
if ((CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger, 0) == 1) &&
(CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger, 1) == 1))
DBGridEh2->Canvas->Brush->Color = TColor(clPurple);
//если только с ПК
else if (CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh3->DataSource->DataSet->FieldByName("id")->AsInteger, 0) == 1)
DBGridEh2->Canvas->Brush->Color = TColor(clMoneyGreen);
//если только с ПЗ
else if (CheckDependancy(DBGridEh2->DataSource->DataSet->FieldByName("self_id")->AsInteger,
DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger, 1) == 1)
DBGridEh2->Canvas->Brush->Color = TColor(clSkyBlue);
DBGridEh2->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
}
//---------------------------------------------------------------------------
void __fastcall TfMain::N12Click(TObject *Sender)
{
frxReport1->LoadFromFile(ExtractFileDir(Application->ExeName) + "\\reports\\prof_tasks_pz.fr3", true);
frxReport1->Variables->Variables["@ptype_id"] = proftypes->KeyValue;
frxReport1->Variables->Variables["@spec_id"] = specialities->KeyValue;
frxReport1->ShowReport();
}
//---------------------------------------------------------------------------
void __fastcall TfMain::N13Click(TObject *Sender)
{
frxReport1->LoadFromFile(ExtractFileDir(Application->ExeName) + "\\reports\\prof_komp_pk.fr3", true);
frxReport1->Variables->Variables["@ptype_id"] = proftypes->KeyValue;
frxReport1->Variables->Variables["@spec_id"] = specialities->KeyValue;
frxReport1->ShowReport();
}
//---------------------------------------------------------------------------
void __fastcall TfMain::N9Click(TObject *Sender)
{
Application->MessageBoxA("Разработала студентка гр. V курса \n"
"факультета,\n"
"Полина","Информация о разработчике", MB_OK | MB_ICONINFORMATION);
}
//---------------------------------------------------------------------------
ProfessionTypes.cpp
#include <vcl.h>
#pragma hdrstop
#include "ProfessionTypes.h"
#include "DataModule.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBGridEh"
#pragma link "DBGridEhGrouping"
#pragma link "GridsEh"
#pragma link "DBCtrlsEh"
#pragma link "DBLookupEh"
#pragma resource "*.dfm"
TfProfessionTypes *fProfessionTypes;
//---------------------------------------------------------------------------
__fastcall TfProfessionTypes::TfProfessionTypes(TComponent* Owner)
: TForm(Owner)
{
}
void TfProfessionTypes::ShowProfTypes()
{
proftypes->ListSource->DataSet->Active = false;
proftypes->ListSource->DataSet->Active = true;
}
void TfProfessionTypes::ShowDepartments()
{
deps->ListSource->DataSet->Active = false;
deps->ListSource->DataSet->Active = true;
}
void TfProfessionTypes::ShowSpecialities()
{
specialities->ListSource->DataSet->Active = false;
dm->qSpeciality->Parameters->ParamValues["id"] = deps->KeyValue;
specialities->ListSource->DataSet->Active = true;
}
void TfProfessionTypes::ShowProfessions()
{
dm->qProfessions->Close();
dm->qProfessions->Parameters->ParamValues["id"] = proftypes->KeyValue;
dm->qProfessions->Parameters->ParamValues["s_id"] = specialities->KeyValue;
dm->qProfessions->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::FormActivate(TObject *Sender)
{
ShowProfTypes();
ShowDepartments();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::depsChange(TObject *Sender)
{
ShowSpecialities();
ShowProfessions();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::specialitiesChange(TObject *Sender)
{
ShowProfessions();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::proftypesChange(TObject *Sender)
{
ShowProfessions();
}
//---------------------------------------------------------------------------
void TfProfessionTypes::ChangeProfessions(AnsiString new_prof_name, bool ins) {
try {
dm->qCommonProc->Close();
dm->qCommonProc->ProcedureName = "ChangeProfession";
dm->qCommonProc->Parameters->Refresh();
if (ins)
dm->qCommonProc->Parameters->ParamValues["@id"] = 0;
if (!ins)
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->Parameters->ParamValues["@proftype_id"] = proftypes->KeyValue;
dm->qCommonProc->Parameters->ParamValues["@spec_id"] = specialities->KeyValue;
dm->qCommonProc->Parameters->ParamValues["@name"] = new_prof_name;
dm->qCommonProc->ExecProc();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::ToolButton1Click(TObject *Sender)
{
AnsiString prof_name = "";
if( InputQuery(L"Профессиональная деятельность",
L"Введите название профессиональной деятельности:",
prof_name) == True )
ChangeProfessions(prof_name, true);
ShowProfessions();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::ToolButton2Click(TObject *Sender)
{
AnsiString prof_name = DBGridEh1->DataSource->DataSet->FieldByName("name")->AsString;
if( InputQuery(L"Профессиональная деятельность",
L"Введите название профессиональной деятельности:",
prof_name) == True )
ChangeProfessions(prof_name, false);
ShowProfessions();
}
//---------------------------------------------------------------------------
void __fastcall TfProfessionTypes::ToolButton3Click(TObject *Sender)
{
if (Application->MessageBoxA("Вы действительно хотите удалить эту запись?",
"Вопрос", MB_YESNO | MB_ICONQUESTION) == IDYES) {
try {
dm->qCommonProc->Active = false;
dm->qCommonProc->ProcedureName = "DeleteProfession";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
ShowProfessions();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
//---------------------------------------------------------------------------
PS.cpp
#include <vcl.h>
#include <clipbrd.hpp>
#pragma hdrstop
#include "PS.h"
#include "DataModule.h"
#include "ChangeOTF.h"
#include "TFDetails.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBCtrlsEh"
#pragma link "DBGridEh"
#pragma link "DBLookupEh"
#pragma link "DBGridEhGrouping"
#pragma link "GridsEh"
#pragma resource "*.dfm"
TfPS *fPS;
//---------------------------------------------------------------------------
__fastcall TfPS::TfPS(TComponent* Owner)
: TForm(Owner)
{
}
void TfPS::ShowProfTypes()
{
proftypes->ListSource->DataSet->Active = true;
}
void TfPS::ShowDepartments()
{
deps->ListSource->DataSet->Active = false;
deps->ListSource->DataSet->Active = true;
}
void TfPS::ShowSpecialities()
{
specialities->ListSource->DataSet->Active = false;
dm->qSpeciality->Parameters->ParamValues["id"] = deps->KeyValue;
specialities->ListSource->DataSet->Active = true;
}
void TfPS::ShowOTF()
{
dm->qOTF->Close();
dm->qOTF->Parameters->ParamValues["spec_id"] = specialities->KeyValue;
dm->qOTF->Parameters->ParamValues["prof_id"] = professions->KeyValue;
dm->qOTF->Open();
ShowTF();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::FormActivate(TObject *Sender)
{
ShowDepartments();
proftypes->ListSource->DataSet->Active = false;
proftypes->ListSource->DataSet->Active = true;
}
//---------------------------------------------------------------------------
void __fastcall TfPS::depsChange(TObject *Sender)
{
ShowSpecialities();
ShowOTF();
ShowProfessions();
}
void TfPS::ShowProfessions()
{
dm->qProfessions->Close();
dm->qProfessions->Parameters->ParamValues["id"] = proftypes->KeyValue;
dm->qProfessions->Parameters->ParamValues["s_id"] = specialities->KeyValue;
dm->qProfessions->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::proftypesChange(TObject *Sender)
{
ShowProfessions();
ShowOTF();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::specialitiesChange(TObject *Sender)
{
ShowOTF();
ShowProfessions();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::professionsChange(TObject *Sender)
{
ShowOTF();
}
void TfPS::ShowTF()
{
dm->qTF->Close();
dm->qTF->Parameters->ParamValues["id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qTF->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::DBGridEh1CellClick(TColumnEh *Column)
{
ShowTF();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::DBGridEh1SelectionChanged(TObject *Sender)
{
// ShowTF();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton1Click(TObject *Sender)
{
TfChangeOTF *fChangeOTF = new TfChangeOTF(Application);
fChangeOTF->Caption = "Общие трудовые функции";
fChangeOTF->prof_id = proftypes->KeyValue;
fChangeOTF->OTF = true;
fChangeOTF->ShowModal();
ShowOTF();
if (fChangeOTF->inserted)
dm->qOTF->Locate("id", fChangeOTF->ins_id, TLocateOptions() << loCaseInsensitive);
delete fChangeOTF;
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton4Click(TObject *Sender)
{
TfChangeOTF *fChangeOTF = new TfChangeOTF(Application);
fChangeOTF->Caption = "Трудовые функции";
fChangeOTF->prof_id = proftypes->KeyValue;
fChangeOTF->OTF = false;
fChangeOTF->ShowModal();
ShowOTF();
if (fChangeOTF->inserted)
dm->qTF->Locate("id", fChangeOTF->ins_id, TLocateOptions() << loCaseInsensitive);
delete fChangeOTF;
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton3Click(TObject *Sender)
{
if (Application->MessageBoxA("Вы действительно хотите удалить эту запись?",
"Вопрос", MB_YESNO | MB_ICONQUESTION) == IDYES) {
try {
dm->qCommonProc->Active = false;
dm->qCommonProc->ProcedureName = "DeleteOTF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
ShowOTF();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton6Click(TObject *Sender)
{
if (Application->MessageBoxA("Вы действительно хотите удалить эту запись?",
"Вопрос", MB_YESNO | MB_ICONQUESTION) == IDYES) {
try {
dm->qCommonProc->Active = false;
dm->qCommonProc->ProcedureName = "DeleteTF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh2->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
ShowTF();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton2Click(TObject *Sender)
{
TfChangeOTF *fChangeOTF = new TfChangeOTF(Application);
fChangeOTF->Caption = "Общие трудовые функции";
fChangeOTF->name_->Text = DBGridEh1->DataSource->DataSet->FieldByName("name")->AsString;
fChangeOTF->ID = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
fChangeOTF->prof_id = professions->KeyValue;
fChangeOTF->OTF = true;
fChangeOTF->ShowModal();
delete fChangeOTF;
ShowOTF();
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton5Click(TObject *Sender)
{
TfChangeOTF *fChangeOTF = new TfChangeOTF(Application);
fChangeOTF->Caption = "Трудовые функции";
fChangeOTF->name_->Text = DBGridEh2->DataSource->DataSet->FieldByName("name")->AsString;
fChangeOTF->ID = DBGridEh2->DataSource->DataSet->FieldByName("id")->AsInteger;
fChangeOTF->prof_id = professions->KeyValue;
fChangeOTF->OTF = false;
fChangeOTF->ShowModal();
delete fChangeOTF;
ShowTF();
}
void TfPS::InsertFromBuffer(AnsiString value, bool OTF)
{
if (value != "") {
try {
dm->qCommonProc->Close();
if (OTF)
dm->qCommonProc->ProcedureName = "ChangeOTF";
else
dm->qCommonProc->ProcedureName = "ChangeTF";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@name"] = value;
dm->qCommonProc->Parameters->ParamValues["@id"] = 0;
if (OTF)
dm->qCommonProc->Parameters->ParamValues["@prof_id"] = professions->KeyValue;
else
dm->qCommonProc->Parameters->ParamValues["@otf_id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
int ins_id = dm->qCommonProc->Parameters->ParamValues["@ins_id"];
dm->qCommonProc->Close();
//позиционируемся на только что введенной записи
if (OTF) {
ShowOTF();
dm->qOTF->Locate("id", ins_id, TLocateOptions() << loCaseInsensitive);
}
else {
ShowTF();
dm->qTF->Locate("id", ins_id, TLocateOptions() << loCaseInsensitive);
}
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
void TfPS::GetFromBuffer(bool OTF)
{
//читаем строку из буфера обмена
AnsiString s = Clipboard()->AsText;
//ставим наш "курсор" на начало строки
int from = 1;
bool pasted = false;
for (int i = 1; i <= s.Length(); ++i) {
pasted = false;
switch (int(s[i])) {
//новая строка - символ \n
case 10:
from = i+1;
break;
//возврат каретки - символ \r
case 13:
//выделяем текущую подчтроку для вставки в базу
if ((s.SubString(from, i-from) != "") && (s.SubString(from, i-from) != "\n"))
InsertFromBuffer(s.SubString(from, i-from), OTF);
from = i+1;
pasted = true;
break;
}
//на случай, если в самом конце строки из буфера не стоят специальные символы новой строки и возврата каретки
if ((!pasted) && (i == s.Length()) && (int(s[i]) != 10) && (int(s[i]) != 13))
InsertFromBuffer(s.SubString(from, i-from), OTF);
}
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton7Click(TObject *Sender)
{
GetFromBuffer(true);
}
//---------------------------------------------------------------------------
void __fastcall TfPS::ToolButton8Click(TObject *Sender)
{
GetFromBuffer(false);
}
//---------------------------------------------------------------------------
void __fastcall TfPS::DBGridEh2DblClick(TObject *Sender)
{
TfTFDetails *fTFDetails = new TfTFDetails(Application);
fTFDetails->TF_ID = DBGridEh2->DataSource->DataSet->FieldByName("id")->AsInteger;
fTFDetails->ShowModal();
delete fTFDetails;
}
//---------------------------------------------------------------------------
Specialities.cpp
#include <vcl.h>
#pragma hdrstop
#include "Specialities.h"
#include "DataModule.h"
#include "ChangeDepartment.h"
#include "ChangeSpeciality.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBGridEh"
#pragma link "DBGridEhGrouping"
#pragma link "GridsEh"
#pragma link "DBCtrlsEh"
#pragma link "DBLookupEh"
#pragma link "MemTableDataEh"
#pragma link "MemTableEh"
#pragma link "DataDriverEh"
#pragma resource "*.dfm"
TfSpeciality *fSpeciality;
//---------------------------------------------------------------------------
__fastcall TfSpeciality::TfSpeciality(TComponent* Owner)
: TForm(Owner)
{
}
void TfSpeciality::ShowDepartments() {
dep_name->ListSource->DataSet->Close();
dep_name->ListSource->DataSet->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::Button1Click(TObject *Sender)
{
TfChangeDepartment *fChangeDepartment = new TfChangeDepartment(Application);
fChangeDepartment->ShowModal();
ShowDepartments();
if (fChangeDepartment->inserted)
dep_name->KeyValue = fChangeDepartment->ID;
delete fChangeDepartment;
}
void TfSpeciality::RefreshTable() {
DBGridEh1->DataSource->DataSet->Active = false;
dm->qSpeciality->Parameters->ParamValues["id"] = dep_name->KeyValue;
DBGridEh1->DataSource->DataSet->Active = true;
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::FormActivate(TObject *Sender)
{
ShowDepartments();
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::dep_nameChange(TObject *Sender)
{
RefreshTable();
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::ToolButton1Click(TObject *Sender)
{
TfChangeSpeciality *fChangeSpeciality = new TfChangeSpeciality(Application);
fChangeSpeciality->dep_id = dep_name->KeyValue;
fChangeSpeciality->ShowModal();
delete fChangeSpeciality;
RefreshTable();
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::ToolButton2Click(TObject *Sender)
{
TfChangeSpeciality *fChangeSpeciality = new TfChangeSpeciality(Application);
fChangeSpeciality->dep_id = dep_name->KeyValue;
fChangeSpeciality->full_name->Text = DBGridEh1->DataSource->DataSet->FieldByName("name")->AsString;
fChangeSpeciality->short_name->Text = DBGridEh1->DataSource->DataSet->FieldByName("short_name")->AsString;
fChangeSpeciality->ID = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
fChangeSpeciality->ShowModal();
delete fChangeSpeciality;
RefreshTable();
}
//---------------------------------------------------------------------------
void __fastcall TfSpeciality::ToolButton3Click(TObject *Sender)
{
if (Application->MessageBoxA("Вы действительно хотите удалить эту запись?",
"Вопрос", MB_YESNO | MB_ICONQUESTION) == IDYES) {
try {
dm->qCommonProc->Active = false;
dm->qCommonProc->ProcedureName = "DeleteSpeciality";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
RefreshTable();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
}
//---------------------------------------------------------------------------
StudyLoad.cpp
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("main.cpp", fMain);
USEFORM("Specialities.cpp", fSpeciality);
USEFORM("DataModule.cpp", dm); /* TDataModule: File Type */
USEFORM("Departments.cpp", fDepartments);
USEFORM("ProfessionTypes.cpp", fProfessionTypes);
USEFORM("FGOS.cpp", fFGOS);
USEFORM("PS.cpp", fPS);
USEFORM("ChangeDepartment.cpp", fChangeDepartment);
USEFORM("ChangeSpeciality.cpp", fChangeSpeciality);
USEFORM("ChangePZK.cpp", fChangePZK);
USEFORM("ChangeOTF.cpp", fChangeOTF);
USEFORM("TFDetails.cpp", fTFDetails);
USEFORM("ChangeTFDetails.cpp", fChangeTFDetails);
USEFORM("Connection.cpp", fConnect);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(Tdm), &dm);
Application->CreateForm(__classid(TfMain), &fMain);
if (!Application->Terminated)
Application->Run();
else
Application->Terminate();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------
TFDetails.cpp
#include <vcl.h>
#include <clipbrd.hpp>
#pragma hdrstop
#include "TFDetails.h"
#include "DataModule.h"
#include "ChangeTFDetails.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBGridEh"
#pragma link "DBGridEhGrouping"
#pragma link "GridsEh"
#pragma resource "*.dfm"
TfTFDetails *fTFDetails;
//---------------------------------------------------------------------------
__fastcall TfTFDetails::TfTFDetails(TComponent* Owner)
: TForm(Owner)
{
}
void TfTFDetails::GetFromBuffer()
{
AnsiString s = Clipboard()->AsText;
AnsiString test;
int from = 1;
int details_type = 0;
bool pasted = false;
for (int i = 1; i <= s.Length(); ++i) {
pasted = false;
switch (int(s[i])) {
//новая ячейка в той же строке, т.е. новая детализация ТФ
case 9:
if (!((int(s[i-2]) == 13) && (int(s[i-1]) == 10)))
details_type++;
test = s.SubString(from, i-from);
from = i+1;
break;
//новая строка
case 10:
test = s.SubString(from, i-from);
from = i+1;
break;
//возврат каретки
case 13:
test = s.SubString(from, i-from);
if ((s.SubString(from, i-from) != "") && (s.SubString(from, i-from) != "\n"))
InsertFromBuffer(s.SubString(from, i-from), details_type);
from = i+1;
pasted = true;
break;
}
if ((!pasted) && (i == s.Length()) && (int(s[i]) != 10) && (int(s[i]) != 13))
InsertFromBuffer(s.SubString(from, i-from), details_type);
}
}
void TfTFDetails::InsertFromBuffer(AnsiString s, int details_type_id)
{
try {
dm->qCommonProc->Close();
dm->qCommonProc->ProcedureName = "ChangeTFDetails";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = 0;
dm->qCommonProc->Parameters->ParamValues["@name"] = s;
dm->qCommonProc->Parameters->ParamValues["@tf_details_type"] = details_type_id;
dm->qCommonProc->Parameters->ParamValues["@tf_id"] = TF_ID;
dm->qCommonProc->ExecProc();
ShowTFDetails();
if (dm->qCommonProc->Parameters->ParamValues["@ins_id"] != NULL)
dm->qTFDetails->Locate("id", dm->qCommonProc->Parameters->ParamValues["@ins_id"], TLocateOptions() << loCaseInsensitive);
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
void TfTFDetails::ShowTFDetails()
{
dm->qTFDetails->Close();
dm->qTFDetails->Parameters->ParamValues["tf_id"] = TF_ID;
dm->qTFDetails->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfTFDetails::ToolButton9Click(TObject *Sender)
{
GetFromBuffer();
}
//---------------------------------------------------------------------------
void __fastcall TfTFDetails::FormActivate(TObject *Sender)
{
ShowTFDetails();
}
//---------------------------------------------------------------------------
void __fastcall TfTFDetails::ToolButton8Click(TObject *Sender)
{
TfChangeTFDetails *fChangeTFDetails = new TfChangeTFDetails(Application);
fChangeTFDetails->TF_ID = TF_ID;
fChangeTFDetails->ShowModal();
if (fChangeTFDetails->id != 0)
dm->qTFDetails->Locate("id", fChangeTFDetails->id, TLocateOptions() << loCaseInsensitive);
delete fChangeTFDetails;
ShowTFDetails();
}
//---------------------------------------------------------------------------
void __fastcall TfTFDetails::ToolButton10Click(TObject *Sender)
{
TfChangeTFDetails *fChangeTFDetails = new TfChangeTFDetails(Application);
fChangeTFDetails->TF_ID = TF_ID;
fChangeTFDetails->type->KeyValue = DBGridEh1->DataSource->DataSet->FieldByName("TF_details_types_id")->AsInteger;
fChangeTFDetails->name_->Text = DBGridEh1->DataSource->DataSet->FieldByName("name")->AsString;
fChangeTFDetails->id = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
fChangeTFDetails->ShowModal();
delete fChangeTFDetails;
ShowTFDetails();
}
//---------------------------------------------------------------------------
void __fastcall TfTFDetails::ToolButton11Click(TObject *Sender)
{
if (Application->MessageBoxA("Вы действительно хотите удалить эту запись?",
"Вопрос", MB_YESNO | MB_ICONQUESTION) == IDYES) {
try {
dm->qCommonProc->Active = false;
dm->qCommonProc->ProcedureName = "DeleteTFDetails";
dm->qCommonProc->Parameters->Refresh();
dm->qCommonProc->Parameters->ParamValues["@id"] = DBGridEh1->DataSource->DataSet->FieldByName("id")->AsInteger;
dm->qCommonProc->ExecProc();
ShowTFDetails();
}
catch(Exception *e) {
Application->MessageBoxA(e->Message.c_str(), "Ошибка!", MB_OK | MB_ICONERROR);
}
}
//---------------------------------------------------------------------------
Приложение Б
(обязательное)
Создание таблиц
CREATE TABLE [dbo].[Specialities] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(100) COLLATE Cyrillic_General_CI_AS NOT NULL,
[short_name] nvarchar(10) COLLATE Cyrillic_General_CI_AS DEFAULT NULL NULL,
[department_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [Specialities_fk] FOREIGN KEY ([department_id])
REFERENCES [dbo].[Departments] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[OTF] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(300) COLLATE Cyrillic_General_CI_AS NOT NULL,
[prof_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [OTF_fk] FOREIGN KEY ([prof_id])
REFERENCES [dbo].[Professions] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[PK] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(250) COLLATE Cyrillic_General_CI_AS NOT NULL,
[proftype_id] int NOT NULL,
[speciality_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [PK_fk] FOREIGN KEY ([proftype_id])
REFERENCES [dbo].[Prof_Types] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT [PK_fk2] FOREIGN KEY ([speciality_id])
REFERENCES [dbo].[Specialities] ([id])
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[PK_TF] (
[id] int IDENTITY(1, 1) NOT NULL,
[PK_id] int NOT NULL,
[TF_id] int NOT NULL,
[isOTF] bit NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [PK_TF_fk] FOREIGN KEY ([PK_id])
REFERENCES [dbo].[PK] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[Prof_Types] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(30) COLLATE Cyrillic_General_CI_AS NOT NULL,
PRIMARY KEY CLUSTERED ([id])
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[Professions] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(100) COLLATE Cyrillic_General_CI_AS NOT NULL,
[speciality_id] int NOT NULL,
[prof_type_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [Professions_fk] FOREIGN KEY ([speciality_id])
REFERENCES [dbo].[Specialities] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT [Professions_fk2] FOREIGN KEY ([prof_type_id])
REFERENCES [dbo].[Prof_Types] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[PZ] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(200) COLLATE Cyrillic_General_CI_AS NOT NULL,
[proftype_id] int NOT NULL,
[speciality_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [PZ_fk] FOREIGN KEY ([proftype_id])
REFERENCES [dbo].[Prof_Types] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT [PZ_fk2] FOREIGN KEY ([speciality_id])
REFERENCES [dbo].[Specialities] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[PZ_TF] (
[id] int IDENTITY(1, 1) NOT NULL,
[PZ_id] int NOT NULL,
[TF_id] int NOT NULL,
[isOTF] bit NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [PZ_OTF_fk] FOREIGN KEY ([PZ_id])
REFERENCES [dbo].[PZ] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[Specialities] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(100) COLLATE Cyrillic_General_CI_AS NOT NULL,
[short_name] nvarchar(10) COLLATE Cyrillic_General_CI_AS DEFAULT NULL NULL,
[department_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [Specialities_fk] FOREIGN KEY ([department_id])
REFERENCES [dbo].[Departments] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[TF] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(300) COLLATE Cyrillic_General_CI_AS NOT NULL,
[OTF_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [TF_fk] FOREIGN KEY ([OTF_id])
REFERENCES [dbo].[OTF] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[TF_details] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(300) COLLATE Cyrillic_General_CI_AS NOT NULL,
[TF_details_types_id] int NOT NULL,
[TF_id] int NOT NULL,
PRIMARY KEY CLUSTERED ([id]),
CONSTRAINT [TF_details_fk] FOREIGN KEY ([TF_details_types_id])
REFERENCES [dbo].[TF_details_types] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT [TF_details_fk2] FOREIGN KEY ([TF_id])
REFERENCES [dbo].[TF] ([id])
ON UPDATE CASCADE
ON DELETE CASCADE
)
ON [PRIMARY]
GO
CREATE TABLE [dbo].[TF_details_types] (
[id] int IDENTITY(1, 1) NOT NULL,
[name] nvarchar(30) COLLATE Cyrillic_General_CI_AS NOT NULL,
PRIMARY KEY CLUSTERED ([id])
)
ON [PRIMARY]
GO
Размещено на Allbest.ru
Подобные документы
Выбор программной среды. Система управления базами данных MySQL. Детский клуб: Hypertext Preprocessor. Определение целевого сегмента пользователей, их функции. Проектирование структуры базы данных. Разработка интерфейса web-сайта и пользовательской части.
дипломная работа [5,0 M], добавлен 19.01.2017Принципы организационно-методического обеспечения образовательного процесса многоуровневого комплекса; согласованность учебных планов и программ. Диверсификационная схема реализации преемственных учебных программ на примере информационной системы ЮРГУЭС.
реферат [651,4 K], добавлен 20.03.2011Разработка и создание информационной системы для осуществления автоматизации документооборота учебного заведения. Группировка и структуризация данных с помощью механизма ADOQuery посредством SQL запроса. Подсчет трудоемкости и затрат на создание СУБД.
курсовая работа [724,6 K], добавлен 14.06.2015Проектирование реляционной базы данных с помощью прикладного программного средства MS ACCESS. Описания особенностей использования запросов для извлечения, изменения и удаления информации из базы данных. Характеристика структуры интерфейса пользователя.
курсовая работа [1,6 M], добавлен 19.11.2012Проектирование базы данных "Учебные заведения Петербурга". Создание и обработка базы данных в среде Excel. Вывод сведений обо всех учебных заведениях, сгруппированных по статусу учебного заведения, с подсчётом средней заработной платы преподавателей.
курсовая работа [1,7 M], добавлен 27.02.2015Понятие, задачи и требования к разработке базы данных. Типы моделей данных, их преимущества и недостатки и обоснование выбора модели. Процесс учета студентов в больнице, описание структуры базы данных, перечень групп пользователей и доступа к данным.
курсовая работа [45,1 K], добавлен 09.03.2009Автоматизация учета закупки лекарственных препаратов в аптеке. Разработка базы данных и прикладных программ для работы с ней. Анализ предметной области и формирование требований пользователей. Выбор архитектуры программно-технологической реализации.
курсовая работа [4,1 M], добавлен 10.09.2015Разработка процесса автоматизации взаимодействия преподавателя и студента через сайт и ведение централизованного процесса обработки данных. Создание графического интерфейса программы и физической модели базы данных. Расчет цены программного продукта.
дипломная работа [6,1 M], добавлен 27.06.2011Анализ существующих систем автоматизации документооборота. Выбор шаблона проектирования. Microsoft SQL Server как комплексная высокопроизводительная платформа баз данных. Язык программирования C#. Разработка интерфейса и иллюстрация работы системы.
дипломная работа [2,5 M], добавлен 19.07.2014Анализ состояния и способов автоматизации складского хозяйства. Управление и оптимизация материальных запасов. Обзор современного состояния программ для торговли и склада. Разработка структуры базы данных информационной системы. Описание интерфейса.
дипломная работа [1,2 M], добавлен 16.06.2015