logo
Система тестирования пользователей

QSelect->Open();

if (!QSelect->IsEmpty())

{

Form3->SG1->Cells[0][i]=QSelect->FieldByName("Tema_text")->AsString;

Form3->SG1->Cells[1][i]=Form3->QOtchet->FieldByName("Date")->AsString;

Form3->SG1->Cells[2][i]=Form3->QOtchet->FieldByName("Time")->AsString;

Form3->SG1->RowCount=i+1;

i++;

Form3->QOtchet->Next();

}

else

{

Form3->SG1->Cells[0][1]="";

Form3->SG1->Cells[1][1]="";

Form3->SG1->Cells[2][1]="";

}

delete QSelect;

}

}

ball=0;

prav=0;

prav_user=0;

}

CheckBox1->Checked=false;

CheckBox2->Checked=false;

CheckBox3->Checked=false;

CheckBox4->Checked=false;

//делаем черный цвет шрифта у всех ответов

CheckBox1->Font->Color = clWindowText;

CheckBox2->Font->Color = clWindowText;

CheckBox3->Font->Color = clWindowText;

CheckBox4->Font->Color = clWindowText;

Pie1->Visible=false;

Timer1->Enabled=false;

}

//---------------------------------------------------------------------------

//второй таймер

void __fastcall TForm1::Timer2Timer(TObject *Sender)

{

Pie1->Angles->EndAngle=Pie1->Angles->EndAngle+2;

}

//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)

{

Pie1->Visible=false;

}

Форма "Результаты тестирования"

//щелчок мыши на таблице "Пользователь"

void __fastcall TForm3::DBGrid1CellClick(TColumn *Column)

{

QOtchet->Close();

QOtchet->SQL->Clear();

QOtchet->SQL->Add("Select * from Otchet where User_ID= "+Form2->QUsers1->FieldByName("User_ID")->AsString+ "and Tema_ID= "+Form2->QTema->FieldByName("Tema_ID")->AsString+ "Order by Date, Time");

QOtchet->Open();

if(!QOtchet->IsEmpty())

{

if (QOtchet->FieldByName("Res_text")->AsString=="Тест не пройден")

{

Label3->Font->Color= clRed;

Label4->Font->Color= clRed;

Label7->Font->Color= clRed;

}

else

{

Label3->Font->Color= clGreen;

Label4->Font->Color= clGreen;

Label7->Font->Color= clGreen;

}

Label7->Caption=Form3->QOtchet->FieldByName("Date")->AsString;

Label3->Caption=QOtchet->FieldByName("Res_text")->AsString+"!";

Label4->Caption="Набрано "+FloatToStr(QOtchet->FieldByName("Ball")->AsFloat)+" баллов";

}

else

{

Label3->Font->Color= clWindowText;

Label4->Font->Color= clWindowText;

Label3->Caption="Тестирование не производилось!";

Label4->Caption="Тестирование не производилось!";

Label7->Caption="";

}

SG1->RowCount=2;

SG1->FixedRows=1;

SG1->Cells[0][0]="Тема";

SG1->Cells[1][0]="Дата";

SG1->Cells[2][0]="Время";

SG1->Cells[0][1]="";

SG1->Cells[1][1]="";

SG1->Cells[2][1]="";

QOtchet->Close();

QOtchet->SQL->Clear();

QOtchet->SQL->Add("Select * from Otchet where User_ID= "+Form2->QUsers1->FieldByName("User_ID")->AsString+ "Order by Date, Time");

QOtchet->Open();

QOtchet->First();

if (!QOtchet->IsEmpty())

{

int i=1;

while (!QOtchet->Eof)

{

TADOQuery *QSelect=new TADOQuery(NULL);

QSelect->ConnectionString=Form2->ADOConnection1->ConnectionString;

QSelect->SQL->Add("Select * from Tema where Tema_ID= "+QOtchet->FieldByName("Tema_ID")->AsString);