Разработка электронной оболочки для тестирования

Клиент-серверная архитектура проектируемой программы по проверке знаний студентов, структура базы данных. Разработка ее программно-интерфейсной реализации в среде Delphi. Установка и запуск приложения, информация для пользователя, листинг программы.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 20.06.2011
Размер файла 2,1 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

form2.Close;

end

else begin

MessageDlg('Данный аккаунт не имеет права доступа к настройкам.'+#10+#13+'Обратитесь к администратору.', mtError,[mbOk], 0);

form1.logedin:=false;

end;

end

else MessageDlg('Логин или пароль не верный.', mtError,[mbOk], 0);

end;

procedure TForm2.LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin button1.Click; exit; end;

if key<#33 then begin LabeledEdit2.Clear; ed:=''; end else begin

ed:=ed+key;

key:='*';

end;

end;

end.

Код формы 3:

unit Unit3;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, ExtCtrls,registry, XPMan;

type

TForm3 = class(TForm)

LabeledEdit1: TLabeledEdit;

LabeledEdit2: TLabeledEdit;

BitBtn1: TBitBtn;

XPManifest1: TXPManifest;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses unit2,unit1;

{$R *.dfm}

procedure TForm3.BitBtn1Click(Sender: TObject);

var registry:tregistry;

b:string[255];

begin

registry := Tregistry.Create(KEY_CREATE_SUB_KEY);

registry.CreateKey('Software\Oprobation');

registry.Free;

Registry := TRegistry.Create(KEY_WRITE);

Registry.RootKey:= HKEY_CURRENT_USER;

Registry.OpenKey('Software\Oprobation', False);

b:=LabeledEdit1.Text+':'+LabeledEdit2.Text;

Registry.WriteString('base',b);

Registry.Free;

form3.Close;

end;

end.

Код формы 4:

unit Unit4;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, DB, IBCustomDataSet, IBQuery, StdCtrls, ExtCtrls, XPMan;

type

TForm4 = class(TForm)

LabeledEdit2: TLabeledEdit;

Button1: TButton;

IBQuery1: TIBQuery;

XPManifest1: TXPManifest;

ComboBox1: TComboBox;

CheckBox1: TCheckBox;

IBQuery2: TIBQuery;

ComboBox2: TComboBox;

labeledEdit1: TEdit;

Label1: TLabel;

IBQuery3: TIBQuery;

IBQuery4: TIBQuery;

IBQuery5: TIBQuery;

IBQuery6: TIBQuery;

procedure LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure CheckBox1Click(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

private

ed:string;

{ Private declarations }

public

usr:integer;

{ Public declarations }

end;

var

Form4: TForm4;

implementation

uses Unit1,unit8,Unit2,unit5,unit7;

{$R *.dfm}

procedure TForm4.LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin button1.Click; exit; end;

if key<#33 then begin LabeledEdit2.Clear; ed:=''; end else begin

ed:=ed+key;

key:='*';

end;

end;

procedure TForm4.Button1Click(Sender: TObject);

begin

case form1.butt of

1: begin

ibquery5.Close;

if length(labelededit1.Text)=0 then exit;

ibquery5.ParamByName('na').AsString:=labelededit1.Text;

ibquery5.ParamByName('pa').AsString:=ed;

ibquery5.Open;

while not ibquery5.Eof do begin form1.logedin:=true; ibquery5.Next; end;

if form1.logedin then begin

form1.user_id:=ibquery5.FieldValues['USR_ID'];

form1.right:=ibquery5.FieldValues['USR_RIGHT'];

if form1.right=0 then begin

form1.StatusBar1.Panels[2].Text:='Прифиль: '+labelededit1.Text;

application.CreateForm(TForm5, Form5);

form5.SetFocus;

form4.Close;

end

else begin

MessageDlg('Данный аккаунт не имеет права доступа к настройкам.'+#10+#13+'Обратитесь к администратору.', mtError,[mbOk], 0);

form1.logedin:=false;

end;

end

else MessageDlg('Логин или пароль не верный.', mtError,[mbOk], 0);

end;

2: begin

ibquery5.Close;

if length(Combobox2.Text)=0 then exit;

ibquery5.ParamByName('na').AsString:=Combobox2.Text;

ibquery5.ParamByName('pa').AsString:=ed;

ibquery5.Open;

while not ibquery5.Eof do begin form1.logedin:=true; ibquery5.Next; end;

if form1.logedin=true then begin

form1.user_id:=ibquery5.FieldValues['USR_ID'];

form1.right:=ibquery5.FieldValues['USR_RIGHT'];

form1.StatusBar1.Panels[2].Text:='Прoфиль: '+Combobox2.Text;

application.CreateForm(TForm8, Form8);

form8.SetFocus;

form4.Close;

end

else

begin

ibquery6.Close;

ibquery6.ParamByName('na').AsString:=ComboBox2.Text;

if (CheckBox1.Checked) then ibquery6.ParamByName('gru').AsString:=ComboBox1.Text+'%'

else ibquery6.ParamByName('gru').AsString:='%';

ibquery6.Open;

while not ibquery6.Eof do ibquery6.Next;

if (ibquery6.FieldByName('USR_PASS').IsNull) then

begin

usr:=ibquery6.Fieldbyname('usr_id').asinteger;

Application.CreateForm(TForm7, Form7);

end

else

showmessage('Логин или пароль не верный.');

end

end

else

end;

end;

procedure TForm4.FormCreate(Sender: TObject);

begin

form1.StatusBar1.Panels[2].Text:='Прoфиль: ';

form1.logedin:=false;

case form1.butt of

1: begin

combobox1.Visible:=false;

checkbox1.Visible:=false;

combobox2.Visible:=false;

end;

2:labelededit1.Visible:=false ;

else

end;

form1.Enabled:=false;

ibquery2.Close;

ibquery2.Open;

combobox1.Items.Clear;

while not ibquery2.Eof do

begin

combobox1.Items.Append(ibquery2.FieldValues['GRU_NAME']);

ibquery2.Next;

end;

ibquery4.Close;

ibquery4.Open;

combobox2.Items.Clear;

while not ibquery4.Eof do

begin

combobox2.Items.Append(ibquery4.FieldValues['USR_NAME']);

ibquery4.Next;

end;

end;

procedure TForm4.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.Enabled:=true;

end;

procedure TForm4.CheckBox1Click(Sender: TObject);

begin

if checkbox1.Checked then combobox1.Enabled:=true

else

begin

combobox1.Enabled:=false;

ibquery4.Close;

ibquery4.Open;

combobox2.Items.Clear;

while not ibquery4.Eof do

begin

combobox2.Items.Append(ibquery4.FieldValues['USR_NAME']);

ibquery4.Next;

end;

end;

end;

procedure TForm4.ComboBox1Change(Sender: TObject);

begin

ibquery3.Close;

ibquery3.ParamByName('k').AsString:=combobox1.Text;

ibquery3.Open;

combobox2.Items.Clear;

while not ibquery3.Eof do

begin

combobox2.Items.Append(ibquery3.FieldValues['USR_NAME']);

ibquery3.Next;

end;

end;

end.

Код формы 5:

unit Unit5;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, XPMan, ComCtrls, StdCtrls, Buttons, Grids, DBGrids, DB,

IBCustomDataSet, IBQuery, IBSQL, ExtCtrls,dateutils, IBStoredProc;

type

TForm5 = class(TForm)

XPManifest1: TXPManifest;

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

GroupBox1: TGroupBox;

ComboBox1: TComboBox;

Button1: TButton;

Button2: TButton;

SpeedButton1: TSpeedButton;

GroupBox2: TGroupBox;

GroupBox3: TGroupBox;

DBGrid1: TDBGrid;

Memo1: TMemo;

GroupBox4: TGroupBox;

Memo2: TMemo;

Memo3: TMemo;

Memo4: TMemo;

Memo5: TMemo;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

RadioButton3: TRadioButton;

RadioButton4: TRadioButton;

Button4: TButton;

Button5: TButton;

GroupBox5: TGroupBox;

ComboBox2: TComboBox;

Button6: TButton;

Button7: TButton;

SpeedButton3: TSpeedButton;

GroupBox6: TGroupBox;

GroupBox7: TGroupBox;

SpeedButton4: TSpeedButton;

Button8: TButton;

Button9: TButton;

Button10: TButton;

DBGrid2: TDBGrid;

GroupBox8: TGroupBox;

GroupBox9: TGroupBox;

ComboBox3: TComboBox;

Label1: TLabel;

DateTimePicker1: TDateTimePicker;

Label2: TLabel;

DateTimePicker2: TDateTimePicker;

GroupBox10: TGroupBox;

DBGrid3: TDBGrid;

IBQuery1: TIBQuery;

IBQuery2: TIBQuery;

DataSource1: TDataSource;

IBQuery3: TIBQuery;

IBSQL1: TIBSQL;

IBSQL3: TIBSQL;

IBSQL4: TIBSQL;

IBSQL5: TIBSQL;

Panel2: TPanel;

SpeedButton5: TSpeedButton;

IBSQL2: TIBSQL;

IBSQL6: TIBSQL;

SpeedButton2: TSpeedButton;

GroupBox11: TGroupBox;

SpeedButton6: TSpeedButton;

Panel3: TPanel;

SpeedButton7: TSpeedButton;

IBSQL7: TIBSQL;

IBSQL8: TIBSQL;

IBQuery4: TIBQuery;

IBSQL9: TIBSQL;

IBSQL10: TIBSQL;

IBSQL11: TIBSQL;

IBQuery5: TIBQuery;

IBSQL12: TIBSQL;

IBSQL13: TIBSQL;

IBQuery6: TIBQuery;

IBQuery7x: TIBQuery;

DataSource2: TDataSource;

IBQuery7: TIBDataSet;

IBSQL14: TIBSQL;

DataSource3: TDataSource;

IBQuery8: TIBQuery;

TabSheet3: TTabSheet;

LabeledEdit1: TLabeledEdit;

LabeledEdit2: TLabeledEdit;

LabeledEdit3: TLabeledEdit;

Button3: TButton;

IBSQL15: TIBSQL;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure FormCreate(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure DBGrid1CellClick(Column: TColumn);

procedure Button2Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure SpeedButton5Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure SpeedButton6Click(Sender: TObject);

procedure SpeedButton7Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure SpeedButton3Click(Sender: TObject);

procedure ComboBox2Change(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure DBGrid2ColExit(Sender: TObject);

procedure IBQuery7AfterInsert(DataSet: TDataSet);

procedure Button9Click(Sender: TObject);

procedure SpeedButton4Click(Sender: TObject);

procedure Button10Click(Sender: TObject);

procedure DBGrid2Enter(Sender: TObject);

procedure ComboBox3Change(Sender: TObject);

procedure DateTimePicker1Change(Sender: TObject);

procedure DateTimePicker2Change(Sender: TObject);

procedure DBGrid2CellClick(Column: TColumn);

procedure DBGrid2KeyPress(Sender: TObject; var Key: Char);

procedure DBGrid2KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

procedure LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

procedure LabeledEdit3KeyPress(Sender: TObject; var Key: Char);

procedure Button3Click(Sender: TObject);

procedure DBGrid2Exit(Sender: TObject);

private

ed,ed2:string;

{ Private declarations }

public

topic:string;

stage:integer;

{ Public declarations }

end;

var

Form5: TForm5;

implementation

uses Unit1,unit9,unit10;

{$R *.dfm}

procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.Enabled:=true;

form1.logedin:=false;

end;

procedure TForm5.FormCreate(Sender: TObject);

begin

datetimepicker2.DateTime:=Tomorrow;

datetimepicker1.DateTime:=incday(date,-(daysinmonth(now)));

stage:=0;

form1.Enabled:=false;

combobox1.Items.Clear;

combobox2.Items.Clear;

combobox3.Items.Clear;

ibquery1.Close;

ibquery1.Open;

while not ibquery1.Eof do begin

combobox1.Items.Append(ibquery1.FieldValues['TEST_NAME']);

combobox3.Items.Append(ibquery1.FieldValues['TEST_NAME']);

ibquery1.Next;

end;

ibquery4.Close;

ibquery4.Open;

while not ibquery4.Eof do begin

combobox2.Items.Append(ibquery4.FieldValues['GRU_NAME']);

ibquery4.Next;

end;

end;

procedure TForm5.ComboBox1Change(Sender: TObject);

begin

ibquery2.Close;

ibquery2.ParamByName('k').AsString:=combobox1.Text;

dbgrid1.DataSource:=datasource1;

ibquery2.Open;

dbgrid1.Enabled:=true;

end;

procedure TForm5.DBGrid1CellClick(Column: TColumn);

begin

groupbox4.Visible:=true;

memo1.Lines.Clear;

memo2.Lines.Clear;

memo3.Lines.Clear;

memo4.Lines.Clear;

memo5.Lines.Clear;

memo1.Lines.Append(dbgrid1.SelectedField.Text);

memo2.Lines.Clear;

if not dbgrid1.Fields[2].IsNull then

begin

radiobutton1.Checked:=true;

memo2.Lines.Append(dbgrid1.Fields[2].asstring);

end;

memo3.Lines.Clear;

memo4.Lines.Clear;

memo5.Lines.Clear;

if not dbgrid1.Fields[3].IsNull then memo3.Lines.Append(dbgrid1.Fields[3].asstring);

if not dbgrid1.Fields[4].IsNull then memo4.Lines.Append(dbgrid1.Fields[4].asstring);

if not dbgrid1.Fields[5].IsNull then memo5.Lines.Append(dbgrid1.Fields[5].asstring);

end;

procedure TForm5.Button2Click(Sender: TObject);

begin

if MessageDlg('Желаете ли удалить данную тему?'+#10+#13+'имейте ввиду - удалятся ВСЕ ответы студентов и вопросы к теме соответственно',

mtConfirmation, [mbYes, mbNo], 0) = mrYes then

begin

ibquery3.Close;

ibquery3.ParamByName('tes').AsString:=combobox1.Text;

ibquery3.Open;

ibsql1.ParamByName('td').AsInteger:=ibquery3.FieldValues['test_id'];

ibsql3.ParamByName('td').AsInteger:=ibquery3.FieldValues['test_id'];

ibsql4.ParamByName('td').AsInteger:=ibquery3.FieldValues['test_id'];

ibsql1.ExecQuery;

ibsql3.ExecQuery;

ibsql4.ExecQuery;

form1.IBTransaction1.Commit;

combobox1.Items.Clear;

ibquery1.Close;

ibquery1.Open;

while not ibquery1.Eof do begin

combobox1.Items.Append(ibquery1.FieldValues['TEST_NAME']);

ibquery1.Next;

end;

combobox1.Text:='';

end;

end;

procedure TForm5.Button1Click(Sender: TObject);

begin

Application.CreateForm(TForm9, Form9);

form9.Visible:=true;

end;

procedure TForm5.SpeedButton1Click(Sender: TObject);

begin

ibquery3.Close;

ibquery3.ParamByName('tes').AsString:=combobox1.Text;

ibquery3.Open;

topic:=ibquery3.FieldValues['test_id'];

Application.CreateForm(TForm9, Form9);

form9.Visible:=true;

end;

procedure TForm5.Button5Click(Sender: TObject);

begin

if MessageDlg('Желаете ли удалить данный вопрос?'+#10+#13,

mtConfirmation, [mbYes, mbNo], 0) = mrYes then

begin

ibsql2.ParamByName('td').AsString:=dbgrid1.Fields[1].AsString;

ibsql2.ExecQuery;

ibquery2.Close;

ibquery2.ParamByName('k').AsString:=combobox1.Text;

dbgrid1.DataSource:=datasource1;

ibquery2.Open;

memo1.Lines.Clear;

end;

end;

procedure TForm5.SpeedButton2Click(Sender: TObject);

begin

stage:=2;

button4.Enabled:=false;

speedbutton2.Enabled:=false;

button5.Enabled:=false;

dbgrid1.Visible:=false;

groupbox1.Visible:=false;

groupbox4.Visible:=false;

memo1.Enabled:=true;

end;

procedure TForm5.SpeedButton5Click(Sender: TObject);

begin

case stage of

1:

begin

button4.Enabled:=true;

speedbutton2.Enabled:=true;

button5.Enabled:=true;

dbgrid1.Visible:=true;

groupbox1.Visible:=true;

groupbox4.Visible:=true;

memo1.Enabled:=false;

ibquery3.Close;

ibquery3.ParamByName('tes').AsString:=combobox1.Text;

ibquery3.Open;

ibsql7.Close;

ibsql7.ParamByName('q').AsVariant:=memo1.Lines.Text;

ibsql7.ParamByName('te').AsVariant:=ibquery3.FieldValues['test_id'];

ibsql7.ExecQuery;

end;

2:

begin

button4.Enabled:=true;

speedbutton2.Enabled:=true;

button5.Enabled:=true;

dbgrid1.Visible:=true;

groupbox1.Visible:=true;

groupbox4.Visible:=true;

memo1.Enabled:=true;

ibsql6.Close;

ibsql6.ParamByName('id').AsInteger:=dbgrid1.Fields[1].AsInteger;

ibsql6.ParamByName('q').AsVariant:=memo1.Lines.Text;

ibsql6.ExecQuery;

memo1.Enabled:=false;

end

else form1.IBTransaction1.Commit;

end;

ibquery2.Close;

ibquery2.ParamByName('k').AsString:=combobox1.Text;

dbgrid1.DataSource:=datasource1;

ibquery2.Open;

dbgrid1.Enabled:=true;

end;

procedure TForm5.Button4Click(Sender: TObject);

begin

stage:=1;

button4.Enabled:=false;

speedbutton2.Enabled:=false;

button5.Enabled:=false;

dbgrid1.Visible:=false;

groupbox1.Visible:=false;

groupbox4.Visible:=false;

memo1.Enabled:=true;

memo1.Lines.Clear;

end;

procedure TForm5.SpeedButton6Click(Sender: TObject);

begin

radiobutton1.Enabled:=true;

radiobutton2.Enabled:=true;

radiobutton3.Enabled:=true;

radiobutton4.Enabled:=true;

memo2.Enabled:=true;

memo3.Enabled:=true;

memo4.Enabled:=true;

memo5.Enabled:=true;

speedbutton7.Enabled:=true;

speedbutton6.Enabled:=false;

end;

procedure TForm5.SpeedButton7Click(Sender: TObject);

begin

radiobutton1.Enabled:=false;

radiobutton2.Enabled:=false;

radiobutton3.Enabled:=false;

radiobutton4.Enabled:=false;

memo2.Enabled:=false;

memo3.Enabled:=false;

memo4.Enabled:=false;

memo5.Enabled:=false;

speedbutton7.Enabled:=false;

speedbutton6.Enabled:=true;

if radiobutton1.Checked then

begin

ibsql8.Close;

ibsql8.ParamByName('id').AsInteger:=dbgrid1.Fields[1].AsInteger;

ibsql8.ParamByName('god').AsString:=memo2.Text;

ibsql8.ParamByName('on').AsString:=memo3.Text;

ibsql8.ParamByName('tw').AsString:=memo4.Text;

ibsql8.ParamByName('th').AsString:=memo5.Text;

ibsql8.ExecQuery;

end;

if radiobutton2.Checked then

begin

ibsql8.Close;

ibsql8.ParamByName('id').AsInteger:=dbgrid1.Fields[1].AsInteger;

ibsql8.ParamByName('god').AsString:=memo3.Text;

ibsql8.ParamByName('on').AsString:=memo2.Text;

ibsql8.ParamByName('tw').AsString:=memo4.Text;

ibsql8.ParamByName('th').AsString:=memo5.Text;

ibsql8.ExecQuery;

end;

if radiobutton3.Checked then

begin

ibsql8.Close;

ibsql8.ParamByName('id').AsInteger:=dbgrid1.Fields[1].AsInteger;

ibsql8.ParamByName('god').AsString:=memo4.Text;

ibsql8.ParamByName('on').AsString:=memo3.Text;

ibsql8.ParamByName('tw').AsString:=memo2.Text;

ibsql8.ParamByName('th').AsString:=memo5.Text;

ibsql8.ExecQuery;

end;

if radiobutton4.Checked then

begin

ibsql8.Close;

ibsql8.ParamByName('id').AsInteger:=dbgrid1.Fields[1].AsInteger;

ibsql8.ParamByName('god').AsString:=memo5.Text;

ibsql8.ParamByName('on').AsString:=memo3.Text;

ibsql8.ParamByName('tw').AsString:=memo4.Text;

ibsql8.ParamByName('th').AsString:=memo2.Text;

ibsql8.ExecQuery;

end;

form1.IBTransaction1.Commit;

groupbox4.Visible:=false;

memo1.Clear;

combobox1.OnChange(mouse);

end;

procedure TForm5.Button7Click(Sender: TObject);

begin

if MessageDlg('Желаете ли удалить данную группу?'+#10+#13+'имейте ввиду - удалятся ВСЕ ответы студентов и их профили соответственно',

mtConfirmation, [mbYes, mbNo], 0) = mrYes then

begin

ibquery5.Close;

ibquery5.ParamByName('na').AsString:=combobox2.Text;

ibquery5.Open;

ibsql12.ParamByName('id').AsInteger:=ibquery5.FieldValues['gru_id'];

ibsql13.ParamByName('id').AsInteger:=ibquery5.FieldValues['gru_id'];

ibquery6.Close;

ibquery6.ParamByName('id').AsInteger:=ibquery5.FieldValues['gru_id'];

ibquery6.Open;

while not ibquery6.Eof do

begin

ibsql9.ParamByName('id').AsInteger:=ibquery6.FieldValues['usr_id'];

ibsql9.ExecQuery;

ibquery6.Next;

end;

ibsql12.ExecQuery;

ibsql13.ExecQuery;

form1.IBTransaction1.Commit;

combobox2.Items.Clear;

ibquery4.Close;

ibquery4.Open;

while not ibquery4.Eof do begin

combobox2.Items.Append(ibquery4.FieldValues['gru_NAME']);

ibquery4.Next;

end;

combobox2.Text:='';

end;

end;

procedure TForm5.Button6Click(Sender: TObject);

begin

Application.CreateForm(TForm10, Form10);

stage:=3;

end;

procedure TForm5.SpeedButton3Click(Sender: TObject);

begin

Application.CreateForm(TForm10, Form10);

stage:=4;

form10.edit1.Text:=ComboBox2.Text;

ibquery5.Close;

ibquery5.ParamByName('na').AsString:=combobox2.Text;

ibquery5.Open;

end;

procedure TForm5.ComboBox2Change(Sender: TObject);

begin

ibquery7.Close;

ibquery7.ParamByName('na').AsString:=combobox2.Text;

ibquery7.Open;

groupbox6.Visible:=true;

end;

procedure TForm5.Button8Click(Sender: TObject);

begin

dbgrid2.SetFocus;

datasource2.DataSet.Insert;

end;

procedure TForm5.DBGrid2ColExit(Sender: TObject);

begin

ibquery7.Transaction.Commit;

end;

procedure TForm5.IBQuery7AfterInsert(DataSet: TDataSet);

begin

ibquery5.Close;

ibquery5.ParamByName('na').AsString:=combobox2.Text;

ibquery5.open;

dbgrid2.Columns[2].Field.asinteger:=ibquery5.FieldValues['gru_id'];

end;

procedure TForm5.Button9Click(Sender: TObject);

begin

if not dbgrid2.DataSource.DataSet.IsEmpty then

dbgrid2.DataSource.DataSet.Delete;

end;

procedure TForm5.SpeedButton4Click(Sender: TObject);

begin

dbgrid2.DataSource.DataSet.Edit;

end;

procedure TForm5.Button10Click(Sender: TObject);

begin

MessageDlg('Пароль сброшен.', mtInformation,

[mbOk], 0);

ibsql14.ParamByName('id').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibsql14.ParamByName('pa').AsVariant:=null;

ibsql14.ExecQuery;

ibsql14.Transaction.Commit;

ibquery7.Close;

ibquery7.ParamByName('na').AsString:=combobox2.Text;

ibquery7.Open;

end;

procedure TForm5.DBGrid2Enter(Sender: TObject);

begin

dbgrid2.DataSource.DataSet.Edit;

groupbox8.Visible:=true;

end;

procedure TForm5.ComboBox3Change(Sender: TObject);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.DateTimePicker1Change(Sender: TObject);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.DateTimePicker2Change(Sender: TObject);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.DBGrid2CellClick(Column: TColumn);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.DBGrid2KeyPress(Sender: TObject; var Key: Char);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.DBGrid2KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

ibquery8.Close;

ibquery8.ParamByName('k').AsString:=combobox3.Text;

ibquery8.ParamByName('fi').AsDate:=datetimepicker1.Date;

ibquery8.ParamByName('se').AsDate:=datetimepicker2.Date;

ibquery8.ParamByName('w').AsInteger:=dbgrid2.Fields[1].AsInteger;

ibquery8.Open;

end;

procedure TForm5.LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin labelededit3.SetFocus; exit; end;

if key<#33 then begin LabeledEdit2.Clear; ed:=''; end else begin

ed:=ed+key;

key:='*';

end;

end;

procedure TForm5.LabeledEdit3KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin button3.Click; exit; end;

if key<#33 then begin LabeledEdit3.Clear; ed2:=''; end else begin

ed2:=ed2+key;

key:='*';

end;

end;

procedure TForm5.Button3Click(Sender: TObject);

begin

//usr_name=:na, usr_pass=:pa where usr_ID=:id;

if ((ed=ed2)and(length(ed)>0)) then

begin

ibsql15.ParamByName('pa').AsString:=ed;

ibsql15.ParamByName('na').AsString:=labelededit1.Text;

ibsql15.ParamByName('id').AsInteger:=form1.user_id;

ibsql15.ExecQuery;

MessageDlg('Пароль успешно сменен.', mtInformation,[mbOk], 0);

end

else MessageDlg('Пароли не совпадают, повторите попытку.', mtError,[mbOk], 0);

end;

procedure TForm5.DBGrid2Exit(Sender: TObject);

begin

dbgrid2.DataSource.DataSet.Edit;

if ((dbgrid2.DataSource.DataSet.State=dsEdit)or

(dbgrid2.DataSource.DataSet.State=dsInsert)) then

dbgrid2.DataSource.DataSet.Post;

end;

end.

Код формы 6:

unit Unit6;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, XPMan, DB, IBCustomDataSet,

IBQuery, ComCtrls, IBSQL;

type

TForm6 = class(TForm)

GroupBox2: TGroupBox;

Memo1: TMemo;

GroupBox4: TGroupBox;

Memo2: TMemo;

Memo3: TMemo;

Memo4: TMemo;

Memo5: TMemo;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

RadioButton3: TRadioButton;

RadioButton4: TRadioButton;

Panel1: TPanel;

Button1: TButton;

XPManifest1: TXPManifest;

IBSQL1: TIBSQL;

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Button1Click(Sender: TObject);

private

god,bad:integer;

{ Private declarations }

public

arry:array[0..3] of string;

rand:array[0..3] of integer;

test:integer;

{ Public declarations }

end;

var

Form6: TForm6;

implementation

uses Unit1,unit8;

{$R *.dfm}

procedure TForm6.FormCreate(Sender: TObject);

var k:integer;

label go,go2,go3;

begin

form1.Enabled:=false;

god:=0;

bad:=god;

randomize;

rand[0]:=random(4);

go:k:=random(4);

if rand[0]<>k then rand[1]:=k else goto go;

go2:k:=random(4);

if ((rand[0]<>k) and (rand[1]<>k)) then rand[2]:=k else goto go2;

go3:k:=random(4);

if ((rand[0]<>k) and (rand[1]<>k) and (rand[2]<>k)) then rand[3]:=k else goto go3;

end;

procedure TForm6.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.Enabled:=true;

end;

procedure TForm6.Button1Click(Sender: TObject);

var k:integer;

label go,go2,go3;

begin

randomize;

rand[0]:=random(4);

go:k:=random(4);

if rand[0]<>k then rand[1]:=k else goto go;

go2:k:=random(4);

if ((rand[0]<>k) and (rand[1]<>k)) then rand[2]:=k else goto go2;

go3:k:=random(4);

if ((rand[0]<>k) and (rand[1]<>k) and (rand[2]<>k)) then rand[3]:=k else goto go3;

if ((radiobutton1.Checked) and(form8.IBQuery3.FieldValues['GOD_ANS']= memo2.Text)) then inc(god) else

if ((radiobutton2.Checked) and(form8.IBQuery3.FieldValues['GOD_ANS']= memo3.Text)) then inc(god) else

if ((radiobutton3.Checked) and(form8.IBQuery3.FieldValues['GOD_ANS']= memo4.Text)) then inc(god) else

if ((radiobutton4.Checked) and(form8.IBQuery3.FieldValues['GOD_ANS']= memo5.Text)) then inc(god) else

inc(bad);

form8.ibquery3.next;

if not form8.ibquery3.Eof then

begin

memo1.Text:=form8.ibquery3.Fields[0].Text;

arry[0]:=form8.ibquery3.Fields[1].Text;

arry[1]:=form8.ibquery3.Fields[2].Text;

arry[2]:=form8.ibquery3.Fields[3].Text;

arry[3]:=form8.ibquery3.Fields[4].Text;

Memo2.Text:=arry[form6.rand[0]];

Memo3.Text:=arry[form6.rand[1]];

Memo4.Text:=arry[form6.rand[2]];

Memo5.Text:=arry[form6.rand[3]];

end

else

begin

form6.Enabled:=false;

ibsql1.ParamByName('da').AsDate:=now;

ibsql1.ParamByName('tr').AsInteger:=god;

ibsql1.ParamByName('fa').AsInteger:=bad;

ibsql1.ParamByName('tes').AsInteger:=form8.ibquery2.FieldValues['test_id'];

ibsql1.ParamByName('wh').AsInteger:=form1.user_id;

ibsql1.ExecQuery;

MessageDlg('Тест пройден!'+#10+#13'Правильно: '+inttostr(god)+#10+#13'Неправильно: '+ inttostr(bad), mtInformation,[mbOk], 0);

form1.logedin:=false;

close;

end;

radiobutton1.Checked:=false;

radiobutton2.Checked:=false;

radiobutton3.Checked:=false;

radiobutton4.Checked:=false;

end;

end.

Код формы 7:

unit Unit7;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ExtCtrls, DB, IBCustomDataSet, IBQuery, IBSQL, XPMan;

type

TForm7 = class(TForm)

labeledEdit1: TEdit;

Label1: TLabel;

LabeledEdit2: TLabeledEdit;

Button1: TButton;

IBQuery1: TIBSQL;

XPManifest1: TXPManifest;

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure labeledEdit1KeyPress(Sender: TObject; var Key: Char);

procedure LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

procedure Button1Click(Sender: TObject);

private

ed1,ed2:string;

{ Private declarations }

public

{ Public declarations }

end;

var

Form7: TForm7;

implementation

uses unit4,unit1;

{$R *.dfm}

procedure TForm7.FormCreate(Sender: TObject);

begin

form4.Visible:=false;

end;

procedure TForm7.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form4.Visible:=true;

end;

procedure TForm7.labeledEdit1KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin labelededit2.SetFocus; exit; end;

if key<#33 then begin LabeledEdit1.Clear; ed1:=''; end else begin

ed1:=ed1+key;

key:='*';

end;

end;

procedure TForm7.LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then begin button1.Click; exit; end;

if key<#33 then begin LabeledEdit2.Clear; ed2:=''; end else begin

ed2:=ed2+key;

key:='*';

end;

end;

procedure TForm7.Button1Click(Sender: TObject);

begin

if ed1=ed2 then

begin

ibquery1.Close;

ibquery1.ParamByName('id').AsInteger:=form4.usr;

ibquery1.ParamByName('pas').AsString:=ed1;

ibquery1.ExecQuery;

ibquery1.Transaction.Commit;

end

else MessageDlg('Пароли не совпадают, повторите попытку.', mtError,[mbOk], 0);

form7.Close;

end;

end.

Код формы 8:

unit Unit8;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, XPMan, DB, IBCustomDataSet, IBQuery;

type

TForm8 = class(TForm)

GroupBox1: TGroupBox;

SpeedButton1: TSpeedButton;

ComboBox1: TComboBox;

Button1: TButton;

XPManifest1: TXPManifest;

IBQuery1: TIBQuery;

IBQuery2: TIBQuery;

IBQuery3: TIBQuery;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form8: TForm8;

implementation

uses unit6, Unit1;

{$R *.dfm}

procedure TForm8.Button1Click(Sender: TObject);

begin

Application.CreateForm(TForm6, Form6);

ibquery2.Close;

ibquery2.ParamByName('tes').AsString:=combobox1.Text;

ibquery2.Open;

form6.test:=ibquery2.FieldValues['test_id'];

form8.Visible:=false;

form6.memo1.Lines.Clear;

ibquery3.Close;

ibquery3.ParamByName('id').AsInteger:=form6.test;

ibquery3.Open;

if not ibquery3.Eof then

begin

form6.memo1.Text:=ibquery3.Fields[0].Text;

form6.arry[0]:=ibquery3.Fields[1].Text;

form6.arry[1]:=ibquery3.Fields[2].Text;

form6.arry[2]:=ibquery3.Fields[3].Text;

form6.arry[3]:=ibquery3.Fields[4].Text;

form6.Memo2.Text:=form6.arry[form6.rand[0]];

form6.Memo3.Text:=form6.arry[form6.rand[1]];

form6.Memo4.Text:=form6.arry[form6.rand[2]];

form6.Memo5.Text:=form6.arry[form6.rand[3]];

end;

end;

procedure TForm8.FormCreate(Sender: TObject);

begin

form1.Enabled:=false;

combobox1.Clear;

ibquery1.Close;

ibquery1.Open;

while not ibquery1.Eof do begin

combobox1.Items.Append(ibquery1.FieldValues['TEST_NAME']);

ibquery1.Next;

end;

end;

procedure TForm8.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.Enabled:=true;

end;

end.

Код формы 9:

unit Unit9;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, IBSQL, XPMan;

type

TForm9 = class(TForm)

Edit1: TEdit;

Button1: TButton;

IBSQL1: TIBSQL;

IBSQL2: TIBSQL;

XPManifest1: TXPManifest;

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Button1Click(Sender: TObject);

private

upd:boolean;

{ Private declarations }

public

{ Public declarations }

end;

var

Form9: TForm9;

implementation

uses unit1,unit5;

{$R *.dfm}

procedure TForm9.FormCreate(Sender: TObject);

begin

form5.Enabled:=false;

upd:=false;

if length(form5.topic)>0 then

begin

edit1.Text:=form5.ComboBox1.Text;

upd:=true;

end;

end;

procedure TForm9.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form5.topic:='';

form5.Enabled:=true;

end;

procedure TForm9.Button1Click(Sender: TObject);

begin

if upd then

begin

ibsql1.ParamByName('na').AsString:=edit1.Text;

ibsql1.ParamByName('id').AsInteger:=strtoint(form5.topic);

ibsql1.ExecQuery;

ibsql1.Transaction.Commit;

form5.combobox1.Items.Clear;

form5.ibquery1.Close;

form5.ibquery1.Open;

while not form5.ibquery1.Eof do begin

form5.combobox1.Items.Append(form5.ibquery1.FieldValues['TEST_NAME']);

form5.ibquery1.Next;

end;

form5.ibquery2.Close;

form5.ibquery2.ParamByName('k').AsString:=edit1.Text;

form5.dbgrid1.DataSource:=form5.datasource1;

form5.ibquery2.Open;

form5.ComboBox1.Text:='';

end

else

begin

ibsql2.ParamByName('na').AsString:=edit1.Text;

ibsql2.ExecQuery;

ibsql2.Transaction.Commit;

form5.combobox1.Items.Clear;

form5.ibquery1.Close;

form5.ibquery1.Open;

while not form5.ibquery1.Eof do begin

form5.combobox1.Items.Append(form5.ibquery1.FieldValues['TEST_NAME']);

form5.ibquery1.Next;

end;

form5.ibquery2.Close;

form5.ibquery2.ParamByName('k').AsString:=edit1.Text;

form5.dbgrid1.DataSource:=form5.datasource1;

form5.ibquery2.Open;

end;

form9.Close;

end;

end.

Код формы 10:

unit Unit10;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, XPMan;

type

TForm10 = class(TForm)

GroupBox1: TGroupBox;

Button1: TButton;

Edit1: TEdit;

XPManifest1: TXPManifest;

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form10: TForm10;

implementation

uses unit5;

{$R *.dfm}

procedure TForm10.FormCreate(Sender: TObject);

begin

form5.Enabled:=false;

end;

procedure TForm10.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form5.Enabled:=true;

end;

procedure TForm10.Button1Click(Sender: TObject);

begin

case form5.stage of

3:begin

form5.ibsql10.ParamByName('na').AsString:=edit1.Text;

form5.ibsql10.ExecQuery;

form5.ibsql10.Transaction.Commit;

form5.combobox2.Items.Clear;

form5.ibquery4.Close;

form5.ibquery4.Open;

while not form5.ibquery4.Eof do begin

form5.combobox2.Items.Append(form5.ibquery4.FieldValues['gru_NAME']);

form5.ibquery4.Next;

end;

end;

4:begin

form5.IBSQL11.Close;

form5.IBSQL11.ParamByName('id').AsInteger:=form5.IBQuery5.FieldValues['gru_id'];

form5.IBSQL11.ParamByName('na').AsString:=edit1.Text;

form5.IBSQL11.ExecQuery;

form5.ComboBox2.Items[form5.ComboBox2.ItemIndex]:=edit1.Text;

form5.ComboBox2.Text:=edit1.Text;

end;

end;close; end;

end.

Размещено на Allbest.ru


Подобные документы

  • Проектирование программы в среде Delphi для тестирования знаний студентов по программированию, с выводом оценки по окончанию тестирования. Разработка экранных форм и алгоритма программы. Описание программных модулей. Алгоритм процедуры BitBtn1Click.

    курсовая работа [365,0 K], добавлен 18.05.2013

  • Разработка программы проверки знаний для тестирования студентов по программированию с кодом на языке Delphi. Проектирование визуального интерфейса и словесный алгоритм работы программы. Алгоритмы разработанных процедур и функций, инструкция пользователя.

    курсовая работа [506,5 K], добавлен 21.02.2011

  • Структура и компоненты Delphi 7, их функциональные особенности и назначение. Системная информация утилиты настройки BDE. Свойства полей базы данных и ее главные объекты. Разработка и содержание руководства пользователя. Требования к надежности программы.

    курсовая работа [1,6 M], добавлен 10.05.2016

  • Структурная схема получения гороскопа по дате рождения. Листинг исходных кодов программы и руководство пользователя. Ввод данных с помощью объекта класса QDateEdit. Разработка пользовательского интерфейса. Выбор стратегии тестирования и отладка программы.

    курсовая работа [1,0 M], добавлен 31.05.2015

  • Разработка клиент-серверного приложения под управлением Windows на языке программирования Delphi, реализующего функции дистанционного обучения (тесты). Основная форма программы, которая состоит из меню, панели активации пользователя и панели чата.

    курсовая работа [4,3 M], добавлен 15.04.2019

  • Разработка программы тестирования студентов по MS PowerPoint с кодом на языке Delphi. Создание алгоритма для решения функциональных требований задачи. Описание переменных, вспомогательных процедур, входных и выходных данных для реализации программы.

    курсовая работа [1,5 M], добавлен 21.09.2010

  • Разработка информационной системы административного управления. Выбор языка и среды программирования. Структура взаимодействия информации. Требования к программно-аппаратному окружению. Создание программы в Delphi и связывание ее с базой данных.

    курсовая работа [1010,9 K], добавлен 08.10.2015

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.