Автор работы: Пользователь скрыл имя, 11 Июня 2013 в 10:46, курсовая работа
В настоящее время, когда ЭВМ прочно вошли в производственную деятельность человека, нет необходимости доказывать эффективность использования вычислительной техники в системах управления технологическими процессами, проектирования, научных исследований, административного управления, в учебном процессе, банковских расчетах, здравоохранении, сфере обслуживания и т.д.
Введение
1 Анализ предметной области
2 Постановка задачи
3 Структура базы данных
4 Разработка программы
4.1 Программная реализация
4.2 Анализ организации данных
4.3 Анализ программного кода
5 Описание программы
5.1 Интерфейс пользователя
5.2 Инструкция пользователя
5.3 Системные требования.
Выводы
Перечень ссылок
Приложение А
Приложение Б
Приложение В
Приложение Г
Приложение Д
Приложение Е
end;
procedure TMainForm.Button6Click(Sender: TObject);
begin
DM.tbKontinent.FlushBuffers;
end;
procedure TMainForm.bbSeekClick(Sender: TObject);
var CountrySeek: String;
begin
InputQuery('Ïîèñê','Ââåäèòå
if CountrySeek <> '' then
begin
DM.tbCountry.Filtered := False;
if DM.tbCountry.Locate('Country',
begin
DM.tbKontinent.Locate('ID',DM.
DM.tbCountry.Filter := 'ID_Kontinent = '+DM.tbKontinentID.Text;
DM.tbCountry.Filtered := True;
DM.tbCountry.Locate('Country',
End
else
begin
DM.tbCountry.Filtered := True;
MessageDlg('Òàêîé ñòðàíû íå
ñóùåñòâóåò!',mtWarning,[mbOk],
end;
end;
end;
procedure TMainForm.bbDelCountryClick(
begin
if MessageDlg('Âû óâåðåíû, ÷òî
õîòèòå óäàëèòü ñòðàíó? ('+DM.tbCountryCountry.Value+'
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(
begin
frmView.ShowModal;
end;
procedure TMainForm.sbAddLanClick(
begin
bbAddLanClick(Sender);
end;
procedure TMainForm.sbAddCountryClick(
begin
bbAddCountryClick(Sender);
end;
procedure TMainForm.sbEditCountryClick(
begin
bbEditCountryClick(Sender);
end;
procedure TMainForm.sbDelCountryClick(
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(
procedure mmSortCountryCapitalClick(
procedure mmSortLanAscClick(Sender: TObject);
procedure mmSortLanDesClick(Sender: TObject);
procedure mmSortKontinentAscClick(
procedure mmSortKontinentDesClick(
procedure mmAboutClick(Sender: TObject);
procedure mmExitClick(Sender: TObject);
procedure tbKontinentAfterScroll(
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(
begin
DM.tbCountry.IndexFieldNames := 'Country';
end;
procedure TDM.mmSortCountryCapitalClick(
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(
begin
DM.tbKontinent.IndexName := 'ixKontinent';
end;
procedure TDM.mmSortKontinentDesClick(
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(
begin
DM.tbCountry.Filter := 'ID_Kontinent = '+DM.tbKontinentID.Text;
DM.tbCountry.Filtered := True;
end;
procedure TDM.mmAddCountryClick(Sender: TObject);
begin
MainForm.bbAddCountryClick(
end;
procedure TDM.mmAddLanClick(Sender: TObject);
begin
MainForm.bbAddLanClick(Sender)
end;
procedure TDM.mmEditCountryClick(Sender: TObject);
begin
MainForm.bbEditCountryClick(
end;
procedure TDM.mmDelCountryClick(Sender: TObject);
begin
MainForm.bbDelCountryClick(
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(
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.
cbLanguage2.Items.Add(DM.
cbLanguage3.Items.Add(DM.
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.
DM.qWork.Next;
end;
DM.qWork.Close;
cbKontinent.ItemIndex := cbKontinent.Items.IndexOf(DM.
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.
if DM.qWork.RecordCount >= 2 then
begin
DM.qWork.Next;
cbLanguage2.ItemIndex := cbLanguage2.Items.IndexOf(DM.
end;
if DM.qWork.RecordCount = 3 then
begin
DM.qWork.Next;
cbLanguage3.ItemIndex := cbLanguage3.Items.IndexOf(DM.
end;
DM.qWork.Close;
Strana := DM.tbCountryCountry.Text;
eCountry.Text := DM.tbCountryCountry.Text;
eCapital.Text := DM.tbCountryCapital.Text;
end;
procedure TfrmEditCountry.
begin
if (cbLanguage1.Text = cbLanguage2.Text) then
begin
cbLanguage2.ItemIndex := cbLanguage3.ItemIndex;
cbLanguage3.ItemIndex := 0;
end;
if (cbLanguage1.Text = cbLanguage3.Text) then
begin
cbLanguage3.ItemIndex := 0;
end;
end;
procedure TfrmEditCountry.
begin
if (cbLanguage2.Text = cbLanguage1.Text) or (cbLanguage2.Text = cbLanguage3.Text) and (cbLanguage2.Text <> '--- íåò ---') then
begin
cbLanguage2.ItemIndex := cbLanguage3.ItemIndex;
cbLanguage3.ItemIndex := 0;
end;
end;
procedure TfrmEditCountry.
begin
if (cbLanguage2.Text = '--- íåò ---') then
begin
cbLanguage2.ItemIndex := cbLanguage3.ItemIndex;
cbLanguage3.ItemIndex := 0;
end;
if (cbLanguage3.Text = cbLanguage1.Text) or (cbLanguage2.Text = cbLanguage3.Text) and (cbLanguage3.Text <> '--- íåò ---') then
begin
cbLanguage3.ItemIndex := 0;
end;
end;
procedure TfrmEditCountry.
begin
DM.odFlag.Execute;
if DM.odFlag.FileName <> '' then
try
DM.tbCountryFlag.LoadFromFile(
except
MessageDlg('Îøèáêà çàãðóçêè ôàéëà ñ ðèñóíêîì ôëàãà', mtError, [mbOk],0)
end;
end;
procedure TfrmEditCountry.FormKeyDown(
Shift: TShiftState);
begin
if key = vk_Escape then frmEditCountry.Close;
end;
procedure TfrmEditCountry.bbCreateClick(
var Temp: LongInt;
var myStream: TMemoryStream;
begin
if eCountry.Text = '' then
begin
MessageDlg('Âû íå ââåëè íàçâàíèå ñòðàíû!', mtWarning, [mbOK], 0);
eCountry.SetFocus;