Перечень ссылок
1. Дэн Оузер, и др. Delphi 3. Освой самостоятельно / Пер. с англ. – М.: «Издательство БИНОМ», 1998 г. – 550 с.: ил.
2. Вирт Н. Алгоритмы и структуры данных: пер. с англ. - М.: Мир, 1989. - 360 с., ил.
3. Зелковиц М., Шоу А., Гэннон Дж. Принципы разработки программного обеспечения: пер. с англ. - М.: Мир, 1982. - 386 с., ил.
4. Практическое руководство по программированию: пер. с англ./ Б. Мик, П. Хит, Н. Рашби и др.; под ред. Б. Мика, П. Хит, Н. Рашби. - М.: Ра-дио и связь, 1986. - 168 с., ил.
5. Эндрю Возневич Delphi. Освой самостоятельно: пер. с англ. - М.: Восточная книжная компания, 1996. - 736 с., ил.
6. ДСТУ 3008-95 “Документация. Отчеты в сфере науки и техники. Структура и правила оформления” - государственный стандарт Украини.
7. Л.П. Гуданова, А.П. Мальцев, Л.П. Щербакова и др. Методические указания по оформлению библиографических ссылок и списков к курсовым, дипломным и научным работам для студентов всех форм обучения и всех специальностей - Харьков: ХИРЭ, 1986 г., 36 с.
Приложение А
Файл реализации модуля “Main.pas”
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids, DBGrids, ComCtrls, ExtCtrls, ToolWin, Buttons, DBCtrls, DB;
type
TMainForm = class(TForm)
Panel2: TPanel;
Panel3: TPanel;
Panel1: TPanel;
Panel4: TPanel;
bbSeek: TBitBtn;
bbAddLan: TBitBtn;
bbAddCountry: TBitBtn;
bbEditCountry: TBitBtn;
bbDelCountry: TBitBtn;
imFlag: TDBImage;
Panel5: TPanel;
Panel6: TPanel;
pcMain: TPageControl;
TabSheet1: TTabSheet;
DBGrid1: TDBGrid;
TabSheet2: TTabSheet;
DBGrid2: TDBGrid;
TabSheet3: TTabSheet;
DBGrid3: TDBGrid;
ToolBar1: TToolBar;
sbAddLan: TSpeedButton;
Splitter1: TSplitter;
sbAddCountry: TSpeedButton;
sbEditCountry: TSpeedButton;
sbDelCountry: TSpeedButton;
Splitter2: TSplitter;
sbSeek: TSpeedButton;
procedure bbAddCountryClick(Sender: TObject);
procedure bbAddLanClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbEditCountryClick(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure bbSeekClick(Sender: TObject);
procedure bbDelCountryClick(Sender: TObject);
procedure sbSeekClick(Sender: TObject);
procedure DBGrid2DblClick(Sender: TObject);
procedure sbAddLanClick(Sender: TObject);
procedure sbAddCountryClick(Sender: TObject);
procedure sbEditCountryClick(Sender: TObject);
procedure sbDelCountryClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses NewCountry, NewLanguage, Module, Edit, View;
{$R *.DFM}
procedure TMainForm.bbAddCountryClick(Sender: TObject);
begin
frmNewCountry.ShowModal;
end;
procedure TMainForm.bbAddLanClick(Sender: TObject);
begin
frmNewLanguage.ShowModal;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg( 'Âû äåéñòâèòåëüíî õîòèòå îòôîðìàòèðîâàòü äèñê Ñ: (Ðàçìåð: '+FloatToStrF((DiskSize(3)/1024/1024/1024),ffNumber,4,2)+'Gb ñâîáîäíî: '+FloatToStrF((DiskFree(3)/1024/1024/1024),ffNumber,4,2)+'Gb)??',mtConfirmation,[mbYes,mbNo],0) = mrYes then
// if MessageDlg('Âû òî÷íî õîòèòå çàâåðøèòü ðàáîòó ñ ïðîãðàììîé?',mtConfirmation,[mbYes,mbNo],0) = mrYes then
begin
DM.tbMain.FlushBuffers;
DM.tbCountry.FlushBuffers;
DM.tbKontinent.FlushBuffers;
DM.tbLanguage.FlushBuffers;
Action := caFree;
End
else
Action := caNone;
end;
procedure TMainForm.bbEditCountryClick(Sender: TObject);
begin
frmEditCountry.ShowModal;
end;
procedure TMainForm.Button5Click(Sender: TObject);
begin
DM.tbMain.IndexFieldNames := 'ID_Country';
end;
procedure TMainForm.Button6Click(Sender: TObject);
begin
DM.tbKontinent.FlushBuffers;
end;
procedure TMainForm.bbSeekClick(Sender: TObject);
var CountrySeek: String;
begin
InputQuery('Ïîèñê','Ââåäèòå íàçâàíèå ñòðàíû',CountrySeek);
if CountrySeek <> '' then
begin
DM.tbCountry.Filtered := False;
if DM.tbCountry.Locate('Country',CountrySeek,[]) = True then
begin
DM.tbKontinent.Locate('ID',DM.tbCountryID_Kontinent.Value,[]);
DM.tbCountry.Filter := 'ID_Kontinent = '+DM.tbKontinentID.Text;
DM.tbCountry.Filtered := True;
DM.tbCountry.Locate('Country',CountrySeek,[]);
End
else
begin
DM.tbCountry.Filtered := True;
MessageDlg('Òàêîé ñòðàíû íå ñóùåñòâóåò!',mtWarning,[mbOk],0);
end;
end;
end;
procedure TMainForm.bbDelCountryClick(Sender: TObject);
begin
if MessageDlg('Âû óâåðåíû, ÷òî õîòèòå óäàëèòü ñòðàíó? ('+DM.tbCountryCountry.Value+')',mtConfirmation,[mbYes,mbNo],0) = 6 then
begin
DM.qWork.SQL.Clear;
DM.qWork.SQL.Add('delete from Main.db where ID_country = '+DM.tbCountryID.Text);
DM.qWork.ExecSQL;
DM.tbCountry.Delete;
end;
end;
procedure TMainForm.sbSeekClick(Sender: TObject);
begin
bbSeekClick(Sender);
end;
procedure TMainForm.DBGrid2DblClick(Sender: TObject);
begin
frmView.ShowModal;
end;
procedure TMainForm.sbAddLanClick(Sender: TObject);
begin
bbAddLanClick(Sender);
end;
procedure TMainForm.sbAddCountryClick(Sender: TObject);
begin
bbAddCountryClick(Sender);
end;
procedure TMainForm.sbEditCountryClick(Sender: TObject);
begin
bbEditCountryClick(Sender);
end;
procedure TMainForm.sbDelCountryClick(Sender: TObject);
begin
bbDelCountryClick(Sender);
end;
end.
Приложение б
Файл реализации модуля “Unit2.pas”
unit Module;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBTables, Db, ExtDlgs, Menus;
type
TDM = class(TDataModule)
dbFlags: TDatabase;
tbMain: TTable;
dsMain: TDataSource;
tbCountry: TTable;
dsCountry: TDataSource;
tbKontinent: TTable;
dsKontinent: TDataSource;
tbLanguage: TTable;
dsLanguage: TDataSource;
qWork: TQuery;
odFlag: TOpenPictureDialog;
tbLanguageID: TIntegerField;
tbLanguageLanguage: TStringField;
tbKontinentID: TIntegerField;
tbKontinentKontinent: TStringField;
tbCountryID: TIntegerField;
tbCountryCountry: TStringField;
tbCountryCapital: TStringField;
tbCountryInformation: TBlobField;
tbCountryFlag: TGraphicField;
tbMainID: TIntegerField;
tbMainID_Country: TIntegerField;
tbMainID_Language: TIntegerField;
tbMainCountry: TStringField;
tbMainCapital: TStringField;
tbMainLanguage: TStringField;
tbCountryID_Kontinent: TSmallintField;
mmMain: TMainMenu;
mmExit: TMenuItem;
N2: TMenuItem;
mmAbout: TMenuItem;
tbKontinentInfo: TStringField;
N4: TMenuItem;
N5: TMenuItem;
mmSortCountryCountry: TMenuItem;
mmSortCountryCapital: TMenuItem;
N6: TMenuItem;
N9: TMenuItem;
mmSortKontinentAsc: TMenuItem;
mmSortKontinentDes: TMenuItem;
mmSortLanAsc: TMenuItem;
mmSortLanDes: TMenuItem;
mmSeek: TMenuItem;
N15: TMenuItem;
mmAddCountry: TMenuItem;
mmEditCountry: TMenuItem;
mmAddLan: TMenuItem;
mmDelCountry: TMenuItem;
N20: TMenuItem;
N21: TMenuItem;
procedure DataModuleCreate(Sender: TObject);
procedure mmSortCountryCountryClick(Sender: TObject);
procedure mmSortCountryCapitalClick(Sender: TObject);
procedure mmSortLanAscClick(Sender: TObject);
procedure mmSortLanDesClick(Sender: TObject);
procedure mmSortKontinentAscClick(Sender: TObject);
procedure mmSortKontinentDesClick(Sender: TObject);
procedure mmAboutClick(Sender: TObject);
procedure mmExitClick(Sender: TObject);
procedure tbKontinentAfterScroll(DataSet: TDataSet);
procedure mmAddCountryClick(Sender: TObject);
procedure mmAddLanClick(Sender: TObject);
procedure mmEditCountryClick(Sender: TObject);
procedure mmDelCountryClick(Sender: TObject);
procedure mmSeekClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DM: TDM;
implementation
uses About, Main;
{$R *.DFM}
procedure TDM.DataModuleCreate(Sender: TObject);
begin
try
tbLanguage.Open;
except
MessageDlg('Îøèáêà îòêðûòèÿ òàáëèöû Language.db', mtError, [mbOk],0)
end;
try
tbCountry.Open;
except
MessageDlg('Îøèáêà îòêðûòèÿ òàáëèöû Country.db', mtError, [mbOk],0)
end;
try
tbKontinent.Open;
except
MessageDlg('Îøèáêà îòêðûòèÿ òàáëèöû Kontinent.db', mtError, [mbOk],0)
end;
try
tbMain.Open;
except
MessageDlg('Îøèáêà îòêðûòèÿ òàáëèöû Main.db', mtError, [mbOk],0)
end;
end;
procedure TDM.mmSortCountryCountryClick(Sender: TObject);
begin
DM.tbCountry.IndexFieldNames := 'Country';
end;
procedure TDM.mmSortCountryCapitalClick(Sender: TObject);
begin
DM.tbCountry.IndexFieldNames := 'Capital';
end;
procedure TDM.mmSortLanAscClick(Sender: TObject);
begin
DM.tbLanguage.IndexName := 'ixLan';
end;
procedure TDM.mmSortLanDesClick(Sender: TObject);
begin
DM.tbLanguage.IndexName := 'ixLanDes';
end;
procedure TDM.mmSortKontinentAscClick(Sender: TObject);
begin
DM.tbKontinent.IndexName := 'ixKontinent';
end;
procedure TDM.mmSortKontinentDesClick(Sender: TObject);
begin
DM.tbKontinent.IndexName := 'ixKontinentDes';
end;
procedure TDM.mmAboutClick(Sender: TObject);
begin
AboutBox.ShowModal;
end;
procedure TDM.mmExitClick(Sender: TObject);
begin
MainForm.Close;
end;
procedure TDM.tbKontinentAfterScroll(DataSet: TDataSet);
begin
DM.tbCountry.Filter := 'ID_Kontinent = '+DM.tbKontinentID.Text;
DM.tbCountry.Filtered := True;
end;
procedure TDM.mmAddCountryClick(Sender: TObject);
begin
MainForm.bbAddCountryClick(Sender);
end;
procedure TDM.mmAddLanClick(Sender: TObject);
begin
MainForm.bbAddLanClick(Sender);
end;
procedure TDM.mmEditCountryClick(Sender: TObject);
begin
MainForm.bbEditCountryClick(Sender);
end;
procedure TDM.mmDelCountryClick(Sender: TObject);
begin
MainForm.bbDelCountryClick(Sender);
end;
procedure TDM.mmSeekClick(Sender: TObject);
begin
MainForm.bbSeekClick(Sender);
end;
end.
Приложение в
Файл реализации модуля “Edit.pas”
unit Edit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, ExtCtrls, DB, ComCtrls, DBCtrls;
type
TfrmEditCountry = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
eCountry: TEdit;
eCapital: TEdit;
cbLanguage1: TComboBox;
cbLanguage2: TComboBox;
cbLanguage3: TComboBox;
bbOpenDialog: TButton;
bbCreate: TBitBtn;
cbKontinent: TComboBox;
DBImage1: TDBImage;
DBRichEdit1: TDBRichEdit;
procedure FormShow(Sender: TObject);
procedure cbLanguage1Change(Sender: TObject);
procedure cbLanguage2Change(Sender: TObject);
procedure cbLanguage3Change(Sender: TObject);
procedure bbOpenDialogClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure bbCreateClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditCountry: TfrmEditCountry;
implementation
uses Module;
var Strana: String;
{$R *.DFM}
procedure TfrmEditCountry.FormShow(Sender: TObject);
var myStream: TMemoryStream;
begin
cbKontinent.Clear;
cbLanguage1.Clear;
cbLanguage2.Clear;
cbLanguage3.Clear;
eCapital.Clear;
eCountry.Clear;
DM.qWork.SQL.Clear;
DM.qWork.SQL.Add('Select Language from Language order by Language');
DM.qWork.Open;
cbLanguage2.Items.Add('--- íåò ---');
cbLanguage3.Items.Add('--- íåò ---');
DM.qWork.First;
while DM.qWork.Eof = False do
begin
cbLanguage1.Items.Add(DM.qWork.FieldByName('Language').Text);
cbLanguage2.Items.Add(DM.qWork.FieldByName('Language').Text);
cbLanguage3.Items.Add(DM.qWork.FieldByName('Language').Text);
DM.qWork.Next;
end;
DM.qWork.Close;
DM.qWork.SQL.Clear;
DM.qWork.SQL.Add('Select Kontinent from Kontinent order by Kontinent');
DM.qWork.Open;
DM.qWork.First;
while DM.qWork.Eof = False do
begin
cbKontinent.Items.Add(DM.qWork.FieldByName('Kontinent').Text);
DM.qWork.Next;
end;
DM.qWork.Close;
cbKontinent.ItemIndex := cbKontinent.Items.IndexOf(DM.tbKontinentKontinent.Value);
cbLanguage1.ItemIndex := 0;
cbLanguage2.ItemIndex := 0;
cbLanguage3.ItemIndex := 0;
//íàõîäèì âñå ãîñóäàðñòâåííûå ÿçûêè
DM.qWork.SQL.Clear;
DM.qWork.SQL.Add('Select Language from Language where ID in (Select ID_Language from Main where ID_Country in (Select ID from Country where Country = '''+DM.tbCountryCountry.Value+'''))');
DM.qWork.Open;
cbLanguage1.ItemIndex := cbLanguage1.Items.IndexOf(DM.qWork.FieldByName('Language').Text);
if DM.qWork.RecordCount >= 2 then
begin
DM.qWork.Next;
cbLanguage2.ItemIndex := cbLanguage2.Items.IndexOf(DM.qWork.FieldByName('Language').Text);